-
Notifications
You must be signed in to change notification settings - Fork 84
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
Implement eval command to upsert command piping #299
Conversation
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.
Beautiful 🥇
Please review my questions/comments
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.
LGTM 💯
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.
fix
errorScope, | ||
); | ||
} | ||
if (_.isEmpty(configs) && _.isEmpty(pipe)) { |
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.
why not sppliting it via wach one of the loops?
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.
I don't understand the question. This condition is to skip the async init method in case there is nothing to upsert.
const upsertConfigs = _(configs) | ||
.entries() | ||
.map<Config>(([key, value]) => { | ||
this.validateConfigValue({ key, value, skipDeclarationAndTemplateValidation: false }); |
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.
I would convert the whole mapper function here
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.
split the skip flag to each of the validation
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.
I split the validations. I don't understand what "convert the whole mapper function here" means.. please elaborate.
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.
please see comments and fix
This PR extends the TS upsert command API to support piping of an eval command result to an upsert command.
pipe
that is a result of an eval command. If provided, the eval result is merged together with the provided configs (which take priority over an eval result). Any key that does not belong to the schema received in the upsert command is filtered, same goes for any key that is a template in the provided schema.pipe
parameter by also having their relevant parameters renamed topipe
(breaking change), the affected code and docs have been adjusted accordingly.false
as a value does not get validated due to an erroneous condition.Notes: