Skip to content

Commit

Permalink
Refining facets returned by Batch methods (tywalch#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
tywalch authored May 24, 2021
1 parent 94fe628 commit d7caa71
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions examples/taskapp_typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ async function query() {
{ dateHired: twoYearsAgo }
).go();
console.log("Employees hired between two and five years ago:", recentHires, "\r\n");

// Explore the models in `./models` and the README for more queries to try!

// CreateEntityItem< typeof YOUR_ENTITY > is exported to help you type items as they are used for creation
Expand Down
8 changes: 4 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,19 +376,19 @@ export class Entity<A extends string, F extends A, C extends string, S extends S
readonly schema: S;
constructor(schema: S, config?: EntityConfiguration);
get(key: AllTableIndexFacets<A,F,C,S>): SingleRecordOperationOptions<A,F,C,S, TableItem<A,F,C,S>>;
get(key: AllTableIndexFacets<A,F,C,S>[]): BulkRecordOperationOptions<A,F,C,S, [Required<TableIndexFacets<A,F,C,S>>, TableItem<A,F,C,S>[]]>;
get(key: AllTableIndexFacets<A,F,C,S>[]): BulkRecordOperationOptions<A,F,C,S, [AllTableIndexFacets<A,F,C,S>[], TableItem<A,F,C,S>[]]>;
delete(key: AllTableIndexFacets<A,F,C,S>): SingleRecordOperationOptions<A,F,C,S, TableItem<A,F,C,S>>;
delete(key: AllTableIndexFacets<A,F,C,S>[]): BulkRecordOperationOptions<A,F,C,S, Required<TableIndexFacets<A,F,C,S>>[]>;
delete(key: AllTableIndexFacets<A,F,C,S>[]): BulkRecordOperationOptions<A,F,C,S, AllTableIndexFacets<A,F,C,S>[]>;
update(key: AllTableIndexFacets<A,F,C,S>): {
set: SetRecord<A,F,C,S, SetItem<A,F,C,S>, TableIndexFacets<A,F,C,S>, TableItem<A,F,C,S>>
};
patch(key: AllTableIndexFacets<A,F,C,S>): {
set: SetRecord<A,F,C,S, SetItem<A,F,C,S>, TableIndexFacets<A,F,C,S>, TableItem<A,F,C,S>>
};
put(record: PutItem<A,F,C,S>): SingleRecordOperationOptions<A,F,C,S, TableItem<A,F,C,S>>;
put(record: PutItem<A,F,C,S>[]): BulkRecordOperationOptions<A,F,C,S, Required<TableIndexFacets<A,F,C,S>>[]>;
put(record: PutItem<A,F,C,S>[]): BulkRecordOperationOptions<A,F,C,S, AllTableIndexFacets<A,F,C,S>[]>;
create(record: PutItem<A,F,C,S>): SingleRecordOperationOptions<A,F,C,S, TableItem<A,F,C,S>>;
find(record: Partial<Item<A,F,C,S>>): RecordsActionOptions<A,F,C,S, TableItem<A,F,C,S>[], Required<TableIndexFacets<A,F,C,S>>>;
find(record: Partial<Item<A,F,C,S>>): RecordsActionOptions<A,F,C,S, TableItem<A,F,C,S>[], AllTableIndexFacets<A,F,C,S>>;
setIdentifier(type: "model" | "version", value: string): void;
scan: RecordsActionOptions<A,F,C,S, Item<A,F,C,S>[], TableIndexFacets<A,F,C,S>>
query: Queries<A,F,C,S>;
Expand Down
4 changes: 2 additions & 2 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ let getKeys = ((val) => {}) as GetKeys;
expectAssignable<"paramtest">(entityWithSK.get({attr1: "abc", attr2: "def"}).params<"paramtest">());
expectAssignable<"paramtest">(entityWithoutSK.get({attr1: "abc"}).params<"paramtest">());

expectAssignable<Promise<[WithSKMyIndexFacets, Item[]]>>(entityWithSK.get([{attr1: "abc", attr2: "def"}]).go());
expectAssignable<Promise<[WithoutSKMyIndexFacets, ItemWithoutSK[]]>>(entityWithoutSK.get([{attr1: "abc"}]).go());
expectAssignable<Promise<[WithSKMyIndexFacets[], Item[]]>>(entityWithSK.get([{attr1: "abc", attr2: "def"}]).go());
expectAssignable<Promise<[WithoutSKMyIndexFacets[], ItemWithoutSK[]]>>(entityWithoutSK.get([{attr1: "abc"}]).go());

// Delete
// Single
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electrodb",
"version": "0.10.0",
"version": "0.10.1",
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit d7caa71

Please sign in to comment.