Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(attributes, attribute) => {
const key = head(keys(attribute))
if (!contains(key, attributeKeys)) {
// return empty string to "unset" removed value
return concat(attributes, [{ [key]: '' }])
}
return attributes
},
[],
map((item) => {
const key = head(keys(item))
const value = head(values(item))
const params = {
subscriptionArn: subscriptionArn,
attributeName: capitalize(key),
attributeValue: value
}
const stateAttribute = context.state.subscriptionAttributes
? context.state.subscriptionAttributes[key]
: {}
if (equals(value, stateAttribute)) {
return Promise.resolve()
}
return setSubscriptionAttributes(params, context)
}, inputsAndState)
)
map((topicAttribute) => {
const value = head(values(topicAttribute))
const params = {
TopicArn: topicArn,
AttributeName: capitalize(head(keys(topicAttribute))),
AttributeValue: typeof value !== 'string' ? JSON.stringify(value) : value
}
return sns.setTopicAttributes(params).promise()
}, topicAttributes)
)
const capitalize = (string) => `${head(string).toUpperCase()}${slice(1, Infinity, string)}`
map((item) => {
const key = head(keys(item))
const value = head(values(item))
const params = {
subscriptionArn: subscriptionArn,
attributeName: capitalize(key),
attributeValue: value
}
const stateAttribute = context.state.subscriptionAttributes
? context.state.subscriptionAttributes[key]
: {}
if (equals(value, stateAttribute)) {
return Promise.resolve()
}
return setSubscriptionAttributes(params, context)
}, inputsAndState)
)
map((topicAttribute) => {
const value = head(values(topicAttribute))
const params = {
TopicArn: topicArn,
AttributeName: capitalize(head(keys(topicAttribute))),
AttributeValue: typeof value !== 'string' ? JSON.stringify(value) : value
}
return sns.setTopicAttributes(params).promise()
}, topicAttributes)
)
(result, value) => merge({ [head(keys(value))]: head(values(value)) }, result),
{},
(result, value) => {
if (head(values(value))) {
return concat(result, [value])
}
return result
},
[],
const prevInstanceTopicAttributes = filter((item) => !isNil(head(values(item))))([
{ displayName: prevInstance.displayName },