effect-dynamodb 1.9.5 → 1.11.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.
Files changed (42) hide show
  1. package/dist/Aggregate.d.ts.map +1 -1
  2. package/dist/Aggregate.js +5 -42
  3. package/dist/Aggregate.js.map +1 -1
  4. package/dist/DynamoClient.d.ts +88 -5
  5. package/dist/DynamoClient.d.ts.map +1 -1
  6. package/dist/DynamoClient.js +158 -4
  7. package/dist/DynamoClient.js.map +1 -1
  8. package/dist/Entity.d.ts +35 -17
  9. package/dist/Entity.d.ts.map +1 -1
  10. package/dist/Entity.js +503 -16
  11. package/dist/Entity.js.map +1 -1
  12. package/dist/Table.d.ts +78 -0
  13. package/dist/Table.d.ts.map +1 -1
  14. package/dist/Table.js +153 -0
  15. package/dist/Table.js.map +1 -1
  16. package/dist/VectorSearchEmulation.d.ts +101 -0
  17. package/dist/VectorSearchEmulation.d.ts.map +1 -0
  18. package/dist/VectorSearchEmulation.js +290 -0
  19. package/dist/VectorSearchEmulation.js.map +1 -0
  20. package/dist/index.d.ts +9 -2
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +4 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/internal/BoundCrud.d.ts +62 -48
  25. package/dist/internal/BoundCrud.d.ts.map +1 -1
  26. package/dist/internal/BoundCrud.js +7 -1
  27. package/dist/internal/BoundCrud.js.map +1 -1
  28. package/dist/internal/BoundVectorQuery.d.ts +130 -0
  29. package/dist/internal/BoundVectorQuery.d.ts.map +1 -0
  30. package/dist/internal/BoundVectorQuery.js +257 -0
  31. package/dist/internal/BoundVectorQuery.js.map +1 -0
  32. package/dist/internal/EntityCombinators.d.ts +16 -0
  33. package/dist/internal/EntityCombinators.d.ts.map +1 -1
  34. package/dist/internal/EntityCombinators.js +25 -1
  35. package/dist/internal/EntityCombinators.js.map +1 -1
  36. package/dist/internal/EntityOps.d.ts +19 -6
  37. package/dist/internal/EntityOps.d.ts.map +1 -1
  38. package/dist/internal/EntityOps.js +5 -2
  39. package/dist/internal/EntityOps.js.map +1 -1
  40. package/dist/internal/TransactableOps.d.ts +1 -1
  41. package/dist/internal/TransactableOps.d.ts.map +1 -1
  42. package/package.json +6 -6
@@ -0,0 +1,290 @@
1
+ /**
2
+ * VectorSearchEmulation — a local stand-in for DynamoDB `SearchVectors`.
3
+ *
4
+ * DynamoDB Local does not implement vector search: `CreateTable` silently
5
+ * accepts and discards `VectorIndexes`, and `SearchVectors` fails with
6
+ * `UnknownOperationException`. LocalStack wraps DynamoDB Local and inherits the
7
+ * gap. Without an emulation layer there is no way to exercise the full
8
+ * write → search round trip without an AWS account, which would leave the most
9
+ * interesting half of the feature untested.
10
+ *
11
+ * This layer wraps a `DynamoClient` layer and replaces `searchVectors` with a
12
+ * Scan + brute-force implementation. Every other operation passes through
13
+ * untouched, so the same layer stack serves the connected suite and the
14
+ * runnable example.
15
+ *
16
+ * Fidelity is deliberate, not approximate: all three distance functions are
17
+ * computed exactly as the developer guide documents them (including the score
18
+ * DIRECTIONS, which differ), the HASH/INLINE_FILTER equality predicates are
19
+ * evaluated, `ProjectionExpression` is honoured, and results are truncated to
20
+ * `TopK`. The ranking output is unit-tested against the developer guide's
21
+ * reference table.
22
+ *
23
+ * What it does NOT emulate: approximate (as opposed to exact) nearest-neighbour
24
+ * behaviour, backfill states, or consumed-capacity reporting. An emulated search
25
+ * is an exhaustive scan, so it is exact and slow — correct for tests, useless
26
+ * for load.
27
+ *
28
+ * See `DESIGN.md §14 Vector Search`.
29
+ */
30
+ import { DynamoValidationError } from "@effect-dynamodb/schema/Errors.js";
31
+ import { vectorAttributeName } from "@effect-dynamodb/schema/VectorIndex.js";
32
+ import { Effect, Layer } from "effect";
33
+ import { DynamoClient } from "./DynamoClient.js";
34
+ import { mergeVectorIndexes } from "./Table.js";
35
+ /** @internal Build the IndexName → {vectorAttribute, distance} registry. */
36
+ const buildRegistry = (options) => {
37
+ const registry = new Map();
38
+ for (const table of Object.values(options?.tables ?? {})) {
39
+ const merged = mergeVectorIndexes(table.entities);
40
+ for (const [indexName, entry] of merged) {
41
+ registry.set(indexName, toEmulated(entry.definition, entry.filters.map(entry.resolveDbName)));
42
+ }
43
+ }
44
+ for (const [indexName, entry] of Object.entries(options?.indexes ?? {})) {
45
+ registry.set(indexName, entry);
46
+ }
47
+ return registry;
48
+ };
49
+ /** @internal */
50
+ const toEmulated = (definition, filterAttributes) => ({
51
+ vectorAttribute: definition.vectorField,
52
+ distance: definition.distance,
53
+ partitionAttribute: definition.partitionField,
54
+ filterAttributes,
55
+ });
56
+ // ---------------------------------------------------------------------------
57
+ // Distance functions — see the reference table in DESIGN.md §14
58
+ // ---------------------------------------------------------------------------
59
+ /** @internal Dot product. Higher is more similar; may be negative. */
60
+ export const dotProduct = (a, b) => {
61
+ let sum = 0;
62
+ for (let i = 0; i < a.length; i++)
63
+ sum += (a[i] ?? 0) * (b[i] ?? 0);
64
+ return sum;
65
+ };
66
+ /**
67
+ * @internal Cosine DISTANCE (`1 - cosine similarity`), range 0…2.
68
+ * Lower is more similar — the same direction DynamoDB reports.
69
+ */
70
+ export const cosineDistance = (a, b) => {
71
+ const magnitudeA = Math.sqrt(dotProduct(a, a));
72
+ const magnitudeB = Math.sqrt(dotProduct(b, b));
73
+ if (magnitudeA === 0 || magnitudeB === 0)
74
+ return 1;
75
+ return 1 - dotProduct(a, b) / (magnitudeA * magnitudeB);
76
+ };
77
+ /** @internal Euclidean (L2) distance, range 0…∞. Lower is more similar. */
78
+ export const euclideanDistance = (a, b) => {
79
+ let sum = 0;
80
+ for (let i = 0; i < Math.max(a.length, b.length); i++) {
81
+ const delta = (a[i] ?? 0) - (b[i] ?? 0);
82
+ sum += delta * delta;
83
+ }
84
+ return Math.sqrt(sum);
85
+ };
86
+ /** @internal Score a candidate exactly as DynamoDB would report it. */
87
+ export const scoreVector = (query, candidate, distance) => {
88
+ switch (distance) {
89
+ case "cosine":
90
+ return cosineDistance(query, candidate);
91
+ case "euclidean":
92
+ return euclideanDistance(query, candidate);
93
+ case "dotProduct":
94
+ return dotProduct(query, candidate);
95
+ }
96
+ };
97
+ /**
98
+ * @internal Is a LOWER raw score more similar for this distance function?
99
+ * COSINE and EUCLIDEAN report distances; DOT_PRODUCT reports a similarity.
100
+ */
101
+ const lowerIsCloser = (distance) => distance !== "dotProduct";
102
+ // ---------------------------------------------------------------------------
103
+ // AttributeValue helpers
104
+ // ---------------------------------------------------------------------------
105
+ /** @internal Read a stored embedding (`L` of `N`) out of an item. */
106
+ const readVector = (value) => {
107
+ if (value === undefined)
108
+ return undefined;
109
+ if (value.L !== undefined) {
110
+ const numbers = value.L.map((element) => Number(element.N));
111
+ return numbers.some((n) => Number.isNaN(n)) ? undefined : numbers;
112
+ }
113
+ if (value.NS !== undefined)
114
+ return value.NS.map((n) => Number(n));
115
+ return undefined;
116
+ };
117
+ /** @internal Structural equality over the scalar AttributeValue shapes. */
118
+ const attributeEquals = (a, b) => {
119
+ if (a === undefined || b === undefined)
120
+ return false;
121
+ if (a.S !== undefined || b.S !== undefined)
122
+ return a.S === b.S;
123
+ if (a.N !== undefined || b.N !== undefined)
124
+ return Number(a.N) === Number(b.N);
125
+ if (a.BOOL !== undefined || b.BOOL !== undefined)
126
+ return a.BOOL === b.BOOL;
127
+ return JSON.stringify(a) === JSON.stringify(b);
128
+ };
129
+ /**
130
+ * @internal Parse the equality-only `SearchConditionExpression`.
131
+ *
132
+ * The expression grammar the library emits (and the only one the API supports)
133
+ * is a conjunction of `#name = :value` terms, so a split is a complete parser
134
+ * rather than a shortcut. Anything unrecognised is skipped rather than throwing:
135
+ * an over-permissive emulator surfaces as a failed assertion in the test that
136
+ * cares, which is easier to debug than a parse error from a layer.
137
+ */
138
+ const parseEqualityConditions = (expression, names, values) => {
139
+ if (!expression)
140
+ return [];
141
+ const conditions = [];
142
+ for (const term of expression.split(/\s+AND\s+/i)) {
143
+ const match = term.trim().match(/^([#\w.]+)\s*=\s*(:[\w]+)$/);
144
+ if (!match)
145
+ continue;
146
+ const rawName = match[1];
147
+ const rawValue = match[2];
148
+ const attribute = rawName.startsWith("#") ? (names?.[rawName] ?? rawName) : rawName;
149
+ const value = values?.[rawValue];
150
+ if (value === undefined)
151
+ continue;
152
+ conditions.push({ attribute, value });
153
+ }
154
+ return conditions;
155
+ };
156
+ /** @internal Resolve a `ProjectionExpression` into concrete attribute names. */
157
+ const parseProjection = (expression, names) => {
158
+ if (!expression)
159
+ return undefined;
160
+ return expression
161
+ .split(",")
162
+ .map((part) => part.trim())
163
+ .filter((part) => part.length > 0)
164
+ .map((part) => (part.startsWith("#") ? (names?.[part] ?? part) : part));
165
+ };
166
+ // ---------------------------------------------------------------------------
167
+ // Emulated searchVectors
168
+ // ---------------------------------------------------------------------------
169
+ /**
170
+ * Wrap a {@link DynamoClientService} so `searchVectors` is emulated locally.
171
+ * Every other operation delegates to the wrapped service unchanged.
172
+ */
173
+ export const wrap = (service, options) => {
174
+ const registry = buildRegistry(options);
175
+ return {
176
+ ...service,
177
+ // Real DynamoDB REQUIRES every vector SearchSchema element in
178
+ // AttributeDefinitions; DynamoDB Local discards `VectorIndexes`, sees those
179
+ // definitions as unreferenced, and rejects the table ("The number of
180
+ // attributes in key schema must match..."). The two backends demand
181
+ // incompatible inputs, so the emulation strips the vector-only parts down
182
+ // to what DynamoDB Local understands.
183
+ createTable: (input) => {
184
+ if (input.VectorIndexes === undefined)
185
+ return service.createTable(input);
186
+ const referenced = new Set([
187
+ ...(input.KeySchema ?? []),
188
+ ...(input.GlobalSecondaryIndexes ?? []).flatMap((gsi) => gsi.KeySchema ?? []),
189
+ ...(input.LocalSecondaryIndexes ?? []).flatMap((lsi) => lsi.KeySchema ?? []),
190
+ ].flatMap((element) => (element.AttributeName ? [element.AttributeName] : [])));
191
+ const { VectorIndexes: _dropped, ...rest } = input;
192
+ return service.createTable({
193
+ ...rest,
194
+ AttributeDefinitions: (input.AttributeDefinitions ?? []).filter((definition) => definition.AttributeName !== undefined && referenced.has(definition.AttributeName)),
195
+ });
196
+ },
197
+ updateTable: (input) => {
198
+ if (input.VectorIndexUpdates === undefined)
199
+ return service.updateTable(input);
200
+ const { AttributeDefinitions: _defs, VectorIndexUpdates: _updates, ...rest } = input;
201
+ const hasOtherUpdates = Object.keys(rest).some((key) => key !== "TableName");
202
+ // A pure vector-index update has nothing DynamoDB Local can apply —
203
+ // succeed as a no-op so `addVectorIndex` stays usable in local stacks.
204
+ return hasOtherUpdates
205
+ ? service.updateTable(rest)
206
+ : Effect.succeed({ $metadata: {} });
207
+ },
208
+ searchVectors: (input) => Effect.gen(function* () {
209
+ const indexName = input.IndexName ?? "";
210
+ const index = registry.get(indexName) ?? {
211
+ vectorAttribute: vectorAttributeName(indexName),
212
+ distance: "cosine",
213
+ };
214
+ const queryVector = (input.SearchVector ?? []).map((element) => Number(element.N));
215
+ const conditions = parseEqualityConditions(input.SearchConditionExpression, input.ExpressionAttributeNames, input.ExpressionAttributeValues);
216
+ const projection = parseProjection(input.ProjectionExpression, input.ExpressionAttributeNames);
217
+ const topK = input.TopK ?? 10;
218
+ // Real DynamoDB rejects a SearchConditionExpression that names an
219
+ // attribute which is not the HASH element or a declared INLINE_FILTER.
220
+ // Reproduce that here — an over-permissive emulator would let an
221
+ // undeclared filter pass every local test and fail only in production.
222
+ if (index.filterAttributes !== undefined) {
223
+ const allowed = new Set(index.filterAttributes);
224
+ if (index.partitionAttribute !== undefined)
225
+ allowed.add(index.partitionAttribute);
226
+ for (const condition of conditions) {
227
+ if (allowed.has(condition.attribute))
228
+ continue;
229
+ return yield* new DynamoValidationError({
230
+ operation: "SearchVectors",
231
+ cause: `Attribute "${condition.attribute}" is not a HASH or INLINE_FILTER element of ` +
232
+ `vector index "${indexName}". Declared: ${[...allowed].sort().join(", ")}.`,
233
+ });
234
+ }
235
+ }
236
+ // Exhaustive scan — the emulator trades speed for exactness.
237
+ const candidates = [];
238
+ let exclusiveStartKey;
239
+ do {
240
+ const page = yield* service.scan({
241
+ TableName: input.TableName,
242
+ ExclusiveStartKey: exclusiveStartKey,
243
+ });
244
+ for (const item of page.Items ?? []) {
245
+ const record = item;
246
+ // Sparse index semantics: no embedding ⇒ not in the index.
247
+ const stored = readVector(record[index.vectorAttribute]);
248
+ if (stored === undefined)
249
+ continue;
250
+ if (!conditions.every((c) => attributeEquals(record[c.attribute], c.value)))
251
+ continue;
252
+ candidates.push({
253
+ item: record,
254
+ score: scoreVector(queryVector, stored, index.distance),
255
+ });
256
+ }
257
+ exclusiveStartKey = page.LastEvaluatedKey;
258
+ } while (exclusiveStartKey !== undefined);
259
+ candidates.sort((a, b) => lowerIsCloser(index.distance) ? a.score - b.score : b.score - a.score);
260
+ return {
261
+ $metadata: {},
262
+ SearchResults: candidates.slice(0, topK).map(({ item, score }) => ({
263
+ Item: projection === undefined ? item : project(item, projection),
264
+ Score: score,
265
+ })),
266
+ };
267
+ }),
268
+ };
269
+ };
270
+ /** @internal Reduce an item to the projected attributes. */
271
+ const project = (item, attributes) => {
272
+ const projected = {};
273
+ for (const attribute of attributes) {
274
+ const value = item[attribute];
275
+ if (value !== undefined)
276
+ projected[attribute] = value;
277
+ }
278
+ return projected;
279
+ };
280
+ /**
281
+ * Wrap a `DynamoClient` layer so `searchVectors` is emulated locally.
282
+ *
283
+ * @example
284
+ * ```typescript
285
+ * const DdbLocal = DynamoClient.layer({ region: "us-east-1", endpoint: "http://localhost:8000" })
286
+ * const Emulated = VectorSearchEmulation.layer(DdbLocal, { tables: { MainTable } })
287
+ * ```
288
+ */
289
+ export const layer = (inner, options) => Layer.effect(DynamoClient, Effect.map(DynamoClient, (service) => wrap(service, options))).pipe(Layer.provide(inner));
290
+ //# sourceMappingURL=VectorSearchEmulation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VectorSearchEmulation.js","sourceRoot":"","sources":["../src/VectorSearchEmulation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAUH,OAAO,EAAE,qBAAqB,EAAE,M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CAAA;AAED,4DAA4D;AAC5D,MAAM,OAAO,GAAG,CACd,IAAoC,EACpC,UAAiC,EACD,EAAE;IAClC,MAAM,SAAS,GAAmC,EAAE,CAAA;IACpD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAA;QAC7B,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;IACvD,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,KAAsC,EACtC,OAA0B,EACO,EAAE,CACnC,KAAK,CAAC,MAAM,CACV,YAAY,EACZ,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAC9D,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAoC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,16 @@
1
1
  export * as DynamoModel from "@effect-dynamodb/schema/DynamoModel.js";
2
2
  export type { Casing, DynamoSchema as DynamoSchemaType, } from "@effect-dynamodb/schema/DynamoSchema.js";
3
3
  export * as DynamoSchema from "@effect-dynamodb/schema/DynamoSchema.js";
4
- export { AggregateAssemblyError, AggregateDecompositionError, AggregateTransactionOverflow, CascadePartialFailure, CompositeKeyHoleError, CompositeNullableError, ConditionalCheckFailed, DynamoError, DynamoValidationError, InternalServerError, ItemDeleted, ItemNotDeleted, ItemNotFound, makeCompositeKeyHoleError, makeCompositeNullableError, OptimisticLockError, RefNotFound, ResourceNotFoundError, StaleAppend, ThrottlingError, TransactionCancelled, TransactionOverflow, UniqueConstraintViolation, ValidationError, VersionConflict, } from "@effect-dynamodb/schema/Errors.js";
5
- export type { AppendInputType, AppendSuccess, EntityInputType, EntityKeyType, EntityRecordType, EntityRefInputType, EntityRefUpdateType, EntityUpdateType, IndexPkComposites, IndexPkInput, IndexSkComposites, ModelType, PrimaryKeyComposites, RefErrors, SystemFieldsType, } from "@effect-dynamodb/schema/internal/EntityTypes.js";
4
+ export type { EmbedderService } from "@effect-dynamodb/schema/Embedder.js";
5
+ export { Embedder } from "@effect-dynamodb/schema/Embedder.js";
6
+ export { AggregateAssemblyError, AggregateDecompositionError, AggregateTransactionOverflow, CascadePartialFailure, CompositeKeyHoleError, CompositeNullableError, ConditionalCheckFailed, DynamoError, DynamoValidationError, EmbeddingError, InternalServerError, ItemDeleted, ItemNotDeleted, ItemNotFound, makeCompositeKeyHoleError, makeCompositeNullableError, OptimisticLockError, RefNotFound, ResourceNotFoundError, StaleAppend, ThrottlingError, TransactionCancelled, TransactionOverflow, UniqueConstraintViolation, ValidationError, VectorIndexBackfilling, VersionConflict, } from "@effect-dynamodb/schema/Errors.js";
7
+ export type { AppendInputType, AppendSuccess, EntityInputType, EntityKeyType, EntityRecordType, EntityRefInputType, EntityRefUpdateType, EntityUpdateType, IndexPkComposites, IndexPkInput, IndexSkComposites, ModelType, PrimaryKeyComposites, RefErrors, SystemFieldsType, VectorErrors, } from "@effect-dynamodb/schema/internal/EntityTypes.js";
6
8
  export type { GsiConfig, IndexDefinition, KeyPart } from "@effect-dynamodb/schema/KeyComposer.js";
7
9
  export * as KeyComposer from "@effect-dynamodb/schema/KeyComposer.js";
8
10
  export type { ProjectionResult } from "@effect-dynamodb/schema/Projection.js";
9
11
  export * as Projection from "@effect-dynamodb/schema/Projection.js";
12
+ export type { DistanceFunction, Similarity, VectorFilterInput, VectorFilterOperand, VectorIndexConfig, VectorIndexDefinition, VectorSourceConfig, } from "@effect-dynamodb/schema/VectorIndex.js";
13
+ export * as VectorIndex from "@effect-dynamodb/schema/VectorIndex.js";
10
14
  export type { BoundAggregate } from "./Aggregate.js";
11
15
  export * as Aggregate from "./Aggregate.js";
12
16
  export type { BatchRetryConfig } from "./Batch.js";
@@ -22,6 +26,7 @@ export type { ConditionInput, ExpressionResult, UpdateInput, } from "./Expressio
22
26
  export * as Expression from "./Expression.js";
23
27
  export type { BoundQuery, BoundQueryBase, BoundQueryWithWhere, SkConditionOps, } from "./internal/BoundQuery.js";
24
28
  export { makeBoundQuery } from "./internal/BoundQuery.js";
29
+ export type { BoundVectorQuery, BoundVectorQueryCombinators, BoundVectorQueryTerminals, BoundVectorQueryWithPartition, VectorHit, VectorSearchError, } from "./internal/BoundVectorQuery.js";
25
30
  export type { CompileResult, ConditionOps, ConditionShorthand, Expr, } from "./internal/Expr.js";
26
31
  export { compileExpr, createConditionOps, isExpr, parseShorthand, parseSimpleShorthand, } from "./internal/Expr.js";
27
32
  export type { ArrayPath, DeepPick, Path, PathBuilder, PathKeys, SizeOperand, } from "./internal/PathBuilder.js";
@@ -32,4 +37,6 @@ export type { Table as TableType, TableConfig } from "./Table.js";
32
37
  export * as Table from "./Table.js";
33
38
  export type { ConditionCheckOp } from "./Transaction.js";
34
39
  export * as Transaction from "./Transaction.js";
40
+ export type { EmulatedVectorIndex, EmulationOptions, } from "./VectorSearchEmulation.js";
41
+ export * as VectorSearchEmulation from "./VectorSearchEmulation.js";
35
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,wCAAwC,CAAA;AACrE,YAAY,EACV,MAAM,EACN,YAAY,IAAI,gBAAgB,GACjC,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,YAAY,MAAM,yCAAyC,CAAA;AACvE,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,yBAAyB,EACzB,0BAA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WAAW,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClF,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,YAAY,EAAE,KAAK,IAAI,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,YAAY,EACV,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAA"}
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  export * as DynamoModel from "@effect-dynamodb/schema/DynamoModel.js";
2
2
  export * as DynamoSchema from "@effect-dynamodb/schema/DynamoSchema.js";
3
- export { AggregateAssemblyError, AggregateDecompositionError, AggregateTransactionOverflow, CascadePartialFailure, CompositeKeyHoleError, CompositeNullableError, ConditionalCheckFailed, DynamoError, DynamoValidationError, InternalServerError, ItemDeleted, ItemNotDeleted, ItemNotFound, makeCompositeKeyHoleError, makeCompositeNullableError, OptimisticLockError, RefNotFound, ResourceNotFoundError, StaleAppend, ThrottlingError, TransactionCancelled, TransactionOverflow, UniqueConstraintViolation, ValidationError, VersionConflict, } from "@effect-dynamodb/schema/Errors.js";
3
+ export { Embedder } from "@effect-dynamodb/schema/Embedder.js";
4
+ export { AggregateAssemblyError, AggregateDecompositionError, AggregateTransactionOverflow, CascadePartialFailure, CompositeKeyHoleError, CompositeNullableError, ConditionalCheckFailed, DynamoError, DynamoValidationError, EmbeddingError, InternalServerError, ItemDeleted, ItemNotDeleted, ItemNotFound, makeCompositeKeyHoleError, makeCompositeNullableError, OptimisticLockError, RefNotFound, ResourceNotFoundError, StaleAppend, ThrottlingError, TransactionCancelled, TransactionOverflow, UniqueConstraintViolation, ValidationError, VectorIndexBackfilling, VersionConflict, } from "@effect-dynamodb/schema/Errors.js";
4
5
  export * as KeyComposer from "@effect-dynamodb/schema/KeyComposer.js";
5
6
  export * as Projection from "@effect-dynamodb/schema/Projection.js";
7
+ export * as VectorIndex from "@effect-dynamodb/schema/VectorIndex.js";
6
8
  export * as Aggregate from "./Aggregate.js";
7
9
  export * as Batch from "./Batch.js";
8
10
  export * as Collection from "./Collection.js";
@@ -17,4 +19,5 @@ export * as Marshaller from "./Marshaller.js";
17
19
  export * as Query from "./Query.js";
18
20
  export * as Table from "./Table.js";
19
21
  export * as Transaction from "./Transaction.js";
22
+ export * as VectorSearchEmulation from "./VectorSearchEmulation.js";
20
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,wCAAwC,CAAA;AAKrE,OAAO,KAAK,YAAY,MAAM,yCAAyC,CAAA;AACvE,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,yBAAyB,EACzB,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,eAAe,GAChB,MAAM,mCAAmC,CAAA;AAmB1C,OAAO,KAAK,WAAW,MAAM,wCAAwC,CAAA;AAErE,OAAO,KAAK,UAAU,MAAM,uCAAuC,CAAA;AAEnE,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,UA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AAO,KAAK,WAAW,MAAM,wCAAwC,CAAA;AAErE,OAAO,KAAK,UAAU,MAAM,uCAAuC,CAAA;AAUnE,OAAO,KAAK,WAAW,MAAM,wCAAwC,CAAA;AAErE,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAQ7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAUhD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAM7C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAO7C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAezD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,cAAc,EACd,oBAAoB,GACrB,MAAM,oBAAoB,CAAA;AAS3B,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClF,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAK/C,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAA"}
@@ -32,20 +32,27 @@ export interface BoundCrudConfig<Model> {
32
32
  * yield* db.entities.Users.create(input).condition((t, { eq }) => eq(t.status, "active"))
33
33
  * ```
34
34
  */
35
- export interface BoundPut<Model, A, E> extends Pipeable.Pipeable {
35
+ export interface BoundPut<Model, A, E, VN extends string = string> extends Pipeable.Pipeable {
36
36
  /** Add a condition expression. Callback or shorthand. */
37
- readonly condition: (cond: ConditionArg<Model>) => BoundPut<Model, A, E>;
37
+ readonly condition: (cond: ConditionArg<Model>) => BoundPut<Model, A, E, VN>;
38
+ /**
39
+ * Supply a pre-computed embedding for a named vector index, skipping the
40
+ * `Embedder` for that index on this write. `name` is the LOGICAL vector index
41
+ * name declared on `Entity.make({ vectorIndexes })`.
42
+ */
43
+ readonly withVector: (name: VN, vector: ReadonlyArray<number>) => BoundPut<Model, A, E, VN>;
38
44
  /** Convert to an executable Effect for Effect combinator interop. */
39
45
  readonly asEffect: () => Effect.Effect<A, E, never>;
40
46
  /** Yield support for `Effect.gen`. */
41
47
  readonly [Symbol.iterator]: () => Iterator<Effect.Effect<A, E, never>, A>;
42
48
  }
43
49
  /** @internal */
44
- export declare class BoundPutImpl<Model, A, E> implements BoundPut<Model, A, E> {
50
+ export declare class BoundPutImpl<Model, A, E, VN extends string = string> implements BoundPut<Model, A, E, VN> {
45
51
  readonly _op: EntityPut<A, any, E, any>;
46
52
  readonly _config: BoundCrudConfig<Model>;
47
53
  constructor(_op: EntityPut<A, any, E, any>, _config: BoundCrudConfig<Model>);
48
- condition(cond: ConditionArg<Model>): BoundPutImpl<Model, A, E>;
54
+ condition(cond: ConditionArg<Model>): BoundPutImpl<Model, A, E, VN>;
55
+ withVector(name: VN, vector: ReadonlyArray<number>): BoundPutImpl<Model, A, E, VN>;
49
56
  asEffect(): Effect.Effect<A, E, never>;
50
57
  [Symbol.iterator](): any;
51
58
  pipe(): unknown;
@@ -94,105 +101,112 @@ export declare class BoundDeleteImpl<Model, E> implements BoundDelete<Model, E>
94
101
  * .remove(["temporaryFlag"])
95
102
  * ```
96
103
  */
97
- export interface BoundUpdate<Model, A, U, E> extends Pipeable.Pipeable {
104
+ export interface BoundUpdate<Model, A, U, E, VN extends string = string> extends Pipeable.Pipeable {
98
105
  /** Set the fields to update (record-based SET). */
99
- readonly set: (updates: U) => BoundUpdate<Model, A, U, E>;
106
+ readonly set: (updates: U) => BoundUpdate<Model, A, U, E, VN>;
100
107
  /** Remove attributes (REMOVE clause). */
101
- readonly remove: (fields: ReadonlyArray<string>) => BoundUpdate<Model, A, U, E>;
108
+ readonly remove: (fields: ReadonlyArray<string>) => BoundUpdate<Model, A, U, E, VN>;
102
109
  /** Atomic numeric ADD. */
103
- readonly add: (values: globalThis.Record<string, number>) => BoundUpdate<Model, A, U, E>;
110
+ readonly add: (values: globalThis.Record<string, number>) => BoundUpdate<Model, A, U, E, VN>;
104
111
  /** Numeric SET subtraction (synthesized as `SET #f = #f - :v`). */
105
- readonly subtract: (values: globalThis.Record<string, number>) => BoundUpdate<Model, A, U, E>;
112
+ readonly subtract: (values: globalThis.Record<string, number>) => BoundUpdate<Model, A, U, E, VN>;
106
113
  /** List append (synthesized as `SET #f = list_append(#f, :v)`). */
107
- readonly append: (values: globalThis.Record<string, ReadonlyArray<unknown>>) => BoundUpdate<Model, A, U, E>;
114
+ readonly append: (values: globalThis.Record<string, ReadonlyArray<unknown>>) => BoundUpdate<Model, A, U, E, VN>;
108
115
  /** Delete elements from a set attribute. */
109
- readonly deleteFromSet: (values: globalThis.Record<string, unknown>) => BoundUpdate<Model, A, U, E>;
116
+ readonly deleteFromSet: (values: globalThis.Record<string, unknown>) => BoundUpdate<Model, A, U, E, VN>;
110
117
  /** Optimistic concurrency — expected version. */
111
- readonly expectedVersion: (version: number) => BoundUpdate<Model, A, U, E>;
118
+ readonly expectedVersion: (version: number) => BoundUpdate<Model, A, U, E, VN>;
112
119
  /** Add a condition expression. Callback or shorthand. */
113
- readonly condition: (cond: ConditionArg<Model>) => BoundUpdate<Model, A, U, E>;
120
+ readonly condition: (cond: ConditionArg<Model>) => BoundUpdate<Model, A, U, E, VN>;
121
+ /**
122
+ * Supply a pre-computed embedding for a named vector index, skipping the
123
+ * `Embedder` for that index on this write. `name` is the LOGICAL vector index
124
+ * name declared on `Entity.make({ vectorIndexes })`.
125
+ */
126
+ readonly withVector: (name: VN, vector: ReadonlyArray<number>) => BoundUpdate<Model, A, U, E, VN>;
114
127
  /** Set ReturnValues mode. */
115
- readonly returnValues: (mode: ReturnValuesMode) => BoundUpdate<Model, A, U, E>;
128
+ readonly returnValues: (mode: ReturnValuesMode) => BoundUpdate<Model, A, U, E, VN>;
116
129
  /** Configure cascade updates to denormalized target entities. */
117
130
  readonly cascade: (config: {
118
131
  readonly targets: ReadonlyArray<CascadeTarget>;
119
132
  readonly filter?: globalThis.Record<string, unknown> | undefined;
120
133
  readonly mode?: "eventual" | "transactional" | undefined;
121
- }) => BoundUpdate<Model, A, U, E>;
134
+ }) => BoundUpdate<Model, A, U, E, VN>;
122
135
  /** Path-based SET. */
123
- readonly pathSet: (op: PathSetOp) => BoundUpdate<Model, A, U, E>;
136
+ readonly pathSet: (op: PathSetOp) => BoundUpdate<Model, A, U, E, VN>;
124
137
  /** Path-based REMOVE. */
125
- readonly pathRemove: (segments: ReadonlyArray<string | number>) => BoundUpdate<Model, A, U, E>;
138
+ readonly pathRemove: (segments: ReadonlyArray<string | number>) => BoundUpdate<Model, A, U, E, VN>;
126
139
  /** Path-based ADD. */
127
- readonly pathAdd: (op: PathAddOp) => BoundUpdate<Model, A, U, E>;
140
+ readonly pathAdd: (op: PathAddOp) => BoundUpdate<Model, A, U, E, VN>;
128
141
  /** Path-based SUBTRACT. */
129
- readonly pathSubtract: (op: PathSubtractOp) => BoundUpdate<Model, A, U, E>;
142
+ readonly pathSubtract: (op: PathSubtractOp) => BoundUpdate<Model, A, U, E, VN>;
130
143
  /** Path-based APPEND. */
131
- readonly pathAppend: (op: PathAppendOp) => BoundUpdate<Model, A, U, E>;
144
+ readonly pathAppend: (op: PathAppendOp) => BoundUpdate<Model, A, U, E, VN>;
132
145
  /** Path-based PREPEND. */
133
- readonly pathPrepend: (op: PathPrependOp) => BoundUpdate<Model, A, U, E>;
146
+ readonly pathPrepend: (op: PathPrependOp) => BoundUpdate<Model, A, U, E, VN>;
134
147
  /** Path-based if_not_exists. */
135
- readonly pathIfNotExists: (op: PathIfNotExistsOp) => BoundUpdate<Model, A, U, E>;
148
+ readonly pathIfNotExists: (op: PathIfNotExistsOp) => BoundUpdate<Model, A, U, E, VN>;
136
149
  /** Path-based DELETE (set removal). */
137
- readonly pathDelete: (op: PathDeleteOp) => BoundUpdate<Model, A, U, E>;
150
+ readonly pathDelete: (op: PathDeleteOp) => BoundUpdate<Model, A, U, E, VN>;
138
151
  /**
139
152
  * Remove specific entries from a sparse-map field. Compiles to
140
153
  * `REMOVE <prefix>#k1, <prefix>#k2, ...`. Removing an entry that doesn't
141
154
  * exist is a no-op (DynamoDB REMOVE semantics).
142
155
  */
143
- readonly removeEntries: (field: string, keys: ReadonlyArray<string>) => BoundUpdate<Model, A, U, E>;
156
+ readonly removeEntries: (field: string, keys: ReadonlyArray<string>) => BoundUpdate<Model, A, U, E, VN>;
144
157
  /**
145
158
  * Clear all entries of a sparse-map field. Two-op helper: reads the current
146
159
  * item, then folds REMOVE clauses for the discovered `<prefix>#*` attrs into
147
160
  * the same final UpdateItem. Atomic via the version CAS for `versioned`
148
161
  * entities; best-effort for non-versioned.
149
162
  */
150
- readonly clearMap: (field: string) => BoundUpdate<Model, A, U, E>;
163
+ readonly clearMap: (field: string) => BoundUpdate<Model, A, U, E, VN>;
151
164
  /** Convert to an executable Effect for Effect combinator interop. */
152
165
  readonly asEffect: () => Effect.Effect<A, E, never>;
153
166
  /** Yield support for `Effect.gen`. */
154
167
  readonly [Symbol.iterator]: () => Iterator<Effect.Effect<A, E, never>, A>;
155
168
  }
156
169
  /** @internal */
157
- export declare class BoundUpdateImpl<Model, A, U, E> implements BoundUpdate<Model, A, U, E> {
170
+ export declare class BoundUpdateImpl<Model, A, U, E, VN extends string = string> implements BoundUpdate<Model, A, U, E, VN> {
158
171
  readonly _op: EntityUpdate<A, any, U, E, any>;
159
172
  readonly _config: BoundCrudConfig<Model>;
160
173
  constructor(_op: EntityUpdate<A, any, U, E, any>, _config: BoundCrudConfig<Model>);
161
174
  private _with;
162
- set(updates: U): BoundUpdateImpl<Model, A, U, E>;
163
- remove(fields: ReadonlyArray<string>): BoundUpdateImpl<Model, A, U, E>;
164
- add(values: globalThis.Record<string, number>): BoundUpdateImpl<Model, A, U, E>;
165
- subtract(values: globalThis.Record<string, number>): BoundUpdateImpl<Model, A, U, E>;
166
- append(values: globalThis.Record<string, ReadonlyArray<unknown>>): BoundUpdateImpl<Model, A, U, E>;
167
- deleteFromSet(values: globalThis.Record<string, unknown>): BoundUpdateImpl<Model, A, U, E>;
168
- expectedVersion(version: number): BoundUpdateImpl<Model, A, U, E>;
169
- condition(cond: ConditionArg<Model>): BoundUpdateImpl<Model, A, U, E>;
170
- returnValues(mode: ReturnValuesMode): BoundUpdateImpl<Model, A, U, E>;
175
+ set(updates: U): BoundUpdateImpl<Model, A, U, E, VN>;
176
+ remove(fields: ReadonlyArray<string>): BoundUpdateImpl<Model, A, U, E, VN>;
177
+ add(values: globalThis.Record<string, number>): BoundUpdateImpl<Model, A, U, E, VN>;
178
+ subtract(values: globalThis.Record<string, number>): BoundUpdateImpl<Model, A, U, E, VN>;
179
+ append(values: globalThis.Record<string, ReadonlyArray<unknown>>): BoundUpdateImpl<Model, A, U, E, VN>;
180
+ deleteFromSet(values: globalThis.Record<string, unknown>): BoundUpdateImpl<Model, A, U, E, VN>;
181
+ expectedVersion(version: number): BoundUpdateImpl<Model, A, U, E, VN>;
182
+ condition(cond: ConditionArg<Model>): BoundUpdateImpl<Model, A, U, E, VN>;
183
+ withVector(name: VN, vector: ReadonlyArray<number>): BoundUpdateImpl<Model, A, U, E, VN>;
184
+ returnValues(mode: ReturnValuesMode): BoundUpdateImpl<Model, A, U, E, VN>;
171
185
  cascade(config: {
172
186
  readonly targets: ReadonlyArray<CascadeTarget>;
173
187
  readonly filter?: globalThis.Record<string, unknown> | undefined;
174
188
  readonly mode?: "eventual" | "transactional" | undefined;
175
- }): BoundUpdateImpl<Model, A, U, E>;
176
- pathSet(op: PathSetOp): BoundUpdateImpl<Model, A, U, E>;
177
- pathRemove(segments: ReadonlyArray<string | number>): BoundUpdateImpl<Model, A, U, E>;
178
- pathAdd(op: PathAddOp): BoundUpdateImpl<Model, A, U, E>;
179
- pathSubtract(op: PathSubtractOp): BoundUpdateImpl<Model, A, U, E>;
180
- pathAppend(op: PathAppendOp): BoundUpdateImpl<Model, A, U, E>;
181
- pathPrepend(op: PathPrependOp): BoundUpdateImpl<Model, A, U, E>;
182
- pathIfNotExists(op: PathIfNotExistsOp): BoundUpdateImpl<Model, A, U, E>;
183
- pathDelete(op: PathDeleteOp): BoundUpdateImpl<Model, A, U, E>;
184
- removeEntries(field: string, keys: ReadonlyArray<string>): BoundUpdateImpl<Model, A, U, E>;
185
- clearMap(field: string): BoundUpdateImpl<Model, A, U, E>;
189
+ }): BoundUpdateImpl<Model, A, U, E, VN>;
190
+ pathSet(op: PathSetOp): BoundUpdateImpl<Model, A, U, E, VN>;
191
+ pathRemove(segments: ReadonlyArray<string | number>): BoundUpdateImpl<Model, A, U, E, VN>;
192
+ pathAdd(op: PathAddOp): BoundUpdateImpl<Model, A, U, E, VN>;
193
+ pathSubtract(op: PathSubtractOp): BoundUpdateImpl<Model, A, U, E, VN>;
194
+ pathAppend(op: PathAppendOp): BoundUpdateImpl<Model, A, U, E, VN>;
195
+ pathPrepend(op: PathPrependOp): BoundUpdateImpl<Model, A, U, E, VN>;
196
+ pathIfNotExists(op: PathIfNotExistsOp): BoundUpdateImpl<Model, A, U, E, VN>;
197
+ pathDelete(op: PathDeleteOp): BoundUpdateImpl<Model, A, U, E, VN>;
198
+ removeEntries(field: string, keys: ReadonlyArray<string>): BoundUpdateImpl<Model, A, U, E, VN>;
199
+ clearMap(field: string): BoundUpdateImpl<Model, A, U, E, VN>;
186
200
  asEffect(): Effect.Effect<A, E, never>;
187
201
  [Symbol.iterator](): any;
188
202
  pipe(): unknown;
189
203
  }
190
204
  /** @internal */
191
- export declare const makeBoundPut: <Model, A, E>(op: EntityPut<A, any, E, any>, config: BoundCrudConfig<Model>) => BoundPut<Model, A, E>;
205
+ export declare const makeBoundPut: <Model, A, E, VN extends string = string>(op: EntityPut<A, any, E, any>, config: BoundCrudConfig<Model>) => BoundPut<Model, A, E, VN>;
192
206
  /** @internal */
193
207
  export declare const makeBoundDelete: <Model, E>(op: EntityDelete<E, any>, config: BoundCrudConfig<Model>) => BoundDelete<Model, E>;
194
208
  /** @internal */
195
- export declare const makeBoundUpdate: <Model, A, U, E>(op: EntityUpdate<A, any, U, E, any>, config: BoundCrudConfig<Model>) => BoundUpdate<Model, A, U, E>;
209
+ export declare const makeBoundUpdate: <Model, A, U, E, VN extends string = string>(op: EntityUpdate<A, any, U, E, any>, config: BoundCrudConfig<Model>) => BoundUpdate<Model, A, U, E, VN>;
196
210
  /**
197
211
  * Fluent builder for `Entity.append()` on time-series entities.
198
212
  *