dyno-table 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -18
- package/dist/entity.d.cts +3 -3
- package/dist/entity.d.ts +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -163,24 +163,6 @@ await table.transaction(tx => [
|
|
|
163
163
|
```
|
|
164
164
|
**[Transactions Guide →](docs/transactions.md)**
|
|
165
165
|
|
|
166
|
-
### Type-Safe Field Selection
|
|
167
|
-
*Get exactly what you need with automatic TypeScript inference*
|
|
168
|
-
|
|
169
|
-
```ts
|
|
170
|
-
// Select specific fields - TypeScript knows the result type!
|
|
171
|
-
const basicInfo = await dinoRepo.query
|
|
172
|
-
.getDinosaursByDiet({ diet: "herbivore" })
|
|
173
|
-
.select(["species", "period", "diet"])
|
|
174
|
-
.execute();
|
|
175
|
-
|
|
176
|
-
for await (const dino of basicInfo) {
|
|
177
|
-
console.log(dino.species); // ✅ string
|
|
178
|
-
console.log(dino.period); // ✅ "triassic" | "jurassic" | "cretaceous"
|
|
179
|
-
// console.log(dino.weight); // ❌ TypeScript error - not selected
|
|
180
|
-
}
|
|
181
|
-
```
|
|
182
|
-
**[Type Safety Guide →](docs/type-safety.md)**
|
|
183
|
-
|
|
184
166
|
### Pagination & Memory Management
|
|
185
167
|
*Handle large datasets efficiently*
|
|
186
168
|
|
package/dist/entity.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { s as Path, t as PathType, a as Condition, b as ConditionOperator, c as
|
|
|
2
2
|
import { P as PutBuilder, G as GetBuilder, U as UpdateBuilder, i as UpdateCommandParams, T as TransactionBuilder, D as DeleteBuilder, S as ScanBuilder, Q as QueryBuilder } from './index-DlN8G9hd.cjs';
|
|
3
3
|
import { StandardSchemaV1 } from './standard-schema.cjs';
|
|
4
4
|
import { Table } from './table.cjs';
|
|
5
|
-
import { DynamoItem,
|
|
5
|
+
import { DynamoItem, Index, TableConfig } from './types.cjs';
|
|
6
6
|
import '@aws-sdk/lib-dynamodb';
|
|
7
7
|
|
|
8
8
|
type SetElementType<T> = T extends Set<infer U> ? U : T extends Array<infer U> ? U : never;
|
|
@@ -110,7 +110,7 @@ type QueryFunctionWithSchema<T extends DynamoItem, I, R> = QueryFunction<T, I, R
|
|
|
110
110
|
schema?: StandardSchemaV1<I>;
|
|
111
111
|
};
|
|
112
112
|
type QueryRecord<T extends DynamoItem> = {
|
|
113
|
-
[K: string]: QueryFunctionWithSchema<T, any,
|
|
113
|
+
[K: string]: QueryFunctionWithSchema<T, any, any>;
|
|
114
114
|
};
|
|
115
115
|
type QueryEntity<T extends DynamoItem> = {
|
|
116
116
|
scan: () => ScanBuilder<T>;
|
|
@@ -221,7 +221,7 @@ declare function defineEntity<T extends DynamoItem, TInput extends DynamoItem =
|
|
|
221
221
|
};
|
|
222
222
|
declare function createQueries<T extends DynamoItem>(): {
|
|
223
223
|
input: <I>(schema: StandardSchemaV1<I>) => {
|
|
224
|
-
query: <
|
|
224
|
+
query: <R extends ScanBuilder<T> | QueryBuilder<T, TableConfig> | GetBuilder<T>>(handler: (params: {
|
|
225
225
|
input: I;
|
|
226
226
|
entity: QueryEntity<T>;
|
|
227
227
|
}) => R) => QueryFunctionWithSchema<T, I, R>;
|
package/dist/entity.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { s as Path, t as PathType, a as Condition, b as ConditionOperator, c as
|
|
|
2
2
|
import { P as PutBuilder, G as GetBuilder, U as UpdateBuilder, i as UpdateCommandParams, T as TransactionBuilder, D as DeleteBuilder, S as ScanBuilder, Q as QueryBuilder } from './index-2cbm07Bi.js';
|
|
3
3
|
import { StandardSchemaV1 } from './standard-schema.js';
|
|
4
4
|
import { Table } from './table.js';
|
|
5
|
-
import { DynamoItem,
|
|
5
|
+
import { DynamoItem, Index, TableConfig } from './types.js';
|
|
6
6
|
import '@aws-sdk/lib-dynamodb';
|
|
7
7
|
|
|
8
8
|
type SetElementType<T> = T extends Set<infer U> ? U : T extends Array<infer U> ? U : never;
|
|
@@ -110,7 +110,7 @@ type QueryFunctionWithSchema<T extends DynamoItem, I, R> = QueryFunction<T, I, R
|
|
|
110
110
|
schema?: StandardSchemaV1<I>;
|
|
111
111
|
};
|
|
112
112
|
type QueryRecord<T extends DynamoItem> = {
|
|
113
|
-
[K: string]: QueryFunctionWithSchema<T, any,
|
|
113
|
+
[K: string]: QueryFunctionWithSchema<T, any, any>;
|
|
114
114
|
};
|
|
115
115
|
type QueryEntity<T extends DynamoItem> = {
|
|
116
116
|
scan: () => ScanBuilder<T>;
|
|
@@ -221,7 +221,7 @@ declare function defineEntity<T extends DynamoItem, TInput extends DynamoItem =
|
|
|
221
221
|
};
|
|
222
222
|
declare function createQueries<T extends DynamoItem>(): {
|
|
223
223
|
input: <I>(schema: StandardSchemaV1<I>) => {
|
|
224
|
-
query: <
|
|
224
|
+
query: <R extends ScanBuilder<T> | QueryBuilder<T, TableConfig> | GetBuilder<T>>(handler: (params: {
|
|
225
225
|
input: I;
|
|
226
226
|
entity: QueryEntity<T>;
|
|
227
227
|
}) => R) => QueryFunctionWithSchema<T, I, R>;
|