@farukada/aws-langgraph-dynamodb-ts 0.3.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/dist/checkpointer/actions/delete-thread.js +1 -1
- package/dist/checkpointer/actions/delete-thread.js.map +1 -1
- package/dist/checkpointer/actions/list.d.ts.map +1 -1
- package/dist/checkpointer/actions/list.js +3 -1
- package/dist/checkpointer/actions/list.js.map +1 -1
- package/dist/checkpointer/actions/put-writes.d.ts +4 -4
- package/dist/checkpointer/actions/put-writes.d.ts.map +1 -1
- package/dist/checkpointer/actions/put-writes.js +21 -20
- package/dist/checkpointer/actions/put-writes.js.map +1 -1
- package/dist/checkpointer/internal/item-writer.d.ts +18 -9
- package/dist/checkpointer/internal/item-writer.d.ts.map +1 -1
- package/dist/checkpointer/internal/item-writer.js +28 -11
- package/dist/checkpointer/internal/item-writer.js.map +1 -1
- package/dist/checkpointer/internal/query.d.ts +5 -1
- package/dist/checkpointer/internal/query.d.ts.map +1 -1
- package/dist/checkpointer/internal/query.js +5 -2
- package/dist/checkpointer/internal/query.js.map +1 -1
- package/dist/checkpointer/internal/setup.d.ts.map +1 -1
- package/dist/checkpointer/internal/setup.js +8 -1
- package/dist/checkpointer/internal/setup.js.map +1 -1
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +18 -0
- package/dist/checkpointer/internal/special-write-cleanup.d.ts.map +1 -0
- package/dist/checkpointer/internal/special-write-cleanup.js +108 -0
- package/dist/checkpointer/internal/special-write-cleanup.js.map +1 -0
- package/dist/factory/factory.d.ts +3 -1
- package/dist/factory/factory.d.ts.map +1 -1
- package/dist/factory/factory.js +4 -6
- package/dist/factory/factory.js.map +1 -1
- package/dist/history/actions/add-messages.d.ts.map +1 -1
- package/dist/history/actions/add-messages.js +4 -3
- package/dist/history/actions/add-messages.js.map +1 -1
- package/dist/history/actions/clear.js +1 -1
- package/dist/history/actions/clear.js.map +1 -1
- package/dist/history/actions/list-sessions.d.ts +1 -0
- package/dist/history/actions/list-sessions.d.ts.map +1 -1
- package/dist/history/actions/list-sessions.js +1 -0
- package/dist/history/actions/list-sessions.js.map +1 -1
- package/dist/history/actions/reconcile-count.d.ts +4 -1
- package/dist/history/actions/reconcile-count.d.ts.map +1 -1
- package/dist/history/actions/reconcile-count.js +21 -9
- package/dist/history/actions/reconcile-count.js.map +1 -1
- package/dist/history/chat-message-history.d.ts +1 -0
- package/dist/history/chat-message-history.d.ts.map +1 -1
- package/dist/history/chat-message-history.js.map +1 -1
- package/dist/history/internal/append-saga.d.ts +1 -0
- package/dist/history/internal/append-saga.d.ts.map +1 -1
- package/dist/history/internal/append-saga.js +25 -21
- package/dist/history/internal/append-saga.js.map +1 -1
- package/dist/history/internal/message-transaction.d.ts +11 -6
- package/dist/history/internal/message-transaction.d.ts.map +1 -1
- package/dist/history/internal/message-transaction.js +40 -13
- package/dist/history/internal/message-transaction.js.map +1 -1
- package/dist/history/internal/query.d.ts +5 -1
- package/dist/history/internal/query.d.ts.map +1 -1
- package/dist/history/internal/query.js +5 -2
- package/dist/history/internal/query.js.map +1 -1
- package/dist/history/internal/session-count.d.ts +20 -0
- package/dist/history/internal/session-count.d.ts.map +1 -0
- package/dist/history/internal/session-count.js +58 -0
- package/dist/history/internal/session-count.js.map +1 -0
- package/dist/history/internal/session-update.d.ts +9 -1
- package/dist/history/internal/session-update.d.ts.map +1 -1
- package/dist/history/internal/session-update.js +26 -2
- package/dist/history/internal/session-update.js.map +1 -1
- package/dist/history/internal/setup.d.ts.map +1 -1
- package/dist/history/internal/setup.js +8 -1
- package/dist/history/internal/setup.js.map +1 -1
- package/dist/history/internal/ttl-anchor.d.ts +20 -7
- package/dist/history/internal/ttl-anchor.d.ts.map +1 -1
- package/dist/history/internal/ttl-anchor.js +19 -7
- package/dist/history/internal/ttl-anchor.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/shared/codec/s3/client.d.ts +7 -1
- package/dist/shared/codec/s3/client.d.ts.map +1 -1
- package/dist/shared/codec/s3/client.js +8 -2
- package/dist/shared/codec/s3/client.js.map +1 -1
- package/dist/shared/codec/s3/config.d.ts +2 -0
- package/dist/shared/codec/s3/config.d.ts.map +1 -1
- package/dist/shared/codec/s3/config.js +5 -0
- package/dist/shared/codec/s3/config.js.map +1 -1
- package/dist/shared/codec/s3/offloader.js +1 -1
- package/dist/shared/codec/s3/offloader.js.map +1 -1
- package/dist/shared/codec/s3/read-write.d.ts.map +1 -1
- package/dist/shared/codec/s3/read-write.js +3 -6
- package/dist/shared/codec/s3/read-write.js.map +1 -1
- package/dist/shared/constants.d.ts +3 -0
- package/dist/shared/constants.d.ts.map +1 -1
- package/dist/shared/constants.js +3 -0
- package/dist/shared/constants.js.map +1 -1
- package/dist/shared/dynamodb/batch-write.d.ts +15 -2
- package/dist/shared/dynamodb/batch-write.d.ts.map +1 -1
- package/dist/shared/dynamodb/batch-write.js +38 -3
- package/dist/shared/dynamodb/batch-write.js.map +1 -1
- package/dist/shared/dynamodb/cancellation.d.ts +7 -0
- package/dist/shared/dynamodb/cancellation.d.ts.map +1 -0
- package/dist/shared/dynamodb/cancellation.js +8 -0
- package/dist/shared/dynamodb/cancellation.js.map +1 -0
- package/dist/shared/dynamodb/client.js +1 -1
- package/dist/shared/dynamodb/client.js.map +1 -1
- package/dist/shared/dynamodb/retry-classifier.d.ts.map +1 -1
- package/dist/shared/dynamodb/retry-classifier.js +5 -1
- package/dist/shared/dynamodb/retry-classifier.js.map +1 -1
- package/dist/shared/errors/errors.d.ts +18 -0
- package/dist/shared/errors/errors.d.ts.map +1 -1
- package/dist/shared/errors/errors.js +28 -1
- package/dist/shared/errors/errors.js.map +1 -1
- package/dist/store/actions/list-namespaces.d.ts.map +1 -1
- package/dist/store/actions/list-namespaces.js +10 -2
- package/dist/store/actions/list-namespaces.js.map +1 -1
- package/dist/store/actions/put.d.ts +5 -5
- package/dist/store/actions/put.d.ts.map +1 -1
- package/dist/store/actions/put.js +20 -36
- package/dist/store/actions/put.js.map +1 -1
- package/dist/store/actions/search.d.ts.map +1 -1
- package/dist/store/actions/search.js +29 -11
- package/dist/store/actions/search.js.map +1 -1
- package/dist/store/internal/filter.d.ts.map +1 -1
- package/dist/store/internal/filter.js +15 -8
- package/dist/store/internal/filter.js.map +1 -1
- package/dist/store/internal/index-reconcile.d.ts.map +1 -1
- package/dist/store/internal/index-reconcile.js +4 -1
- package/dist/store/internal/index-reconcile.js.map +1 -1
- package/dist/store/internal/item-mapper.d.ts +2 -1
- package/dist/store/internal/item-mapper.d.ts.map +1 -1
- package/dist/store/internal/item-mapper.js +1 -1
- package/dist/store/internal/item-mapper.js.map +1 -1
- package/dist/store/internal/persist.d.ts +11 -0
- package/dist/store/internal/persist.d.ts.map +1 -0
- package/dist/store/internal/persist.js +38 -0
- package/dist/store/internal/persist.js.map +1 -0
- package/dist/store/internal/ranker.d.ts.map +1 -1
- package/dist/store/internal/ranker.js +3 -1
- package/dist/store/internal/ranker.js.map +1 -1
- package/dist/store/internal/setup.d.ts +1 -0
- package/dist/store/internal/setup.d.ts.map +1 -1
- package/dist/store/internal/setup.js +8 -1
- package/dist/store/internal/setup.js.map +1 -1
- package/dist/store/internal/write-verify.d.ts +12 -0
- package/dist/store/internal/write-verify.d.ts.map +1 -0
- package/dist/store/internal/write-verify.js +28 -0
- package/dist/store/internal/write-verify.js.map +1 -0
- package/dist/store/types.d.ts +2 -0
- package/dist/store/types.d.ts.map +1 -1
- package/package.json +9 -8
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.revertSessionCount = revertSessionCount;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const cancellation_1 = require("../../shared/dynamodb/cancellation");
|
|
6
|
+
const retry_1 = require("../../shared/dynamodb/retry");
|
|
7
|
+
const keys_1 = require("./keys");
|
|
8
|
+
/**
|
|
9
|
+
* True when a TransactWriteItems cancellation was caused by a
|
|
10
|
+
* ConditionalCheckFailed reason. Named distinctly from
|
|
11
|
+
* checkpointer/actions/put-writes.ts's isConditionalCheckFailed, which
|
|
12
|
+
* checks a different thing entirely (a raw PutItem exception name, not a
|
|
13
|
+
* transaction cancellation reason) — this function had that same name
|
|
14
|
+
* until now, a real trap for whoever read one assuming it was the other.
|
|
15
|
+
*/
|
|
16
|
+
function isCancelledByCondition(error) {
|
|
17
|
+
const reasons = (0, cancellation_1.getCancellationReasons)(error);
|
|
18
|
+
return reasons?.[0]?.Code === 'ConditionalCheckFailed';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Subtract a previously-added count from the session, leaving it consistent.
|
|
22
|
+
* Guarded so a concurrently-deleted SESSION row is never resurrected as a
|
|
23
|
+
* permanent, ttl-less junk row: if the row is already gone there is nothing
|
|
24
|
+
* to revert, so that specific condition failure is swallowed rather than
|
|
25
|
+
* surfaced — this runs only from an already-in-progress rollback, where a
|
|
26
|
+
* spurious error for a no-op would misrepresent what happened.
|
|
27
|
+
*
|
|
28
|
+
* Deliberately does not revert a `forceTtlRefresh`-driven ttl SET from an
|
|
29
|
+
* earlier committed chunk: the healed anchor is never shorter than what
|
|
30
|
+
* was there before, so leaving it in place after a rollback only means the
|
|
31
|
+
* session's metadata row outlives its content a bit longer than ideal —
|
|
32
|
+
* self-healing (the next successful append, or DynamoDB's own TTL sweep,
|
|
33
|
+
* resolves it), unlike reverting, which would need to re-check for a
|
|
34
|
+
* concurrent legitimate extension to avoid regressing it. See README.md's
|
|
35
|
+
* "TTL expiry" section.
|
|
36
|
+
*/
|
|
37
|
+
async function revertSessionCount(context, sessionId, delta) {
|
|
38
|
+
if (delta === 0)
|
|
39
|
+
return;
|
|
40
|
+
const update = {
|
|
41
|
+
TableName: context.tableName,
|
|
42
|
+
Key: { PK: (0, keys_1.sessionPartition)(sessionId), SK: keys_1.SESSION_SORT_KEY },
|
|
43
|
+
UpdateExpression: 'ADD #count :neg',
|
|
44
|
+
ConditionExpression: 'attribute_exists(PK)',
|
|
45
|
+
ExpressionAttributeNames: { '#count': 'messageCount' },
|
|
46
|
+
ExpressionAttributeValues: { ':neg': -delta },
|
|
47
|
+
};
|
|
48
|
+
const input = { TransactItems: [{ Update: update }], ClientRequestToken: (0, node_crypto_1.randomUUID)() };
|
|
49
|
+
try {
|
|
50
|
+
await (0, retry_1.withDynamoDBRetry)(() => context.client.transactWrite(input));
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (isCancelledByCondition(error))
|
|
54
|
+
return;
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=session-count.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-count.js","sourceRoot":"","sources":["../../../src/history/internal/session-count.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC,qEAA4E;AAC5E,uDAAgE;AAChE,iCAA4D;AAG5D;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAAC,KAAY;IAC1C,MAAM,OAAO,GAAG,IAAA,qCAAsB,EAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,wBAAwB,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,6BACV,OAAuB,EACvB,SAAiB,EACjB,KAAa;IAEb,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO;IACxB,MAAM,MAAM,GAAG;QACb,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,GAAG,EAAE,EAAE,EAAE,EAAE,IAAA,uBAAgB,EAAC,SAAS,CAAC,EAAE,EAAE,EAAE,uBAAgB,EAAE;QAC9D,gBAAgB,EAAE,iBAAiB;QACnC,mBAAmB,EAAE,sBAAsB;QAC3C,wBAAwB,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE;QACtD,yBAAyB,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE;KAC9C,CAAC;IACF,MAAM,KAAK,GAAG,EAAE,aAAa,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAA,wBAAU,GAAE,EAAE,CAAC;IACxF,IAAI,CAAC;QACH,MAAM,IAAA,yBAAiB,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,sBAAsB,CAAC,KAAc,CAAC;YAAE,OAAO;QACnD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -8,13 +8,21 @@ export interface SessionUpdateFields {
|
|
|
8
8
|
now: string;
|
|
9
9
|
title?: string;
|
|
10
10
|
ttlTimestamp?: number;
|
|
11
|
+
forceTtlRefresh?: boolean;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Build the metadata `Update` transact-item: `ADD` the message count and `SET`
|
|
14
15
|
* `updatedAt` every time, while `createdAt`, `sessionId`, `title`, and the `ttl`
|
|
15
16
|
* anchor are written once via `if_not_exists`. Folding the `ttl` anchor in here
|
|
16
17
|
* means the first append fixes one shared expiry atomically with the count, with
|
|
17
|
-
* no separate pre-write that could orphan a metadata-only row.
|
|
18
|
+
* no separate pre-write that could orphan a metadata-only row. When
|
|
19
|
+
* `forceTtlRefresh` is set (because {@link resolveTtlAnchor} found the persisted
|
|
20
|
+
* anchor missing or already expired), the `ttl` clause instead does a plain
|
|
21
|
+
* `SET`, so the SESSION row's own stale attribute actually heals instead of
|
|
22
|
+
* being permanently blocked by `if_not_exists`. When forceTtlRefresh is set,
|
|
23
|
+
* the SET is additionally guarded by a ConditionExpression so a concurrent
|
|
24
|
+
* caller's already-healed anchor can never be regressed backward — see
|
|
25
|
+
* message-transaction.ts for how a lost race is retried without forcing.
|
|
18
26
|
*/
|
|
19
27
|
export declare function buildSessionUpdateItem(tableName: string, fields: SessionUpdateFields): HistoryTransactItem;
|
|
20
28
|
//# sourceMappingURL=session-update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-update.d.ts","sourceRoot":"","sources":["../../../src/history/internal/session-update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAI7F,8EAA8E;AAC9E,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAElG,oFAAoF;AACpF,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"session-update.d.ts","sourceRoot":"","sources":["../../../src/history/internal/session-update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAI7F,8EAA8E;AAC9E,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAElG,oFAAoF;AACpF,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,GAC1B,mBAAmB,CAiDrB"}
|
|
@@ -7,7 +7,14 @@ const keys_1 = require("./keys");
|
|
|
7
7
|
* `updatedAt` every time, while `createdAt`, `sessionId`, `title`, and the `ttl`
|
|
8
8
|
* anchor are written once via `if_not_exists`. Folding the `ttl` anchor in here
|
|
9
9
|
* means the first append fixes one shared expiry atomically with the count, with
|
|
10
|
-
* no separate pre-write that could orphan a metadata-only row.
|
|
10
|
+
* no separate pre-write that could orphan a metadata-only row. When
|
|
11
|
+
* `forceTtlRefresh` is set (because {@link resolveTtlAnchor} found the persisted
|
|
12
|
+
* anchor missing or already expired), the `ttl` clause instead does a plain
|
|
13
|
+
* `SET`, so the SESSION row's own stale attribute actually heals instead of
|
|
14
|
+
* being permanently blocked by `if_not_exists`. When forceTtlRefresh is set,
|
|
15
|
+
* the SET is additionally guarded by a ConditionExpression so a concurrent
|
|
16
|
+
* caller's already-healed anchor can never be regressed backward — see
|
|
17
|
+
* message-transaction.ts for how a lost race is retried without forcing.
|
|
11
18
|
*/
|
|
12
19
|
function buildSessionUpdateItem(tableName, fields) {
|
|
13
20
|
const names = {
|
|
@@ -28,16 +35,33 @@ function buildSessionUpdateItem(tableName, fields) {
|
|
|
28
35
|
values[':title'] = fields.title;
|
|
29
36
|
sets.push('#title = if_not_exists(#title, :title)');
|
|
30
37
|
}
|
|
38
|
+
let conditionExpression;
|
|
31
39
|
if (fields.ttlTimestamp !== undefined) {
|
|
32
40
|
names['#ttl'] = 'ttl';
|
|
33
41
|
values[':ttl'] = fields.ttlTimestamp;
|
|
34
|
-
|
|
42
|
+
if (fields.forceTtlRefresh) {
|
|
43
|
+
sets.push('#ttl = :ttl');
|
|
44
|
+
/**
|
|
45
|
+
* Guards the force-overwrite so a concurrent caller's already-healed,
|
|
46
|
+
* equal-or-later anchor can never be regressed backward by this one.
|
|
47
|
+
* `<=` (not `<`): two concurrent healers of the same stale anchor
|
|
48
|
+
* typically compute the identical target timestamp, and `<=` lets
|
|
49
|
+
* the second one succeed by re-applying the same value instead of
|
|
50
|
+
* failing the condition and paying a full transaction retry for a
|
|
51
|
+
* write that was never actually a regression.
|
|
52
|
+
*/
|
|
53
|
+
conditionExpression = 'attribute_not_exists(#ttl) OR #ttl <= :ttl';
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
sets.push('#ttl = if_not_exists(#ttl, :ttl)');
|
|
57
|
+
}
|
|
35
58
|
}
|
|
36
59
|
return {
|
|
37
60
|
Update: {
|
|
38
61
|
TableName: tableName,
|
|
39
62
|
Key: { PK: (0, keys_1.sessionPartition)(fields.sessionId), SK: keys_1.SESSION_SORT_KEY },
|
|
40
63
|
UpdateExpression: `ADD #count :n SET ${sets.join(', ')}`,
|
|
64
|
+
...(conditionExpression ? { ConditionExpression: conditionExpression } : {}),
|
|
41
65
|
ExpressionAttributeNames: names,
|
|
42
66
|
ExpressionAttributeValues: values,
|
|
43
67
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-update.js","sourceRoot":"","sources":["../../../src/history/internal/session-update.ts"],"names":[],"mappings":";;;AAEA,iCAA4D;
|
|
1
|
+
{"version":3,"file":"session-update.js","sourceRoot":"","sources":["../../../src/history/internal/session-update.ts"],"names":[],"mappings":";;;AAEA,iCAA4D;AAe5D;;;;;;;;;;;;;GAaG;AACH,gCACE,SAAiB,EACjB,MAA2B;IAE3B,MAAM,KAAK,GAA2B;QACpC,QAAQ,EAAE,cAAc;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,WAAW;KACpB,CAAC;IACF,MAAM,MAAM,GAAyC;QACnD,IAAI,EAAE,MAAM,CAAC,KAAK;QAClB,IAAI,EAAE,MAAM,CAAC,GAAG;QAChB,IAAI,EAAE,MAAM,CAAC,GAAG;QAChB,MAAM,EAAE,MAAM,CAAC,SAAS;KACzB,CAAC;IACF,MAAM,IAAI,GAAG,CAAC,SAAS,EAAE,4BAA4B,EAAE,kCAAkC,CAAC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F;AAChF,wBAAgB,YAAY,CAAC,OAAO,EAAE,iCAAiC,GAAG,YAAY,CAsBrF"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setUpHistory = setUpHistory;
|
|
4
4
|
const json_serde_1 = require("../../shared/codec/json-serde");
|
|
5
|
+
const config_1 = require("../../shared/codec/s3/config");
|
|
5
6
|
const offloader_1 = require("../../shared/codec/s3/offloader");
|
|
7
|
+
const constants_1 = require("../../shared/constants");
|
|
6
8
|
const client_1 = require("../../shared/dynamodb/client");
|
|
7
9
|
const logger_1 = require("../../shared/logging/logger");
|
|
8
10
|
const ulid_1 = require("../../shared/ulid");
|
|
@@ -15,7 +17,12 @@ function setUpHistory(options) {
|
|
|
15
17
|
tableName: options.tableName,
|
|
16
18
|
serde: options.serde ?? json_serde_1.JSON_SERDE,
|
|
17
19
|
compression: options.compression,
|
|
18
|
-
offloader: options.s3
|
|
20
|
+
offloader: options.s3
|
|
21
|
+
? new offloader_1.S3Offloader({
|
|
22
|
+
...options.s3,
|
|
23
|
+
keyPrefix: options.s3.keyPrefix ?? (0, config_1.defaultAdapterKeyPrefix)(constants_1.DEFAULT_S3_KEY_PREFIX, 'history'),
|
|
24
|
+
})
|
|
25
|
+
: undefined,
|
|
19
26
|
ttl: options.ttl,
|
|
20
27
|
logger: (0, logger_1.resolveLogger)(options.logger),
|
|
21
28
|
ulid: (0, ulid_1.createUlidFactory)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/history/internal/setup.ts"],"names":[],"mappings":";;;AAKA,8DAA2D;AAC3D,+DAA8D;AAC9D,yDAAqE;AACrE,wDAAyE;AACzE,4CAAsD;AAuBtD,gFAAgF;AAChF,sBAA6B,OAA0C;IACrE,MAAM,QAAQ,GAAG,IAAA,8BAAqB,EAAC,OAAO,CAAC,CAAC;IAChD,OAAO;QACL,OAAO,EAAE;YACP,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,uBAAU;YAClC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/history/internal/setup.ts"],"names":[],"mappings":";;;AAKA,8DAA2D;AAC3D,yDAAuE;AACvE,+DAA8D;AAC9D,sDAA+D;AAC/D,yDAAqE;AACrE,wDAAyE;AACzE,4CAAsD;AAuBtD,gFAAgF;AAChF,sBAA6B,OAA0C;IACrE,MAAM,QAAQ,GAAG,IAAA,8BAAqB,EAAC,OAAO,CAAC,CAAC;IAChD,OAAO;QACL,OAAO,EAAE;YACP,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,uBAAU;YAClC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,SAAS,EAAE,OAAO,CAAC,EAAE;gBACnB,CAAC,CAAC,IAAI,uBAAW,CAAC;oBACd,GAAG,OAAO,CAAC,EAAE;oBACb,SAAS,EACP,OAAO,CAAC,EAAE,CAAC,SAAS,IAAI,IAAA,gCAAuB,EAAC,iCAAqB,EAAE,SAAS,CAAC;iBACpF,CAAC;gBACJ,CAAC,CAAC,SAAS;YACb,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,MAAM,EAAE,IAAA,sBAAa,EAAC,OAAO,CAAC,MAAM,CAAC;YACrC,IAAI,EAAE,IAAA,wBAAiB,GAAE;SAC1B;QACD,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,UAAU,EAAE,QAAQ,CAAC,UAAU;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import type { HistoryContext } from './setup';
|
|
2
|
+
/** The resolved ttl anchor plus whether the persisted SESSION-row value must be force-refreshed. */
|
|
3
|
+
export interface TtlAnchorResult {
|
|
4
|
+
ttlTimestamp: number;
|
|
5
|
+
refresh: boolean;
|
|
6
|
+
}
|
|
2
7
|
/**
|
|
3
8
|
* Resolve the session's creation-anchored TTL: the value already stored on the
|
|
4
|
-
* SESSION item if one exists
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
9
|
+
* SESSION item, if one exists AND is still in the future; otherwise the
|
|
10
|
+
* supplied `candidate`, with `refresh: true` so the caller force-overwrites
|
|
11
|
+
* the stale/missing persisted anchor instead of leaving it stuck (DynamoDB's
|
|
12
|
+
* `if_not_exists` would otherwise never correct an already-expired anchor).
|
|
13
|
+
* This is a strongly-consistent read, never a write, so it cannot leave a
|
|
14
|
+
* metadata-only orphan row when the following append transaction fails.
|
|
15
|
+
*
|
|
16
|
+
* When a stale anchor is healed, only the persisted SESSION row's `ttl` is
|
|
17
|
+
* force-refreshed — the message rows already written under the expired
|
|
18
|
+
* anchor keep their own (already-expired) `ttl` and get swept independently
|
|
19
|
+
* by DynamoDB's TTL sweep. Until that sweep runs (and until
|
|
20
|
+
* `reconcileMessageCount` repairs the count), `messageCount` can therefore be
|
|
21
|
+
* temporarily overstated relative to what `getMessages` actually returns.
|
|
22
|
+
* This is expected, not a bug.
|
|
10
23
|
*/
|
|
11
|
-
export declare function resolveTtlAnchor(context: HistoryContext, sessionId: string, candidate: number): Promise<
|
|
24
|
+
export declare function resolveTtlAnchor(context: HistoryContext, sessionId: string, candidate: number): Promise<TtlAnchorResult>;
|
|
12
25
|
//# sourceMappingURL=ttl-anchor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ttl-anchor.d.ts","sourceRoot":"","sources":["../../../src/history/internal/ttl-anchor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"ttl-anchor.d.ts","sourceRoot":"","sources":["../../../src/history/internal/ttl-anchor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,oGAAoG;AACpG,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,CAAC,CAgB1B"}
|
|
@@ -5,12 +5,20 @@ const retry_1 = require("../../shared/dynamodb/retry");
|
|
|
5
5
|
const keys_1 = require("./keys");
|
|
6
6
|
/**
|
|
7
7
|
* Resolve the session's creation-anchored TTL: the value already stored on the
|
|
8
|
-
* SESSION item if one exists
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* SESSION item, if one exists AND is still in the future; otherwise the
|
|
9
|
+
* supplied `candidate`, with `refresh: true` so the caller force-overwrites
|
|
10
|
+
* the stale/missing persisted anchor instead of leaving it stuck (DynamoDB's
|
|
11
|
+
* `if_not_exists` would otherwise never correct an already-expired anchor).
|
|
12
|
+
* This is a strongly-consistent read, never a write, so it cannot leave a
|
|
13
|
+
* metadata-only orphan row when the following append transaction fails.
|
|
14
|
+
*
|
|
15
|
+
* When a stale anchor is healed, only the persisted SESSION row's `ttl` is
|
|
16
|
+
* force-refreshed — the message rows already written under the expired
|
|
17
|
+
* anchor keep their own (already-expired) `ttl` and get swept independently
|
|
18
|
+
* by DynamoDB's TTL sweep. Until that sweep runs (and until
|
|
19
|
+
* `reconcileMessageCount` repairs the count), `messageCount` can therefore be
|
|
20
|
+
* temporarily overstated relative to what `getMessages` actually returns.
|
|
21
|
+
* This is expected, not a bug.
|
|
14
22
|
*/
|
|
15
23
|
async function resolveTtlAnchor(context, sessionId, candidate) {
|
|
16
24
|
const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
|
|
@@ -21,6 +29,10 @@ async function resolveTtlAnchor(context, sessionId, candidate) {
|
|
|
21
29
|
ExpressionAttributeNames: { '#ttl': 'ttl' },
|
|
22
30
|
}));
|
|
23
31
|
const ttl = result.Item?.ttl;
|
|
24
|
-
|
|
32
|
+
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
33
|
+
if (typeof ttl === 'number' && ttl > nowSeconds) {
|
|
34
|
+
return { ttlTimestamp: ttl, refresh: false };
|
|
35
|
+
}
|
|
36
|
+
return { ttlTimestamp: candidate, refresh: true };
|
|
25
37
|
}
|
|
26
38
|
//# sourceMappingURL=ttl-anchor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ttl-anchor.js","sourceRoot":"","sources":["../../../src/history/internal/ttl-anchor.ts"],"names":[],"mappings":";;;AAAA,uDAAgE;AAChE,iCAA4D;
|
|
1
|
+
{"version":3,"file":"ttl-anchor.js","sourceRoot":"","sources":["../../../src/history/internal/ttl-anchor.ts"],"names":[],"mappings":";;;AAAA,uDAAgE;AAChE,iCAA4D;AAS5D;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,2BACV,OAAuB,EACvB,SAAiB,EACjB,SAAiB;IAEjB,MAAM,MAAM,GAAG,MAAM,IAAA,yBAAiB,EAAC,GAAG,EAAE,CAC1C,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,GAAG,EAAE,EAAE,EAAE,EAAE,IAAA,uBAAgB,EAAC,SAAS,CAAC,EAAE,EAAE,EAAE,uBAAgB,EAAE;QAC9D,cAAc,EAAE,IAAI;QACpB,oBAAoB,EAAE,MAAM;QAC5B,wBAAwB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;KAC5C,CAAC,CACH,CAAC;IACF,MAAM,GAAG,GAAI,MAAM,CAAC,IAAqC,EAAE,GAAG,CAAC;IAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACjD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,GAAG,UAAU,EAAE,CAAC;QAChD,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACpD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type { CreateAllOptions, CreatedAdapters, FactoryBaseOptions } from './fa
|
|
|
12
12
|
export { DynamoDbLangGraphError } from './shared/errors/base-error';
|
|
13
13
|
export type { ErrorContext } from './shared/errors/base-error';
|
|
14
14
|
export { ErrorCode } from './shared/errors/error-code';
|
|
15
|
-
export { AbortError, BatchWriteIncompleteError, CompensationFailedError, ConflictError, ResultTruncatedError, RetryExhaustedError, ValidationError, } from './shared/errors/errors';
|
|
15
|
+
export { AbortError, BatchWriteAllIncompleteError, BatchWriteIncompleteError, CompensationFailedError, ConflictError, ResultTruncatedError, RetryExhaustedError, ValidationError, } from './shared/errors/errors';
|
|
16
16
|
export type { Logger, LogArgument } from './shared/logging/logger';
|
|
17
17
|
export { redactLogger, redactSecrets } from './shared/logging/redaction';
|
|
18
18
|
export type { BaseAdapterOptions, CodecOptions } from './shared/options';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,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E,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.redactSecrets = exports.redactLogger = exports.ValidationError = exports.RetryExhaustedError = exports.ResultTruncatedError = exports.ConflictError = exports.CompensationFailedError = exports.BatchWriteIncompleteError = exports.AbortError = exports.ErrorCode = exports.DynamoDbLangGraphError = exports.DynamoDBFactory = exports.DynamoDBSessionChatMessageHistory = exports.DynamoDBChatMessageHistory = exports.DynamoDBStore = exports.DynamoDBSaver = void 0;
|
|
3
|
+
exports.redactSecrets = exports.redactLogger = exports.ValidationError = exports.RetryExhaustedError = exports.ResultTruncatedError = exports.ConflictError = exports.CompensationFailedError = exports.BatchWriteIncompleteError = exports.BatchWriteAllIncompleteError = exports.AbortError = exports.ErrorCode = exports.DynamoDbLangGraphError = exports.DynamoDBFactory = exports.DynamoDBSessionChatMessageHistory = exports.DynamoDBChatMessageHistory = exports.DynamoDBStore = exports.DynamoDBSaver = void 0;
|
|
4
4
|
var saver_1 = require("./checkpointer/saver");
|
|
5
5
|
Object.defineProperty(exports, "DynamoDBSaver", { enumerable: true, get: function () { return saver_1.DynamoDBSaver; } });
|
|
6
6
|
var store_1 = require("./store/store");
|
|
@@ -17,6 +17,7 @@ var error_code_1 = require("./shared/errors/error-code");
|
|
|
17
17
|
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return error_code_1.ErrorCode; } });
|
|
18
18
|
var errors_1 = require("./shared/errors/errors");
|
|
19
19
|
Object.defineProperty(exports, "AbortError", { enumerable: true, get: function () { return errors_1.AbortError; } });
|
|
20
|
+
Object.defineProperty(exports, "BatchWriteAllIncompleteError", { enumerable: true, get: function () { return errors_1.BatchWriteAllIncompleteError; } });
|
|
20
21
|
Object.defineProperty(exports, "BatchWriteIncompleteError", { enumerable: true, get: function () { return errors_1.BatchWriteIncompleteError; } });
|
|
21
22
|
Object.defineProperty(exports, "CompensationFailedError", { enumerable: true, get: function () { return errors_1.CompensationFailedError; } });
|
|
22
23
|
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return errors_1.ConflictError; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,8CAAqD;AAA5C,sGAAA,aAAa,OAAA;AAEtB,uCAA8C;AAArC,sGAAA,aAAa,OAAA;AAItB,uEAA4E;AAAnE,kIAAA,0BAA0B,OAAA;AACnC,6DAA8E;AAArE,oIAAA,iCAAiC,OAAA;AAE1C,6CAAoD;AAA3C,0GAAA,eAAe,OAAA;AAGxB,yDAAoE;AAA3D,oHAAA,sBAAsB,OAAA;AAE/B,yDAAuD;AAA9C,uGAAA,SAAS,OAAA;AAClB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,8CAAqD;AAA5C,sGAAA,aAAa,OAAA;AAEtB,uCAA8C;AAArC,sGAAA,aAAa,OAAA;AAItB,uEAA4E;AAAnE,kIAAA,0BAA0B,OAAA;AACnC,6DAA8E;AAArE,oIAAA,iCAAiC,OAAA;AAE1C,6CAAoD;AAA3C,0GAAA,eAAe,OAAA;AAGxB,yDAAoE;AAA3D,oHAAA,sBAAsB,OAAA;AAE/B,yDAAuD;AAA9C,uGAAA,SAAS,OAAA;AAClB,iDASgC;AAR9B,oGAAA,UAAU,OAAA;AACV,sHAAA,4BAA4B,OAAA;AAC5B,mHAAA,yBAAyB,OAAA;AACzB,iHAAA,uBAAuB,OAAA;AACvB,uGAAA,aAAa,OAAA;AACb,8GAAA,oBAAoB,OAAA;AACpB,6GAAA,mBAAmB,OAAA;AACnB,yGAAA,eAAe,OAAA;AAIjB,wDAAyE;AAAhE,yGAAA,YAAY,OAAA;AAAE,0GAAA,aAAa,OAAA"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { S3Client, S3ClientConfig } from '@aws-sdk/client-s3';
|
|
2
2
|
/** Lazily import the optional `@aws-sdk/client-s3` peer, caching the module. */
|
|
3
3
|
export declare function loadS3Sdk(): Promise<typeof import('@aws-sdk/client-s3')>;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Construct an `S3Client` from `config` using the lazily-loaded SDK. Defaults
|
|
6
|
+
* `maxAttempts: 1` so the SDK's own internal retries are disabled and this
|
|
7
|
+
* library's retry/backoff/classification system is the sole retry layer,
|
|
8
|
+
* matching {@link resolveDynamoDBClient}'s equivalent default; an explicit
|
|
9
|
+
* `maxAttempts` in `config` still wins.
|
|
10
|
+
*/
|
|
5
11
|
export declare function createDefaultS3Client(config: S3ClientConfig): Promise<S3Client>;
|
|
6
12
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/shared/codec/s3/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAInE,gFAAgF;AAChF,wBAAsB,SAAS,IAAI,OAAO,CAAC,cAAc,oBAAoB,CAAC,CAAC,CAK9E;AAED
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/shared/codec/s3/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAInE,gFAAgF;AAChF,wBAAsB,SAAS,IAAI,OAAO,CAAC,cAAc,oBAAoB,CAAC,CAAC,CAK9E;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAGrF"}
|
|
@@ -10,9 +10,15 @@ async function loadS3Sdk() {
|
|
|
10
10
|
}
|
|
11
11
|
return sdkPromise;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Construct an `S3Client` from `config` using the lazily-loaded SDK. Defaults
|
|
15
|
+
* `maxAttempts: 1` so the SDK's own internal retries are disabled and this
|
|
16
|
+
* library's retry/backoff/classification system is the sole retry layer,
|
|
17
|
+
* matching {@link resolveDynamoDBClient}'s equivalent default; an explicit
|
|
18
|
+
* `maxAttempts` in `config` still wins.
|
|
19
|
+
*/
|
|
14
20
|
async function createDefaultS3Client(config) {
|
|
15
21
|
const { S3Client: S3ClientCtor } = await loadS3Sdk();
|
|
16
|
-
return new S3ClientCtor(config);
|
|
22
|
+
return new S3ClientCtor({ maxAttempts: 1, ...config });
|
|
17
23
|
}
|
|
18
24
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/shared/codec/s3/client.ts"],"names":[],"mappings":";;;;AAEA,IAAI,UAAoE,CAAC;AAEzE,gFAAgF;AACzE,KAAK;IACV,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/shared/codec/s3/client.ts"],"names":[],"mappings":";;;;AAEA,IAAI,UAAoE,CAAC;AAEzE,gFAAgF;AACzE,KAAK;IACV,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;GAMG;AACI,KAAK,gCAAgC,MAAsB;IAChE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,SAAS,EAAE,CAAC;IACrD,OAAO,IAAI,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -19,4 +19,6 @@ export interface S3OffloadConfig {
|
|
|
19
19
|
export declare function buildS3Key(prefix: string, parts: readonly string[]): string;
|
|
20
20
|
/** Build a deterministic, TTL-independent lifecycle rule id from the prefix. */
|
|
21
21
|
export declare function buildLifecycleRuleId(prefix: string): string;
|
|
22
|
+
/** An adapter's default S3 key prefix: the shared base plus its own segment. */
|
|
23
|
+
export declare function defaultAdapterKeyPrefix(base: string, adapter: string): string;
|
|
22
24
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/shared/codec/s3/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEnE,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,QAAQ,CAAC;CACvD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAG3E;AAED,gFAAgF;AAChF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG3D"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/shared/codec/s3/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEnE,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,QAAQ,CAAC;CACvD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAG3E;AAED,gFAAgF;AAChF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED,gFAAgF;AAChF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7E"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildS3Key = buildS3Key;
|
|
4
4
|
exports.buildLifecycleRuleId = buildLifecycleRuleId;
|
|
5
|
+
exports.defaultAdapterKeyPrefix = defaultAdapterKeyPrefix;
|
|
5
6
|
/**
|
|
6
7
|
* Build a fully-qualified S3 key: `${prefix}${parts, each base64url-encoded,
|
|
7
8
|
* joined with '/'}.bin`. Encoding (not rejecting) is what makes two distinct
|
|
@@ -18,4 +19,8 @@ function buildLifecycleRuleId(prefix) {
|
|
|
18
19
|
const slug = prefix.replace(/\/+$/, '').replace(/[^a-zA-Z0-9-]/g, '-') || 'default';
|
|
19
20
|
return `langgraph-ttl-${slug}`;
|
|
20
21
|
}
|
|
22
|
+
/** An adapter's default S3 key prefix: the shared base plus its own segment. */
|
|
23
|
+
function defaultAdapterKeyPrefix(base, adapter) {
|
|
24
|
+
return `${base}${adapter}/`;
|
|
25
|
+
}
|
|
21
26
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/shared/codec/s3/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/shared/codec/s3/config.ts"],"names":[],"mappings":";;;;;AAaA;;;;;;GAMG;AACH,oBAA2B,MAAc,EAAE,KAAwB;IACjE,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;IACrF,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;AAC7C,CAAC;AAED,gFAAgF;AAChF,8BAAqC,MAAc;IACjD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,IAAI,SAAS,CAAC;IACpF,OAAO,iBAAiB,IAAI,EAAE,CAAC;AACjC,CAAC;AAED,gFAAgF;AAChF,iCAAwC,IAAY,EAAE,OAAe;IACnE,OAAO,GAAG,IAAI,GAAG,OAAO,GAAG,CAAC;AAC9B,CAAC"}
|
|
@@ -32,7 +32,7 @@ class S3Offloader {
|
|
|
32
32
|
if (!this.clientPromise) {
|
|
33
33
|
const cfg = this.config.clientConfig ?? {};
|
|
34
34
|
this.clientPromise = (this.config.createS3Client
|
|
35
|
-
? Promise.resolve(this.config.createS3Client(cfg))
|
|
35
|
+
? Promise.resolve(this.config.createS3Client({ maxAttempts: 1, ...cfg }))
|
|
36
36
|
: (0, client_1.createDefaultS3Client)(cfg)).then((client) => {
|
|
37
37
|
this.resolvedClient = client;
|
|
38
38
|
return client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offloader.js","sourceRoot":"","sources":["../../../../src/shared/codec/s3/offloader.ts"],"names":[],"mappings":";;;AAEA,+CAAoG;AACpG,qCAAiD;AACjD,qCAAuD;AACvD,qCAAyC;AACzC,2CAAkD;AAClD,6CAA4D;AAE5D;;;GAGG;AACH;IACU,aAAa,CAAgC;IAC7C,cAAc,CAAuB;IAC5B,UAAU,CAAS;IACnB,SAAS,CAAS;IAClB,cAAc,CAAS;IACvB,GAAG,CAAS;IACZ,WAAW,CAAU;IACrB,MAAM,CAAkB;IAEzC,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,iCAAqB,CAAC;QAC3D,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,sCAA0B,CAAC;QAC1E,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,oBAAoB,IAAI,0BAAc,CAAC;QACzD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACxC,CAAC;IAEO,SAAS;QACf,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC;YAC3C,IAAI,CAAC,aAAa,GAAG,CACnB,IAAI,CAAC,MAAM,CAAC,cAAc;gBACxB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"offloader.js","sourceRoot":"","sources":["../../../../src/shared/codec/s3/offloader.ts"],"names":[],"mappings":";;;AAEA,+CAAoG;AACpG,qCAAiD;AACjD,qCAAuD;AACvD,qCAAyC;AACzC,2CAAkD;AAClD,6CAA4D;AAE5D;;;GAGG;AACH;IACU,aAAa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OAAO,EAAE,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-write.d.ts","sourceRoot":"","sources":["../../../../src/shared/codec/s3/read-write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAwB,MAAM,oBAAoB,CAAC;AAQzE,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qEAAqE;AACrE,wBAAsB,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"read-write.d.ts","sourceRoot":"","sources":["../../../../src/shared/codec/s3/read-write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAwB,MAAM,oBAAoB,CAAC;AAQzE,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qEAAqE;AACrE,wBAAsB,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBxF;AAED,yFAAyF;AACzF,wBAAsB,cAAc,CAClC,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,UAAU,CAAC,CAqBrB"}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.uploadObject = uploadObject;
|
|
4
4
|
exports.downloadObject = downloadObject;
|
|
5
5
|
const retry_1 = require("../../dynamodb/retry");
|
|
6
|
+
const base_error_1 = require("../../errors/base-error");
|
|
6
7
|
const error_code_1 = require("../../errors/error-code");
|
|
7
|
-
const wrap_error_1 = require("../../errors/wrap-error");
|
|
8
8
|
const client_1 = require("./client");
|
|
9
9
|
const retry_2 = require("./retry");
|
|
10
10
|
/** Upload `data` to S3, wrapping failures as `S3_OFFLOAD_FAILED`. */
|
|
@@ -21,10 +21,7 @@ async function uploadObject(client, params) {
|
|
|
21
21
|
})), { maxAttempts: 3, retryableErrors: retry_2.RETRYABLE_S3_SIGNALS });
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
|
-
throw
|
|
25
|
-
operation: 'upload',
|
|
26
|
-
key: params.key,
|
|
27
|
-
});
|
|
24
|
+
throw new base_error_1.DynamoDbLangGraphError(error.message, error_code_1.ErrorCode.S3_OFFLOAD_FAILED, { operation: 'upload', key: params.key }, error);
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
27
|
/** Download an object's bytes, wrapping failures/empty bodies as `S3_OFFLOAD_FAILED`. */
|
|
@@ -40,7 +37,7 @@ async function downloadObject(client, bucket, key) {
|
|
|
40
37
|
}, { maxAttempts: 3, retryableErrors: retry_2.RETRYABLE_S3_SIGNALS });
|
|
41
38
|
}
|
|
42
39
|
catch (error) {
|
|
43
|
-
throw
|
|
40
|
+
throw new base_error_1.DynamoDbLangGraphError(error.message, error_code_1.ErrorCode.S3_OFFLOAD_FAILED, { operation: 'download', key }, error);
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
43
|
//# sourceMappingURL=read-write.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-write.js","sourceRoot":"","sources":["../../../../src/shared/codec/s3/read-write.ts"],"names":[],"mappings":";;;;AAEA,gDAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"read-write.js","sourceRoot":"","sources":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,IAAI,CAAC,IAAI,gBAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;YACvF,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,oCAAoC,GAAG,EAAE,CAAC,CAAC;YAC7D,CAAC;YACD,OAAO,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACpE,CAAC,EACD,EAAE,WAAW,EAAE,CAAC,EAAE,eAAe,EAAE,4BAAoB,EAAE,CAC1D,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,mCAAsB,CAC7B,KAAe,CAAC,OAAO,EACxB,sBAAS,CAAC,iBAAiB,EAC3B,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,EAC9B,KAAc,CACf,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -39,6 +39,9 @@ export declare const DEFAULT_RETRY_MAX_ATTEMPTS = 5;
|
|
|
39
39
|
* existing 100ms base / 5000ms cap backoff, this keeps worst-case retrying
|
|
40
40
|
* within AWS's documented guidance to bound conflict retries to "around one
|
|
41
41
|
* minute" (see DynamoDB's "Error retries and exponential backoff" guide).
|
|
42
|
+
* This bound is exact, not a floor: the DynamoDB client disables the AWS
|
|
43
|
+
* SDK's own internal retries by default (see `resolveDynamoDBClient`), so
|
|
44
|
+
* this is the only retry layer in play.
|
|
42
45
|
*/
|
|
43
46
|
export declare const MESSAGE_APPEND_RETRY_MAX_ATTEMPTS = 18;
|
|
44
47
|
/** Default cap on candidates the in-DB semantic ranker will score. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/shared/constants.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,eAAO,MAAM,YAAY,QAAU,CAAC;AAEpC,oDA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,aAAa,MAAM,CAAC;AAEjC,mEAAmE;AACnE,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,6CAA6C;AAC7C,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,iDAAiD;AACjD,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,8FAA8F;AAC9F,eAAO,MAAM,0BAA0B,QAAa,CAAC;AAErD,oDAAoD;AACpD,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAE9D,mDAAmD;AACnD,eAAO,MAAM,cAAc,WAAW,CAAC;AAEvC,yEAAyE;AACzE,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD,6DAA6D;AAC7D,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,qEAAqE;AACrE,eAAO,MAAM,8BAA8B,QAAmB,CAAC;AAE/D,4DAA4D;AAC5D,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAEpD,sEAAsE;AACtE,eAAO,MAAM,6BAA6B,OAAO,CAAC"}
|
package/dist/shared/constants.js
CHANGED
|
@@ -42,6 +42,9 @@ exports.DEFAULT_RETRY_MAX_ATTEMPTS = 5;
|
|
|
42
42
|
* existing 100ms base / 5000ms cap backoff, this keeps worst-case retrying
|
|
43
43
|
* within AWS's documented guidance to bound conflict retries to "around one
|
|
44
44
|
* minute" (see DynamoDB's "Error retries and exponential backoff" guide).
|
|
45
|
+
* This bound is exact, not a floor: the DynamoDB client disables the AWS
|
|
46
|
+
* SDK's own internal retries by default (see `resolveDynamoDBClient`), so
|
|
47
|
+
* this is the only retry layer in play.
|
|
45
48
|
*/
|
|
46
49
|
exports.MESSAGE_APPEND_RETRY_MAX_ATTEMPTS = 18;
|
|
47
50
|
/** Default cap on candidates the in-DB semantic ranker will score. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/shared/constants.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAClC,QAAA,YAAY,GAAG,GAAG,GAAG,CAAC,CAAC;AAEpC,oDAAoD;AACvC,QAAA,eAAe,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAExD,yEAAyE;AAC5D,QAAA,mBAAmB,GAAG,IAAI,CAAC;AAExC,wEAAwE;AAC3D,QAAA,yBAAyB,GAAG,KAAK,CAAC;AAE/C,yDAAyD;AAC5C,QAAA,eAAe,GAAG,EAAE,CAAC;AAElC,mDAAmD;AACtC,QAAA,aAAa,GAAG,GAAG,CAAC;AAEjC,mEAAmE;AACtD,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAE1C,2EAA2E;AAC9D,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAE5C,6CAA6C;AAChC,QAAA,oBAAoB,GAAG,IAAI,CAAC;AAEzC,iDAAiD;AACpC,QAAA,mBAAmB,GAAG,IAAI,CAAC;AAExC,8FAA8F;AACjF,QAAA,0BAA0B,GAAG,GAAG,GAAG,IAAI,CAAC;AAErD,oDAAoD;AACvC,QAAA,qBAAqB,GAAG,wBAAwB,CAAC;AAE9D,mDAAmD;AACtC,QAAA,cAAc,GAAG,QAAQ,CAAC;AAEvC,yEAAyE;AAC5D,QAAA,6BAA6B,GAAG,IAAI,CAAC;AAElD,6DAA6D;AAChD,QAAA,yBAAyB,GAAG,CAAC,CAAC;AAE3C,qEAAqE;AACxD,QAAA,8BAA8B,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/D,4DAA4D;AAC/C,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/shared/constants.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAClC,QAAA,YAAY,GAAG,GAAG,GAAG,CAAC,CAAC;AAEpC,oDAAoD;AACvC,QAAA,eAAe,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAExD,yEAAyE;AAC5D,QAAA,mBAAmB,GAAG,IAAI,CAAC;AAExC,wEAAwE;AAC3D,QAAA,yBAAyB,GAAG,KAAK,CAAC;AAE/C,yDAAyD;AAC5C,QAAA,eAAe,GAAG,EAAE,CAAC;AAElC,mDAAmD;AACtC,QAAA,aAAa,GAAG,GAAG,CAAC;AAEjC,mEAAmE;AACtD,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAE1C,2EAA2E;AAC9D,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAE5C,6CAA6C;AAChC,QAAA,oBAAoB,GAAG,IAAI,CAAC;AAEzC,iDAAiD;AACpC,QAAA,mBAAmB,GAAG,IAAI,CAAC;AAExC,8FAA8F;AACjF,QAAA,0BAA0B,GAAG,GAAG,GAAG,IAAI,CAAC;AAErD,oDAAoD;AACvC,QAAA,qBAAqB,GAAG,wBAAwB,CAAC;AAE9D,mDAAmD;AACtC,QAAA,cAAc,GAAG,QAAQ,CAAC;AAEvC,yEAAyE;AAC5D,QAAA,6BAA6B,GAAG,IAAI,CAAC;AAElD,6DAA6D;AAChD,QAAA,yBAAyB,GAAG,CAAC,CAAC;AAE3C,qEAAqE;AACxD,QAAA,8BAA8B,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/D,4DAA4D;AAC/C,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAE5C;;;;;;;;;;GAUG;AACU,QAAA,iCAAiC,GAAG,EAAE,CAAC;AAEpD,sEAAsE;AACzD,QAAA,6BAA6B,GAAG,IAAI,CAAC"}
|
|
@@ -3,8 +3,21 @@ import { DrainOptions } from './drain-unprocessed';
|
|
|
3
3
|
import type { WriteRequest } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Write an arbitrary number of requests, chunked into batches of 25 (the
|
|
6
|
-
* BatchWriteItem limit).
|
|
7
|
-
*
|
|
6
|
+
* BatchWriteItem limit). Every chunk is attempted regardless of an earlier
|
|
7
|
+
* chunk's failure — order-independent writes (deletes/puts) should never
|
|
8
|
+
* lose "later" chunks just because an earlier one failed. If any chunk fails,
|
|
9
|
+
* throws {@link BatchWriteAllIncompleteError} reporting exactly how many
|
|
10
|
+
* chunks succeeded vs. failed, and exactly how many individual writes
|
|
11
|
+
* persisted, once every chunk has been attempted.
|
|
12
|
+
*
|
|
13
|
+
* This is this function's ONLY throw site. Two callers —
|
|
14
|
+
* checkpointer/internal/special-write-cleanup.ts and
|
|
15
|
+
* history/internal/append-saga.ts — type-assert a caught error straight to
|
|
16
|
+
* {@link BatchWriteAllIncompleteError} on that guarantee (not `instanceof`,
|
|
17
|
+
* banned repo-wide) instead of narrowing it, since this project enforces
|
|
18
|
+
* 100% branch coverage and a defensive else-branch here would be
|
|
19
|
+
* unreachable, hence untestable. Adding another throw path to this function
|
|
20
|
+
* requires updating both call sites.
|
|
8
21
|
*/
|
|
9
22
|
export declare function batchWriteAll(client: DynamoDBDocument, tableName: string, requests: WriteRequest[], options?: DrainOptions): Promise<void>;
|
|
10
23
|
//# sourceMappingURL=batch-write.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-write.d.ts","sourceRoot":"","sources":["../../../src/shared/dynamodb/batch-write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"batch-write.d.ts","sourceRoot":"","sources":["../../../src/shared/dynamodb/batch-write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,OAAO,EAAE,YAAY,EAA0B,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAO5C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAyBf"}
|