@langchain/langgraph-checkpoint 0.1.1 → 1.0.1
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/base.cjs +73 -88
- package/dist/base.cjs.map +1 -0
- package/dist/base.d.cts +94 -0
- package/dist/base.d.cts.map +1 -0
- package/dist/base.d.ts +78 -73
- package/dist/base.d.ts.map +1 -0
- package/dist/base.js +68 -80
- package/dist/base.js.map +1 -1
- package/dist/cache/base.cjs +16 -21
- package/dist/cache/base.cjs.map +1 -0
- package/dist/cache/base.d.cts +43 -0
- package/dist/cache/base.d.cts.map +1 -0
- package/dist/cache/base.d.ts +41 -36
- package/dist/cache/base.d.ts.map +1 -0
- package/dist/cache/base.js +15 -16
- package/dist/cache/base.js.map +1 -1
- package/dist/cache/index.cjs +2 -19
- package/dist/cache/index.js +3 -3
- package/dist/cache/memory.cjs +50 -58
- package/dist/cache/memory.cjs.map +1 -0
- package/dist/cache/memory.d.cts +19 -0
- package/dist/cache/memory.d.cts.map +1 -0
- package/dist/cache/memory.d.ts +18 -13
- package/dist/cache/memory.d.ts.map +1 -0
- package/dist/cache/memory.js +49 -53
- package/dist/cache/memory.js.map +1 -1
- package/dist/id.cjs +10 -16
- package/dist/id.cjs.map +1 -0
- package/dist/id.d.cts +6 -0
- package/dist/id.d.cts.map +1 -0
- package/dist/id.d.ts +6 -2
- package/dist/id.d.ts.map +1 -0
- package/dist/id.js +9 -12
- package/dist/id.js.map +1 -1
- package/dist/index.cjs +36 -27
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -8
- package/dist/index.js +11 -9
- package/dist/memory.cjs +191 -268
- package/dist/memory.cjs.map +1 -0
- package/dist/memory.d.cts +21 -0
- package/dist/memory.d.cts.map +1 -0
- package/dist/memory.d.ts +18 -12
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +190 -263
- package/dist/memory.js.map +1 -1
- package/dist/serde/base.d.cts +8 -0
- package/dist/serde/base.d.cts.map +1 -0
- package/dist/serde/base.d.ts +7 -3
- package/dist/serde/base.d.ts.map +1 -0
- package/dist/serde/jsonplus.cjs +90 -141
- package/dist/serde/jsonplus.cjs.map +1 -0
- package/dist/serde/jsonplus.js +89 -136
- package/dist/serde/jsonplus.js.map +1 -1
- package/dist/serde/types.cjs +14 -9
- package/dist/serde/types.cjs.map +1 -0
- package/dist/serde/types.d.cts +52 -0
- package/dist/serde/types.d.cts.map +1 -0
- package/dist/serde/types.d.ts +50 -47
- package/dist/serde/types.d.ts.map +1 -0
- package/dist/serde/types.js +9 -5
- package/dist/serde/types.js.map +1 -1
- package/dist/serde/utils/fast-safe-stringify/index.cjs +87 -208
- package/dist/serde/utils/fast-safe-stringify/index.cjs.map +1 -0
- package/dist/serde/utils/fast-safe-stringify/index.js +87 -205
- package/dist/serde/utils/fast-safe-stringify/index.js.map +1 -1
- package/dist/store/base.cjs +199 -209
- package/dist/store/base.cjs.map +1 -0
- package/dist/store/base.d.cts +391 -0
- package/dist/store/base.d.cts.map +1 -0
- package/dist/store/base.d.ts +335 -332
- package/dist/store/base.d.ts.map +1 -0
- package/dist/store/base.js +198 -204
- package/dist/store/base.js.map +1 -1
- package/dist/store/batch.cjs +114 -147
- package/dist/store/batch.cjs.map +1 -0
- package/dist/store/batch.d.cts +46 -0
- package/dist/store/batch.d.cts.map +1 -0
- package/dist/store/batch.d.ts +45 -40
- package/dist/store/batch.d.ts.map +1 -0
- package/dist/store/batch.js +114 -143
- package/dist/store/batch.js.map +1 -1
- package/dist/store/memory.cjs +256 -363
- package/dist/store/memory.cjs.map +1 -0
- package/dist/store/memory.d.cts +62 -0
- package/dist/store/memory.d.cts.map +1 -0
- package/dist/store/memory.d.ts +28 -24
- package/dist/store/memory.d.ts.map +1 -0
- package/dist/store/memory.js +255 -358
- package/dist/store/memory.js.map +1 -1
- package/dist/store/utils.cjs +137 -249
- package/dist/store/utils.cjs.map +1 -0
- package/dist/store/utils.js +137 -245
- package/dist/store/utils.js.map +1 -1
- package/dist/types.d.cts +35 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +29 -28
- package/dist/types.d.ts.map +1 -0
- package/package.json +33 -34
- package/CHANGELOG.md +0 -19
- package/dist/cache/index.d.ts +0 -2
- package/dist/cache/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/serde/base.cjs +0 -3
- package/dist/serde/base.js +0 -2
- package/dist/serde/base.js.map +0 -1
- package/dist/serde/jsonplus.d.ts +0 -7
- package/dist/serde/utils/fast-safe-stringify/index.d.ts +0 -1
- package/dist/store/index.cjs +0 -20
- package/dist/store/index.d.ts +0 -3
- package/dist/store/index.js +0 -4
- package/dist/store/index.js.map +0 -1
- package/dist/store/utils.d.ts +0 -26
- package/dist/types.cjs +0 -3
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/index.cjs +0 -1
- package/index.d.cts +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
package/dist/store/base.d.ts
CHANGED
|
@@ -1,267 +1,267 @@
|
|
|
1
1
|
import { Embeddings } from "@langchain/core/embeddings";
|
|
2
|
+
|
|
3
|
+
//#region src/store/base.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Error thrown when an invalid namespace is provided.
|
|
4
6
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
declare class InvalidNamespaceError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* Represents a stored item with metadata.
|
|
10
12
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
interface Item {
|
|
14
|
+
/**
|
|
15
|
+
* The stored data as an object. Keys are filterable.
|
|
16
|
+
*/
|
|
17
|
+
value: Record<string, any>;
|
|
18
|
+
/**
|
|
19
|
+
* Unique identifier within the namespace.
|
|
20
|
+
*/
|
|
21
|
+
key: string;
|
|
22
|
+
/**
|
|
23
|
+
* Hierarchical path defining the collection in which this document resides.
|
|
24
|
+
* Represented as an array of strings, allowing for nested categorization.
|
|
25
|
+
* For example: ["documents", "user123"]
|
|
26
|
+
*/
|
|
27
|
+
namespace: string[];
|
|
28
|
+
/**
|
|
29
|
+
* Timestamp of item creation.
|
|
30
|
+
*/
|
|
31
|
+
createdAt: Date;
|
|
32
|
+
/**
|
|
33
|
+
* Timestamp of last update.
|
|
34
|
+
*/
|
|
35
|
+
updatedAt: Date;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Represents a search result item with relevance score.
|
|
37
39
|
* Extends the base Item interface with an optional similarity score.
|
|
38
40
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
interface SearchItem extends Item {
|
|
42
|
+
/**
|
|
43
|
+
* Relevance/similarity score if from a ranked operation.
|
|
44
|
+
* Higher scores indicate better matches.
|
|
45
|
+
*
|
|
46
|
+
* This is typically a cosine similarity score between -1 and 1,
|
|
47
|
+
* where 1 indicates identical vectors and -1 indicates opposite vectors.
|
|
48
|
+
*/
|
|
49
|
+
score?: number;
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
50
52
|
* Operation to retrieve an item by namespace and ID.
|
|
51
53
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
interface GetOperation {
|
|
55
|
+
/**
|
|
56
|
+
* Hierarchical path for the item.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // Get a user profile
|
|
60
|
+
* namespace: ["users", "profiles"]
|
|
61
|
+
*/
|
|
62
|
+
namespace: string[];
|
|
63
|
+
/**
|
|
64
|
+
* Unique identifier within the namespace.
|
|
65
|
+
* Together with namespace forms the complete path to the item.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* key: "user123" // For a user profile
|
|
69
|
+
* key: "doc456" // For a document
|
|
70
|
+
*/
|
|
71
|
+
key: string;
|
|
70
72
|
}
|
|
71
73
|
/**
|
|
72
74
|
* Operation to search for items within a namespace prefix.
|
|
73
75
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
76
|
+
interface SearchOperation {
|
|
77
|
+
/**
|
|
78
|
+
* Hierarchical path prefix to search within.
|
|
79
|
+
* Only items under this prefix will be searched.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* // Search all user documents
|
|
83
|
+
* namespacePrefix: ["users", "documents"]
|
|
84
|
+
*
|
|
85
|
+
* // Search everything
|
|
86
|
+
* namespacePrefix: []
|
|
87
|
+
*/
|
|
88
|
+
namespacePrefix: string[];
|
|
89
|
+
/**
|
|
90
|
+
* Key-value pairs to filter results based on exact matches or comparison operators.
|
|
91
|
+
*
|
|
92
|
+
* Supports both exact matches and operator-based comparisons:
|
|
93
|
+
* - $eq: Equal to (same as direct value comparison)
|
|
94
|
+
* - $ne: Not equal to
|
|
95
|
+
* - $gt: Greater than
|
|
96
|
+
* - $gte: Greater than or equal to
|
|
97
|
+
* - $lt: Less than
|
|
98
|
+
* - $lte: Less than or equal to
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* // Exact match
|
|
102
|
+
* filter: { status: "active" }
|
|
103
|
+
*
|
|
104
|
+
* // With operators
|
|
105
|
+
* filter: { score: { $gt: 4.99 } }
|
|
106
|
+
*
|
|
107
|
+
* // Multiple conditions
|
|
108
|
+
* filter: {
|
|
109
|
+
* score: { $gte: 3.0 },
|
|
110
|
+
* color: "red"
|
|
111
|
+
* }
|
|
112
|
+
*/
|
|
113
|
+
filter?: Record<string, any>;
|
|
114
|
+
/**
|
|
115
|
+
* Maximum number of items to return.
|
|
116
|
+
* @default 10
|
|
117
|
+
*/
|
|
118
|
+
limit?: number;
|
|
119
|
+
/**
|
|
120
|
+
* Number of items to skip before returning results.
|
|
121
|
+
* Useful for pagination.
|
|
122
|
+
* @default 0
|
|
123
|
+
*/
|
|
124
|
+
offset?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Natural language search query for semantic search.
|
|
127
|
+
* When provided, results will be ranked by relevance to this query
|
|
128
|
+
* using vector similarity search.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* // Find technical documentation about APIs
|
|
132
|
+
* query: "technical documentation about REST APIs"
|
|
133
|
+
*
|
|
134
|
+
* // Find recent ML papers
|
|
135
|
+
* query: "machine learning papers from 2023"
|
|
136
|
+
*/
|
|
137
|
+
query?: string;
|
|
136
138
|
}
|
|
137
139
|
/**
|
|
138
140
|
* Operation to store, update, or delete an item.
|
|
139
141
|
*/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
142
|
+
interface PutOperation {
|
|
143
|
+
/**
|
|
144
|
+
* Hierarchical path for the item.
|
|
145
|
+
* Acts as a folder-like structure to organize items.
|
|
146
|
+
* Each element represents one level in the hierarchy.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* // Root level documents
|
|
150
|
+
* namespace: ["documents"]
|
|
151
|
+
*
|
|
152
|
+
* // User-specific documents
|
|
153
|
+
* namespace: ["documents", "user123"]
|
|
154
|
+
*
|
|
155
|
+
* // Nested cache structure
|
|
156
|
+
* namespace: ["cache", "docs", "v1"]
|
|
157
|
+
*/
|
|
158
|
+
namespace: string[];
|
|
159
|
+
/**
|
|
160
|
+
* Unique identifier for the document within its namespace.
|
|
161
|
+
* Together with namespace forms the complete path to the item.
|
|
162
|
+
*
|
|
163
|
+
* Example: If namespace is ["documents", "user123"] and key is "report1",
|
|
164
|
+
* the full path would effectively be "documents/user123/report1"
|
|
165
|
+
*/
|
|
166
|
+
key: string;
|
|
167
|
+
/**
|
|
168
|
+
* Data to be stored, or null to delete the item.
|
|
169
|
+
* Must be a JSON-serializable object with string keys.
|
|
170
|
+
* Setting to null signals that the item should be deleted.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* {
|
|
174
|
+
* field1: "string value",
|
|
175
|
+
* field2: 123,
|
|
176
|
+
* nested: { can: "contain", any: "serializable data" }
|
|
177
|
+
* }
|
|
178
|
+
*/
|
|
179
|
+
value: Record<string, any> | null;
|
|
180
|
+
/**
|
|
181
|
+
* Controls how the item's fields are indexed for search operations.
|
|
182
|
+
*
|
|
183
|
+
* - undefined: Uses store's default indexing configuration
|
|
184
|
+
* - false: Disables indexing for this item
|
|
185
|
+
* - string[]: List of field paths to index
|
|
186
|
+
*
|
|
187
|
+
* Path syntax supports:
|
|
188
|
+
* - Nested fields: "metadata.title"
|
|
189
|
+
* - Array access: "chapters[*].content" (each indexed separately)
|
|
190
|
+
* - Specific indices: "authors[0].name"
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* // Index specific fields
|
|
194
|
+
* index: ["metadata.title", "chapters[*].content"]
|
|
195
|
+
*
|
|
196
|
+
* // Disable indexing
|
|
197
|
+
* index: false
|
|
198
|
+
*/
|
|
199
|
+
index?: false | string[];
|
|
198
200
|
}
|
|
199
201
|
/**
|
|
200
202
|
* Operation to list and filter namespaces in the store.
|
|
201
203
|
*/
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
interface ListNamespacesOperation {
|
|
205
|
+
matchConditions?: MatchCondition[];
|
|
206
|
+
maxDepth?: number;
|
|
207
|
+
limit: number;
|
|
208
|
+
offset: number;
|
|
207
209
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
type NameSpacePath = (string | "*")[];
|
|
211
|
+
type NamespaceMatchType = "prefix" | "suffix";
|
|
212
|
+
interface MatchCondition {
|
|
213
|
+
matchType: NamespaceMatchType;
|
|
214
|
+
path: NameSpacePath;
|
|
213
215
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
[K in keyof Tuple]: Tuple[K] extends PutOperation ? void : Tuple[K] extends SearchOperation ? SearchItem[] : Tuple[K] extends GetOperation ? Item | null : Tuple[K] extends ListNamespacesOperation ? string[][] : never;
|
|
217
|
-
};
|
|
216
|
+
type Operation = GetOperation | SearchOperation | PutOperation | ListNamespacesOperation;
|
|
217
|
+
type OperationResults<Tuple extends readonly Operation[]> = { [K in keyof Tuple]: Tuple[K] extends PutOperation ? void : Tuple[K] extends SearchOperation ? SearchItem[] : Tuple[K] extends GetOperation ? Item | null : Tuple[K] extends ListNamespacesOperation ? string[][] : never };
|
|
218
218
|
/**
|
|
219
219
|
* Configuration for indexing documents for semantic search in the store.
|
|
220
220
|
*
|
|
221
221
|
* This configures how documents are embedded and indexed for vector similarity search.
|
|
222
222
|
*/
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
223
|
+
interface IndexConfig {
|
|
224
|
+
/**
|
|
225
|
+
* Number of dimensions in the embedding vectors.
|
|
226
|
+
*
|
|
227
|
+
* Common embedding model dimensions:
|
|
228
|
+
* - OpenAI text-embedding-3-large: 256, 1024, or 3072
|
|
229
|
+
* - OpenAI text-embedding-3-small: 512 or 1536
|
|
230
|
+
* - OpenAI text-embedding-ada-002: 1536
|
|
231
|
+
* - Cohere embed-english-v3.0: 1024
|
|
232
|
+
* - Cohere embed-english-light-v3.0: 384
|
|
233
|
+
* - Cohere embed-multilingual-v3.0: 1024
|
|
234
|
+
* - Cohere embed-multilingual-light-v3.0: 384
|
|
235
|
+
*/
|
|
236
|
+
dims: number;
|
|
237
|
+
/**
|
|
238
|
+
* The embeddings model to use for generating vectors.
|
|
239
|
+
* This should be a LangChain Embeddings implementation.
|
|
240
|
+
*/
|
|
241
|
+
embeddings: Embeddings;
|
|
242
|
+
/**
|
|
243
|
+
* Fields to extract text from for embedding generation.
|
|
244
|
+
*
|
|
245
|
+
* Path syntax supports:
|
|
246
|
+
* - Simple field access: "field"
|
|
247
|
+
* - Nested fields: "metadata.title"
|
|
248
|
+
* - Array indexing:
|
|
249
|
+
* - All elements: "chapters[*].content"
|
|
250
|
+
* - Specific index: "authors[0].name"
|
|
251
|
+
* - Last element: "array[-1]"
|
|
252
|
+
*
|
|
253
|
+
* @default ["$"] Embeds the entire document as one vector
|
|
254
|
+
*/
|
|
255
|
+
fields?: string[];
|
|
256
256
|
}
|
|
257
257
|
/**
|
|
258
258
|
* Utility function to get text at a specific JSON path
|
|
259
259
|
*/
|
|
260
|
-
|
|
260
|
+
declare function getTextAtPath(obj: any, path: string): string[];
|
|
261
261
|
/**
|
|
262
262
|
* Tokenizes a JSON path into parts
|
|
263
263
|
*/
|
|
264
|
-
|
|
264
|
+
declare function tokenizePath(path: string): string[];
|
|
265
265
|
/**
|
|
266
266
|
* Abstract base class for persistent key-value stores.
|
|
267
267
|
*
|
|
@@ -274,115 +274,118 @@ export declare function tokenizePath(path: string): string[];
|
|
|
274
274
|
* - Vector similarity search (if configured)
|
|
275
275
|
* - Filtering and pagination
|
|
276
276
|
*/
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
277
|
+
declare abstract class BaseStore {
|
|
278
|
+
/**
|
|
279
|
+
* Execute multiple operations in a single batch.
|
|
280
|
+
* This is more efficient than executing operations individually.
|
|
281
|
+
*
|
|
282
|
+
* @param operations Array of operations to execute
|
|
283
|
+
* @returns Promise resolving to results matching the operations
|
|
284
|
+
*/
|
|
285
|
+
abstract batch<Op extends Operation[]>(operations: Op): Promise<OperationResults<Op>>;
|
|
286
|
+
/**
|
|
287
|
+
* Retrieve a single item by its namespace and key.
|
|
288
|
+
*
|
|
289
|
+
* @param namespace Hierarchical path for the item
|
|
290
|
+
* @param key Unique identifier within the namespace
|
|
291
|
+
* @returns Promise resolving to the item or null if not found
|
|
292
|
+
*/
|
|
293
|
+
get(namespace: string[], key: string): Promise<Item | null>;
|
|
294
|
+
/**
|
|
295
|
+
* Search for items within a namespace prefix.
|
|
296
|
+
* Supports both metadata filtering and vector similarity search.
|
|
297
|
+
*
|
|
298
|
+
* @param namespacePrefix Hierarchical path prefix to search within
|
|
299
|
+
* @param options Search options for filtering and pagination
|
|
300
|
+
* @returns Promise resolving to list of matching items with relevance scores
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* // Search with filters
|
|
304
|
+
* await store.search(["documents"], {
|
|
305
|
+
* filter: { type: "report", status: "active" },
|
|
306
|
+
* limit: 5,
|
|
307
|
+
* offset: 10
|
|
308
|
+
* });
|
|
309
|
+
*
|
|
310
|
+
* // Vector similarity search
|
|
311
|
+
* await store.search(["users", "content"], {
|
|
312
|
+
* query: "technical documentation about APIs",
|
|
313
|
+
* limit: 20
|
|
314
|
+
* });
|
|
315
|
+
*/
|
|
316
|
+
search(namespacePrefix: string[], options?: {
|
|
317
|
+
filter?: Record<string, any>;
|
|
318
|
+
limit?: number;
|
|
319
|
+
offset?: number;
|
|
320
|
+
query?: string;
|
|
321
|
+
}): Promise<SearchItem[]>;
|
|
322
|
+
/**
|
|
323
|
+
* Store or update an item.
|
|
324
|
+
*
|
|
325
|
+
* @param namespace Hierarchical path for the item
|
|
326
|
+
* @param key Unique identifier within the namespace
|
|
327
|
+
* @param value Object containing the item's data
|
|
328
|
+
* @param index Optional indexing configuration
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* // Simple storage
|
|
332
|
+
* await store.put(["docs"], "report", { title: "Annual Report" });
|
|
333
|
+
*
|
|
334
|
+
* // With specific field indexing
|
|
335
|
+
* await store.put(
|
|
336
|
+
* ["docs"],
|
|
337
|
+
* "report",
|
|
338
|
+
* {
|
|
339
|
+
* title: "Q4 Report",
|
|
340
|
+
* chapters: [{ content: "..." }, { content: "..." }]
|
|
341
|
+
* },
|
|
342
|
+
* ["title", "chapters[*].content"]
|
|
343
|
+
* );
|
|
344
|
+
*/
|
|
345
|
+
put(namespace: string[], key: string, value: Record<string, any>, index?: false | string[]): Promise<void>;
|
|
346
|
+
/**
|
|
347
|
+
* Delete an item from the store.
|
|
348
|
+
*
|
|
349
|
+
* @param namespace Hierarchical path for the item
|
|
350
|
+
* @param key Unique identifier within the namespace
|
|
351
|
+
*/
|
|
352
|
+
delete(namespace: string[], key: string): Promise<void>;
|
|
353
|
+
/**
|
|
354
|
+
* List and filter namespaces in the store.
|
|
355
|
+
* Used to explore data organization and navigate the namespace hierarchy.
|
|
356
|
+
*
|
|
357
|
+
* @param options Options for listing namespaces
|
|
358
|
+
* @returns Promise resolving to list of namespace paths
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* // List all namespaces under "documents"
|
|
362
|
+
* await store.listNamespaces({
|
|
363
|
+
* prefix: ["documents"],
|
|
364
|
+
* maxDepth: 2
|
|
365
|
+
* });
|
|
366
|
+
*
|
|
367
|
+
* // List namespaces ending with "v1"
|
|
368
|
+
* await store.listNamespaces({
|
|
369
|
+
* suffix: ["v1"],
|
|
370
|
+
* limit: 50
|
|
371
|
+
* });
|
|
372
|
+
*/
|
|
373
|
+
listNamespaces(options?: {
|
|
374
|
+
prefix?: string[];
|
|
375
|
+
suffix?: string[];
|
|
376
|
+
maxDepth?: number;
|
|
377
|
+
limit?: number;
|
|
378
|
+
offset?: number;
|
|
379
|
+
}): Promise<string[][]>;
|
|
380
|
+
/**
|
|
381
|
+
* Start the store. Override if initialization is needed.
|
|
382
|
+
*/
|
|
383
|
+
start(): void | Promise<void>;
|
|
384
|
+
/**
|
|
385
|
+
* Stop the store. Override if cleanup is needed.
|
|
386
|
+
*/
|
|
387
|
+
stop(): void | Promise<void>;
|
|
388
388
|
}
|
|
389
|
+
//#endregion
|
|
390
|
+
export { BaseStore, GetOperation, IndexConfig, InvalidNamespaceError, Item, ListNamespacesOperation, MatchCondition, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchItem, SearchOperation, getTextAtPath, tokenizePath };
|
|
391
|
+
//# sourceMappingURL=base.d.ts.map
|