effect-dynamodb 1.42.2 → 1.44.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/dist/Aggregate.d.ts +157 -20
- package/dist/Aggregate.d.ts.map +1 -1
- package/dist/Aggregate.js +1219 -286
- package/dist/Aggregate.js.map +1 -1
- package/dist/Batch.d.ts +17 -4
- package/dist/Batch.d.ts.map +1 -1
- package/dist/Batch.js +129 -62
- package/dist/Batch.js.map +1 -1
- package/dist/BlobGc.d.ts +243 -0
- package/dist/BlobGc.d.ts.map +1 -0
- package/dist/BlobGc.js +961 -0
- package/dist/BlobGc.js.map +1 -0
- package/dist/BlobStore.d.ts +83 -0
- package/dist/BlobStore.d.ts.map +1 -0
- package/dist/BlobStore.js +70 -0
- package/dist/BlobStore.js.map +1 -0
- package/dist/Collection.d.ts +88 -8
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +22 -26
- package/dist/Collection.js.map +1 -1
- package/dist/Collections.d.ts +0 -7
- package/dist/Collections.d.ts.map +1 -1
- package/dist/Collections.js +0 -16
- package/dist/Collections.js.map +1 -1
- package/dist/DynamoClient.d.ts +68 -35
- package/dist/DynamoClient.d.ts.map +1 -1
- package/dist/DynamoClient.js +58 -12
- package/dist/DynamoClient.js.map +1 -1
- package/dist/Entity.d.ts +403 -104
- package/dist/Entity.d.ts.map +1 -1
- package/dist/Entity.js +1771 -382
- package/dist/Entity.js.map +1 -1
- package/dist/EventStore.d.ts +323 -77
- package/dist/EventStore.d.ts.map +1 -1
- package/dist/EventStore.js +473 -96
- package/dist/EventStore.js.map +1 -1
- package/dist/Offload.d.ts +199 -0
- package/dist/Offload.d.ts.map +1 -0
- package/dist/Offload.js +120 -0
- package/dist/Offload.js.map +1 -0
- package/dist/Query.d.ts +132 -59
- package/dist/Query.d.ts.map +1 -1
- package/dist/Query.js +95 -31
- package/dist/Query.js.map +1 -1
- package/dist/StorageEncoding.d.ts +62 -15
- package/dist/StorageEncoding.d.ts.map +1 -1
- package/dist/StorageEncoding.js +108 -24
- package/dist/StorageEncoding.js.map +1 -1
- package/dist/Table.d.ts +1 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Transaction.d.ts +16 -3
- package/dist/Transaction.d.ts.map +1 -1
- package/dist/Transaction.js +28 -9
- package/dist/Transaction.js.map +1 -1
- package/dist/blob/S3BlobStore.d.ts +178 -0
- package/dist/blob/S3BlobStore.d.ts.map +1 -0
- package/dist/blob/S3BlobStore.js +770 -0
- package/dist/blob/S3BlobStore.js.map +1 -0
- package/dist/blob/s3.d.ts +122 -0
- package/dist/blob/s3.d.ts.map +1 -0
- package/dist/blob/s3.js +143 -0
- package/dist/blob/s3.js.map +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/AggregateWrite.d.ts +130 -0
- package/dist/internal/AggregateWrite.d.ts.map +1 -0
- package/dist/internal/AggregateWrite.js +341 -0
- package/dist/internal/AggregateWrite.js.map +1 -0
- package/dist/internal/BlobCalls.d.ts +70 -0
- package/dist/internal/BlobCalls.d.ts.map +1 -0
- package/dist/internal/BlobCalls.js +105 -0
- package/dist/internal/BlobCalls.js.map +1 -0
- package/dist/internal/BlobKeys.d.ts +100 -0
- package/dist/internal/BlobKeys.d.ts.map +1 -0
- package/dist/internal/BlobKeys.js +135 -0
- package/dist/internal/BlobKeys.js.map +1 -0
- package/dist/internal/BlobLedger.d.ts +323 -0
- package/dist/internal/BlobLedger.d.ts.map +1 -0
- package/dist/internal/BlobLedger.js +1012 -0
- package/dist/internal/BlobLedger.js.map +1 -0
- package/dist/internal/BlobMetadata.d.ts +109 -0
- package/dist/internal/BlobMetadata.d.ts.map +1 -0
- package/dist/internal/BlobMetadata.js +249 -0
- package/dist/internal/BlobMetadata.js.map +1 -0
- package/dist/internal/BlobResolver.d.ts +146 -0
- package/dist/internal/BlobResolver.d.ts.map +1 -0
- package/dist/internal/BlobResolver.js +417 -0
- package/dist/internal/BlobResolver.js.map +1 -0
- package/dist/internal/BlobStoreContract.d.ts +214 -0
- package/dist/internal/BlobStoreContract.d.ts.map +1 -0
- package/dist/internal/BlobStoreContract.js +181 -0
- package/dist/internal/BlobStoreContract.js.map +1 -0
- package/dist/internal/BoundCrud.d.ts +153 -53
- package/dist/internal/BoundCrud.d.ts.map +1 -1
- package/dist/internal/BoundCrud.js +27 -5
- package/dist/internal/BoundCrud.js.map +1 -1
- package/dist/internal/BoundQuery.d.ts +49 -33
- package/dist/internal/BoundQuery.d.ts.map +1 -1
- package/dist/internal/BoundQuery.js +8 -2
- package/dist/internal/BoundQuery.js.map +1 -1
- package/dist/internal/BoundVectorQuery.d.ts +59 -25
- package/dist/internal/BoundVectorQuery.d.ts.map +1 -1
- package/dist/internal/BoundVectorQuery.js +38 -17
- package/dist/internal/BoundVectorQuery.js.map +1 -1
- package/dist/internal/Capacity.d.ts +17 -2
- package/dist/internal/Capacity.d.ts.map +1 -1
- package/dist/internal/Capacity.js +47 -9
- package/dist/internal/Capacity.js.map +1 -1
- package/dist/internal/ConditionHolds.d.ts.map +1 -1
- package/dist/internal/ConditionHolds.js +2 -8
- package/dist/internal/ConditionHolds.js.map +1 -1
- package/dist/internal/CredentialRefusal.d.ts.map +1 -1
- package/dist/internal/CredentialRefusal.js +4 -0
- package/dist/internal/CredentialRefusal.js.map +1 -1
- package/dist/internal/Digest.d.ts +4 -3
- package/dist/internal/Digest.d.ts.map +1 -1
- package/dist/internal/Digest.js +25 -82
- package/dist/internal/Digest.js.map +1 -1
- package/dist/internal/EntityCombinators.d.ts +93 -45
- package/dist/internal/EntityCombinators.d.ts.map +1 -1
- package/dist/internal/EntityCombinators.js +42 -7
- package/dist/internal/EntityCombinators.js.map +1 -1
- package/dist/internal/EntityOps.d.ts +47 -6
- package/dist/internal/EntityOps.d.ts.map +1 -1
- package/dist/internal/EntityOps.js +30 -10
- package/dist/internal/EntityOps.js.map +1 -1
- package/dist/internal/EventProjection.d.ts +99 -25
- package/dist/internal/EventProjection.d.ts.map +1 -1
- package/dist/internal/EventProjection.js +124 -33
- package/dist/internal/EventProjection.js.map +1 -1
- package/dist/internal/ExpressionLimits.d.ts +22 -3
- package/dist/internal/ExpressionLimits.d.ts.map +1 -1
- package/dist/internal/ExpressionLimits.js +46 -7
- package/dist/internal/ExpressionLimits.js.map +1 -1
- package/dist/internal/GcSupport.d.ts +258 -0
- package/dist/internal/GcSupport.d.ts.map +1 -0
- package/dist/internal/GcSupport.js +284 -0
- package/dist/internal/GcSupport.js.map +1 -0
- package/dist/internal/ItemSize.d.ts +7 -1
- package/dist/internal/ItemSize.d.ts.map +1 -1
- package/dist/internal/ItemSize.js +13 -5
- package/dist/internal/ItemSize.js.map +1 -1
- package/dist/internal/MemoryBlobStore.d.ts +203 -0
- package/dist/internal/MemoryBlobStore.d.ts.map +1 -0
- package/dist/internal/MemoryBlobStore.js +623 -0
- package/dist/internal/MemoryBlobStore.js.map +1 -0
- package/dist/internal/MultiProjection.d.ts +56 -28
- package/dist/internal/MultiProjection.d.ts.map +1 -1
- package/dist/internal/MultiProjection.js +9 -3
- package/dist/internal/MultiProjection.js.map +1 -1
- package/dist/internal/Multipart.d.ts +96 -0
- package/dist/internal/Multipart.d.ts.map +1 -0
- package/dist/internal/Multipart.js +143 -0
- package/dist/internal/Multipart.js.map +1 -0
- package/dist/internal/OffloadChange.d.ts +187 -0
- package/dist/internal/OffloadChange.d.ts.map +1 -0
- package/dist/internal/OffloadChange.js +391 -0
- package/dist/internal/OffloadChange.js.map +1 -0
- package/dist/internal/OffloadInput.d.ts +141 -0
- package/dist/internal/OffloadInput.d.ts.map +1 -0
- package/dist/internal/OffloadInput.js +236 -0
- package/dist/internal/OffloadInput.js.map +1 -0
- package/dist/internal/OffloadRead.d.ts +140 -0
- package/dist/internal/OffloadRead.d.ts.map +1 -0
- package/dist/internal/OffloadRead.js +369 -0
- package/dist/internal/OffloadRead.js.map +1 -0
- package/dist/internal/OffloadTypes.d.ts +182 -0
- package/dist/internal/OffloadTypes.d.ts.map +1 -0
- package/dist/internal/OffloadTypes.js +15 -0
- package/dist/internal/OffloadTypes.js.map +1 -0
- package/dist/internal/OffloadValues.d.ts +87 -0
- package/dist/internal/OffloadValues.d.ts.map +1 -0
- package/dist/internal/OffloadValues.js +114 -0
- package/dist/internal/OffloadValues.js.map +1 -0
- package/dist/internal/OffloadWrite.d.ts +267 -0
- package/dist/internal/OffloadWrite.d.ts.map +1 -0
- package/dist/internal/OffloadWrite.js +766 -0
- package/dist/internal/OffloadWrite.js.map +1 -0
- package/dist/internal/Packed.d.ts +58 -23
- package/dist/internal/Packed.d.ts.map +1 -1
- package/dist/internal/Packed.js +108 -33
- package/dist/internal/Packed.js.map +1 -1
- package/dist/internal/ProjectionEngine.d.ts +28 -3
- package/dist/internal/ProjectionEngine.d.ts.map +1 -1
- package/dist/internal/ProjectionEngine.js +47 -9
- package/dist/internal/ProjectionEngine.js.map +1 -1
- package/dist/internal/RangePlanner.d.ts +3 -6
- package/dist/internal/RangePlanner.d.ts.map +1 -1
- package/dist/internal/RangePlanner.js +3 -29
- package/dist/internal/RangePlanner.js.map +1 -1
- package/dist/internal/Rekey.d.ts +16 -0
- package/dist/internal/Rekey.d.ts.map +1 -1
- package/dist/internal/Rekey.js +31 -2
- package/dist/internal/Rekey.js.map +1 -1
- package/dist/internal/StoredPointer.d.ts +19 -0
- package/dist/internal/StoredPointer.d.ts.map +1 -0
- package/dist/internal/StoredPointer.js +59 -0
- package/dist/internal/StoredPointer.js.map +1 -0
- package/dist/internal/TransactPlan.d.ts +18 -1
- package/dist/internal/TransactPlan.d.ts.map +1 -1
- package/dist/internal/TransactPlan.js +50 -10
- package/dist/internal/TransactPlan.js.map +1 -1
- package/dist/internal/TransactWriteOps.d.ts +33 -12
- package/dist/internal/TransactWriteOps.d.ts.map +1 -1
- package/dist/internal/TransactWriteOps.js +49 -19
- package/dist/internal/TransactWriteOps.js.map +1 -1
- package/dist/internal/TransactableOps.d.ts +58 -11
- package/dist/internal/TransactableOps.d.ts.map +1 -1
- package/dist/internal/TransactableOps.js +95 -19
- package/dist/internal/TransactableOps.js.map +1 -1
- package/dist/internal/Utf8Order.d.ts +21 -0
- package/dist/internal/Utf8Order.d.ts.map +1 -0
- package/dist/internal/Utf8Order.js +44 -0
- package/dist/internal/Utf8Order.js.map +1 -0
- package/dist/internal/WriteDiagnosis.d.ts +7 -1
- package/dist/internal/WriteDiagnosis.d.ts.map +1 -1
- package/dist/internal/WriteDiagnosis.js +12 -16
- package/dist/internal/WriteDiagnosis.js.map +1 -1
- package/package.json +15 -4
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal The multipart upload driver a store's `put` runs (#179, design
|
|
3
|
+
* §7): it decides between one `PutObject`-like call and a multipart upload,
|
|
4
|
+
* re-chunks the body into parts of exactly `partSize` bytes (the last may be
|
|
5
|
+
* shorter), uploads them at the store's `uploadConcurrency`, completes the
|
|
6
|
+
* upload (uninterruptibly), and aborts it — in an uninterruptible finalizer,
|
|
7
|
+
* after in-flight parts are interrupted — on any failure or interruption
|
|
8
|
+
* between create and complete.
|
|
9
|
+
*
|
|
10
|
+
* ```
|
|
11
|
+
* body ≤ partSize (buffered, or a stream that ends within one part) → single
|
|
12
|
+
* otherwise → create, parts, complete
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* A store supplies the protocol (its `single`, `create`, `part`, `complete`
|
|
16
|
+
* and `abort` calls); the in-memory store simulates S3's, and the S3 store
|
|
17
|
+
* (`effect-dynamodb/blob/s3`) speaks it. The driver never pre-checks S3's
|
|
18
|
+
* part limit: a part number past `maxParts` is the protocol's to refuse
|
|
19
|
+
* (`TooLarge`, naming the part size — diagnosed on failure).
|
|
20
|
+
*
|
|
21
|
+
* The body's checksum is the caller's (`BlobPutRequest.checksum`, resolved
|
|
22
|
+
* when the body ends): `complete` awaits it, so the driver computes none.
|
|
23
|
+
*
|
|
24
|
+
* Not part of the public API.
|
|
25
|
+
*/
|
|
26
|
+
import { Cause, Effect, Exit, Stream } from "effect";
|
|
27
|
+
/** S3's part limit: a multipart upload has at most 10,000 parts. */
|
|
28
|
+
export const MAX_PARTS = 10_000;
|
|
29
|
+
/** The default part size, 8 MiB (design §24.1). */
|
|
30
|
+
export const DEFAULT_PART_SIZE = 8 * 1024 * 1024;
|
|
31
|
+
/** S3's smallest part (but the last), 5 MiB. */
|
|
32
|
+
export const MIN_PART_SIZE = 5 * 1024 * 1024;
|
|
33
|
+
/** S3's largest part, 5 GiB. */
|
|
34
|
+
export const MAX_PART_SIZE = 5 * 1024 * 1024 * 1024;
|
|
35
|
+
/** The default number of parts uploaded at once. */
|
|
36
|
+
export const DEFAULT_UPLOAD_CONCURRENCY = 4;
|
|
37
|
+
/**
|
|
38
|
+
* The part size of a body of `contentLength` bytes (when known): `partSize`,
|
|
39
|
+
* raised to `ceil(contentLength / maxParts)` when that many parts would not
|
|
40
|
+
* hold it. An unknown length keeps `partSize`.
|
|
41
|
+
*/
|
|
42
|
+
export const partSizeFor = (partSize, contentLength, maxParts = MAX_PARTS) => contentLength === undefined ? partSize : Math.max(partSize, Math.ceil(contentLength / maxParts));
|
|
43
|
+
const concat = (chunks, length) => {
|
|
44
|
+
const out = new Uint8Array(length);
|
|
45
|
+
let offset = 0;
|
|
46
|
+
for (const chunk of chunks) {
|
|
47
|
+
out.set(chunk, offset);
|
|
48
|
+
offset += chunk.length;
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
};
|
|
52
|
+
const END = { _tag: "End" };
|
|
53
|
+
/**
|
|
54
|
+
* `body` as parts of exactly `size` bytes, the last shorter; an empty body
|
|
55
|
+
* is one empty part. A part is marked `last` only when the body **ended** —
|
|
56
|
+
* a failing body fails before its final part is emitted (Effect's own
|
|
57
|
+
* end-of-stream hooks also run on failure, so the end is an explicit marker
|
|
58
|
+
* concatenated after the body). Each part is a fresh array: a source that
|
|
59
|
+
* reuses its chunk buffers cannot change a part once emitted.
|
|
60
|
+
*/
|
|
61
|
+
export const rechunk = (body, size) => Stream.concat(Stream.map(body, (chunk) => ({ _tag: "Chunk", chunk })), Stream.succeed(END)).pipe(Stream.mapAccum(() => ({ chunks: [], length: 0, held: undefined }), (state, signal) => {
|
|
62
|
+
const parts = [];
|
|
63
|
+
let { chunks, length, held } = state;
|
|
64
|
+
if (signal._tag === "End") {
|
|
65
|
+
const tail = length > 0 ? concat(chunks, length) : undefined;
|
|
66
|
+
if (held !== undefined)
|
|
67
|
+
parts.push({ bytes: held, last: tail === undefined });
|
|
68
|
+
if (tail !== undefined || held === undefined) {
|
|
69
|
+
parts.push({ bytes: tail ?? new Uint8Array(0), last: true });
|
|
70
|
+
}
|
|
71
|
+
return [{ chunks: [], length: 0, held: undefined }, parts];
|
|
72
|
+
}
|
|
73
|
+
const { chunk } = signal;
|
|
74
|
+
let offset = 0;
|
|
75
|
+
while (length + (chunk.length - offset) >= size) {
|
|
76
|
+
const take = size - length;
|
|
77
|
+
chunks.push(chunk.slice(offset, offset + take));
|
|
78
|
+
offset += take;
|
|
79
|
+
if (held !== undefined)
|
|
80
|
+
parts.push({ bytes: held, last: false });
|
|
81
|
+
held = concat(chunks, size);
|
|
82
|
+
chunks = [];
|
|
83
|
+
length = 0;
|
|
84
|
+
}
|
|
85
|
+
if (offset < chunk.length) {
|
|
86
|
+
chunks.push(chunk.slice(offset));
|
|
87
|
+
length += chunk.length - offset;
|
|
88
|
+
}
|
|
89
|
+
return [{ chunks, length, held }, parts];
|
|
90
|
+
}));
|
|
91
|
+
/**
|
|
92
|
+
* Upload `body` (`contentLength` its length, when known) through `protocol`:
|
|
93
|
+
* one `single` call for a body of at most one part, else a multipart upload
|
|
94
|
+
* (design §7). Memory held is at most about `partSize × (concurrency + 2)`.
|
|
95
|
+
*/
|
|
96
|
+
export const upload = (body, contentLength, options, protocol) => Effect.suspend(() => {
|
|
97
|
+
const known = body instanceof Uint8Array ? body.length : contentLength;
|
|
98
|
+
const partSize = partSizeFor(options.partSize, known, options.maxParts ?? MAX_PARTS);
|
|
99
|
+
if (body instanceof Uint8Array && body.length <= partSize)
|
|
100
|
+
return protocol.single(body);
|
|
101
|
+
const source = body instanceof Uint8Array ? Stream.succeed(body) : body;
|
|
102
|
+
let created;
|
|
103
|
+
let completed = false;
|
|
104
|
+
const run = Effect.gen(function* () {
|
|
105
|
+
// Uninterruptible once started, so an upload S3 created is always known
|
|
106
|
+
// to the finalizer that aborts it.
|
|
107
|
+
const create = yield* Effect.cached(Effect.uninterruptible(Effect.tap(protocol.create, (handle) => Effect.sync(() => {
|
|
108
|
+
created = handle;
|
|
109
|
+
}))));
|
|
110
|
+
const outcomes = yield* rechunk(source, partSize).pipe(Stream.mapEffect(({ bytes, last }, i) => i === 0 && last
|
|
111
|
+
? Effect.map(protocol.single(bytes), (result) => ({ _tag: "Single", result }))
|
|
112
|
+
: Effect.flatMap(create, (handle) => Effect.map(protocol.part(handle, { number: i + 1, bytes, partSize }), (part) => ({
|
|
113
|
+
_tag: "Part",
|
|
114
|
+
part,
|
|
115
|
+
}))), { concurrency: options.concurrency }), Stream.runCollect);
|
|
116
|
+
const first = outcomes[0];
|
|
117
|
+
if (first === undefined) {
|
|
118
|
+
return yield* Effect.die(new Error("Multipart: a body gave no part"));
|
|
119
|
+
}
|
|
120
|
+
if (first._tag === "Single")
|
|
121
|
+
return first.result;
|
|
122
|
+
const handle = yield* create;
|
|
123
|
+
const parts = outcomes.flatMap((outcome) => (outcome._tag === "Part" ? [outcome.part] : []));
|
|
124
|
+
// Uninterruptible, with `completed` set in the same region: a sent
|
|
125
|
+
// Complete runs to its answer, and a completed upload is never aborted.
|
|
126
|
+
// An interruption that arrives meanwhile is delivered when the region
|
|
127
|
+
// ends, so the caller never sees that answer: the upload ledger reports
|
|
128
|
+
// an interrupted put by its key (`interrupted`).
|
|
129
|
+
return yield* Effect.uninterruptible(Effect.tap(protocol.complete(handle, parts), () => Effect.sync(() => {
|
|
130
|
+
completed = true;
|
|
131
|
+
})));
|
|
132
|
+
});
|
|
133
|
+
return run.pipe(Effect.onExit((exit) => {
|
|
134
|
+
const handle = created;
|
|
135
|
+
if (Exit.isSuccess(exit) || handle === undefined || completed)
|
|
136
|
+
return Effect.void;
|
|
137
|
+
return Effect.uninterruptible(protocol
|
|
138
|
+
.abort(handle)
|
|
139
|
+
.pipe(Effect.catchCause((cause) => Effect.logWarning(`effect-dynamodb: ${options.where} could not abort a multipart upload; a ` +
|
|
140
|
+
"lifecycle AbortIncompleteMultipartUpload rule reclaims its parts", Cause.squash(cause)))));
|
|
141
|
+
}));
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=Multipart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Multipart.js","sourceRoot":"","sources":["../../src/internal/Multipart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAGpD,oEAAoE;AACpE,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAA;AAC/B,mDAAmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;AAChD,gDAAgD;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;AAC5C,gCAAgC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AACnD,oDAAoD;AACpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAA;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,QAAgB,EAChB,aAAiC,EACjC,WAAmB,SAAS,EACpB,EAAE,CACV,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,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,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAC5F,mEAAmE;QACnE,wEAAwE;QACxE,sEAAsE;QACtE,wEAAwE;QACxE,iDAAiD;QACjD,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,eAAe,CAClC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,CAChD,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YACf,SAAS,GAAG,IAAI,CAAA;QAClB,CAAC,CAAC,CACH,CACF,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,CAAC,IAAI,CACb,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,MAAM,MAAM,GAAG,OAAO,CAAA;QACtB,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,MAAM,KAAK,SAAS,IAAI,SAAS;YAAE,OAAO,MAAM,CAAC,IAAI,CAAA;QACjF,OAAO,MAAM,CAAC,eAAe,CAC3B,QAAQ;aACL,KAAK,CAAC,MAAM,CAAC;aACb,IAAI,CACH,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE,CAC1B,MAAM,CAAC,UAAU,CACf,oBAAoB,OAAO,CAAC,KAAK,yCAAyC;YACxE,kEAAkE,EACpE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CACpB,CACF,CACF,CACJ,CAAA;IACH,CAAC,CAAC,CACH,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal Change detection over offloaded fields (#179, design §10.3,
|
|
3
|
+
* §10.4): what a write did to one offloaded field, read from the stored forms
|
|
4
|
+
* of its old and new values — never from the blob store — and the check that
|
|
5
|
+
* a DynamoDB Streams record carries the images change detection needs.
|
|
6
|
+
*
|
|
7
|
+
* - **Stored forms.** An offloaded attribute holds, by its stored form: a
|
|
8
|
+
* pointer (a `B` json pointer on an overflow attribute, `~edbp:` `S` text on
|
|
9
|
+
* a binary one), an inline value (an overflow field's JSON as `S`, or as a
|
|
10
|
+
* v1 `B` — its content the decompressed JSON; a binary field's bytes), a
|
|
11
|
+
* legacy native value (an overflow attribute written before `Packed`: a map,
|
|
12
|
+
* a list, …), `NULL`, or nothing.
|
|
13
|
+
* - **Classification** ({@link compareForms}, design §10.3's table): a pointer
|
|
14
|
+
* to the same ref is `unchanged`; equal checksum algorithm, checksum and
|
|
15
|
+
* content size elsewhere `rewritten` (probably identical, §5); an inline
|
|
16
|
+
* value against a pointer is compared by the CRC-64/NVME and size of its
|
|
17
|
+
* content, computed here; two inline values by their content bytes; legacy
|
|
18
|
+
* native values only with each other, structurally; anything else
|
|
19
|
+
* `changed`. `added` / `removed` when one side is absent.
|
|
20
|
+
* - **Records** ({@link recordImages}): `[EDD-9119]` when a record's
|
|
21
|
+
* `StreamViewType` is not `NEW_AND_OLD_IMAGES`, or a record lacks an image
|
|
22
|
+
* its event has (a `MODIFY` / `REMOVE` without `OldImage`, a `MODIFY` /
|
|
23
|
+
* `INSERT` without `NewImage`).
|
|
24
|
+
*
|
|
25
|
+
* Runtime-neutral, like `Offload.ts`, which re-exports {@link compareStored}:
|
|
26
|
+
* no AWS SDK and no Node builtin in its import graph (types included), so the
|
|
27
|
+
* attribute values it takes are typed structurally
|
|
28
|
+
* ({@link StoredAttributeValue}, which the SDK's `AttributeValue` fits).
|
|
29
|
+
*
|
|
30
|
+
* Not part of the public API.
|
|
31
|
+
*/
|
|
32
|
+
import { type CompressionRegistry } from "@effect-dynamodb/schema/Compression.js";
|
|
33
|
+
import { ValidationError } from "@effect-dynamodb/schema/Errors.js";
|
|
34
|
+
import { type BlobPointer } from "@effect-dynamodb/schema/internal/BlobPointer.js";
|
|
35
|
+
import { type OperationContext } from "@effect-dynamodb/schema/internal/PackedCodec.js";
|
|
36
|
+
import { Effect } from "effect";
|
|
37
|
+
import type { OffloadKind } from "./OffloadValues.js";
|
|
38
|
+
/**
|
|
39
|
+
* What a write did to one offloaded field, read from its stored forms
|
|
40
|
+
* (design §10.3):
|
|
41
|
+
*
|
|
42
|
+
* - `unchanged` — the same value: a pointer to the same object version, or
|
|
43
|
+
* inline values with the same content;
|
|
44
|
+
* - `rewritten` — **probably** the same content in another place: another
|
|
45
|
+
* version (or another stored form — inline, compressed — of it) with the
|
|
46
|
+
* same checksum algorithm, content checksum and content size. A checksum
|
|
47
|
+
* match is not proof (CRC-64/NVME can be matched by crafted content): a
|
|
48
|
+
* consumer that must not miss a change treats `rewritten` as `changed`, or
|
|
49
|
+
* compares the content;
|
|
50
|
+
* - `changed` — different content (or no way to compare: a legacy native
|
|
51
|
+
* value against any other form);
|
|
52
|
+
* - `added` / `removed` — the field is only in the new / old image.
|
|
53
|
+
*/
|
|
54
|
+
export type OffloadChange = "unchanged" | "rewritten" | "changed" | "added" | "removed";
|
|
55
|
+
/**
|
|
56
|
+
* One attribute value in DynamoDB JSON, as the SDK, DynamoDB Streams, Lambda
|
|
57
|
+
* and EventBridge Pipes deliver it — `B` / `BS` members as bytes or base64
|
|
58
|
+
* text. Structural, with every member optional, so the SDK's `AttributeValue`
|
|
59
|
+
* and Lambda's (`aws-lambda`) both fit; a value must still have exactly one
|
|
60
|
+
* member, or it fails with a `ValidationError` — a member set to `undefined`
|
|
61
|
+
* is not one (`{ S: "…", B: undefined }` is an `S` value).
|
|
62
|
+
*/
|
|
63
|
+
export type StoredAttributeValue = {
|
|
64
|
+
readonly S?: string | undefined;
|
|
65
|
+
readonly N?: string | undefined;
|
|
66
|
+
readonly B?: Uint8Array | string | undefined;
|
|
67
|
+
readonly BOOL?: boolean | undefined;
|
|
68
|
+
readonly NULL?: boolean | undefined;
|
|
69
|
+
readonly SS?: ReadonlyArray<string> | undefined;
|
|
70
|
+
readonly NS?: ReadonlyArray<string> | undefined;
|
|
71
|
+
readonly BS?: ReadonlyArray<Uint8Array | string> | undefined;
|
|
72
|
+
readonly M?: {
|
|
73
|
+
readonly [name: string]: StoredAttributeValue;
|
|
74
|
+
} | undefined;
|
|
75
|
+
readonly L?: ReadonlyArray<StoredAttributeValue> | undefined;
|
|
76
|
+
};
|
|
77
|
+
/** A DynamoDB Streams image: DynamoDB JSON, or an already-unmarshalled item. */
|
|
78
|
+
export type RecordImage = {
|
|
79
|
+
readonly [attribute: string]: unknown;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* A DynamoDB Streams record — only the members change detection and the
|
|
83
|
+
* blob reaper read. Structural: the SDK's `_Record` (the change feed's
|
|
84
|
+
* records), a Lambda `DynamoDBRecord`, an EventBridge Pipes record and a
|
|
85
|
+
* Kinesis Data Streams for DynamoDB record all fit.
|
|
86
|
+
*/
|
|
87
|
+
export interface StreamRecordLike {
|
|
88
|
+
readonly eventName?: string | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* The ARN of the stream the record was read from
|
|
91
|
+
* (`arn:…:dynamodb:…:table/<name>/stream/<label>`), as Lambda and
|
|
92
|
+
* EventBridge Pipes deliver it.
|
|
93
|
+
*/
|
|
94
|
+
readonly eventSourceARN?: string | undefined;
|
|
95
|
+
/** The table the record was written to, as a Kinesis Data Streams record carries it. */
|
|
96
|
+
readonly tableName?: string | undefined;
|
|
97
|
+
readonly dynamodb?: {
|
|
98
|
+
readonly Keys?: RecordImage | undefined;
|
|
99
|
+
readonly OldImage?: RecordImage | undefined;
|
|
100
|
+
readonly NewImage?: RecordImage | undefined;
|
|
101
|
+
readonly StreamViewType?: string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* A `Date` (the SDK), epoch seconds (DynamoDB Streams JSON: Lambda,
|
|
104
|
+
* Pipes), or epoch milliseconds or microseconds (Kinesis Data
|
|
105
|
+
* Streams, per `ApproximateCreationDateTimePrecision`).
|
|
106
|
+
*/
|
|
107
|
+
readonly ApproximateCreationDateTime?: Date | number | undefined;
|
|
108
|
+
/** `"MILLISECOND"` or `"MICROSECOND"`: a Kinesis Data Streams record's time unit. */
|
|
109
|
+
readonly ApproximateCreationDateTimePrecision?: string | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
}
|
|
112
|
+
/** The event and images of a record that passed {@link recordImages}. */
|
|
113
|
+
export interface RecordImages {
|
|
114
|
+
readonly eventName: "INSERT" | "MODIFY" | "REMOVE";
|
|
115
|
+
/** A `MODIFY` / `REMOVE` record's `OldImage`; `undefined` for an `INSERT`. */
|
|
116
|
+
readonly oldImage: RecordImage | undefined;
|
|
117
|
+
/** An `INSERT` / `MODIFY` record's `NewImage`; `undefined` for a `REMOVE`. */
|
|
118
|
+
readonly newImage: RecordImage | undefined;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The event and images of `record`, or why it cannot be read: `[EDD-9119]`
|
|
122
|
+
* when it lacks the images change detection (and the reaper) need — its
|
|
123
|
+
* `StreamViewType` is not `NEW_AND_OLD_IMAGES`, or it lacks an image its
|
|
124
|
+
* event has (design §10.4) — and a plain reason for a record that is not
|
|
125
|
+
* one (no event name of DynamoDB's, an image that is not an object).
|
|
126
|
+
* `consumer` names the caller in the message. A `StreamViewType` is checked
|
|
127
|
+
* when present; the images always, so a record whose view type an input
|
|
128
|
+
* template stripped is still caught. An `INSERT`'s `OldImage` and a
|
|
129
|
+
* `REMOVE`'s `NewImage` are ignored.
|
|
130
|
+
*/
|
|
131
|
+
export declare const recordImages: (record: StreamRecordLike, consumer: string) => RecordImages | string;
|
|
132
|
+
/** One side of a comparison: an offloaded attribute's value, by its stored form. */
|
|
133
|
+
export type StoredForm = {
|
|
134
|
+
readonly _tag: "absent";
|
|
135
|
+
} | {
|
|
136
|
+
readonly _tag: "null";
|
|
137
|
+
} | {
|
|
138
|
+
readonly _tag: "pointer";
|
|
139
|
+
readonly pointer: BlobPointer;
|
|
140
|
+
}
|
|
141
|
+
/** The content the checksum covers: the JSON's UTF-8 bytes (overflow), the bytes (binary). */
|
|
142
|
+
| {
|
|
143
|
+
readonly _tag: "inline";
|
|
144
|
+
readonly content: Uint8Array;
|
|
145
|
+
}
|
|
146
|
+
/** A legacy native value of an overflow attribute, in DynamoDB JSON. */
|
|
147
|
+
| {
|
|
148
|
+
readonly _tag: "native";
|
|
149
|
+
readonly value: StoredAttributeValue;
|
|
150
|
+
};
|
|
151
|
+
/** The form of an attribute an image does not hold. */
|
|
152
|
+
export declare const ABSENT: StoredForm;
|
|
153
|
+
/**
|
|
154
|
+
* The stored form of an offloaded attribute's value in DynamoDB JSON (`B` as
|
|
155
|
+
* bytes or base64 text): `undefined` is absent. In DynamoDB JSON the `S` /
|
|
156
|
+
* `B` tag says what the value is.
|
|
157
|
+
*/
|
|
158
|
+
export declare const formOfAttributeValue: (value: unknown, kind: OffloadKind, registry: CompressionRegistry, ctx: OperationContext, attribute: string) => StoredForm | ValidationError;
|
|
159
|
+
/**
|
|
160
|
+
* The stored form of an offloaded attribute's value in an unmarshalled item
|
|
161
|
+
* (`string` for `S`, `Uint8Array` for `B`): `undefined` is absent. In an
|
|
162
|
+
* unmarshalled stream **image** (`image`), a `B` value may arrive as base64
|
|
163
|
+
* text — on an overflow attribute a string starting with `I`–`X` (which JSON
|
|
164
|
+
* text never does), on a binary one any string but a `~edbp:` pointer (§4.3).
|
|
165
|
+
* A legacy native value is marshalled by `marshal` to be compared.
|
|
166
|
+
*/
|
|
167
|
+
export declare const formOfUnmarshalled: (value: unknown, kind: OffloadKind, image: boolean, marshal: (value: unknown) => unknown, registry: CompressionRegistry, ctx: OperationContext, attribute: string) => StoredForm | ValidationError;
|
|
168
|
+
/**
|
|
169
|
+
* What the change from `before` to `after` did to the field (design §10.3;
|
|
170
|
+
* see {@link OffloadChange}). Both absent: `unchanged`.
|
|
171
|
+
*/
|
|
172
|
+
export declare const compareForms: (before: StoredForm, after: StoredForm) => OffloadChange;
|
|
173
|
+
/**
|
|
174
|
+
* What a change did to one offloaded field, from the stored attribute values
|
|
175
|
+
* of its old and new images (DynamoDB JSON, `B` as bytes or base64 text;
|
|
176
|
+
* `undefined` when the image has no such attribute) — see
|
|
177
|
+
* {@link OffloadChange}. `kind` is the field's: `"overflow"`
|
|
178
|
+
* (`Packed({ external })`) or `"binary"` (`External`). Never touches the blob
|
|
179
|
+
* store; an inline compressed value is decompressed with the `Compression`
|
|
180
|
+
* service in scope to checksum its content (without the codec: a
|
|
181
|
+
* `ValidationError` whose `cause` is a `CompressorNotRegistered`). A value
|
|
182
|
+
* that is not a stored form of `kind` (a malformed pointer, an `S` value on a
|
|
183
|
+
* binary attribute that is not a pointer, a binary field's `~edbp:` text on
|
|
184
|
+
* an overflow attribute) fails with a `ValidationError`.
|
|
185
|
+
*/
|
|
186
|
+
export declare const compareStored: (oldValue: StoredAttributeValue | undefined, newValue: StoredAttributeValue | undefined, kind: OffloadKind) => Effect.Effect<OffloadChange, ValidationError>;
|
|
187
|
+
//# sourceMappingURL=OffloadChange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OffloadChange.d.ts","sourceRoot":"","sources":["../../src/internal/OffloadChange.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,iDAAiD,CAAA;AAExD,OAAO,EAEL,KAAK,gBAAgB,EAGtB,MAAM,iDAAiD,CAAA;AACxD,OAAO,EAAW,MAAM,EAAU,MAAM,QAAQ,CAAA;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAMrD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,aAA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