Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mapbox/cloudfriend

Package Overview
Dependencies
Maintainers
28
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/cloudfriend - npm Package Compare versions

Comparing version 7.0.0 to 7.0.1-0

.nyc_output/13dd5fa6-a680-407e-bed7-47290487a0b2.json

2

.nyc_output/processinfo/index.json

@@ -1,1 +0,1 @@

{"processes":{"1983e39b-fcbb-4618-a9dd-36f2ec3b1532":{"parent":"2c9b3698-f822-47f6-a941-eea13e638ffc","children":[]},"2c9b3698-f822-47f6-a941-eea13e638ffc":{"parent":null,"children":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532"]}},"files":{"/Users/bilindhajer/cloudfriend/bin/build-template.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532"],"/Users/bilindhajer/cloudfriend/index.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/intrinsic.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/conditions.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/rules.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/pseudo.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/build.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/validate.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/merge.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/index.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/lambda.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/service-role.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/role.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/scheduled-lambda.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/event-lambda.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/queue-lambda.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/stream-lambda.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/cross-account-role.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/queue.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/s3-kinesis-firehose.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/kinesis-firehose-base.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-database.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-table.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-json-table.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-orc-table.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-parquet-table.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-presto-view.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-spark-view.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/hookshot.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/log-subscription-lambda.js":["1983e39b-fcbb-4618-a9dd-36f2ec3b1532","2c9b3698-f822-47f6-a941-eea13e638ffc"]},"externalIds":{}}
{"processes":{"13dd5fa6-a680-407e-bed7-47290487a0b2":{"parent":"5132a444-31e1-4063-bff6-e610421b2edf","children":[]},"5132a444-31e1-4063-bff6-e610421b2edf":{"parent":null,"children":["13dd5fa6-a680-407e-bed7-47290487a0b2"]}},"files":{"/Users/bilindhajer/cloudfriend/bin/build-template.js":["13dd5fa6-a680-407e-bed7-47290487a0b2"],"/Users/bilindhajer/cloudfriend/index.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/intrinsic.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/conditions.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/rules.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/pseudo.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/build.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/validate.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/merge.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/index.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/lambda.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/service-role.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/role.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/scheduled-lambda.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/event-lambda.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/queue-lambda.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/stream-lambda.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/cross-account-role.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/queue.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/s3-kinesis-firehose.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/kinesis-firehose-base.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-database.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-table.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-json-table.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-orc-table.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-parquet-table.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-presto-view.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/glue-spark-view.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/hookshot.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"],"/Users/bilindhajer/cloudfriend/lib/shortcuts/log-subscription-lambda.js":["13dd5fa6-a680-407e-bed7-47290487a0b2","5132a444-31e1-4063-bff6-e610421b2edf"]},"externalIds":{}}

@@ -10,2 +10,12 @@ 'use strict';

function assertNodeVersion(runtime) {
if (runtime.match(/^nodejs[\d+]+.x$/)) {
const version = runtime.match(/\d+/)[0];
if (Number(version) < 18)
throw new Error(`Only nodejs runtimes >= 18 are supported for hookshot lambdas, received: '${runtime}'`);
} else {
throw new Error(`Only valid nodejs runtimes are supported for hookshot lambdas, received: '${runtime}'`);
}
}
/**

@@ -90,2 +100,4 @@ * The hookshot.Passthrough class defines resources that set up a single API Gateway

if (options.Runtime) assertNodeVersion(options.Runtime);
let {

@@ -265,6 +277,5 @@ LoggingLevel = 'OFF'

'Fn::Sub': redent(`
'use strict';
const AWS = require('aws-sdk');
const lambda = new AWS.Lambda();
const { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');
const client = new LambdaClient();

@@ -286,8 +297,8 @@ module.exports.lambda = (event, context, callback) => {

const lambdaParams = {
const command = new InvokeCommand({
FunctionName: '\${${this.PassthroughTo}}',
Payload: JSON.stringify(event)
};
});
lambda.invoke(lambdaParams).promise()
client.send(command)
.then((response) => {

@@ -427,4 +438,4 @@ if (!response || !response.Payload)

const crypto = require('crypto');
const AWS = require('aws-sdk');
const lambda = new AWS.Lambda();
const { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');
const client = new LambdaClient();
const secret = '\${WebhookSecret}';

@@ -444,9 +455,9 @@

const lambdaParams = {
const command = new InvokeCommand({
FunctionName: '\${${this.PassthroughTo}}',
Payload: JSON.stringify(event.body),
InvocationType: 'Event'
};
});
lambda.invoke(lambdaParams).promise()
client.send(command)
.then(() => callback(null, 'success'))

@@ -453,0 +464,0 @@ .catch((err) => callback(err));

{
"name": "@mapbox/cloudfriend",
"version": "7.0.0",
"version": "7.0.1-0",
"description": "Helper functions for assembling CloudFormation templates in JavaScript",

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

@@ -31,3 +31,3 @@ {

"DeploymentId": {
"Ref": "PassDeployment0e352c83"
"Ref": "PassDeploymentda5b06a6"
},

@@ -51,3 +51,3 @@ "StageName": "hookshot",

},
"PassDeployment0e352c83": {
"PassDeploymentda5b06a6": {
"Type": "AWS::ApiGateway::Deployment",

@@ -169,3 +169,3 @@ "DependsOn": "PassMethod",

"Fn::Sub": [
"'use strict';\n\nconst crypto = require('crypto');\nconst AWS = require('aws-sdk');\nconst lambda = new AWS.Lambda();\nconst secret = '${WebhookSecret}';\n\nmodule.exports.lambda = (event, context, callback) => {\n const body = event.body;\n const hash = 'sha1=' + crypto\n .createHmac('sha1', secret)\n .update(new Buffer(JSON.stringify(body)))\n .digest('hex');\n\n if (event.signature !== hash)\n return callback('invalid: signature does not match');\n\n if (body.zen) return callback(null, 'ignored ping request');\n\n const lambdaParams = {\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event.body),\n InvocationType: 'Event'\n };\n\n lambda.invoke(lambdaParams).promise()\n .then(() => callback(null, 'success'))\n .catch((err) => callback(err));\n};",
"'use strict';\n\nconst crypto = require('crypto');\nconst { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');\nconst client = new LambdaClient();\nconst secret = '${WebhookSecret}';\n\nmodule.exports.lambda = (event, context, callback) => {\n const body = event.body;\n const hash = 'sha1=' + crypto\n .createHmac('sha1', secret)\n .update(new Buffer(JSON.stringify(body)))\n .digest('hex');\n\n if (event.signature !== hash)\n return callback('invalid: signature does not match');\n\n if (body.zen) return callback(null, 'ignored ping request');\n\n const command = new InvokeCommand({\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event.body),\n InvocationType: 'Event'\n });\n\n client.send(command)\n .then(() => callback(null, 'success'))\n .catch((err) => callback(err));\n};",
{

@@ -172,0 +172,0 @@ "WebhookSecret": {

@@ -27,3 +27,3 @@ {

"DeploymentId": {
"Ref": "PassDeployment0e352c83"
"Ref": "PassDeploymentda5b06a6"
},

@@ -47,3 +47,3 @@ "StageName": "hookshot",

},
"PassDeployment0e352c83": {
"PassDeploymentda5b06a6": {
"Type": "AWS::ApiGateway::Deployment",

@@ -165,3 +165,3 @@ "DependsOn": "PassMethod",

"Fn::Sub": [
"'use strict';\n\nconst crypto = require('crypto');\nconst AWS = require('aws-sdk');\nconst lambda = new AWS.Lambda();\nconst secret = '${WebhookSecret}';\n\nmodule.exports.lambda = (event, context, callback) => {\n const body = event.body;\n const hash = 'sha1=' + crypto\n .createHmac('sha1', secret)\n .update(new Buffer(JSON.stringify(body)))\n .digest('hex');\n\n if (event.signature !== hash)\n return callback('invalid: signature does not match');\n\n if (body.zen) return callback(null, 'ignored ping request');\n\n const lambdaParams = {\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event.body),\n InvocationType: 'Event'\n };\n\n lambda.invoke(lambdaParams).promise()\n .then(() => callback(null, 'success'))\n .catch((err) => callback(err));\n};",
"'use strict';\n\nconst crypto = require('crypto');\nconst { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');\nconst client = new LambdaClient();\nconst secret = '${WebhookSecret}';\n\nmodule.exports.lambda = (event, context, callback) => {\n const body = event.body;\n const hash = 'sha1=' + crypto\n .createHmac('sha1', secret)\n .update(new Buffer(JSON.stringify(body)))\n .digest('hex');\n\n if (event.signature !== hash)\n return callback('invalid: signature does not match');\n\n if (body.zen) return callback(null, 'ignored ping request');\n\n const command = new InvokeCommand({\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event.body),\n InvocationType: 'Event'\n });\n\n client.send(command)\n .then(() => callback(null, 'success'))\n .catch((err) => callback(err));\n};",
{

@@ -168,0 +168,0 @@ "WebhookSecret": "abc123"

@@ -27,3 +27,3 @@ {

"DeploymentId": {
"Ref": "PassDeployment0e352c83"
"Ref": "PassDeploymentda5b06a6"
},

@@ -47,3 +47,3 @@ "StageName": "hookshot",

},
"PassDeployment0e352c83": {
"PassDeploymentda5b06a6": {
"Type": "AWS::ApiGateway::Deployment",

@@ -171,3 +171,3 @@ "DependsOn": "PassMethod",

"Fn::Sub": [
"'use strict';\n\nconst crypto = require('crypto');\nconst AWS = require('aws-sdk');\nconst lambda = new AWS.Lambda();\nconst secret = '${WebhookSecret}';\n\nmodule.exports.lambda = (event, context, callback) => {\n const body = event.body;\n const hash = 'sha1=' + crypto\n .createHmac('sha1', secret)\n .update(new Buffer(JSON.stringify(body)))\n .digest('hex');\n\n if (event.signature !== hash)\n return callback('invalid: signature does not match');\n\n if (body.zen) return callback(null, 'ignored ping request');\n\n const lambdaParams = {\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event.body),\n InvocationType: 'Event'\n };\n\n lambda.invoke(lambdaParams).promise()\n .then(() => callback(null, 'success'))\n .catch((err) => callback(err));\n};",
"'use strict';\n\nconst crypto = require('crypto');\nconst { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');\nconst client = new LambdaClient();\nconst secret = '${WebhookSecret}';\n\nmodule.exports.lambda = (event, context, callback) => {\n const body = event.body;\n const hash = 'sha1=' + crypto\n .createHmac('sha1', secret)\n .update(new Buffer(JSON.stringify(body)))\n .digest('hex');\n\n if (event.signature !== hash)\n return callback('invalid: signature does not match');\n\n if (body.zen) return callback(null, 'ignored ping request');\n\n const command = new InvokeCommand({\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event.body),\n InvocationType: 'Event'\n });\n\n client.send(command)\n .then(() => callback(null, 'success'))\n .catch((err) => callback(err));\n};",
{

@@ -174,0 +174,0 @@ "WebhookSecret": {

@@ -27,3 +27,3 @@ {

"DeploymentId": {
"Ref": "PassDeployment0e352c83"
"Ref": "PassDeploymentda5b06a6"
},

@@ -56,3 +56,3 @@ "StageName": "hookshot",

},
"PassDeployment0e352c83": {
"PassDeploymentda5b06a6": {
"Type": "AWS::ApiGateway::Deployment",

@@ -173,3 +173,3 @@ "DependsOn": "PassMethod",

"ZipFile": {
"Fn::Sub": "'use strict';\n\nconst AWS = require('aws-sdk');\nconst lambda = new AWS.Lambda();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const lambdaParams = {\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n };\n\n lambda.invoke(lambdaParams).promise()\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
"Fn::Sub": "const { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');\nconst client = new LambdaClient();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const command = new InvokeCommand({\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n });\n\n client.send(command)\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
}

@@ -176,0 +176,0 @@ },

@@ -27,3 +27,3 @@ {

"DeploymentId": {
"Ref": "PassDeployment0e352c83"
"Ref": "PassDeploymentda5b06a6"
},

@@ -47,3 +47,3 @@ "StageName": "hookshot",

},
"PassDeployment0e352c83": {
"PassDeploymentda5b06a6": {
"Type": "AWS::ApiGateway::Deployment",

@@ -155,3 +155,3 @@ "DependsOn": "PassMethod",

"ZipFile": {
"Fn::Sub": "'use strict';\n\nconst AWS = require('aws-sdk');\nconst lambda = new AWS.Lambda();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const lambdaParams = {\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n };\n\n lambda.invoke(lambdaParams).promise()\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
"Fn::Sub": "const { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');\nconst client = new LambdaClient();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const command = new InvokeCommand({\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n });\n\n client.send(command)\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
}

@@ -158,0 +158,0 @@ },

@@ -27,3 +27,3 @@ {

"DeploymentId": {
"Ref": "PassDeployment0e352c83"
"Ref": "PassDeploymentda5b06a6"
},

@@ -47,3 +47,3 @@ "StageName": "hookshot",

},
"PassDeployment0e352c83": {
"PassDeploymentda5b06a6": {
"Type": "AWS::ApiGateway::Deployment",

@@ -155,3 +155,3 @@ "DependsOn": "PassMethod",

"ZipFile": {
"Fn::Sub": "'use strict';\n\nconst AWS = require('aws-sdk');\nconst lambda = new AWS.Lambda();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const lambdaParams = {\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n };\n\n lambda.invoke(lambdaParams).promise()\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
"Fn::Sub": "const { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');\nconst client = new LambdaClient();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const command = new InvokeCommand({\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n });\n\n client.send(command)\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
}

@@ -158,0 +158,0 @@ },

@@ -27,3 +27,3 @@ {

"DeploymentId": {
"Ref": "PassDeployment0e352c83"
"Ref": "PassDeploymentda5b06a6"
},

@@ -47,3 +47,3 @@ "StageName": "hookshot",

},
"PassDeployment0e352c83": {
"PassDeploymentda5b06a6": {
"Type": "AWS::ApiGateway::Deployment",

@@ -155,3 +155,3 @@ "DependsOn": "PassMethod",

"ZipFile": {
"Fn::Sub": "'use strict';\n\nconst AWS = require('aws-sdk');\nconst lambda = new AWS.Lambda();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const lambdaParams = {\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n };\n\n lambda.invoke(lambdaParams).promise()\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
"Fn::Sub": "const { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');\nconst client = new LambdaClient();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const command = new InvokeCommand({\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n });\n\n client.send(command)\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
}

@@ -158,0 +158,0 @@ },

@@ -27,3 +27,3 @@ {

"DeploymentId": {
"Ref": "PassDeployment0e352c83"
"Ref": "PassDeploymentda5b06a6"
},

@@ -47,3 +47,3 @@ "StageName": "hookshot",

},
"PassDeployment0e352c83": {
"PassDeploymentda5b06a6": {
"Type": "AWS::ApiGateway::Deployment",

@@ -155,3 +155,3 @@ "DependsOn": "PassMethod",

"ZipFile": {
"Fn::Sub": "'use strict';\n\nconst AWS = require('aws-sdk');\nconst lambda = new AWS.Lambda();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const lambdaParams = {\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n };\n\n lambda.invoke(lambdaParams).promise()\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
"Fn::Sub": "const { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');\nconst client = new LambdaClient();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const command = new InvokeCommand({\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n });\n\n client.send(command)\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
}

@@ -158,0 +158,0 @@ },

@@ -27,3 +27,3 @@ {

"DeploymentId": {
"Ref": "PassDeployment0e352c83"
"Ref": "PassDeploymentda5b06a6"
},

@@ -47,3 +47,3 @@ "StageName": "hookshot",

},
"PassDeployment0e352c83": {
"PassDeploymentda5b06a6": {
"Type": "AWS::ApiGateway::Deployment",

@@ -155,3 +155,3 @@ "DependsOn": "PassMethod",

"ZipFile": {
"Fn::Sub": "'use strict';\n\nconst AWS = require('aws-sdk');\nconst lambda = new AWS.Lambda();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const lambdaParams = {\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n };\n\n lambda.invoke(lambdaParams).promise()\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
"Fn::Sub": "const { InvokeCommand, LambdaClient } = require('@aws-sdk/client-lambda');\nconst client = new LambdaClient();\n\nmodule.exports.lambda = (event, context, callback) => {\n if (event.httpMethod === 'OPTIONS') {\n const requestHeaders = event.headers['Access-Control-Request-Headers'] || event.headers['access-control-request-headers'];\n const response = {\n statusCode: 200,\n body: '',\n headers: {\n 'Access-Control-Allow-Headers': requestHeaders,\n 'Access-Control-Allow-Methods': 'POST, OPTIONS',\n 'Access-Control-Allow-Origin': '*'\n }\n };\n return callback(null, response);\n }\n\n const command = new InvokeCommand({\n FunctionName: '${Destination}',\n Payload: JSON.stringify(event)\n });\n\n client.send(command)\n .then((response) => {\n if (!response || !response.Payload)\n return callback(new Error('Your Lambda function Destination did not provide a payload'));\n\n var payload = JSON.parse(response.Payload);\n payload.headers = payload.headers || {};\n payload.headers['Access-Control-Allow-Origin'] = '*';\n callback(null, payload);\n })\n .catch((err) => callback(err));\n};"
}

@@ -158,0 +158,0 @@ },

@@ -1445,2 +1445,26 @@ 'use strict';

assert.throws(
() =>
new cf.shortcuts.hookshot.Passthrough({
Prefix: 'Pass',
PassthroughTo: 'Destination',
LoggingLevel: 'INFO',
Runtime: 'python3.7'
}),
/Only valid nodejs runtimes are supported for hookshot lambdas, received: 'python3.7'/,
'throws with invalid lambda Runtime python3.7'
);
assert.throws(
() =>
new cf.shortcuts.hookshot.Passthrough({
Prefix: 'Pass',
PassthroughTo: 'Destination',
LoggingLevel: 'INFO',
Runtime: 'nodejs16.x'
}),
/Only nodejs runtimes >= 18 are supported for hookshot lambdas, received: 'nodejs16.x'/,
'throws with invalid lambda Runtime nodejs16.x'
);
const to = new cf.shortcuts.Lambda({

@@ -1554,2 +1578,24 @@ LogicalName: 'Destination',

assert.throws(
() =>
new cf.shortcuts.hookshot.Github({
Prefix: 'Pass',
PassthroughTo: 'Destination',
Runtime: 'python3.7'
}),
/Only valid nodejs runtimes are supported for hookshot lambdas, received: 'python3.7'/,
'throws with invalid lambda Runtime python3.7'
);
assert.throws(
() =>
new cf.shortcuts.hookshot.Github({
Prefix: 'Pass',
PassthroughTo: 'Destination',
Runtime: 'nodejs16.x'
}),
/Only nodejs runtimes >= 18 are supported for hookshot lambdas, received: 'nodejs16.x'/,
'throws with invalid lambda Runtime nodejs16.x'
);
const to = new cf.shortcuts.Lambda({

@@ -1556,0 +1602,0 @@ LogicalName: 'Destination',

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc