-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Dynamoose interfaces #76
Comments
Or maybe E.g. in your |
the current Model interface from dynamoose is still broken, therefore I need to maintain a copy here, however I will review the interfaces and match the new v2 api as much as possible. |
Could you explain what you mean by broken?
Thanks for your efforts! Even tho he released 2.x it seems to be still in beta and changes and fixes are currently common. I am kind of afraid that changes made are not reflected in this project if there is a copy. It could be even in years that Dynamoose gets updated but this package is no more maintained so I hope one day this package will not redefine the interfaces of Dynamoose. I leave this issue open until then. |
Yes eventually all interfaces should be under dynamoose, I will make this happen :) |
@MickL I just released 0.2.0-beta.3 would you mind to have a test. thanks :) |
because of the query cannot be chained like that this.model.query('targetId')
.eq(targetId)
.exec(); |
Hi @hardyscc , I recently did a PR dynamoose/dynamoose#890 that is fixing some of the type definitions in dynamoose. Mick mentioned that this project had some custom interface that eventually should be moved to the dynamoose project and that I should team up with you. What's the strategy here. |
Hi @pfulop, I also facing the same problem, As you know now dynamoose is using a Condition class which shared with scan() and query(), however I cannot find a way to type it correctly when do a query chain like this
Therefore I just create a type file to overcome it in this project. please see |
@pfulop yes correct :) |
@hardyscc please see actual changes here dynamoose/dynamoose@92d1c20 I took some liberties and removed one of the TODOs concerning duplicity. So with code such as this: const queryResult = Stat.query('targetId').eq('targetId').exec();
const scanREsult = Stat.scan('targetId').eq('targetId').exec();`
the infered types are const queryResult: Promise<QueryResponse<dynamoose.Document[]>>
const scanREsult: Promise<ScanResponse<dynamoose.Document[]>> I also think I can get more granular and work it in a way where the exec result won't be a generic document but rather a document for a specific model. But first I wanted to make sure that you're ok with the changes. |
@pfulop Yes this is definitely the right direction, thanks for your great help! Furthermore is it possible to support additional generic type for model's key like this? export interface UserKey {
id: string;
}
export interface User extends UserKey {
name: string;
email?: string;
}
@Injectable()
export class UserService {
constructor(
@InjectModel('User')
private userModel: Model<User, UserKey>,
) {}
update(key: UserKey, user: Partial<User>) {
return this.userModel.update(key, user);
}
} |
I think this shall do |
@pfulop that is wonderful! I am looking forward for this PR. ^^ |
Just remind myself here, still cannot close this issue yet, need generic type support for Key. |
Could you please remove all interfaces related to Dynamoose?
It now has its own type definitions and it could happen that the IDE imports typings from nestjs-dynamoose by mistake and those type definitions are deprecated.
I have used:
0.2.0-beta.2
Also readme should be updated:
Model
should not be imported fromnestjs-dynamoose
but fromdynamoose
The text was updated successfully, but these errors were encountered: