Socket
Socket
Sign inDemoInstall

serverless-leo

Package Overview
Dependencies
10
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.13 to 1.3.14

28

lib/leo.js

@@ -63,4 +63,14 @@ 'use strict'

botNumbers.forEach(botNumber => {
let botId
let botSuffix = botNumber > 0 ? '-' + botNumber : ''
let botId = `${this.serverless.service.service}-${stage}-${botPrefix}${ymlFunctionName}${botSuffix}`
// If there is no botPrefix, no source queue and multiple bots: add the eventIndex to the botSuffix (botId ultimately)
if (!botPrefix && !sourceQueue && leoEvents.length > 1) {
botSuffix = `-${eventIndex}${botSuffix}`
}
// Only add the queue to the bot name if there are multiple events
if (sourceQueue && leoEvents.length > 1) {
botId = `${this.serverless.service.service}-${stage}-${botPrefix}${sourceQueue}-${ymlFunctionName}${botSuffix}`
} else {
botId = `${this.serverless.service.service}-${stage}-${botPrefix}${ymlFunctionName}${botSuffix}`
}
const installProperty = {

@@ -76,19 +86,13 @@ type: 'cron',

}
if (config && config.cron) {
installProperty.time = config.cron
}
// If there is no source queue, no botPrefix, and there are multiple bots: add the eventIndex to the bot Id
if (!sourceQueue && !botPrefix && leoEvents.length > 1) {
botSuffix = `-${eventIndex}${botSuffix}`
botId = `${this.serverless.service.service}-${stage}-${botPrefix}${ymlFunctionName}${botSuffix}`
}
if (sourceQueue) {
botId = `${this.serverless.service.service}-${stage}-${botPrefix}${sourceQueue}-${ymlFunctionName}${botSuffix}`
installProperty.settings.source = sourceQueue
installProperty.settings.queue = sourceQueue
}
if (config && config.cron) {
installProperty.time = config.cron
}
if (config && config.name) {
installProperty.name = config.name + botSuffix
installProperty.name = config.name
} else {
installProperty.name = functionObj.botName ? `${functionObj.botName}${botSuffix}` : botId.replace(`${this.serverless.service.service}-${stage}-`, '')
installProperty.name = botId.replace(`${this.serverless.service.service}-${stage}-`, '')
}

@@ -95,0 +99,0 @@ if (config && config.codeOverrides) {

{
"name": "serverless-leo",
"version": "1.3.13",
"version": "1.3.14",
"description": "Serverless plugin for leo microservices",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -147,16 +147,2 @@ 'use strict'

})
it('names the bot according to the config', async () => {
const sls = testServerless()
const lambda = cloneDeep(helloNodeWorldLambda)
lambda.events = [
{
'leo': 'test_hello'
}
]
lambda.botName = 'bot1'
sls.serverless.service.functions.helloNodeWorld = lambda
await sls.compileLeo()
expect(sls.serverless.service.provider.compiledCloudFormationTemplate.Resources['LeoRegister0']
.Properties['hello-serverless-leo-world-dev-test_hello-helloNodeWorld'].name).to.equal('bot1')
})
it('names the bot according to the config in events', async () => {

@@ -176,3 +162,3 @@ const sls = testServerless()

expect(sls.serverless.service.provider.compiledCloudFormationTemplate.Resources['LeoRegister0']
.Properties['hello-serverless-leo-world-dev-test_hello-helloNodeWorld'].name).to.equal('bot2')
.Properties['hello-serverless-leo-world-dev-helloNodeWorld'].name).to.equal('bot2')
})

@@ -179,0 +165,0 @@ it('names the bot using the prefix in config in events', async () => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc