-
Notifications
You must be signed in to change notification settings - Fork 1
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
Function Wrapper for 8base functions #21
Comments
@alacret what you think? |
I like the concept as is being tried to achieve, my comments:
Other languages support: @FeatureFlag('SEND_EMAIL')
function(param1, param2, context) {
const ffSendEmail = context[0];
...
} But this in javascript can lead to undesired behavior due to hoisting variables:
Example module.exports = async (event, context) => {
const featureFlag = Util8base.resolveFeatureFlag('SEND_EMAIL', cache: 0);
const [featureFlag,featureFlag2 ] = Util8base.resolveFeatureFlag(['SEND_EMAIL', 'SALESFORCE_INTEGRATION']);
const templateId = Util8base.resolveSystemSetting('SENDGRID_TEMPLATE', cache:90)
// For the current User
const user = Util8base.resolveUser();
// For Graphql queries, is important to allow multiple for efficiency
const [result1, result2] = Util8base.resolveQuery([FETCH_ROLES_QUERY, FETCH_COMPANY], cache:60);
} |
The principle of the wrapper was to separate the logic of accessing the fatureFlag or the environment variables of the function and only pass the results through parameters. But I will review this alternative |
Description
Function Wrapper for 8 base functions. This function separates the logic of obtaining the variables of enteronos or the feature flags from the logic of the function. The environment variables and the feature flags are standardized so we could add that logic in the wrapper
Note: This would be a quick example, it would not be the final wrapper, you would have to make some changes
Example in function
The text was updated successfully, but these errors were encountered: