-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): wip: initial attribute aliasing support
- Loading branch information
1 parent
33fe5cb
commit b6d05dc
Showing
7 changed files
with
59 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {INDEX_TYPE} from './enums'; | ||
import {Replace} from './helpers/replace-type'; | ||
|
||
export interface GSIIndexOptions { | ||
type: INDEX_TYPE.GSI; | ||
partitionKey: string; | ||
sortKey: string; | ||
/** | ||
* DynamoDB only adds item to index if both Partition Key and Sort Key defined | ||
* for any given GSI contains value | ||
* | ||
* Indexes missing sort key value will not be added to index. | ||
*/ | ||
isSparse?: boolean; | ||
} | ||
|
||
export interface LSIIndexOptions { | ||
type: INDEX_TYPE.LSI; | ||
sortKey: string; | ||
isSparse?: boolean; | ||
} | ||
export type IndexOptions = GSIIndexOptions | LSIIndexOptions; | ||
|
||
type EntityAliasOrString<Entity> = string | {$alias: keyof Entity}; | ||
|
||
export type IndexOptionsWithAlias<Entity> = | ||
| Replace< | ||
GSIIndexOptions, | ||
'partitionKey' | 'sortKey', | ||
{ | ||
partitionKey: EntityAliasOrString<Entity>; | ||
sortKey: EntityAliasOrString<Entity>; | ||
} | ||
> | ||
| Replace< | ||
LSIIndexOptions, | ||
'sortKey', | ||
{ | ||
sortKey: string; | ||
} | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/core/src/classes/transformer/document-client-request-transformer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters