@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.
Files changed (120) hide show
  1. package/dist/base.cjs +73 -88
  2. package/dist/base.cjs.map +1 -0
  3. package/dist/base.d.cts +94 -0
  4. package/dist/base.d.cts.map +1 -0
  5. package/dist/base.d.ts +78 -73
  6. package/dist/base.d.ts.map +1 -0
  7. package/dist/base.js +68 -80
  8. package/dist/base.js.map +1 -1
  9. package/dist/cache/base.cjs +16 -21
  10. package/dist/cache/base.cjs.map +1 -0
  11. package/dist/cache/base.d.cts +43 -0
  12. package/dist/cache/base.d.cts.map +1 -0
  13. package/dist/cache/base.d.ts +41 -36
  14. package/dist/cache/base.d.ts.map +1 -0
  15. package/dist/cache/base.js +15 -16
  16. package/dist/cache/base.js.map +1 -1
  17. package/dist/cache/index.cjs +2 -19
  18. package/dist/cache/index.js +3 -3
  19. package/dist/cache/memory.cjs +50 -58
  20. package/dist/cache/memory.cjs.map +1 -0
  21. package/dist/cache/memory.d.cts +19 -0
  22. package/dist/cache/memory.d.cts.map +1 -0
  23. package/dist/cache/memory.d.ts +18 -13
  24. package/dist/cache/memory.d.ts.map +1 -0
  25. package/dist/cache/memory.js +49 -53
  26. package/dist/cache/memory.js.map +1 -1
  27. package/dist/id.cjs +10 -16
  28. package/dist/id.cjs.map +1 -0
  29. package/dist/id.d.cts +6 -0
  30. package/dist/id.d.cts.map +1 -0
  31. package/dist/id.d.ts +6 -2
  32. package/dist/id.d.ts.map +1 -0
  33. package/dist/id.js +9 -12
  34. package/dist/id.js.map +1 -1
  35. package/dist/index.cjs +36 -27
  36. package/dist/index.d.cts +12 -0
  37. package/dist/index.d.ts +12 -8
  38. package/dist/index.js +11 -9
  39. package/dist/memory.cjs +191 -268
  40. package/dist/memory.cjs.map +1 -0
  41. package/dist/memory.d.cts +21 -0
  42. package/dist/memory.d.cts.map +1 -0
  43. package/dist/memory.d.ts +18 -12
  44. package/dist/memory.d.ts.map +1 -0
  45. package/dist/memory.js +190 -263
  46. package/dist/memory.js.map +1 -1
  47. package/dist/serde/base.d.cts +8 -0
  48. package/dist/serde/base.d.cts.map +1 -0
  49. package/dist/serde/base.d.ts +7 -3
  50. package/dist/serde/base.d.ts.map +1 -0
  51. package/dist/serde/jsonplus.cjs +90 -141
  52. package/dist/serde/jsonplus.cjs.map +1 -0
  53. package/dist/serde/jsonplus.js +89 -136
  54. package/dist/serde/jsonplus.js.map +1 -1
  55. package/dist/serde/types.cjs +14 -9
  56. package/dist/serde/types.cjs.map +1 -0
  57. package/dist/serde/types.d.cts +52 -0
  58. package/dist/serde/types.d.cts.map +1 -0
  59. package/dist/serde/types.d.ts +50 -47
  60. package/dist/serde/types.d.ts.map +1 -0
  61. package/dist/serde/types.js +9 -5
  62. package/dist/serde/types.js.map +1 -1
  63. package/dist/serde/utils/fast-safe-stringify/index.cjs +87 -208
  64. package/dist/serde/utils/fast-safe-stringify/index.cjs.map +1 -0
  65. package/dist/serde/utils/fast-safe-stringify/index.js +87 -205
  66. package/dist/serde/utils/fast-safe-stringify/index.js.map +1 -1
  67. package/dist/store/base.cjs +199 -209
  68. package/dist/store/base.cjs.map +1 -0
  69. package/dist/store/base.d.cts +391 -0
  70. package/dist/store/base.d.cts.map +1 -0
  71. package/dist/store/base.d.ts +335 -332
  72. package/dist/store/base.d.ts.map +1 -0
  73. package/dist/store/base.js +198 -204
  74. package/dist/store/base.js.map +1 -1
  75. package/dist/store/batch.cjs +114 -147
  76. package/dist/store/batch.cjs.map +1 -0
  77. package/dist/store/batch.d.cts +46 -0
  78. package/dist/store/batch.d.cts.map +1 -0
  79. package/dist/store/batch.d.ts +45 -40
  80. package/dist/store/batch.d.ts.map +1 -0
  81. package/dist/store/batch.js +114 -143
  82. package/dist/store/batch.js.map +1 -1
  83. package/dist/store/memory.cjs +256 -363
  84. package/dist/store/memory.cjs.map +1 -0
  85. package/dist/store/memory.d.cts +62 -0
  86. package/dist/store/memory.d.cts.map +1 -0
  87. package/dist/store/memory.d.ts +28 -24
  88. package/dist/store/memory.d.ts.map +1 -0
  89. package/dist/store/memory.js +255 -358
  90. package/dist/store/memory.js.map +1 -1
  91. package/dist/store/utils.cjs +137 -249
  92. package/dist/store/utils.cjs.map +1 -0
  93. package/dist/store/utils.js +137 -245
  94. package/dist/store/utils.js.map +1 -1
  95. package/dist/types.d.cts +35 -0
  96. package/dist/types.d.cts.map +1 -0
  97. package/dist/types.d.ts +29 -28
  98. package/dist/types.d.ts.map +1 -0
  99. package/package.json +33 -34
  100. package/CHANGELOG.md +0 -19
  101. package/dist/cache/index.d.ts +0 -2
  102. package/dist/cache/index.js.map +0 -1
  103. package/dist/index.js.map +0 -1
  104. package/dist/serde/base.cjs +0 -3
  105. package/dist/serde/base.js +0 -2
  106. package/dist/serde/base.js.map +0 -1
  107. package/dist/serde/jsonplus.d.ts +0 -7
  108. package/dist/serde/utils/fast-safe-stringify/index.d.ts +0 -1
  109. package/dist/store/index.cjs +0 -20
  110. package/dist/store/index.d.ts +0 -3
  111. package/dist/store/index.js +0 -4
  112. package/dist/store/index.js.map +0 -1
  113. package/dist/store/utils.d.ts +0 -26
  114. package/dist/types.cjs +0 -3
  115. package/dist/types.js +0 -2
  116. package/dist/types.js.map +0 -1
  117. package/index.cjs +0 -1
  118. package/index.d.cts +0 -1
  119. package/index.d.ts +0 -1
  120. package/index.js +0 -1
@@ -1,151 +1,118 @@
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
+ //#region src/store/batch.ts
6
3
  /**
7
- * Extracts and returns the underlying store from an `AsyncBatchedStore`,
8
- * or returns the input if it is not an `AsyncBatchedStore`.
9
- */
4
+ * Extracts and returns the underlying store from an `AsyncBatchedStore`,
5
+ * or returns the input if it is not an `AsyncBatchedStore`.
6
+ */
10
7
  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;
8
+ if ("lg_name" in input && input.lg_name === "AsyncBatchedStore") return input.store;
9
+ return input;
16
10
  };
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
- }
11
+ var AsyncBatchedStore = class extends require_base.BaseStore {
12
+ lg_name = "AsyncBatchedStore";
13
+ store;
14
+ queue = /* @__PURE__ */ new Map();
15
+ nextKey = 0;
16
+ running = false;
17
+ processingTask = null;
18
+ constructor(store) {
19
+ super();
20
+ this.store = extractStore(store);
21
+ }
22
+ get isRunning() {
23
+ return this.running;
24
+ }
25
+ /**
26
+ * @ignore
27
+ * Batch is not implemented here as we're only extending `BaseStore`
28
+ * to allow it to be passed where `BaseStore` is expected, and implement
29
+ * the convenience methods (get, search, put, delete).
30
+ */
31
+ async batch(_operations) {
32
+ 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.");
33
+ }
34
+ async get(namespace, key) {
35
+ return this.enqueueOperation({
36
+ namespace,
37
+ key
38
+ });
39
+ }
40
+ async search(namespacePrefix, options) {
41
+ const { filter, limit = 10, offset = 0, query } = options || {};
42
+ return this.enqueueOperation({
43
+ namespacePrefix,
44
+ filter,
45
+ limit,
46
+ offset,
47
+ query
48
+ });
49
+ }
50
+ async put(namespace, key, value) {
51
+ return this.enqueueOperation({
52
+ namespace,
53
+ key,
54
+ value
55
+ });
56
+ }
57
+ async delete(namespace, key) {
58
+ return this.enqueueOperation({
59
+ namespace,
60
+ key,
61
+ value: null
62
+ });
63
+ }
64
+ start() {
65
+ if (!this.running) {
66
+ this.running = true;
67
+ this.processingTask = this.processBatchQueue();
68
+ }
69
+ }
70
+ async stop() {
71
+ this.running = false;
72
+ if (this.processingTask) await this.processingTask;
73
+ }
74
+ enqueueOperation(operation) {
75
+ return new Promise((resolve, reject) => {
76
+ const key = this.nextKey;
77
+ this.nextKey += 1;
78
+ this.queue.set(key, {
79
+ operation,
80
+ resolve,
81
+ reject
82
+ });
83
+ });
84
+ }
85
+ async processBatchQueue() {
86
+ while (this.running) {
87
+ await new Promise((resolve) => {
88
+ setTimeout(resolve, 0);
89
+ });
90
+ if (this.queue.size === 0) continue;
91
+ const batch = new Map(this.queue);
92
+ this.queue.clear();
93
+ try {
94
+ const operations = Array.from(batch.values()).map(({ operation }) => operation);
95
+ const results = await this.store.batch(operations);
96
+ batch.forEach(({ resolve }, key) => {
97
+ resolve(results[Array.from(batch.keys()).indexOf(key)]);
98
+ });
99
+ } catch (e) {
100
+ batch.forEach(({ reject }) => {
101
+ reject(e);
102
+ });
103
+ }
104
+ }
105
+ }
106
+ toJSON() {
107
+ return {
108
+ queue: this.queue,
109
+ nextKey: this.nextKey,
110
+ running: this.running,
111
+ store: "[LangGraphStore]"
112
+ };
113
+ }
114
+ };
115
+ //#endregion
150
116
  exports.AsyncBatchedStore = AsyncBatchedStore;
151
- //# sourceMappingURL=batch.js.map
117
+
118
+ //# 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,aAAAA,UAAU;CAC/C,UAAU;CAEV;CAEA,wBAOI,IAAI,KAAK;CAEb,UAA0B;CAE1B,UAAkB;CAElB,iBAA+C;CAE/C,YAAY,OAAkB;AAC5B,SAAO;AACP,OAAK,QAAQ,aAAa,MAAM;;CAGlC,IAAI,YAAqB;AACvB,SAAO,KAAK;;;;;;;;CASd,MAAM,MACJ,aAC+B;AAC/B,QAAM,IAAI,MACR,iLAGD;;CAGH,MAAM,IAAI,WAAqB,KAAmC;AAChE,SAAO,KAAK,iBAAiB;GAAE;GAAW;GAAK,CAAiB;;CAGlE,MAAM,OACJ,iBACA,SAMiB;EACjB,MAAM,EAAE,QAAQ,QAAQ,IAAI,SAAS,GAAG,UAAU,WAAW,EAAE;AAC/D,SAAO,KAAK,iBAAiB;GAC3B;GACA;GACA;GACA;GACA;GACD,CAAoB;;CAGvB,MAAM,IACJ,WACA,KACA,OACe;AACf,SAAO,KAAK,iBAAiB;GAAE;GAAW;GAAK;GAAO,CAAiB;;CAGzE,MAAM,OAAO,WAAqB,KAA4B;AAC5D,SAAO,KAAK,iBAAiB;GAC3B;GACA;GACA,OAAO;GACR,CAAiB;;CAGpB,QAAc;AACZ,MAAI,CAAC,KAAK,SAAS;AACjB,QAAK,UAAU;AACf,QAAK,iBAAiB,KAAK,mBAAmB;;;CAIlD,MAAM,OAAsB;AAC1B,OAAK,UAAU;AACf,MAAI,KAAK,eACP,OAAM,KAAK;;CAIf,iBAA4B,WAAkC;AAC5D,SAAO,IAAI,SAAY,SAAS,WAAW;GACzC,MAAM,MAAM,KAAK;AACjB,QAAK,WAAW;AAChB,QAAK,MAAM,IAAI,KAAK;IAAE;IAAW;IAAS;IAAQ,CAAC;IACnD;;CAGJ,MAAc,oBAAmC;AAC/C,SAAO,KAAK,SAAS;AACnB,SAAM,IAAI,SAAS,YAAY;AAC7B,eAAW,SAAS,EAAE;KACtB;AACF,OAAI,KAAK,MAAM,SAAS,EAAG;GAE3B,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM;AACjC,QAAK,MAAM,OAAO;AAElB,OAAI;IACF,MAAM,aAAa,MAAM,KAAK,MAAM,QAAQ,CAAC,CAAC,KAC3C,EAAE,gBAAgB,UACpB;IACD,MAAM,UAAU,MAAM,KAAK,MAAM,MAAM,WAAW;AAElD,UAAM,SAAS,EAAE,WAAW,QAAQ;AAElC,aAAQ,QADM,MAAM,KAAK,MAAM,MAAM,CAAC,CAAC,QAAQ,IAAI,EAC5B;MACvB;YACK,GAAG;AACV,UAAM,SAAS,EAAE,aAAa;AAC5B,YAAO,EAAE;MACT;;;;CAQR,SAAS;AACP,SAAO;GACL,OAAO,KAAK;GACZ,SAAS,KAAK;GACd,SAAS,KAAK;GACd,OAAO;GACR"}
@@ -0,0 +1,46 @@
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
+ toJSON(): {
34
+ queue: Map<number, {
35
+ operation: Operation;
36
+ resolve: (value: any) => void;
37
+ reject: (reason?: any) => void;
38
+ }>;
39
+ nextKey: number;
40
+ running: boolean;
41
+ store: string;
42
+ };
43
+ }
44
+ //#endregion
45
+ export { AsyncBatchedStore };
46
+ //# sourceMappingURL=batch.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch.d.cts","names":[],"sources":["../../src/store/batch.ts"],"mappings":";;;cAwBa,iBAAA,SAA0B,SAAA;EACrC,OAAA;EAAA,UAEU,KAAA,EAAO,SAAA;EAAA,QAET,KAAA;EAAA,QASA,OAAA;EAAA,QAEA,OAAA;EAAA,QAEA,cAAA;EAER,WAAA,CAAY,KAAA,EAAO,SAAA;EAAA,IAKf,SAAA,CAAA;EAYwB;;;;;;EAFtB,KAAA,YAAiB,SAAA,GAAA,CACrB,WAAA,EAAa,EAAA,GACZ,OAAA,CAAQ,gBAAA,CAAiB,EAAA;EAQtB,GAAA,CAAI,SAAA,YAAqB,GAAA,WAAc,OAAA,CAAQ,IAAA;EAI/C,MAAA,CACJ,eAAA,YACA,OAAA;IACE,MAAA,GAAS,MAAA;IACT,KAAA;IACA,MAAA;IACA,KAAA;EAAA,IAED,OAAA,CAAQ,IAAA;EAWL,GAAA,CACJ,SAAA,YACA,GAAA,UACA,KAAA,EAAO,MAAA,gBACN,OAAA;EAIG,MAAA,CAAO,SAAA,YAAqB,GAAA,WAAc,OAAA;EAQhD,KAAA,CAAA;EAOM,IAAA,CAAA,GAAQ,OAAA;EAAA,QAON,gBAAA;EAAA,QAQM,iBAAA;EA+Bd,MAAA,CAAA"}
@@ -1,41 +1,46 @@
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
+ toJSON(): {
34
+ queue: Map<number, {
35
+ operation: Operation;
36
+ resolve: (value: any) => void;
37
+ reject: (reason?: any) => void;
38
+ }>;
39
+ nextKey: number;
40
+ running: boolean;
41
+ store: string;
42
+ };
41
43
  }
44
+ //#endregion
45
+ export { AsyncBatchedStore };
46
+ //# sourceMappingURL=batch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch.d.ts","names":[],"sources":["../../src/store/batch.ts"],"mappings":";;;cAwBa,iBAAA,SAA0B,SAAA;EACrC,OAAA;EAAA,UAEU,KAAA,EAAO,SAAA;EAAA,QAET,KAAA;EAAA,QASA,OAAA;EAAA,QAEA,OAAA;EAAA,QAEA,cAAA;EAER,WAAA,CAAY,KAAA,EAAO,SAAA;EAAA,IAKf,SAAA,CAAA;EAYwB;;;;;;EAFtB,KAAA,YAAiB,SAAA,GAAA,CACrB,WAAA,EAAa,EAAA,GACZ,OAAA,CAAQ,gBAAA,CAAiB,EAAA;EAQtB,GAAA,CAAI,SAAA,YAAqB,GAAA,WAAc,OAAA,CAAQ,IAAA;EAI/C,MAAA,CACJ,eAAA,YACA,OAAA;IACE,MAAA,GAAS,MAAA;IACT,KAAA;IACA,MAAA;IACA,KAAA;EAAA,IAED,OAAA,CAAQ,IAAA;EAWL,GAAA,CACJ,SAAA,YACA,GAAA,UACA,KAAA,EAAO,MAAA,gBACN,OAAA;EAIG,MAAA,CAAO,SAAA,YAAqB,GAAA,WAAc,OAAA;EAQhD,KAAA,CAAA;EAOM,IAAA,CAAA,GAAQ,OAAA;EAAA,QAON,gBAAA;EAAA,QAQM,iBAAA;EA+Bd,MAAA,CAAA"}