@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.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +960 -0
  3. package/dist/checkpointer/actions/delete-thread.d.ts +9 -0
  4. package/dist/checkpointer/actions/delete-thread.d.ts.map +1 -0
  5. package/dist/checkpointer/actions/delete-thread.js +109 -0
  6. package/dist/checkpointer/actions/delete-thread.js.map +1 -0
  7. package/dist/checkpointer/actions/get-tuple.d.ts +11 -0
  8. package/dist/checkpointer/actions/get-tuple.d.ts.map +1 -0
  9. package/dist/checkpointer/actions/get-tuple.js +96 -0
  10. package/dist/checkpointer/actions/get-tuple.js.map +1 -0
  11. package/dist/checkpointer/actions/index.d.ts +5 -0
  12. package/dist/checkpointer/actions/index.d.ts.map +1 -0
  13. package/dist/checkpointer/actions/index.js +21 -0
  14. package/dist/checkpointer/actions/index.js.map +1 -0
  15. package/dist/checkpointer/actions/put-writes.d.ts +9 -0
  16. package/dist/checkpointer/actions/put-writes.d.ts.map +1 -0
  17. package/dist/checkpointer/actions/put-writes.js +63 -0
  18. package/dist/checkpointer/actions/put-writes.js.map +1 -0
  19. package/dist/checkpointer/actions/put.d.ts +11 -0
  20. package/dist/checkpointer/actions/put.d.ts.map +1 -0
  21. package/dist/checkpointer/actions/put.js +55 -0
  22. package/dist/checkpointer/actions/put.js.map +1 -0
  23. package/dist/checkpointer/actions/validate-configurable.d.ts +10 -0
  24. package/dist/checkpointer/actions/validate-configurable.d.ts.map +1 -0
  25. package/dist/checkpointer/actions/validate-configurable.js +39 -0
  26. package/dist/checkpointer/actions/validate-configurable.js.map +1 -0
  27. package/dist/checkpointer/actions/writer.d.ts +50 -0
  28. package/dist/checkpointer/actions/writer.d.ts.map +1 -0
  29. package/dist/checkpointer/actions/writer.js +109 -0
  30. package/dist/checkpointer/actions/writer.js.map +1 -0
  31. package/dist/checkpointer/index.d.ts +70 -0
  32. package/dist/checkpointer/index.d.ts.map +1 -0
  33. package/dist/checkpointer/index.js +172 -0
  34. package/dist/checkpointer/index.js.map +1 -0
  35. package/dist/checkpointer/types/index.d.ts +162 -0
  36. package/dist/checkpointer/types/index.d.ts.map +1 -0
  37. package/dist/checkpointer/types/index.js +3 -0
  38. package/dist/checkpointer/types/index.js.map +1 -0
  39. package/dist/checkpointer/utils/index.d.ts +6 -0
  40. package/dist/checkpointer/utils/index.d.ts.map +1 -0
  41. package/dist/checkpointer/utils/index.js +26 -0
  42. package/dist/checkpointer/utils/index.js.map +1 -0
  43. package/dist/checkpointer/utils/validation.d.ts +48 -0
  44. package/dist/checkpointer/utils/validation.d.ts.map +1 -0
  45. package/dist/checkpointer/utils/validation.js +190 -0
  46. package/dist/checkpointer/utils/validation.js.map +1 -0
  47. package/dist/index.d.ts +5 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +8 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/shared/index.d.ts +5 -0
  52. package/dist/shared/index.d.ts.map +1 -0
  53. package/dist/shared/index.js +21 -0
  54. package/dist/shared/index.js.map +1 -0
  55. package/dist/shared/utils/constants.d.ts +11 -0
  56. package/dist/shared/utils/constants.d.ts.map +1 -0
  57. package/dist/shared/utils/constants.js +35 -0
  58. package/dist/shared/utils/constants.js.map +1 -0
  59. package/dist/shared/utils/index.d.ts +6 -0
  60. package/dist/shared/utils/index.d.ts.map +1 -0
  61. package/dist/shared/utils/index.js +22 -0
  62. package/dist/shared/utils/index.js.map +1 -0
  63. package/dist/shared/utils/retry.d.ts +19 -0
  64. package/dist/shared/utils/retry.d.ts.map +1 -0
  65. package/dist/shared/utils/retry.js +102 -0
  66. package/dist/shared/utils/retry.js.map +1 -0
  67. package/dist/store/actions/get-operation.d.ts +11 -0
  68. package/dist/store/actions/get-operation.d.ts.map +1 -0
  69. package/dist/store/actions/get-operation.js +42 -0
  70. package/dist/store/actions/get-operation.js.map +1 -0
  71. package/dist/store/actions/index.d.ts +5 -0
  72. package/dist/store/actions/index.d.ts.map +1 -0
  73. package/dist/store/actions/index.js +21 -0
  74. package/dist/store/actions/index.js.map +1 -0
  75. package/dist/store/actions/list-namespaces-operation.d.ts +10 -0
  76. package/dist/store/actions/list-namespaces-operation.d.ts.map +1 -0
  77. package/dist/store/actions/list-namespaces-operation.js +212 -0
  78. package/dist/store/actions/list-namespaces-operation.js.map +1 -0
  79. package/dist/store/actions/put-operation.d.ts +9 -0
  80. package/dist/store/actions/put-operation.d.ts.map +1 -0
  81. package/dist/store/actions/put-operation.js +94 -0
  82. package/dist/store/actions/put-operation.js.map +1 -0
  83. package/dist/store/actions/search-operation.d.ts +11 -0
  84. package/dist/store/actions/search-operation.d.ts.map +1 -0
  85. package/dist/store/actions/search-operation.js +150 -0
  86. package/dist/store/actions/search-operation.js.map +1 -0
  87. package/dist/store/index.d.ts +73 -0
  88. package/dist/store/index.d.ts.map +1 -0
  89. package/dist/store/index.js +145 -0
  90. package/dist/store/index.js.map +1 -0
  91. package/dist/store/types/index.d.ts +97 -0
  92. package/dist/store/types/index.d.ts.map +1 -0
  93. package/dist/store/types/index.js +3 -0
  94. package/dist/store/types/index.js.map +1 -0
  95. package/dist/store/utils/filter.d.ts +16 -0
  96. package/dist/store/utils/filter.d.ts.map +1 -0
  97. package/dist/store/utils/filter.js +71 -0
  98. package/dist/store/utils/filter.js.map +1 -0
  99. package/dist/store/utils/index.d.ts +8 -0
  100. package/dist/store/utils/index.d.ts.map +1 -0
  101. package/dist/store/utils/index.js +28 -0
  102. package/dist/store/utils/index.js.map +1 -0
  103. package/dist/store/utils/result.d.ts +42 -0
  104. package/dist/store/utils/result.d.ts.map +1 -0
  105. package/dist/store/utils/result.js +51 -0
  106. package/dist/store/utils/result.js.map +1 -0
  107. package/dist/store/utils/validation.d.ts +57 -0
  108. package/dist/store/utils/validation.d.ts.map +1 -0
  109. package/dist/store/utils/validation.js +243 -0
  110. package/dist/store/utils/validation.js.map +1 -0
  111. package/package.json +85 -0
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Writer = void 0;
4
+ const utils_1 = require("../utils");
5
+ /**
6
+ * Writer class for managing pending writes in DynamoDB
7
+ * Handles serialization and composite key management
8
+ */
9
+ class Writer {
10
+ /** Unique identifier for the conversation thread */
11
+ thread_id;
12
+ /** Namespace for checkpoint isolation (default: '') */
13
+ checkpoint_ns;
14
+ /** Unique identifier for the checkpoint */
15
+ checkpoint_id;
16
+ /** Unique identifier for the task that created this write */
17
+ task_id;
18
+ /** Index of the write within the task (0-based) */
19
+ idx;
20
+ /** Channel name for the write */
21
+ channel;
22
+ /** Type identifier for deserialization */
23
+ type;
24
+ /** Serialized value as binary data */
25
+ value;
26
+ constructor({ thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value, }) {
27
+ // Validate all inputs
28
+ (0, utils_1.validateThreadId)(thread_id);
29
+ (0, utils_1.validateCheckpointNs)(checkpoint_ns);
30
+ (0, utils_1.validateCheckpointId)(checkpoint_id, true);
31
+ (0, utils_1.validateTaskId)(task_id);
32
+ (0, utils_1.validateChannel)(channel);
33
+ if (!Number.isInteger(idx) || idx < 0) {
34
+ throw new Error('idx must be a non-negative integer');
35
+ }
36
+ this.thread_id = thread_id;
37
+ this.checkpoint_ns = checkpoint_ns;
38
+ this.checkpoint_id = checkpoint_id;
39
+ this.task_id = task_id;
40
+ this.idx = idx;
41
+ this.channel = channel;
42
+ this.type = type;
43
+ this.value = value;
44
+ }
45
+ toDynamoDBItem() {
46
+ return {
47
+ thread_id_checkpoint_id_checkpoint_ns: Writer.getPartitionKey({
48
+ thread_id: this.thread_id,
49
+ checkpoint_id: this.checkpoint_id,
50
+ checkpoint_ns: this.checkpoint_ns,
51
+ }),
52
+ task_id_idx: [this.task_id, this.idx].join(Writer.separator()),
53
+ channel: this.channel,
54
+ type: this.type,
55
+ value: this.value,
56
+ };
57
+ }
58
+ /**
59
+ * Deserialize a Writer instance from a DynamoDB item
60
+ *
61
+ * @param item - DynamoDB write item
62
+ * @returns Writer instance
63
+ * @throws Error if parsing fails or data is invalid
64
+ */
65
+ static fromDynamoDBItem({ thread_id_checkpoint_id_checkpoint_ns, task_id_idx, channel, type, value, }) {
66
+ const parts = thread_id_checkpoint_id_checkpoint_ns.split(this.separator());
67
+ if (parts.length !== 3) {
68
+ throw new Error(`Invalid partition key format: expected 3 parts, got ${parts.length}`);
69
+ }
70
+ const [thread_id, checkpoint_id, checkpoint_ns] = parts;
71
+ const idxParts = task_id_idx.split(this.separator());
72
+ if (idxParts.length !== 2) {
73
+ throw new Error(`Invalid sort key format: expected 2 parts, got ${idxParts.length}`);
74
+ }
75
+ const [task_id, idxStr] = idxParts;
76
+ const idx = parseInt(idxStr, 10);
77
+ if (isNaN(idx)) {
78
+ throw new Error(`Invalid idx value: ${idxStr}`);
79
+ }
80
+ return new Writer({
81
+ thread_id,
82
+ checkpoint_ns,
83
+ checkpoint_id,
84
+ task_id,
85
+ idx,
86
+ channel,
87
+ type,
88
+ value,
89
+ });
90
+ }
91
+ /**
92
+ * Generate a partition key for DynamoDB from thread, checkpoint, and namespace
93
+ *
94
+ * @param params - Thread ID, checkpoint ID, and namespace
95
+ * @returns Composite partition key
96
+ */
97
+ static getPartitionKey({ thread_id, checkpoint_id, checkpoint_ns, }) {
98
+ return [thread_id, checkpoint_id, checkpoint_ns].join(this.separator());
99
+ }
100
+ /**
101
+ * Get the separator used for composite keys
102
+ * Note: Input validation ensures this separator cannot be in any component
103
+ */
104
+ static separator() {
105
+ return ':::';
106
+ }
107
+ }
108
+ exports.Writer = Writer;
109
+ //# sourceMappingURL=writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.js","sourceRoot":"","sources":["../../../src/checkpointer/actions/writer.ts"],"names":[],"mappings":";;;AACA,oCAMkB;AAElB;;;GAGG;AACH,MAAa,MAAM;IACjB,oDAAoD;IAC3C,SAAS,CAAS;IAC3B,uDAAuD;IAC9C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Aa;YACb,OAAO;YACP,GAAG;YACH,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,EACrB,SAAS,EACT,aAAa,EACb,aAAa,GAKd;QACC,OAAO,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,SAAS;QACd,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAnID,wBAmIC"}
@@ -0,0 +1,70 @@
1
+ import { BaseCheckpointSaver, type Checkpoint, type CheckpointTuple, type CheckpointMetadata, type CheckpointListOptions, type PendingWrite, type ChannelVersions } from '@langchain/langgraph-checkpoint';
2
+ import type { RunnableConfig } from '@langchain/core/runnables';
3
+ import type { DynamoDBSaverOptions } from './types';
4
+ /**
5
+ * DynamoDB-based checkpoint saver for LangGraph
6
+ * Provides persistent storage for checkpoints and pending writes
7
+ */
8
+ export declare class DynamoDBSaver extends BaseCheckpointSaver {
9
+ private readonly ddbClient;
10
+ private readonly client;
11
+ private readonly checkpointsTableName;
12
+ private readonly writesTableName;
13
+ private readonly ttlDays?;
14
+ /**
15
+ * Create a new DynamoDB checkpoint saver
16
+ *
17
+ * @param options - Configuration options for the saver
18
+ * @param options.checkpointsTableName - Name of the DynamoDB table for checkpoints
19
+ * @param options.writesTableName - Name of the DynamoDB table for writes
20
+ * @param options.ttlDays - Optional TTL in days for stored items
21
+ * @param options.serde - Optional serializer protocol
22
+ * @param options.clientConfig - Optional DynamoDB client configuration
23
+ */
24
+ constructor(options: DynamoDBSaverOptions);
25
+ /**
26
+ * Delete a thread and all its checkpoints and writes
27
+ *
28
+ * @param threadId - The thread ID to delete
29
+ * @throws Error if validation fails or operation fails
30
+ */
31
+ deleteThread(threadId: string): Promise<void>;
32
+ /**
33
+ * Get a checkpoint tuple from DynamoDB
34
+ *
35
+ * @param config - Runnable configuration containing thread_id and optional checkpoint_id
36
+ * @returns CheckpointTuple if found, undefined otherwise
37
+ * @throws Error if validation fails or operation fails
38
+ */
39
+ getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined>;
40
+ /**
41
+ * Save a checkpoint to DynamoDB
42
+ *
43
+ * @param config - Runnable configuration
44
+ * @param checkpoint - Checkpoint to save
45
+ * @param metadata - Checkpoint metadata
46
+ * @param newVersions - Channel versions (not used in DynamoDB implementation)
47
+ * @returns Updated RunnableConfig with checkpoint information
48
+ * @throws Error if validation fails or operation fails
49
+ */
50
+ put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata, newVersions: ChannelVersions): Promise<RunnableConfig>;
51
+ /**
52
+ * Save pending writes to DynamoDB
53
+ *
54
+ * @param config - Runnable configuration
55
+ * @param writes - Array of pending writes to save
56
+ * @param taskId - Task ID for the writes
57
+ * @throws Error if validation fails or operation fails
58
+ */
59
+ putWrites(config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise<void>;
60
+ /**
61
+ * List checkpoints for a thread
62
+ *
63
+ * @param config - Runnable configuration containing thread_id
64
+ * @param options - List options including limit and before checkpoint
65
+ * @yields CheckpointTuple objects in descending order
66
+ * @throws Error if validation fails or operation fails
67
+ */
68
+ list(config: RunnableConfig, options: CheckpointListOptions | undefined): AsyncGenerator<CheckpointTuple>;
69
+ }
70
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/checkpointer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAkB,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAIpE;;;GAGG;AACH,qBAAa,aAAc,SAAQ,mBAAmB;IACpD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAS;IAElC;;;;;;;;;OASG;gBACS,OAAO,EAAE,oBAAoB;IASzC;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnD;;;;;;OAMG;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAU5E;;;;;;;;;OASG;IACG,GAAG,CACP,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,kBAAkB,EAC5B,WAAW,EAAE,eAAe,GAC3B,OAAO,CAAC,cAAc,CAAC;IAY1B;;;;;;;OAOG;IACG,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY9F;;;;;;;OAOG;IACI,IAAI,CACT,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,qBAAqB,GAAG,SAAS,GACzC,cAAc,CAAC,eAAe,CAAC;CAgEnC"}
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamoDBSaver = void 0;
4
+ const langgraph_checkpoint_1 = require("@langchain/langgraph-checkpoint");
5
+ const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
6
+ const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
7
+ const actions_1 = require("./actions");
8
+ const utils_1 = require("./utils");
9
+ const shared_1 = require("../shared");
10
+ /**
11
+ * DynamoDB-based checkpoint saver for LangGraph
12
+ * Provides persistent storage for checkpoints and pending writes
13
+ */
14
+ class DynamoDBSaver extends langgraph_checkpoint_1.BaseCheckpointSaver {
15
+ ddbClient;
16
+ client;
17
+ checkpointsTableName;
18
+ writesTableName;
19
+ ttlDays;
20
+ /**
21
+ * Create a new DynamoDB checkpoint saver
22
+ *
23
+ * @param options - Configuration options for the saver
24
+ * @param options.checkpointsTableName - Name of the DynamoDB table for checkpoints
25
+ * @param options.writesTableName - Name of the DynamoDB table for writes
26
+ * @param options.ttlDays - Optional TTL in days for stored items
27
+ * @param options.serde - Optional serializer protocol
28
+ * @param options.clientConfig - Optional DynamoDB client configuration
29
+ */
30
+ constructor(options) {
31
+ super(options.serde);
32
+ this.checkpointsTableName = options.checkpointsTableName;
33
+ this.writesTableName = options.writesTableName;
34
+ this.ttlDays = options.ttlDays;
35
+ this.ddbClient = new client_dynamodb_1.DynamoDBClient(options.clientConfig || {});
36
+ this.client = lib_dynamodb_1.DynamoDBDocument.from(this.ddbClient);
37
+ }
38
+ /**
39
+ * Delete a thread and all its checkpoints and writes
40
+ *
41
+ * @param threadId - The thread ID to delete
42
+ * @throws Error if validation fails or operation fails
43
+ */
44
+ async deleteThread(threadId) {
45
+ return await (0, actions_1.deleteThreadAction)({
46
+ client: this.client,
47
+ checkpointsTableName: this.checkpointsTableName,
48
+ writesTableName: this.writesTableName,
49
+ threadId,
50
+ });
51
+ }
52
+ /**
53
+ * Get a checkpoint tuple from DynamoDB
54
+ *
55
+ * @param config - Runnable configuration containing thread_id and optional checkpoint_id
56
+ * @returns CheckpointTuple if found, undefined otherwise
57
+ * @throws Error if validation fails or operation fails
58
+ */
59
+ async getTuple(config) {
60
+ return await (0, actions_1.getTupleAction)({
61
+ client: this.client,
62
+ checkpointsTableName: this.checkpointsTableName,
63
+ writesTableName: this.writesTableName,
64
+ serde: this.serde,
65
+ config,
66
+ });
67
+ }
68
+ /**
69
+ * Save a checkpoint to DynamoDB
70
+ *
71
+ * @param config - Runnable configuration
72
+ * @param checkpoint - Checkpoint to save
73
+ * @param metadata - Checkpoint metadata
74
+ * @param newVersions - Channel versions (not used in DynamoDB implementation)
75
+ * @returns Updated RunnableConfig with checkpoint information
76
+ * @throws Error if validation fails or operation fails
77
+ */
78
+ async put(config, checkpoint, metadata, newVersions) {
79
+ return await (0, actions_1.putAction)({
80
+ client: this.client,
81
+ checkpointsTableName: this.checkpointsTableName,
82
+ serde: this.serde,
83
+ config,
84
+ checkpoint,
85
+ metadata,
86
+ ttlDays: this.ttlDays,
87
+ });
88
+ }
89
+ /**
90
+ * Save pending writes to DynamoDB
91
+ *
92
+ * @param config - Runnable configuration
93
+ * @param writes - Array of pending writes to save
94
+ * @param taskId - Task ID for the writes
95
+ * @throws Error if validation fails or operation fails
96
+ */
97
+ async putWrites(config, writes, taskId) {
98
+ return await (0, actions_1.putWritesAction)({
99
+ client: this.client,
100
+ writesTableName: this.writesTableName,
101
+ serde: this.serde,
102
+ config,
103
+ writes,
104
+ taskId,
105
+ ttlDays: this.ttlDays,
106
+ });
107
+ }
108
+ /**
109
+ * List checkpoints for a thread
110
+ *
111
+ * @param config - Runnable configuration containing thread_id
112
+ * @param options - List options including limit and before checkpoint
113
+ * @yields CheckpointTuple objects in descending order
114
+ * @throws Error if validation fails or operation fails
115
+ */
116
+ async *list(config, options) {
117
+ const { limit, before } = options ?? {};
118
+ const thread_id = config.configurable?.thread_id;
119
+ // Validate thread_id
120
+ if (typeof thread_id !== 'string') {
121
+ throw new Error('thread_id must be a string');
122
+ }
123
+ (0, utils_1.validateThreadId)(thread_id);
124
+ // Validate limit if provided
125
+ (0, utils_1.validateListLimit)(limit);
126
+ const expressionAttributeValues = {
127
+ ':thread_id': thread_id,
128
+ };
129
+ let keyConditionExpression = 'thread_id = :thread_id';
130
+ if (before?.configurable?.checkpoint_id) {
131
+ keyConditionExpression += ' AND checkpoint_id < :before_checkpoint_id';
132
+ expressionAttributeValues[':before_checkpoint_id'] = before.configurable.checkpoint_id;
133
+ }
134
+ const result = await (0, shared_1.withDynamoDBRetry)(async () => {
135
+ return await this.client.query({
136
+ TableName: this.checkpointsTableName,
137
+ KeyConditionExpression: keyConditionExpression,
138
+ ExpressionAttributeValues: expressionAttributeValues,
139
+ Limit: limit,
140
+ ScanIndexForward: false, // Descending order
141
+ });
142
+ });
143
+ if (result.Items) {
144
+ for (const item of result.Items) {
145
+ const checkpoint = (await this.serde.loadsTyped(item.type, item.checkpoint));
146
+ const metadata = (await this.serde.loadsTyped(item.type, item.metadata));
147
+ yield {
148
+ config: {
149
+ configurable: {
150
+ thread_id: item.thread_id,
151
+ checkpoint_ns: item.checkpoint_ns,
152
+ checkpoint_id: item.checkpoint_id,
153
+ },
154
+ },
155
+ checkpoint,
156
+ metadata,
157
+ parentConfig: item.parent_checkpoint_id
158
+ ? {
159
+ configurable: {
160
+ thread_id: item.thread_id,
161
+ checkpoint_ns: item.checkpoint_ns,
162
+ checkpoint_id: item.parent_checkpoint_id,
163
+ },
164
+ }
165
+ : undefined,
166
+ };
167
+ }
168
+ }
169
+ }
170
+ }
171
+ exports.DynamoDBSaver = DynamoDBSaver;
172
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/checkpointer/index.ts"],"names":[],"mappings":";;;AAAA,0EAQyC;AACzC,8DAA0D;AAC1D,wDAAyD;AACzD,uCAA2F;AAG3F,mCAA8D;AAC9D,sCAA8C;AAE9C;;;GAGG;AACH,MAAa,aAAc,SAAQ,0CAAmB;IACnC,SAAS,CAAiB;IAC1B,MAAM,CAAmB;IACzB,oBAAoB,CAAS;IAC7B,eAAe,CAAS;IACxB,OAAO,CAAU;IAElC;;;;;;;;;OASG;IACH,YAAY,OAA6B;QACvC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrB,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,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ACpD,KAAK,EAAE,KAAK;gBACZ,gBAAgB,EAAE,KAAK,EAAE,mBAAmB;aAC7C,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAyB,EAAE,CAAC;gBACpD,MAAM,UAAU,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAe,CAAC;gBAC3F,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAC3C,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,QAAQ,CACd,CAAuB,CAAC;gBAEzB,MAAM;oBACJ,MAAM,EAAE;wBACN,YAAY,EAAE;4BACZ,SAAS,EAAE,IAAI,CAAC,SAAS;4BACzB,aAAa,EAAE,IAAI,CAAC,aAAa;4BACjC,aAAa,EAAE,IAAI,CAAC,aAAa;yBAClC;qBACF;oBACD,UAAU;oBACV,QAAQ;oBACR,YAAY,EAAE,IAAI,CAAC,oBAAoB;wBACrC,CAAC,CAAC;4BACE,YAAY,EAAE;gCACZ,SAAS,EAAE,IAAI,CAAC,SAAS;gCACzB,aAAa,EAAE,IAAI,CAAC,aAAa;gCACjC,aAAa,EAAE,IAAI,CAAC,oBAAoB;6BACzC;yBACF;wBACH,CAAC,CAAC,SAAS;iBACd,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF;AApLD,sCAoLC"}
@@ -0,0 +1,162 @@
1
+ import { Checkpoint, CheckpointMetadata, PendingWrite, SerializerProtocol } from '@langchain/langgraph-checkpoint';
2
+ import type { DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
3
+ import { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
4
+ import { RunnableConfig } from '@langchain/core/runnables';
5
+ /**
6
+ * Configuration options for DynamoDBSaver
7
+ *
8
+ * @property checkpointsTableName - Name of the DynamoDB table for storing checkpoints
9
+ * @property writesTableName - Name of the DynamoDB table for storing pending writes
10
+ * @property ttlDays - Optional TTL in days for automatic item expiration (max 1825 days)
11
+ * @property serde - Optional custom serializer protocol for checkpoint serialization
12
+ * @property clientConfig - Optional DynamoDB client configuration
13
+ */
14
+ export interface DynamoDBSaverOptions {
15
+ checkpointsTableName: string;
16
+ writesTableName: string;
17
+ ttlDays?: number;
18
+ serde?: SerializerProtocol;
19
+ clientConfig?: DynamoDBClientConfig;
20
+ }
21
+ /**
22
+ * Properties for creating a Writer instance
23
+ *
24
+ * @property thread_id - Unique identifier for the conversation thread
25
+ * @property checkpoint_ns - Namespace for checkpoint isolation (default: '')
26
+ * @property checkpoint_id - Unique identifier for the checkpoint
27
+ * @property task_id - Unique identifier for the task that created the write
28
+ * @property idx - Index of the write within the task (0-based)
29
+ * @property channel - Channel name for the write
30
+ * @property type - Type identifier for deserialization
31
+ * @property value - Serialized value as binary data
32
+ */
33
+ export interface WriterProps {
34
+ thread_id: string;
35
+ checkpoint_ns: string;
36
+ checkpoint_id: string;
37
+ task_id: string;
38
+ idx: number;
39
+ channel: string;
40
+ type: string;
41
+ value: Uint8Array;
42
+ }
43
+ /**
44
+ * DynamoDB representation of a pending write
45
+ * Uses composite keys for efficient querying
46
+ *
47
+ * @property thread_id_checkpoint_id_checkpoint_ns - Composite partition key (format: "thread_id:::checkpoint_id:::checkpoint_ns")
48
+ * @property task_id_idx - Composite sort key (format: "task_id:::idx")
49
+ * @property channel - Channel name for the write
50
+ * @property type - Type identifier for deserialization
51
+ * @property value - Serialized value as binary data
52
+ */
53
+ export interface DynamoDBWriteItem {
54
+ thread_id_checkpoint_id_checkpoint_ns: string;
55
+ task_id_idx: string;
56
+ channel: string;
57
+ type: string;
58
+ value: Uint8Array;
59
+ }
60
+ /**
61
+ * DynamoDB representation of a checkpoint
62
+ *
63
+ * @property thread_id - Unique identifier for the conversation thread (partition key)
64
+ * @property checkpoint_ns - Namespace for checkpoint isolation
65
+ * @property checkpoint_id - Unique identifier for the checkpoint (sort key)
66
+ * @property parent_checkpoint_id - Optional ID of the parent checkpoint for checkpoint chains
67
+ * @property type - Type identifier for deserialization
68
+ * @property checkpoint - Serialized checkpoint data as binary
69
+ * @property metadata - Serialized metadata as binary
70
+ */
71
+ export interface CheckpointItem {
72
+ thread_id: string;
73
+ checkpoint_ns: string;
74
+ checkpoint_id: string;
75
+ parent_checkpoint_id?: string;
76
+ type: string;
77
+ checkpoint: Uint8Array;
78
+ metadata: Uint8Array;
79
+ }
80
+ /**
81
+ * Validated configurable parameters from RunnableConfig
82
+ *
83
+ * @property thread_id - Validated unique identifier for the conversation thread
84
+ * @property checkpoint_ns - Validated namespace for checkpoint isolation (empty string if not provided)
85
+ * @property checkpoint_id - Optional validated checkpoint identifier
86
+ */
87
+ export interface ValidatedConfigurable {
88
+ thread_id: string;
89
+ checkpoint_ns: string;
90
+ checkpoint_id: string | undefined;
91
+ }
92
+ /**
93
+ * Parameters for deleteThread action
94
+ *
95
+ * @property client - DynamoDB Document client instance
96
+ * @property checkpointsTableName - Name of the checkpoints table
97
+ * @property writesTableName - Name of the pending writes table
98
+ * @property threadId - Thread identifier to delete
99
+ */
100
+ export interface DeleteThreadActionParams {
101
+ client: DynamoDBDocument;
102
+ checkpointsTableName: string;
103
+ writesTableName: string;
104
+ threadId: string;
105
+ }
106
+ /**
107
+ * Parameters for getTuple action
108
+ *
109
+ * @property client - DynamoDB Document client instance
110
+ * @property checkpointsTableName - Name of the checkpoints table
111
+ * @property writesTableName - Name of the pending writes table
112
+ * @property serde - Serialization protocol for checkpoint data
113
+ * @property config - Runnable configuration with thread_id and optional checkpoint_id
114
+ */
115
+ export interface GetTupleActionParams {
116
+ client: DynamoDBDocument;
117
+ checkpointsTableName: string;
118
+ writesTableName: string;
119
+ serde: SerializerProtocol;
120
+ config: RunnableConfig;
121
+ }
122
+ /**
123
+ * Parameters for put action
124
+ *
125
+ * @property client - DynamoDB Document client instance
126
+ * @property checkpointsTableName - Name of the checkpoints table
127
+ * @property serde - Serialization protocol for checkpoint data
128
+ * @property config - Runnable configuration with thread_id and namespace
129
+ * @property checkpoint - Checkpoint data to save
130
+ * @property metadata - Checkpoint metadata to save
131
+ * @property ttlDays - Optional TTL in days for automatic expiration (max 1825 days)
132
+ */
133
+ export interface PutActionParams {
134
+ client: DynamoDBDocument;
135
+ checkpointsTableName: string;
136
+ serde: SerializerProtocol;
137
+ config: RunnableConfig;
138
+ checkpoint: Checkpoint;
139
+ metadata: CheckpointMetadata;
140
+ ttlDays?: number;
141
+ }
142
+ /**
143
+ * Parameters for putWrites action
144
+ *
145
+ * @property client - DynamoDB Document client instance
146
+ * @property writesTableName - Name of the pending writes table
147
+ * @property serde - Serialization protocol for write data
148
+ * @property config - Runnable configuration with thread_id, checkpoint_id, and namespace
149
+ * @property writes - Array of pending writes to save (max 1000 items)
150
+ * @property taskId - Task identifier that created these writes
151
+ * @property ttlDays - Optional TTL in days for automatic expiration (max 1825 days)
152
+ */
153
+ export interface PutWritesActionParams {
154
+ client: DynamoDBDocument;
155
+ writesTableName: string;
156
+ serde: SerializerProtocol;
157
+ config: RunnableConfig;
158
+ writes: PendingWrite[];
159
+ taskId: string;
160
+ ttlDays?: number;
161
+ }
162
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/checkpointer/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,oBAAoB,EAAE,M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,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,gBAAgB,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,gBAAgB,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/checkpointer/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checkpointer utilities
3
+ */
4
+ export * from './validation';
5
+ export { withDynamoDBRetry, withRetry, type RetryOptions } from '../../shared/utils';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/checkpointer/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * Checkpointer utilities
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
+ exports.withRetry = exports.withDynamoDBRetry = void 0;
21
+ __exportStar(require("./validation"), exports);
22
+ // Retry utilities re-exported from shared
23
+ var utils_1 = require("../../shared/utils");
24
+ Object.defineProperty(exports, "withDynamoDBRetry", { enumerable: true, get: function () { return utils_1.withDynamoDBRetry; } });
25
+ Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return utils_1.withRetry; } });
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/checkpointer/utils/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAEH,+CAA6B;AAC7B,0CAA0C;AAC1C,4CAAqF;AAA5E,0GAAA,iBAAiB,OAAA;AAAE,kGAAA,SAAS,OAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Validation utilities for checkpointer operations
3
+ */
4
+ export declare class CheckpointerValidationError extends Error {
5
+ constructor(message: string);
6
+ }
7
+ /**
8
+ * Validate thread ID
9
+ */
10
+ export declare function validateThreadId(threadId: string): void;
11
+ /**
12
+ * Validate checkpoint ID
13
+ */
14
+ export declare function validateCheckpointId(checkpointId: string | undefined, required?: boolean): void;
15
+ /**
16
+ * Validate checkpoint namespace
17
+ */
18
+ export declare function validateCheckpointNs(checkpointNs: string | undefined): void;
19
+ /**
20
+ * Validate task ID
21
+ */
22
+ export declare function validateTaskId(taskId: string): void;
23
+ /**
24
+ * Validate channel name
25
+ */
26
+ export declare function validateChannel(channel: string): void;
27
+ /**
28
+ * Validate writes array length
29
+ */
30
+ export declare function validateWritesCount(writesCount: number): void;
31
+ /**
32
+ * Validate list limit parameter
33
+ */
34
+ export declare function validateListLimit(limit: number | undefined): void;
35
+ /**
36
+ * Validate TTL days (wraps shared validation with a checkpointer-specific error type)
37
+ */
38
+ export declare function validateTTLDays(ttlDays: number | undefined): void;
39
+ /**
40
+ * Export constants for use in other modules
41
+ */
42
+ export declare const CheckpointerValidationConstants: {
43
+ readonly MAX_DELETE_BATCH_SIZE: 100;
44
+ readonly MAX_WRITES_PER_BATCH: 1000;
45
+ readonly MAX_LIST_LIMIT: 1000;
46
+ readonly SEPARATOR: ":::";
47
+ };
48
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/checkpointer/utils/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAyBvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,QAAQ,GAAE,OAAe,GACxB,IAAI,CAgCN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAyB3E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAmBnD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAcrD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAc7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAgBjE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAMjE;AAED;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;CAKlC,CAAC"}