-
Notifications
You must be signed in to change notification settings - Fork 27
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
Fix unable to mapReduce with decorator on an Instance type #78
Conversation
…tion and add new tests
Changes Unknown when pulling c79b2a4 on RagibHasin:master into ** on SierraSoftworks:master**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly pretty good, I don't believe it'll break any existing code with the previous API, but can you confirm that quickly please? (will determine whether this is a patch or major version bump)
Otherwise, all looks like a nice improvement on the approach being used.
lib/Model.ts
Outdated
return resolve(); | ||
}); | ||
} | ||
else return reject("mapReduceOptions not provided"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reject this with an actual Error object? Strings as errors are generally a bad idea for debugging and handling purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! 😛 My mistake. Just missed the new Error
.
lib/Model.ts
Outdated
if (err) return reject(err); | ||
return resolve(); | ||
}); | ||
if (instanceType.mapReduceOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rather shift this test up to the top of this function (line 733 or so) to make it easier to read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course. That will be cleaner.
Changes Unknown when pulling 5eb054f on RagibHasin:master into ** on SierraSoftworks:master**. |
Looks good, I'll go about merging and releasing this this evening if that works for you? Let me know if it's more urgent and I'll shuffle some stuff around. |
It is not very important but is good to get it released. I'm using my fork at this moment for a project. And it did not break any previous code of mine. |
Deployed in v7.2.1 - thanks for the PR @RagibHasin and as always, if you run into any issues please feel free to open an issue 👍 |
Sorry for knocking again.
I noticed that when applying mapReduce functions with decorators, it failed to compile. (Actually for the ugly static type checks I added at the last moment). So it seems better to me to check for those functions at runtime which will also be useful for JavaScript users. And added accompanying test.
Best regards.