@langchain/langgraph-checkpoint 0.1.1 → 1.0.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/CHANGELOG.md +6 -0
- package/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/base.cjs +74 -88
- package/dist/base.cjs.map +1 -0
- package/dist/base.d.cts +95 -0
- package/dist/base.d.cts.map +1 -0
- package/dist/base.d.ts +79 -73
- package/dist/base.d.ts.map +1 -0
- package/dist/base.js +69 -80
- package/dist/base.js.map +1 -1
- package/dist/cache/base.cjs +17 -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 +16 -16
- package/dist/cache/base.js.map +1 -1
- package/dist/cache/index.cjs +2 -19
- package/dist/cache/index.js +4 -3
- package/dist/cache/memory.cjs +53 -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 +52 -53
- package/dist/cache/memory.js.map +1 -1
- package/dist/id.cjs +12 -16
- package/dist/id.cjs.map +1 -0
- package/dist/id.d.cts +10 -0
- package/dist/id.d.cts.map +1 -0
- package/dist/id.d.ts +10 -2
- package/dist/id.d.ts.map +1 -0
- package/dist/id.js +10 -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 +12 -9
- package/dist/memory.cjs +194 -268
- package/dist/memory.cjs.map +1 -0
- package/dist/memory.d.cts +22 -0
- package/dist/memory.d.cts.map +1 -0
- package/dist/memory.d.ts +19 -12
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +193 -263
- package/dist/memory.js.map +1 -1
- package/dist/serde/base.d.cts +10 -0
- package/dist/serde/base.d.cts.map +1 -0
- package/dist/serde/base.d.ts +9 -3
- package/dist/serde/base.d.ts.map +1 -0
- package/dist/serde/jsonplus.cjs +92 -141
- package/dist/serde/jsonplus.cjs.map +1 -0
- package/dist/serde/jsonplus.js +90 -136
- package/dist/serde/jsonplus.js.map +1 -1
- package/dist/serde/types.cjs +15 -9
- package/dist/serde/types.cjs.map +1 -0
- package/dist/serde/types.d.cts +55 -0
- package/dist/serde/types.d.cts.map +1 -0
- package/dist/serde/types.d.ts +53 -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 +88 -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 +200 -209
- package/dist/store/base.cjs.map +1 -0
- package/dist/store/base.d.cts +392 -0
- package/dist/store/base.d.cts.map +1 -0
- package/dist/store/base.d.ts +336 -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 +116 -147
- package/dist/store/batch.cjs.map +1 -0
- package/dist/store/batch.d.cts +49 -0
- package/dist/store/batch.d.cts.map +1 -0
- package/dist/store/batch.d.ts +48 -40
- package/dist/store/batch.d.ts.map +1 -0
- package/dist/store/batch.js +116 -143
- package/dist/store/batch.js.map +1 -1
- package/dist/store/memory.cjs +262 -363
- package/dist/store/memory.cjs.map +1 -0
- package/dist/store/memory.d.cts +64 -0
- package/dist/store/memory.d.cts.map +1 -0
- package/dist/store/memory.d.ts +30 -24
- package/dist/store/memory.d.ts.map +1 -0
- package/dist/store/memory.js +261 -358
- package/dist/store/memory.js.map +1 -1
- package/dist/store/utils.cjs +141 -249
- package/dist/store/utils.cjs.map +1 -0
- package/dist/store/utils.js +140 -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 +16 -18
- 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/batch.cjs
CHANGED
|
@@ -1,151 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.AsyncBatchedStore = void 0;
|
|
5
|
-
const base_js_1 = require("./base.cjs");
|
|
1
|
+
const require_base = require('./base.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/store/batch.ts
|
|
6
4
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
* Extracts and returns the underlying store from an `AsyncBatchedStore`,
|
|
6
|
+
* or returns the input if it is not an `AsyncBatchedStore`.
|
|
7
|
+
*/
|
|
10
8
|
const extractStore = (input) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return input.store;
|
|
14
|
-
}
|
|
15
|
-
return input;
|
|
9
|
+
if ("lg_name" in input && input.lg_name === "AsyncBatchedStore") return input.store;
|
|
10
|
+
return input;
|
|
16
11
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
const operations = Array.from(batch.values()).map(({ operation }) => operation);
|
|
125
|
-
const results = await this.store.batch(operations);
|
|
126
|
-
batch.forEach(({ resolve }, key) => {
|
|
127
|
-
const index = Array.from(batch.keys()).indexOf(key);
|
|
128
|
-
resolve(results[index]);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
catch (e) {
|
|
132
|
-
batch.forEach(({ reject }) => {
|
|
133
|
-
reject(e);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
// AsyncBatchedStore is internal and gets passed as args into traced tasks
|
|
139
|
-
// some BaseStores contain circular references so just serialize without it
|
|
140
|
-
// as this causes warnings when tracing with LangSmith.
|
|
141
|
-
toJSON() {
|
|
142
|
-
return {
|
|
143
|
-
queue: this.queue,
|
|
144
|
-
nextKey: this.nextKey,
|
|
145
|
-
running: this.running,
|
|
146
|
-
store: "[LangGraphStore]",
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
12
|
+
var AsyncBatchedStore = class extends require_base.BaseStore {
|
|
13
|
+
lg_name = "AsyncBatchedStore";
|
|
14
|
+
store;
|
|
15
|
+
queue = /* @__PURE__ */ new Map();
|
|
16
|
+
nextKey = 0;
|
|
17
|
+
running = false;
|
|
18
|
+
processingTask = null;
|
|
19
|
+
constructor(store) {
|
|
20
|
+
super();
|
|
21
|
+
this.store = extractStore(store);
|
|
22
|
+
}
|
|
23
|
+
get isRunning() {
|
|
24
|
+
return this.running;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @ignore
|
|
28
|
+
* Batch is not implemented here as we're only extending `BaseStore`
|
|
29
|
+
* to allow it to be passed where `BaseStore` is expected, and implement
|
|
30
|
+
* the convenience methods (get, search, put, delete).
|
|
31
|
+
*/
|
|
32
|
+
async batch(_operations) {
|
|
33
|
+
throw new Error("The `batch` method is not implemented on `AsyncBatchedStore`.\n Instead, it calls the `batch` method on the wrapped store.\n If you are seeing this error, something is wrong.");
|
|
34
|
+
}
|
|
35
|
+
async get(namespace, key) {
|
|
36
|
+
return this.enqueueOperation({
|
|
37
|
+
namespace,
|
|
38
|
+
key
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async search(namespacePrefix, options) {
|
|
42
|
+
const { filter, limit = 10, offset = 0, query } = options || {};
|
|
43
|
+
return this.enqueueOperation({
|
|
44
|
+
namespacePrefix,
|
|
45
|
+
filter,
|
|
46
|
+
limit,
|
|
47
|
+
offset,
|
|
48
|
+
query
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
async put(namespace, key, value) {
|
|
52
|
+
return this.enqueueOperation({
|
|
53
|
+
namespace,
|
|
54
|
+
key,
|
|
55
|
+
value
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async delete(namespace, key) {
|
|
59
|
+
return this.enqueueOperation({
|
|
60
|
+
namespace,
|
|
61
|
+
key,
|
|
62
|
+
value: null
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
start() {
|
|
66
|
+
if (!this.running) {
|
|
67
|
+
this.running = true;
|
|
68
|
+
this.processingTask = this.processBatchQueue();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async stop() {
|
|
72
|
+
this.running = false;
|
|
73
|
+
if (this.processingTask) await this.processingTask;
|
|
74
|
+
}
|
|
75
|
+
enqueueOperation(operation) {
|
|
76
|
+
return new Promise((resolve, reject) => {
|
|
77
|
+
const key = this.nextKey;
|
|
78
|
+
this.nextKey += 1;
|
|
79
|
+
this.queue.set(key, {
|
|
80
|
+
operation,
|
|
81
|
+
resolve,
|
|
82
|
+
reject
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async processBatchQueue() {
|
|
87
|
+
while (this.running) {
|
|
88
|
+
await new Promise((resolve) => {
|
|
89
|
+
setTimeout(resolve, 0);
|
|
90
|
+
});
|
|
91
|
+
if (this.queue.size === 0) continue;
|
|
92
|
+
const batch = new Map(this.queue);
|
|
93
|
+
this.queue.clear();
|
|
94
|
+
try {
|
|
95
|
+
const operations = Array.from(batch.values()).map(({ operation }) => operation);
|
|
96
|
+
const results = await this.store.batch(operations);
|
|
97
|
+
batch.forEach(({ resolve }, key) => {
|
|
98
|
+
const index = Array.from(batch.keys()).indexOf(key);
|
|
99
|
+
resolve(results[index]);
|
|
100
|
+
});
|
|
101
|
+
} catch (e) {
|
|
102
|
+
batch.forEach(({ reject }) => {
|
|
103
|
+
reject(e);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
toJSON() {
|
|
109
|
+
return {
|
|
110
|
+
queue: this.queue,
|
|
111
|
+
nextKey: this.nextKey,
|
|
112
|
+
running: this.running,
|
|
113
|
+
store: "[LangGraphStore]"
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
150
119
|
exports.AsyncBatchedStore = AsyncBatchedStore;
|
|
151
|
-
//# sourceMappingURL=batch.
|
|
120
|
+
//# sourceMappingURL=batch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.cjs","names":["BaseStore"],"sources":["../../src/store/batch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport {\n BaseStore,\n type Item,\n type SearchOperation,\n type PutOperation,\n type GetOperation,\n type Operation,\n OperationResults,\n} from \"./base.js\";\n\n/**\n * Extracts and returns the underlying store from an `AsyncBatchedStore`,\n * or returns the input if it is not an `AsyncBatchedStore`.\n */\nconst extractStore = (input: BaseStore | AsyncBatchedStore): BaseStore => {\n if (\"lg_name\" in input && input.lg_name === \"AsyncBatchedStore\") {\n // @ts-expect-error is a protected property\n return input.store;\n }\n return input;\n};\n\nexport class AsyncBatchedStore extends BaseStore {\n lg_name = \"AsyncBatchedStore\";\n\n protected store: BaseStore;\n\n private queue: Map<\n number,\n {\n operation: Operation;\n resolve: (value: any) => void;\n reject: (reason?: any) => void;\n }\n > = new Map();\n\n private nextKey: number = 0;\n\n private running = false;\n\n private processingTask: Promise<void> | null = null;\n\n constructor(store: BaseStore) {\n super();\n this.store = extractStore(store);\n }\n\n get isRunning(): boolean {\n return this.running;\n }\n\n /**\n * @ignore\n * Batch is not implemented here as we're only extending `BaseStore`\n * to allow it to be passed where `BaseStore` is expected, and implement\n * the convenience methods (get, search, put, delete).\n */\n async batch<Op extends Operation[]>(\n _operations: Op\n ): Promise<OperationResults<Op>> {\n throw new Error(\n \"The `batch` method is not implemented on `AsyncBatchedStore`.\" +\n \"\\n Instead, it calls the `batch` method on the wrapped store.\" +\n \"\\n If you are seeing this error, something is wrong.\"\n );\n }\n\n async get(namespace: string[], key: string): Promise<Item | null> {\n return this.enqueueOperation({ namespace, key } as GetOperation);\n }\n\n async search(\n namespacePrefix: string[],\n options?: {\n filter?: Record<string, any>;\n limit?: number;\n offset?: number;\n query?: string;\n }\n ): Promise<Item[]> {\n const { filter, limit = 10, offset = 0, query } = options || {};\n return this.enqueueOperation({\n namespacePrefix,\n filter,\n limit,\n offset,\n query,\n } as SearchOperation);\n }\n\n async put(\n namespace: string[],\n key: string,\n value: Record<string, any>\n ): Promise<void> {\n return this.enqueueOperation({ namespace, key, value } as PutOperation);\n }\n\n async delete(namespace: string[], key: string): Promise<void> {\n return this.enqueueOperation({\n namespace,\n key,\n value: null,\n } as PutOperation);\n }\n\n start(): void {\n if (!this.running) {\n this.running = true;\n this.processingTask = this.processBatchQueue();\n }\n }\n\n async stop(): Promise<void> {\n this.running = false;\n if (this.processingTask) {\n await this.processingTask;\n }\n }\n\n private enqueueOperation<T>(operation: Operation): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const key = this.nextKey;\n this.nextKey += 1;\n this.queue.set(key, { operation, resolve, reject });\n });\n }\n\n private async processBatchQueue(): Promise<void> {\n while (this.running) {\n await new Promise((resolve) => {\n setTimeout(resolve, 0);\n });\n if (this.queue.size === 0) continue;\n\n const batch = new Map(this.queue);\n this.queue.clear();\n\n try {\n const operations = Array.from(batch.values()).map(\n ({ operation }) => operation\n );\n const results = await this.store.batch(operations);\n\n batch.forEach(({ resolve }, key) => {\n const index = Array.from(batch.keys()).indexOf(key);\n resolve(results[index]);\n });\n } catch (e) {\n batch.forEach(({ reject }) => {\n reject(e);\n });\n }\n }\n }\n\n // AsyncBatchedStore is internal and gets passed as args into traced tasks\n // some BaseStores contain circular references so just serialize without it\n // as this causes warnings when tracing with LangSmith.\n toJSON() {\n return {\n queue: this.queue,\n nextKey: this.nextKey,\n running: this.running,\n store: \"[LangGraphStore]\",\n };\n }\n}\n"],"mappings":";;;;;;;AAgBA,MAAM,gBAAgB,UAAoD;AACxE,KAAI,aAAa,SAAS,MAAM,YAAY,oBAE1C,QAAO,MAAM;AAEf,QAAO;;AAGT,IAAa,oBAAb,cAAuCA,uBAAU;CAC/C,UAAU;CAEV,AAAU;CAEV,AAAQ,wBAOJ,IAAI;CAER,AAAQ,UAAkB;CAE1B,AAAQ,UAAU;CAElB,AAAQ,iBAAuC;CAE/C,YAAY,OAAkB;AAC5B;AACA,OAAK,QAAQ,aAAa;;CAG5B,IAAI,YAAqB;AACvB,SAAO,KAAK;;;;;;;;CASd,MAAM,MACJ,aAC+B;AAC/B,QAAM,IAAI,MACR;;CAMJ,MAAM,IAAI,WAAqB,KAAmC;AAChE,SAAO,KAAK,iBAAiB;GAAE;GAAW;;;CAG5C,MAAM,OACJ,iBACA,SAMiB;EACjB,MAAM,EAAE,QAAQ,QAAQ,IAAI,SAAS,GAAG,UAAU,WAAW;AAC7D,SAAO,KAAK,iBAAiB;GAC3B;GACA;GACA;GACA;GACA;;;CAIJ,MAAM,IACJ,WACA,KACA,OACe;AACf,SAAO,KAAK,iBAAiB;GAAE;GAAW;GAAK;;;CAGjD,MAAM,OAAO,WAAqB,KAA4B;AAC5D,SAAO,KAAK,iBAAiB;GAC3B;GACA;GACA,OAAO;;;CAIX,QAAc;AACZ,MAAI,CAAC,KAAK,SAAS;AACjB,QAAK,UAAU;AACf,QAAK,iBAAiB,KAAK;;;CAI/B,MAAM,OAAsB;AAC1B,OAAK,UAAU;AACf,MAAI,KAAK,eACP,OAAM,KAAK;;CAIf,AAAQ,iBAAoB,WAAkC;AAC5D,SAAO,IAAI,SAAY,SAAS,WAAW;GACzC,MAAM,MAAM,KAAK;AACjB,QAAK,WAAW;AAChB,QAAK,MAAM,IAAI,KAAK;IAAE;IAAW;IAAS;;;;CAI9C,MAAc,oBAAmC;AAC/C,SAAO,KAAK,SAAS;AACnB,SAAM,IAAI,SAAS,YAAY;AAC7B,eAAW,SAAS;;AAEtB,OAAI,KAAK,MAAM,SAAS,EAAG;GAE3B,MAAM,QAAQ,IAAI,IAAI,KAAK;AAC3B,QAAK,MAAM;AAEX,OAAI;IACF,MAAM,aAAa,MAAM,KAAK,MAAM,UAAU,KAC3C,EAAE,gBAAgB;IAErB,MAAM,UAAU,MAAM,KAAK,MAAM,MAAM;AAEvC,UAAM,SAAS,EAAE,WAAW,QAAQ;KAClC,MAAM,QAAQ,MAAM,KAAK,MAAM,QAAQ,QAAQ;AAC/C,aAAQ,QAAQ;;YAEX,GAAG;AACV,UAAM,SAAS,EAAE,aAAa;AAC5B,YAAO;;;;;CASf,SAAS;AACP,SAAO;GACL,OAAO,KAAK;GACZ,SAAS,KAAK;GACd,SAAS,KAAK;GACd,OAAO"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BaseStore, Item, Operation, OperationResults } from "./base.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/store/batch.d.ts
|
|
4
|
+
declare class AsyncBatchedStore extends BaseStore {
|
|
5
|
+
lg_name: string;
|
|
6
|
+
protected store: BaseStore;
|
|
7
|
+
private queue;
|
|
8
|
+
private nextKey;
|
|
9
|
+
private running;
|
|
10
|
+
private processingTask;
|
|
11
|
+
constructor(store: BaseStore);
|
|
12
|
+
get isRunning(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @ignore
|
|
15
|
+
* Batch is not implemented here as we're only extending `BaseStore`
|
|
16
|
+
* to allow it to be passed where `BaseStore` is expected, and implement
|
|
17
|
+
* the convenience methods (get, search, put, delete).
|
|
18
|
+
*/
|
|
19
|
+
batch<Op extends Operation[]>(_operations: Op): Promise<OperationResults<Op>>;
|
|
20
|
+
get(namespace: string[], key: string): Promise<Item | null>;
|
|
21
|
+
search(namespacePrefix: string[], options?: {
|
|
22
|
+
filter?: Record<string, any>;
|
|
23
|
+
limit?: number;
|
|
24
|
+
offset?: number;
|
|
25
|
+
query?: string;
|
|
26
|
+
}): Promise<Item[]>;
|
|
27
|
+
put(namespace: string[], key: string, value: Record<string, any>): Promise<void>;
|
|
28
|
+
delete(namespace: string[], key: string): Promise<void>;
|
|
29
|
+
start(): void;
|
|
30
|
+
stop(): Promise<void>;
|
|
31
|
+
private enqueueOperation;
|
|
32
|
+
private processBatchQueue;
|
|
33
|
+
// AsyncBatchedStore is internal and gets passed as args into traced tasks
|
|
34
|
+
// some BaseStores contain circular references so just serialize without it
|
|
35
|
+
// as this causes warnings when tracing with LangSmith.
|
|
36
|
+
toJSON(): {
|
|
37
|
+
queue: Map<number, {
|
|
38
|
+
operation: Operation;
|
|
39
|
+
resolve: (value: any) => void;
|
|
40
|
+
reject: (reason?: any) => void;
|
|
41
|
+
}>;
|
|
42
|
+
nextKey: number;
|
|
43
|
+
running: boolean;
|
|
44
|
+
store: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { AsyncBatchedStore };
|
|
49
|
+
//# sourceMappingURL=batch.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.d.cts","names":["BaseStore","Item","Operation","OperationResults","AsyncBatchedStore","Op","Promise","Record","Map"],"sources":["../../src/store/batch.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { BaseStore, type Item, type Operation, OperationResults } from \"./base.js\";\nexport declare class AsyncBatchedStore extends BaseStore {\n lg_name: string;\n protected store: BaseStore;\n private queue;\n private nextKey;\n private running;\n private processingTask;\n constructor(store: BaseStore);\n get isRunning(): boolean;\n /**\n * @ignore\n * Batch is not implemented here as we're only extending `BaseStore`\n * to allow it to be passed where `BaseStore` is expected, and implement\n * the convenience methods (get, search, put, delete).\n */\n batch<Op extends Operation[]>(_operations: Op): Promise<OperationResults<Op>>;\n get(namespace: string[], key: string): Promise<Item | null>;\n search(namespacePrefix: string[], options?: {\n filter?: Record<string, any>;\n limit?: number;\n offset?: number;\n query?: string;\n }): Promise<Item[]>;\n put(namespace: string[], key: string, value: Record<string, any>): Promise<void>;\n delete(namespace: string[], key: string): Promise<void>;\n start(): void;\n stop(): Promise<void>;\n private enqueueOperation;\n private processBatchQueue;\n // AsyncBatchedStore is internal and gets passed as args into traced tasks\n // some BaseStores contain circular references so just serialize without it\n // as this causes warnings when tracing with LangSmith.\n toJSON(): {\n queue: Map<number, {\n operation: Operation;\n resolve: (value: any) => void;\n reject: (reason?: any) => void;\n }>;\n nextKey: number;\n running: boolean;\n store: string;\n };\n}\n"],"mappings":";;;cAEqBI,iBAAAA,SAA0BJ,SAAAA;EAA1BI,OAAAA,EAAAA,MAAAA;EAAiB,UAAA,KAAA,EAEjBJ,SAFiB;UAEjBA,KAAAA;UAKEA,OAAAA;UAQFE,OAAAA;UAA0BG,cAAAA;aAA8BA,CAAAA,KAAAA,EARtDL,SAQsDK;MAAjBF,SAAAA,CAAAA,CAAAA,EAAAA,OAAAA;;;;;;;OAQXI,CAAAA,WAR5BL,SAQ4BK,EAAAA,CAAAA,CAAAA,WAAAA,EARFF,EAQEE,CAAAA,EARGD,OAQHC,CARWJ,gBAQXI,CAR4BF,EAQ5BE,CAAAA,CAAAA;KAAsBD,CAAAA,SAAAA,EAAAA,MAAAA,EAAAA,EAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAP5BA,OAO4BA,CAPpBL,IAOoBK,GAAAA,IAAAA,CAAAA;QACzBA,CAAAA,eAAAA,EAAAA,MAAAA,EAAAA,EAAAA,QAAAA,EAAAA;IAElCA,MAAAA,CAAAA,EARKC,MAQLD,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA;IAQWJ,KAAAA,CAAAA,EAAAA,MAAAA;IADRM,MAAAA,CAAAA,EAAAA,MAAAA;IAjCgCR,KAAAA,CAAAA,EAAAA,MAAAA;MAsBvCM,QAAQL;+CACiCM,sBAAsBD;4CACzBA;;UAElCA;;;;;;;WAOGE;iBACQN"}
|
package/dist/store/batch.d.ts
CHANGED
|
@@ -1,41 +1,49 @@
|
|
|
1
|
-
import { BaseStore,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
import { BaseStore, Item, Operation, OperationResults } from "./base.js";
|
|
2
|
+
|
|
3
|
+
//#region src/store/batch.d.ts
|
|
4
|
+
declare class AsyncBatchedStore extends BaseStore {
|
|
5
|
+
lg_name: string;
|
|
6
|
+
protected store: BaseStore;
|
|
7
|
+
private queue;
|
|
8
|
+
private nextKey;
|
|
9
|
+
private running;
|
|
10
|
+
private processingTask;
|
|
11
|
+
constructor(store: BaseStore);
|
|
12
|
+
get isRunning(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @ignore
|
|
15
|
+
* Batch is not implemented here as we're only extending `BaseStore`
|
|
16
|
+
* to allow it to be passed where `BaseStore` is expected, and implement
|
|
17
|
+
* the convenience methods (get, search, put, delete).
|
|
18
|
+
*/
|
|
19
|
+
batch<Op extends Operation[]>(_operations: Op): Promise<OperationResults<Op>>;
|
|
20
|
+
get(namespace: string[], key: string): Promise<Item | null>;
|
|
21
|
+
search(namespacePrefix: string[], options?: {
|
|
22
|
+
filter?: Record<string, any>;
|
|
23
|
+
limit?: number;
|
|
24
|
+
offset?: number;
|
|
25
|
+
query?: string;
|
|
26
|
+
}): Promise<Item[]>;
|
|
27
|
+
put(namespace: string[], key: string, value: Record<string, any>): Promise<void>;
|
|
28
|
+
delete(namespace: string[], key: string): Promise<void>;
|
|
29
|
+
start(): void;
|
|
30
|
+
stop(): Promise<void>;
|
|
31
|
+
private enqueueOperation;
|
|
32
|
+
private processBatchQueue;
|
|
33
|
+
// AsyncBatchedStore is internal and gets passed as args into traced tasks
|
|
34
|
+
// some BaseStores contain circular references so just serialize without it
|
|
35
|
+
// as this causes warnings when tracing with LangSmith.
|
|
36
|
+
toJSON(): {
|
|
37
|
+
queue: Map<number, {
|
|
38
|
+
operation: Operation;
|
|
39
|
+
resolve: (value: any) => void;
|
|
40
|
+
reject: (reason?: any) => void;
|
|
41
|
+
}>;
|
|
42
|
+
nextKey: number;
|
|
43
|
+
running: boolean;
|
|
44
|
+
store: string;
|
|
45
|
+
};
|
|
41
46
|
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { AsyncBatchedStore };
|
|
49
|
+
//# sourceMappingURL=batch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.d.ts","names":["BaseStore","Item","Operation","OperationResults","AsyncBatchedStore","Op","Promise","Record","Map"],"sources":["../../src/store/batch.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { BaseStore, type Item, type Operation, OperationResults } from \"./base.js\";\nexport declare class AsyncBatchedStore extends BaseStore {\n lg_name: string;\n protected store: BaseStore;\n private queue;\n private nextKey;\n private running;\n private processingTask;\n constructor(store: BaseStore);\n get isRunning(): boolean;\n /**\n * @ignore\n * Batch is not implemented here as we're only extending `BaseStore`\n * to allow it to be passed where `BaseStore` is expected, and implement\n * the convenience methods (get, search, put, delete).\n */\n batch<Op extends Operation[]>(_operations: Op): Promise<OperationResults<Op>>;\n get(namespace: string[], key: string): Promise<Item | null>;\n search(namespacePrefix: string[], options?: {\n filter?: Record<string, any>;\n limit?: number;\n offset?: number;\n query?: string;\n }): Promise<Item[]>;\n put(namespace: string[], key: string, value: Record<string, any>): Promise<void>;\n delete(namespace: string[], key: string): Promise<void>;\n start(): void;\n stop(): Promise<void>;\n private enqueueOperation;\n private processBatchQueue;\n // AsyncBatchedStore is internal and gets passed as args into traced tasks\n // some BaseStores contain circular references so just serialize without it\n // as this causes warnings when tracing with LangSmith.\n toJSON(): {\n queue: Map<number, {\n operation: Operation;\n resolve: (value: any) => void;\n reject: (reason?: any) => void;\n }>;\n nextKey: number;\n running: boolean;\n store: string;\n };\n}\n"],"mappings":";;;cAEqBI,iBAAAA,SAA0BJ,SAAAA;EAA1BI,OAAAA,EAAAA,MAAAA;EAAiB,UAAA,KAAA,EAEjBJ,SAFiB;UAEjBA,KAAAA;UAKEA,OAAAA;UAQFE,OAAAA;UAA0BG,cAAAA;aAA8BA,CAAAA,KAAAA,EARtDL,SAQsDK;MAAjBF,SAAAA,CAAAA,CAAAA,EAAAA,OAAAA;;;;;;;OAQXI,CAAAA,WAR5BL,SAQ4BK,EAAAA,CAAAA,CAAAA,WAAAA,EARFF,EAQEE,CAAAA,EARGD,OAQHC,CARWJ,gBAQXI,CAR4BF,EAQ5BE,CAAAA,CAAAA;KAAsBD,CAAAA,SAAAA,EAAAA,MAAAA,EAAAA,EAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAP5BA,OAO4BA,CAPpBL,IAOoBK,GAAAA,IAAAA,CAAAA;QACzBA,CAAAA,eAAAA,EAAAA,MAAAA,EAAAA,EAAAA,QAAAA,EAAAA;IAElCA,MAAAA,CAAAA,EARKC,MAQLD,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA;IAQWJ,KAAAA,CAAAA,EAAAA,MAAAA;IADRM,MAAAA,CAAAA,EAAAA,MAAAA;IAjCgCR,KAAAA,CAAAA,EAAAA,MAAAA;MAsBvCM,QAAQL;+CACiCM,sBAAsBD;4CACzBA;;UAElCA;;;;;;;WAOGE;iBACQN"}
|