@farukada/aws-langgraph-dynamodb-ts 0.0.2
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/LICENSE +21 -0
- package/README.md +960 -0
- package/dist/checkpointer/actions/delete-thread.d.ts +9 -0
- package/dist/checkpointer/actions/delete-thread.d.ts.map +1 -0
- package/dist/checkpointer/actions/delete-thread.js +109 -0
- package/dist/checkpointer/actions/delete-thread.js.map +1 -0
- package/dist/checkpointer/actions/get-tuple.d.ts +11 -0
- package/dist/checkpointer/actions/get-tuple.d.ts.map +1 -0
- package/dist/checkpointer/actions/get-tuple.js +96 -0
- package/dist/checkpointer/actions/get-tuple.js.map +1 -0
- package/dist/checkpointer/actions/index.d.ts +5 -0
- package/dist/checkpointer/actions/index.d.ts.map +1 -0
- package/dist/checkpointer/actions/index.js +21 -0
- package/dist/checkpointer/actions/index.js.map +1 -0
- package/dist/checkpointer/actions/put-writes.d.ts +9 -0
- package/dist/checkpointer/actions/put-writes.d.ts.map +1 -0
- package/dist/checkpointer/actions/put-writes.js +63 -0
- package/dist/checkpointer/actions/put-writes.js.map +1 -0
- package/dist/checkpointer/actions/put.d.ts +11 -0
- package/dist/checkpointer/actions/put.d.ts.map +1 -0
- package/dist/checkpointer/actions/put.js +55 -0
- package/dist/checkpointer/actions/put.js.map +1 -0
- package/dist/checkpointer/actions/validate-configurable.d.ts +10 -0
- package/dist/checkpointer/actions/validate-configurable.d.ts.map +1 -0
- package/dist/checkpointer/actions/validate-configurable.js +39 -0
- package/dist/checkpointer/actions/validate-configurable.js.map +1 -0
- package/dist/checkpointer/actions/writer.d.ts +50 -0
- package/dist/checkpointer/actions/writer.d.ts.map +1 -0
- package/dist/checkpointer/actions/writer.js +109 -0
- package/dist/checkpointer/actions/writer.js.map +1 -0
- package/dist/checkpointer/index.d.ts +70 -0
- package/dist/checkpointer/index.d.ts.map +1 -0
- package/dist/checkpointer/index.js +172 -0
- package/dist/checkpointer/index.js.map +1 -0
- package/dist/checkpointer/types/index.d.ts +162 -0
- package/dist/checkpointer/types/index.d.ts.map +1 -0
- package/dist/checkpointer/types/index.js +3 -0
- package/dist/checkpointer/types/index.js.map +1 -0
- package/dist/checkpointer/utils/index.d.ts +6 -0
- package/dist/checkpointer/utils/index.d.ts.map +1 -0
- package/dist/checkpointer/utils/index.js +26 -0
- package/dist/checkpointer/utils/index.js.map +1 -0
- package/dist/checkpointer/utils/validation.d.ts +48 -0
- package/dist/checkpointer/utils/validation.d.ts.map +1 -0
- package/dist/checkpointer/utils/validation.js +190 -0
- package/dist/checkpointer/utils/validation.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +21 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/utils/constants.d.ts +11 -0
- package/dist/shared/utils/constants.d.ts.map +1 -0
- package/dist/shared/utils/constants.js +35 -0
- package/dist/shared/utils/constants.js.map +1 -0
- package/dist/shared/utils/index.d.ts +6 -0
- package/dist/shared/utils/index.d.ts.map +1 -0
- package/dist/shared/utils/index.js +22 -0
- package/dist/shared/utils/index.js.map +1 -0
- package/dist/shared/utils/retry.d.ts +19 -0
- package/dist/shared/utils/retry.d.ts.map +1 -0
- package/dist/shared/utils/retry.js +102 -0
- package/dist/shared/utils/retry.js.map +1 -0
- package/dist/store/actions/get-operation.d.ts +11 -0
- package/dist/store/actions/get-operation.d.ts.map +1 -0
- package/dist/store/actions/get-operation.js +42 -0
- package/dist/store/actions/get-operation.js.map +1 -0
- package/dist/store/actions/index.d.ts +5 -0
- package/dist/store/actions/index.d.ts.map +1 -0
- package/dist/store/actions/index.js +21 -0
- package/dist/store/actions/index.js.map +1 -0
- package/dist/store/actions/list-namespaces-operation.d.ts +10 -0
- package/dist/store/actions/list-namespaces-operation.d.ts.map +1 -0
- package/dist/store/actions/list-namespaces-operation.js +212 -0
- package/dist/store/actions/list-namespaces-operation.js.map +1 -0
- package/dist/store/actions/put-operation.d.ts +9 -0
- package/dist/store/actions/put-operation.d.ts.map +1 -0
- package/dist/store/actions/put-operation.js +94 -0
- package/dist/store/actions/put-operation.js.map +1 -0
- package/dist/store/actions/search-operation.d.ts +11 -0
- package/dist/store/actions/search-operation.d.ts.map +1 -0
- package/dist/store/actions/search-operation.js +150 -0
- package/dist/store/actions/search-operation.js.map +1 -0
- package/dist/store/index.d.ts +73 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +145 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/types/index.d.ts +97 -0
- package/dist/store/types/index.d.ts.map +1 -0
- package/dist/store/types/index.js +3 -0
- package/dist/store/types/index.js.map +1 -0
- package/dist/store/utils/filter.d.ts +16 -0
- package/dist/store/utils/filter.d.ts.map +1 -0
- package/dist/store/utils/filter.js +71 -0
- package/dist/store/utils/filter.js.map +1 -0
- package/dist/store/utils/index.d.ts +8 -0
- package/dist/store/utils/index.d.ts.map +1 -0
- package/dist/store/utils/index.js +28 -0
- package/dist/store/utils/index.js.map +1 -0
- package/dist/store/utils/result.d.ts +42 -0
- package/dist/store/utils/result.d.ts.map +1 -0
- package/dist/store/utils/result.js +51 -0
- package/dist/store/utils/result.js.map +1 -0
- package/dist/store/utils/validation.d.ts +57 -0
- package/dist/store/utils/validation.d.ts.map +1 -0
- package/dist/store/utils/validation.js +243 -0
- package/dist/store/utils/validation.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Validation utilities for checkpointer operations
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CheckpointerValidationConstants = exports.CheckpointerValidationError = void 0;
|
|
7
|
+
exports.validateThreadId = validateThreadId;
|
|
8
|
+
exports.validateCheckpointId = validateCheckpointId;
|
|
9
|
+
exports.validateCheckpointNs = validateCheckpointNs;
|
|
10
|
+
exports.validateTaskId = validateTaskId;
|
|
11
|
+
exports.validateChannel = validateChannel;
|
|
12
|
+
exports.validateWritesCount = validateWritesCount;
|
|
13
|
+
exports.validateListLimit = validateListLimit;
|
|
14
|
+
exports.validateTTLDays = validateTTLDays;
|
|
15
|
+
const utils_1 = require("../../shared/utils");
|
|
16
|
+
const MAX_THREAD_ID_LENGTH = 256;
|
|
17
|
+
const MAX_CHECKPOINT_ID_LENGTH = 256;
|
|
18
|
+
const MAX_CHECKPOINT_NS_LENGTH = 256;
|
|
19
|
+
const MAX_TASK_ID_LENGTH = 256;
|
|
20
|
+
const MAX_CHANNEL_LENGTH = 256;
|
|
21
|
+
const MAX_WRITES_PER_BATCH = 1000;
|
|
22
|
+
const MAX_LIST_LIMIT = 1000;
|
|
23
|
+
const MAX_DELETE_BATCH_SIZE = 100; // Maximum checkpoints to delete at once
|
|
24
|
+
const SEPARATOR = ':::';
|
|
25
|
+
class CheckpointerValidationError extends Error {
|
|
26
|
+
constructor(message) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.name = 'CheckpointerValidationError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.CheckpointerValidationError = CheckpointerValidationError;
|
|
32
|
+
/**
|
|
33
|
+
* Validate thread ID
|
|
34
|
+
*/
|
|
35
|
+
function validateThreadId(threadId) {
|
|
36
|
+
if (typeof threadId !== 'string') {
|
|
37
|
+
throw new CheckpointerValidationError('thread_id must be a string');
|
|
38
|
+
}
|
|
39
|
+
if (threadId.length === 0) {
|
|
40
|
+
throw new CheckpointerValidationError('thread_id cannot be empty');
|
|
41
|
+
}
|
|
42
|
+
if (threadId.length > MAX_THREAD_ID_LENGTH) {
|
|
43
|
+
throw new CheckpointerValidationError(`thread_id exceeds maximum length of ${MAX_THREAD_ID_LENGTH} characters`);
|
|
44
|
+
}
|
|
45
|
+
// Prevent separator injection
|
|
46
|
+
if (threadId.includes(SEPARATOR)) {
|
|
47
|
+
throw new CheckpointerValidationError(`thread_id cannot contain separator "${SEPARATOR}"`);
|
|
48
|
+
}
|
|
49
|
+
// Prevent control characters and null bytes
|
|
50
|
+
// eslint-disable-next-line no-control-regex
|
|
51
|
+
if (/[\x00-\x1F\x7F]/.test(threadId)) {
|
|
52
|
+
throw new CheckpointerValidationError('thread_id cannot contain control characters');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Validate checkpoint ID
|
|
57
|
+
*/
|
|
58
|
+
function validateCheckpointId(checkpointId, required = false) {
|
|
59
|
+
if (checkpointId === undefined) {
|
|
60
|
+
if (required) {
|
|
61
|
+
throw new CheckpointerValidationError('checkpoint_id is required');
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (typeof checkpointId !== 'string') {
|
|
66
|
+
throw new CheckpointerValidationError('checkpoint_id must be a string');
|
|
67
|
+
}
|
|
68
|
+
if (checkpointId.length === 0) {
|
|
69
|
+
throw new CheckpointerValidationError('checkpoint_id cannot be empty');
|
|
70
|
+
}
|
|
71
|
+
if (checkpointId.length > MAX_CHECKPOINT_ID_LENGTH) {
|
|
72
|
+
throw new CheckpointerValidationError(`checkpoint_id exceeds maximum length of ${MAX_CHECKPOINT_ID_LENGTH} characters`);
|
|
73
|
+
}
|
|
74
|
+
// Prevent separator injection
|
|
75
|
+
if (checkpointId.includes(SEPARATOR)) {
|
|
76
|
+
throw new CheckpointerValidationError(`checkpoint_id cannot contain separator "${SEPARATOR}"`);
|
|
77
|
+
}
|
|
78
|
+
// Prevent control characters
|
|
79
|
+
// eslint-disable-next-line no-control-regex
|
|
80
|
+
if (/[\x00-\x1F\x7F]/.test(checkpointId)) {
|
|
81
|
+
throw new CheckpointerValidationError('checkpoint_id cannot contain control characters');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Validate checkpoint namespace
|
|
86
|
+
*/
|
|
87
|
+
function validateCheckpointNs(checkpointNs) {
|
|
88
|
+
if (checkpointNs === undefined || checkpointNs === '') {
|
|
89
|
+
return; // Empty namespace is allowed
|
|
90
|
+
}
|
|
91
|
+
if (typeof checkpointNs !== 'string') {
|
|
92
|
+
throw new CheckpointerValidationError('checkpoint_ns must be a string');
|
|
93
|
+
}
|
|
94
|
+
if (checkpointNs.length > MAX_CHECKPOINT_NS_LENGTH) {
|
|
95
|
+
throw new CheckpointerValidationError(`checkpoint_ns exceeds maximum length of ${MAX_CHECKPOINT_NS_LENGTH} characters`);
|
|
96
|
+
}
|
|
97
|
+
// Prevent separator injection
|
|
98
|
+
if (checkpointNs.includes(SEPARATOR)) {
|
|
99
|
+
throw new CheckpointerValidationError(`checkpoint_ns cannot contain separator "${SEPARATOR}"`);
|
|
100
|
+
}
|
|
101
|
+
// Prevent control characters
|
|
102
|
+
// eslint-disable-next-line no-control-regex
|
|
103
|
+
if (/[\x00-\x1F\x7F]/.test(checkpointNs)) {
|
|
104
|
+
throw new CheckpointerValidationError('checkpoint_ns cannot contain control characters');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Validate task ID
|
|
109
|
+
*/
|
|
110
|
+
function validateTaskId(taskId) {
|
|
111
|
+
if (typeof taskId !== 'string') {
|
|
112
|
+
throw new CheckpointerValidationError('task_id must be a string');
|
|
113
|
+
}
|
|
114
|
+
if (taskId.length === 0) {
|
|
115
|
+
throw new CheckpointerValidationError('task_id cannot be empty');
|
|
116
|
+
}
|
|
117
|
+
if (taskId.length > MAX_TASK_ID_LENGTH) {
|
|
118
|
+
throw new CheckpointerValidationError(`task_id exceeds maximum length of ${MAX_TASK_ID_LENGTH} characters`);
|
|
119
|
+
}
|
|
120
|
+
// Prevent separator injection
|
|
121
|
+
if (taskId.includes(SEPARATOR)) {
|
|
122
|
+
throw new CheckpointerValidationError(`task_id cannot contain separator "${SEPARATOR}"`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Validate channel name
|
|
127
|
+
*/
|
|
128
|
+
function validateChannel(channel) {
|
|
129
|
+
if (typeof channel !== 'string') {
|
|
130
|
+
throw new CheckpointerValidationError('channel must be a string');
|
|
131
|
+
}
|
|
132
|
+
if (channel.length === 0) {
|
|
133
|
+
throw new CheckpointerValidationError('channel cannot be empty');
|
|
134
|
+
}
|
|
135
|
+
if (channel.length > MAX_CHANNEL_LENGTH) {
|
|
136
|
+
throw new CheckpointerValidationError(`channel exceeds maximum length of ${MAX_CHANNEL_LENGTH} characters`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Validate writes array length
|
|
141
|
+
*/
|
|
142
|
+
function validateWritesCount(writesCount) {
|
|
143
|
+
if (typeof writesCount !== 'number' || !Number.isInteger(writesCount)) {
|
|
144
|
+
throw new CheckpointerValidationError('Writes count must be an integer');
|
|
145
|
+
}
|
|
146
|
+
if (writesCount < 0) {
|
|
147
|
+
throw new CheckpointerValidationError('Writes count cannot be negative');
|
|
148
|
+
}
|
|
149
|
+
if (writesCount > MAX_WRITES_PER_BATCH) {
|
|
150
|
+
throw new CheckpointerValidationError(`Writes count (${writesCount}) exceeds maximum of ${MAX_WRITES_PER_BATCH}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Validate list limit parameter
|
|
155
|
+
*/
|
|
156
|
+
function validateListLimit(limit) {
|
|
157
|
+
if (limit === undefined) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (typeof limit !== 'number' || !Number.isInteger(limit)) {
|
|
161
|
+
throw new CheckpointerValidationError('Limit must be an integer');
|
|
162
|
+
}
|
|
163
|
+
if (limit <= 0) {
|
|
164
|
+
throw new CheckpointerValidationError('Limit must be positive');
|
|
165
|
+
}
|
|
166
|
+
if (limit > MAX_LIST_LIMIT) {
|
|
167
|
+
throw new CheckpointerValidationError(`Limit cannot exceed ${MAX_LIST_LIMIT}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Validate TTL days (wraps shared validation with a checkpointer-specific error type)
|
|
172
|
+
*/
|
|
173
|
+
function validateTTLDays(ttlDays) {
|
|
174
|
+
try {
|
|
175
|
+
(0, utils_1.validateTTLDays)(ttlDays);
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
throw new CheckpointerValidationError(error instanceof Error ? error.message : String(error));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Export constants for use in other modules
|
|
183
|
+
*/
|
|
184
|
+
exports.CheckpointerValidationConstants = {
|
|
185
|
+
MAX_DELETE_BATCH_SIZE,
|
|
186
|
+
MAX_WRITES_PER_BATCH,
|
|
187
|
+
MAX_LIST_LIMIT,
|
|
188
|
+
SEPARATOR,
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/checkpointer/utils/validation.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAwBH,4CAyBC;AAKD,oDAmCC;AAKD,oDAyBC;AAKD,wCAmBC;AAKD,0CAcC;AAKD,kDAcC;AAKD,8CAgBC;AAKD,0CAMC;AAnND,8CAA0E;AAE1E,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,qBAAqB,GAAG,GAAG,CAAC,CAAC,wCAAwC;AAC3E,MAAM,SAAS,GAAG,KAAK,CAAC;AAExB,MAAa,2BAA4B,SAAQ,KAAK;IACpD,YAAY,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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamoDBStore = exports.DynamoDBSaver = void 0;
|
|
4
|
+
var checkpointer_1 = require("./checkpointer");
|
|
5
|
+
Object.defineProperty(exports, "DynamoDBSaver", { enumerable: true, get: function () { return checkpointer_1.DynamoDBSaver; } });
|
|
6
|
+
var store_1 = require("./store");
|
|
7
|
+
Object.defineProperty(exports, "DynamoDBStore", { enumerable: true, get: function () { return store_1.DynamoDBStore; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAAtC,6GAAA,aAAa,OAAA;AAEtB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared utilities and types
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,0CAAwB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for validation across store and checkpointer
|
|
3
|
+
*/
|
|
4
|
+
export declare const MAX_TTL_DAYS: number;
|
|
5
|
+
export declare const MAX_LOOP_ITERATIONS = 100;
|
|
6
|
+
export declare const MAX_TOTAL_ITEMS_IN_MEMORY = 10000;
|
|
7
|
+
/**
|
|
8
|
+
* Validate TTL days (shared logic)
|
|
9
|
+
*/
|
|
10
|
+
export declare function validateTTLDays(ttlDays: number | undefined): void;
|
|
11
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,YAAY,QAAU,CAAC;AACpC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,yBAAyB,QAAQ,CAAC;AAE/C;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAuBjE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared constants for validation across store and checkpointer
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MAX_TOTAL_ITEMS_IN_MEMORY = exports.MAX_LOOP_ITERATIONS = exports.MAX_TTL_DAYS = void 0;
|
|
7
|
+
exports.validateTTLDays = validateTTLDays;
|
|
8
|
+
// Common DynamoDB limits
|
|
9
|
+
exports.MAX_TTL_DAYS = 365 * 5; // 5 years
|
|
10
|
+
exports.MAX_LOOP_ITERATIONS = 100; // Maximum loop iterations to prevent infinite loops
|
|
11
|
+
exports.MAX_TOTAL_ITEMS_IN_MEMORY = 10000; // Maximum items to collect in memory
|
|
12
|
+
/**
|
|
13
|
+
* Validate TTL days (shared logic)
|
|
14
|
+
*/
|
|
15
|
+
function validateTTLDays(ttlDays) {
|
|
16
|
+
if (ttlDays === undefined) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (typeof ttlDays !== 'number' || !Number.isInteger(ttlDays)) {
|
|
20
|
+
throw new Error('TTL days must be an integer');
|
|
21
|
+
}
|
|
22
|
+
if (ttlDays <= 0) {
|
|
23
|
+
throw new Error('TTL days must be positive');
|
|
24
|
+
}
|
|
25
|
+
if (ttlDays > exports.MAX_TTL_DAYS) {
|
|
26
|
+
throw new Error(`TTL days cannot exceed ${exports.MAX_TTL_DAYS}`);
|
|
27
|
+
}
|
|
28
|
+
// Check for overflow when converting to Unix timestamp
|
|
29
|
+
const futureTimestamp = Math.floor(Date.now() / 1000) + ttlDays * 24 * 60 * 60;
|
|
30
|
+
if (futureTimestamp > 2147483647) {
|
|
31
|
+
// Max 32-bit integer
|
|
32
|
+
throw new Error('TTL would overflow Unix timestamp (max date: 2038-01-19)');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/shared/utils/constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAUH,0CAuBC;AA/BD,yBAAyB;AACZ,QAAA,YAAY,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,UAAU;AAClC,QAAA,mBAAmB,GAAG,GAAG,CAAC,CAAC,oDAAoD;AAC/E,QAAA,yBAAyB,GAAG,KAAK,CAAC,CAAC,qCAAqC;AAErF;;GAEG;AACH,SAAgB,eAAe,CAAC,OAA2B;IACzD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,OAAO,GAAG,oBAAY,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,0BAA0B,oBAAY,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,uDAAuD;IACvD,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAC/E,IAAI,eAAe,GAAG,UAAU,EAAE,CAAC;QACjC,qBAAqB;QACrB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared utilities for store and checkpointer
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./retry"), exports);
|
|
21
|
+
__exportStar(require("./constants"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,8CAA4B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry utilities for handling transient DynamoDB errors
|
|
3
|
+
* Shared between store and checkpointer
|
|
4
|
+
*/
|
|
5
|
+
export interface RetryOptions {
|
|
6
|
+
maxAttempts?: number;
|
|
7
|
+
baseDelayMs?: number;
|
|
8
|
+
maxDelayMs?: number;
|
|
9
|
+
retryableErrors?: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Retry a function with exponential backoff
|
|
13
|
+
*/
|
|
14
|
+
export declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
|
|
15
|
+
/**
|
|
16
|
+
* Specialized retry for DynamoDB operations
|
|
17
|
+
*/
|
|
18
|
+
export declare function withDynamoDBRetry<T>(fn: () => Promise<T>): Promise<T>;
|
|
19
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAyCD;;GAEG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,CAAC,CAAC,CAgD/F;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAM3E"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Retry utilities for handling transient DynamoDB errors
|
|
4
|
+
* Shared between store and checkpointer
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.withRetry = withRetry;
|
|
8
|
+
exports.withDynamoDBRetry = withDynamoDBRetry;
|
|
9
|
+
const DEFAULT_OPTIONS = {
|
|
10
|
+
maxAttempts: 3,
|
|
11
|
+
baseDelayMs: 100,
|
|
12
|
+
maxDelayMs: 5000,
|
|
13
|
+
retryableErrors: [
|
|
14
|
+
'ProvisionedThroughputExceededException',
|
|
15
|
+
'ThrottlingException',
|
|
16
|
+
'RequestLimitExceeded',
|
|
17
|
+
'InternalServerError',
|
|
18
|
+
'ServiceUnavailable',
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Sleep for a specified number of milliseconds
|
|
23
|
+
*/
|
|
24
|
+
function sleep(ms) {
|
|
25
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Calculate delay with exponential backoff and jitter
|
|
29
|
+
*/
|
|
30
|
+
function calculateDelay(attempt, baseDelayMs, maxDelayMs) {
|
|
31
|
+
const exponentialDelay = baseDelayMs * Math.pow(2, attempt - 1);
|
|
32
|
+
const jitter = Math.random() * 0.3 * exponentialDelay; // Add up to 30% jitter
|
|
33
|
+
return Math.min(exponentialDelay + jitter, maxDelayMs);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Check if an error is retryable
|
|
37
|
+
*/
|
|
38
|
+
function isRetryableError(error, retryableErrors) {
|
|
39
|
+
if (!error)
|
|
40
|
+
return false;
|
|
41
|
+
const errorName = error.name || error.code || '';
|
|
42
|
+
return retryableErrors.some((retryable) => errorName.includes(retryable));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Retry a function with exponential backoff
|
|
46
|
+
*/
|
|
47
|
+
async function withRetry(fn, options = {}) {
|
|
48
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
49
|
+
let lastError;
|
|
50
|
+
for (let attempt = 1; attempt <= opts.maxAttempts; attempt++) {
|
|
51
|
+
try {
|
|
52
|
+
return await fn();
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
lastError = error;
|
|
56
|
+
// Don't retry if this is the last attempt
|
|
57
|
+
if (attempt === opts.maxAttempts) {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
// Don't retry if the error is not retryable
|
|
61
|
+
if (!isRetryableError(error, opts.retryableErrors)) {
|
|
62
|
+
// Convert to Error if needed, preserving properties
|
|
63
|
+
if (error instanceof Error) {
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
const wrappedError = new Error(error?.message || String(error));
|
|
67
|
+
// Preserve name and other properties from the original error
|
|
68
|
+
if (error && typeof error === 'object') {
|
|
69
|
+
Object.assign(wrappedError, error);
|
|
70
|
+
}
|
|
71
|
+
throw wrappedError;
|
|
72
|
+
}
|
|
73
|
+
// Calculate delay and wait
|
|
74
|
+
const delay = calculateDelay(attempt, opts.baseDelayMs, opts.maxDelayMs);
|
|
75
|
+
await sleep(delay);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Ensure we always throw an Error object
|
|
79
|
+
if (!lastError) {
|
|
80
|
+
throw new Error('Retry failed without error');
|
|
81
|
+
}
|
|
82
|
+
if (lastError instanceof Error) {
|
|
83
|
+
throw lastError;
|
|
84
|
+
}
|
|
85
|
+
// Convert to Error while preserving properties
|
|
86
|
+
const wrappedError = new Error(lastError?.message || String(lastError));
|
|
87
|
+
if (lastError && typeof lastError === 'object') {
|
|
88
|
+
Object.assign(wrappedError, lastError);
|
|
89
|
+
}
|
|
90
|
+
throw wrappedError;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Specialized retry for DynamoDB operations
|
|
94
|
+
*/
|
|
95
|
+
async function withDynamoDBRetry(fn) {
|
|
96
|
+
return withRetry(fn, {
|
|
97
|
+
maxAttempts: 3,
|
|
98
|
+
baseDelayMs: 100,
|
|
99
|
+
maxDelayMs: 5000,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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CAAC;QAC/B,MAAM,SAAS,CAAC;IAClB,CAAC;IACD,+CAA+C;IAC/C,MAAM,YAAY,GAAG,IAAI,KAAK,CAAE,SAAiB,EAAE,OAAO,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IACjF,IAAI,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC/C,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,YAAY,CAAC;AACrB,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,iBAAiB,CAAI,EAAoB;IAC7D,OAAO,SAAS,CAAC,EAAE,EAAE;QACnB,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,GAAG;QAChB,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Item } from '@langchain/langgraph';
|
|
2
|
+
import type { GetOperationActionParams } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Get a memory item from DynamoDB
|
|
5
|
+
*
|
|
6
|
+
* @param params - Parameters for the get operation
|
|
7
|
+
* @returns The item if found, null if not found
|
|
8
|
+
* @throws Error if the operation fails or validation fails
|
|
9
|
+
*/
|
|
10
|
+
export declare const getOperationAction: (params: GetOperationActionParams) => Promise<Item | null>;
|
|
11
|
+
//# sourceMappingURL=get-operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-operation.d.ts","sourceRoot":"","sources":["../../../src/store/actions/get-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAGzD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,wBAAwB,KAC/B,OAAO,CAAC,IAAI,GAAG,IAAI,CAiCrB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOperationAction = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
/**
|
|
6
|
+
* Get a memory item from DynamoDB
|
|
7
|
+
*
|
|
8
|
+
* @param params - Parameters for the get operation
|
|
9
|
+
* @returns The item if found, null if not found
|
|
10
|
+
* @throws Error if the operation fails or validation fails
|
|
11
|
+
*/
|
|
12
|
+
const getOperationAction = async (params) => {
|
|
13
|
+
const { client, memoryTableName, userId, op } = params;
|
|
14
|
+
// Validate inputs
|
|
15
|
+
(0, utils_1.validateUserId)(userId);
|
|
16
|
+
(0, utils_1.validateNamespace)(op.namespace);
|
|
17
|
+
(0, utils_1.validateKey)(op.key);
|
|
18
|
+
const namespacePath = op.namespace.join('/');
|
|
19
|
+
const sortKey = `${namespacePath}#${op.key}`;
|
|
20
|
+
// Execute with retry logic
|
|
21
|
+
const ddbItem = await (0, utils_1.withDynamoDBRetry)(async () => {
|
|
22
|
+
return await client.get({
|
|
23
|
+
TableName: memoryTableName,
|
|
24
|
+
Key: {
|
|
25
|
+
user_id: userId,
|
|
26
|
+
namespace_key: sortKey,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
if (!ddbItem.Item) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
key: ddbItem.Item.key,
|
|
35
|
+
namespace: op.namespace,
|
|
36
|
+
value: ddbItem.Item.value,
|
|
37
|
+
createdAt: ddbItem.Item.createdAt,
|
|
38
|
+
updatedAt: ddbItem.Item.updatedAt,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.getOperationAction = getOperationAction;
|
|
42
|
+
//# sourceMappingURL=get-operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-operation.js","sourceRoot":"","sources":["../../../src/store/actions/get-oper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ot":"","sources":["../../../src/store/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-operation"), exports);
|
|
18
|
+
__exportStar(require("./put-operation"), exports);
|
|
19
|
+
__exportStar(require("./search-operation"), exports);
|
|
20
|
+
__exportStar(require("./list-namespaces-operation"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,kDAAgC;AAChC,qDAAmC;AACnC,8DAA4C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ListNamespacesOperationActionParams } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* List unique namespaces from DynamoDB with filtering and pagination
|
|
4
|
+
*
|
|
5
|
+
* @param params - Parameters for the list namespaces operation
|
|
6
|
+
* @returns Array of namespace paths (each path is an array of strings including userId)
|
|
7
|
+
* @throws Error if the operation fails or validation fails
|
|
8
|
+
*/
|
|
9
|
+
export declare const listNamespacesOperationAction: (params: ListNamespacesOperationActionParams) => Promise<string[][]>;
|
|
10
|
+
//# sourceMappingURL=list-namespaces-operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-namespaces-operation.d.ts","sourceRoot":"","sources":["../../../src/store/actions/list-namespaces-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mCAAmC,EAAiB,MAAM,UAAU,CAAC;AAWnF;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GACxC,QAAQ,mCAAmC,KAC1C,OAAO,CAAC,MAAM,EAAE,EAAE,CAsIpB,CAAC"}
|