How to use the @serverless/utils.head function in @serverless/utils

To help you get started, we’ve selected a few @serverless/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github serverless / components / registry / AwsSnsTopic / src / index.js View on Github external
(attributes, attribute) => {
          const key = head(keys(attribute))
          if (!contains(key, attributeKeys)) {
            // return empty string to "unset" removed value
            return concat(attributes, [{ [key]: '' }])
          }
          return attributes
        },
        [],
github serverless / components / registry / AwsSnsSubscription / src / index.js View on Github external
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)
  )
github serverless / components / registry / AwsSnsTopic / src / index.js View on Github external
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)
  )
github serverless / components / registry / AwsSnsSubscription / src / index.js View on Github external
const capitalize = (string) => `${head(string).toUpperCase()}${slice(1, Infinity, string)}`
github serverless / components / registry / AwsSnsSubscription / src / index.js View on Github external
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)
  )
github serverless / components / registry / AwsSnsTopic / src / index.js View on Github external
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)
  )
github serverless / components / registry / AwsSnsTopic / src / index.js View on Github external
      (result, value) => merge({ [head(keys(value))]: head(values(value)) }, result),
      {},
github serverless / components / registry / AwsSnsTopic / src / index.js View on Github external
(result, value) => {
      if (head(values(value))) {
        return concat(result, [value])
      }
      return result
    },
    [],
github serverless / components / registry / AwsSnsTopic / src / index.js View on Github external
  const prevInstanceTopicAttributes = filter((item) => !isNil(head(values(item))))([
    { displayName: prevInstance.displayName },