@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.
Files changed (121) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +25 -0
  3. package/dist/base.cjs +74 -88
  4. package/dist/base.cjs.map +1 -0
  5. package/dist/base.d.cts +95 -0
  6. package/dist/base.d.cts.map +1 -0
  7. package/dist/base.d.ts +79 -73
  8. package/dist/base.d.ts.map +1 -0
  9. package/dist/base.js +69 -80
  10. package/dist/base.js.map +1 -1
  11. package/dist/cache/base.cjs +17 -21
  12. package/dist/cache/base.cjs.map +1 -0
  13. package/dist/cache/base.d.cts +43 -0
  14. package/dist/cache/base.d.cts.map +1 -0
  15. package/dist/cache/base.d.ts +41 -36
  16. package/dist/cache/base.d.ts.map +1 -0
  17. package/dist/cache/base.js +16 -16
  18. package/dist/cache/base.js.map +1 -1
  19. package/dist/cache/index.cjs +2 -19
  20. package/dist/cache/index.js +4 -3
  21. package/dist/cache/memory.cjs +53 -58
  22. package/dist/cache/memory.cjs.map +1 -0
  23. package/dist/cache/memory.d.cts +19 -0
  24. package/dist/cache/memory.d.cts.map +1 -0
  25. package/dist/cache/memory.d.ts +18 -13
  26. package/dist/cache/memory.d.ts.map +1 -0
  27. package/dist/cache/memory.js +52 -53
  28. package/dist/cache/memory.js.map +1 -1
  29. package/dist/id.cjs +12 -16
  30. package/dist/id.cjs.map +1 -0
  31. package/dist/id.d.cts +10 -0
  32. package/dist/id.d.cts.map +1 -0
  33. package/dist/id.d.ts +10 -2
  34. package/dist/id.d.ts.map +1 -0
  35. package/dist/id.js +10 -12
  36. package/dist/id.js.map +1 -1
  37. package/dist/index.cjs +36 -27
  38. package/dist/index.d.cts +12 -0
  39. package/dist/index.d.ts +12 -8
  40. package/dist/index.js +12 -9
  41. package/dist/memory.cjs +194 -268
  42. package/dist/memory.cjs.map +1 -0
  43. package/dist/memory.d.cts +22 -0
  44. package/dist/memory.d.cts.map +1 -0
  45. package/dist/memory.d.ts +19 -12
  46. package/dist/memory.d.ts.map +1 -0
  47. package/dist/memory.js +193 -263
  48. package/dist/memory.js.map +1 -1
  49. package/dist/serde/base.d.cts +10 -0
  50. package/dist/serde/base.d.cts.map +1 -0
  51. package/dist/serde/base.d.ts +9 -3
  52. package/dist/serde/base.d.ts.map +1 -0
  53. package/dist/serde/jsonplus.cjs +92 -141
  54. package/dist/serde/jsonplus.cjs.map +1 -0
  55. package/dist/serde/jsonplus.js +90 -136
  56. package/dist/serde/jsonplus.js.map +1 -1
  57. package/dist/serde/types.cjs +15 -9
  58. package/dist/serde/types.cjs.map +1 -0
  59. package/dist/serde/types.d.cts +55 -0
  60. package/dist/serde/types.d.cts.map +1 -0
  61. package/dist/serde/types.d.ts +53 -47
  62. package/dist/serde/types.d.ts.map +1 -0
  63. package/dist/serde/types.js +9 -5
  64. package/dist/serde/types.js.map +1 -1
  65. package/dist/serde/utils/fast-safe-stringify/index.cjs +88 -208
  66. package/dist/serde/utils/fast-safe-stringify/index.cjs.map +1 -0
  67. package/dist/serde/utils/fast-safe-stringify/index.js +87 -205
  68. package/dist/serde/utils/fast-safe-stringify/index.js.map +1 -1
  69. package/dist/store/base.cjs +200 -209
  70. package/dist/store/base.cjs.map +1 -0
  71. package/dist/store/base.d.cts +392 -0
  72. package/dist/store/base.d.cts.map +1 -0
  73. package/dist/store/base.d.ts +336 -332
  74. package/dist/store/base.d.ts.map +1 -0
  75. package/dist/store/base.js +198 -204
  76. package/dist/store/base.js.map +1 -1
  77. package/dist/store/batch.cjs +116 -147
  78. package/dist/store/batch.cjs.map +1 -0
  79. package/dist/store/batch.d.cts +49 -0
  80. package/dist/store/batch.d.cts.map +1 -0
  81. package/dist/store/batch.d.ts +48 -40
  82. package/dist/store/batch.d.ts.map +1 -0
  83. package/dist/store/batch.js +116 -143
  84. package/dist/store/batch.js.map +1 -1
  85. package/dist/store/memory.cjs +262 -363
  86. package/dist/store/memory.cjs.map +1 -0
  87. package/dist/store/memory.d.cts +64 -0
  88. package/dist/store/memory.d.cts.map +1 -0
  89. package/dist/store/memory.d.ts +30 -24
  90. package/dist/store/memory.d.ts.map +1 -0
  91. package/dist/store/memory.js +261 -358
  92. package/dist/store/memory.js.map +1 -1
  93. package/dist/store/utils.cjs +141 -249
  94. package/dist/store/utils.cjs.map +1 -0
  95. package/dist/store/utils.js +140 -245
  96. package/dist/store/utils.js.map +1 -1
  97. package/dist/types.d.cts +35 -0
  98. package/dist/types.d.cts.map +1 -0
  99. package/dist/types.d.ts +29 -28
  100. package/dist/types.d.ts.map +1 -0
  101. package/package.json +16 -18
  102. package/dist/cache/index.d.ts +0 -2
  103. package/dist/cache/index.js.map +0 -1
  104. package/dist/index.js.map +0 -1
  105. package/dist/serde/base.cjs +0 -3
  106. package/dist/serde/base.js +0 -2
  107. package/dist/serde/base.js.map +0 -1
  108. package/dist/serde/jsonplus.d.ts +0 -7
  109. package/dist/serde/utils/fast-safe-stringify/index.d.ts +0 -1
  110. package/dist/store/index.cjs +0 -20
  111. package/dist/store/index.d.ts +0 -3
  112. package/dist/store/index.js +0 -4
  113. package/dist/store/index.js.map +0 -1
  114. package/dist/store/utils.d.ts +0 -26
  115. package/dist/types.cjs +0 -3
  116. package/dist/types.js +0 -2
  117. package/dist/types.js.map +0 -1
  118. package/index.cjs +0 -1
  119. package/index.d.cts +0 -1
  120. package/index.d.ts +0 -1
  121. package/index.js +0 -1
@@ -1,151 +1,120 @@
1
- "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- Object.defineProperty(exports, "__esModule", { value: true });
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
- * Extracts and returns the underlying store from an `AsyncBatchedStore`,
8
- * or returns the input if it is not an `AsyncBatchedStore`.
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
- if ("lg_name" in input && input.lg_name === "AsyncBatchedStore") {
12
- // @ts-expect-error is a protected property
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
- class AsyncBatchedStore extends base_js_1.BaseStore {
18
- constructor(store) {
19
- super();
20
- Object.defineProperty(this, "lg_name", {
21
- enumerable: true,
22
- configurable: true,
23
- writable: true,
24
- value: "AsyncBatchedStore"
25
- });
26
- Object.defineProperty(this, "store", {
27
- enumerable: true,
28
- configurable: true,
29
- writable: true,
30
- value: void 0
31
- });
32
- Object.defineProperty(this, "queue", {
33
- enumerable: true,
34
- configurable: true,
35
- writable: true,
36
- value: new Map()
37
- });
38
- Object.defineProperty(this, "nextKey", {
39
- enumerable: true,
40
- configurable: true,
41
- writable: true,
42
- value: 0
43
- });
44
- Object.defineProperty(this, "running", {
45
- enumerable: true,
46
- configurable: true,
47
- writable: true,
48
- value: false
49
- });
50
- Object.defineProperty(this, "processingTask", {
51
- enumerable: true,
52
- configurable: true,
53
- writable: true,
54
- value: null
55
- });
56
- this.store = extractStore(store);
57
- }
58
- get isRunning() {
59
- return this.running;
60
- }
61
- /**
62
- * @ignore
63
- * Batch is not implemented here as we're only extending `BaseStore`
64
- * to allow it to be passed where `BaseStore` is expected, and implement
65
- * the convenience methods (get, search, put, delete).
66
- */
67
- async batch(_operations) {
68
- throw new Error("The `batch` method is not implemented on `AsyncBatchedStore`." +
69
- "\n Instead, it calls the `batch` method on the wrapped store." +
70
- "\n If you are seeing this error, something is wrong.");
71
- }
72
- async get(namespace, key) {
73
- return this.enqueueOperation({ namespace, key });
74
- }
75
- async search(namespacePrefix, options) {
76
- const { filter, limit = 10, offset = 0, query } = options || {};
77
- return this.enqueueOperation({
78
- namespacePrefix,
79
- filter,
80
- limit,
81
- offset,
82
- query,
83
- });
84
- }
85
- async put(namespace, key, value) {
86
- return this.enqueueOperation({ namespace, key, value });
87
- }
88
- async delete(namespace, key) {
89
- return this.enqueueOperation({
90
- namespace,
91
- key,
92
- value: null,
93
- });
94
- }
95
- start() {
96
- if (!this.running) {
97
- this.running = true;
98
- this.processingTask = this.processBatchQueue();
99
- }
100
- }
101
- async stop() {
102
- this.running = false;
103
- if (this.processingTask) {
104
- await this.processingTask;
105
- }
106
- }
107
- enqueueOperation(operation) {
108
- return new Promise((resolve, reject) => {
109
- const key = this.nextKey;
110
- this.nextKey += 1;
111
- this.queue.set(key, { operation, resolve, reject });
112
- });
113
- }
114
- async processBatchQueue() {
115
- while (this.running) {
116
- await new Promise((resolve) => {
117
- setTimeout(resolve, 0);
118
- });
119
- if (this.queue.size === 0)
120
- continue;
121
- const batch = new Map(this.queue);
122
- this.queue.clear();
123
- try {
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.js.map
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"}
@@ -1,41 +1,49 @@
1
- import { BaseStore, type Item, type Operation, OperationResults } from "./base.js";
2
- export declare class AsyncBatchedStore extends BaseStore {
3
- lg_name: string;
4
- protected store: BaseStore;
5
- private queue;
6
- private nextKey;
7
- private running;
8
- private processingTask;
9
- constructor(store: BaseStore);
10
- get isRunning(): boolean;
11
- /**
12
- * @ignore
13
- * Batch is not implemented here as we're only extending `BaseStore`
14
- * to allow it to be passed where `BaseStore` is expected, and implement
15
- * the convenience methods (get, search, put, delete).
16
- */
17
- batch<Op extends Operation[]>(_operations: Op): Promise<OperationResults<Op>>;
18
- get(namespace: string[], key: string): Promise<Item | null>;
19
- search(namespacePrefix: string[], options?: {
20
- filter?: Record<string, any>;
21
- limit?: number;
22
- offset?: number;
23
- query?: string;
24
- }): Promise<Item[]>;
25
- put(namespace: string[], key: string, value: Record<string, any>): Promise<void>;
26
- delete(namespace: string[], key: string): Promise<void>;
27
- start(): void;
28
- stop(): Promise<void>;
29
- private enqueueOperation;
30
- private processBatchQueue;
31
- toJSON(): {
32
- queue: Map<number, {
33
- operation: Operation;
34
- resolve: (value: any) => void;
35
- reject: (reason?: any) => void;
36
- }>;
37
- nextKey: number;
38
- running: boolean;
39
- store: string;
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"}