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

lambda-serverless-api

Package Overview
Dependencies
Maintainers
1
Versions
396
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-serverless-api - npm Package Compare versions

Comparing version 1.12.6 to 1.12.7

42

lib/api.js
const xor = require('lodash.xor');
const get = require('lodash.get');
const Rollbar = require('lambda-rollbar');
const Limiter = require('lambda-rate-limiter');
const yaml = require("yaml-boost");
const param = require("./param");
const response = require("./response");
const swagger = require("./swagger");
const Find = require("./util/find");

@@ -14,2 +22,3 @@

const receivedRequestMethod = get(event, 'httpMethod');
if (receivedRequestMethod !== expectedRequestMethod) {

@@ -20,3 +29,5 @@ throw response.ApiError(`Request Method "${expectedRequestMethod}" expected.`, 400, 99004, {

}
let body;
try {

@@ -29,3 +40,6 @@ body = JSON.parse(get(event, 'body', '{}'));

}
const eventParsed = Object.assign({}, event, { body });
const eventParsed = Object.assign({}, event, {
body
});
return Promise.resolve(params.map(p => p.get(eventParsed)));

@@ -45,2 +59,3 @@ };

}
if (resp instanceof response.ApiResponseClass) {

@@ -53,2 +68,3 @@ return {

}
throw err;

@@ -66,16 +82,11 @@ };

}
if (params.filter(p => p.position === 'path').some(p => request.indexOf(`{${p.name}}`) === -1)) {
throw new Error("Path Parameter not defined in given path.");
}
endpoints[request] = params;
return rollbar
.wrap((event, context, rb) => limiter
.check(limit, get(event, 'requestContext.identity.sourceIp'))
.catch(() => {
throw response.ApiError("Rate limit exceeded.", 429);
})
.then(() => parse(request, params, event))
.then(paramsOut => handler(paramsOut, context, rb))
.then(payload => generateResponse(null, payload, rb))
.catch(err => generateResponse(err, null, rb)));
return rollbar.wrap((event, context, rb) => limiter.check(limit, get(event, 'requestContext.identity.sourceIp')).catch(() => {
throw response.ApiError("Rate limit exceeded.", 429);
}).then(() => parse(request, params, event)).then(paramsOut => handler(paramsOut, context, rb)).then(payload => generateResponse(null, payload, rb)).catch(err => generateResponse(err, null, rb)));
};

@@ -86,8 +97,4 @@

const swaggerData = yaml.load(swaggerFile);
const serverlessRequests = Find(["functions.*.events.*.http"])(serverlessData)
.map(k => get(serverlessData, k)).map(e => `${e.method.toUpperCase()} ${e.path}`);
const swaggerRequests = Find(["paths.*.*"])(swaggerData)
.map(k => k.split(".")).map(e => `${e[2].toUpperCase()} ${e[1].substring(1)}`);
const serverlessRequests = Find(["functions.*.events.*.http"])(serverlessData).map(k => get(serverlessData, k)).map(e => `${e.method.toUpperCase()} ${e.path}`);
const swaggerRequests = Find(["paths.*.*"])(swaggerData).map(k => k.split(".")).map(e => `${e[2].toUpperCase()} ${e[1].substring(1)}`);
return xor(serverlessRequests, swaggerRequests);

@@ -109,1 +116,2 @@ };

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9hcGkuanMiXSwibmFtZXMiOlsieG9yIiwicmVxdWlyZSIsImdldCIsIlJvbGxiYXIiLCJMaW1pdGVyIiwieWFtbCIsInBhcmFtIiwicmVzcG9uc2UiLCJzd2FnZ2VyIiwiRmluZCIsInBhcnNlIiwicmVxdWVzdCIsInBhcmFtcyIsImV2ZW50IiwiZXhwZWN0ZWRSZXF1ZXN0TWV0aG9kIiwic3BsaXQiLCJyZWNlaXZlZFJlcXVlc3RNZXRob2QiLCJBcGlFcnJvciIsInZhbHVlIiwiYm9keSIsIkpTT04iLCJlIiwiZXZlbnRQYXJzZWQiLCJPYmplY3QiLCJhc3NpZ24iLCJQcm9taXNlIiwicmVzb2x2ZSIsIm1hcCIsInAiLCJnZW5lcmF0ZVJlc3BvbnNlIiwiZXJyIiwicmVzcCIsInJiIiwiQXBpRXJyb3JDbGFzcyIsIndhcm5pbmciLCJ0aGVuIiwic3RhdHVzQ29kZSIsInN0cmluZ2lmeSIsIm1lc3NhZ2UiLCJtZXNzYWdlSWQiLCJjb250ZXh0IiwiQXBpUmVzcG9uc2VDbGFz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pbmQoW1wiZnVuY3Rpb25zLiouZXZlbnRzLiouaHR0cFwiXSkoc2VydmVybGVzc0RhdGEpXG4gICAgICAubWFwKGsgPT4gZ2V0KHNlcnZlcmxlc3NEYXRhLCBrKSkubWFwKGUgPT4gYCR7ZS5tZXRob2QudG9VcHBlckNhc2UoKX0gJHtlLnBhdGh9YCk7XG4gICAgY29uc3Qgc3dhZ2dlclJlcXVlc3RzID0gRmluZChbXCJwYXRocy4qLipcIl0pKHN3YWdnZXJEYXRhKVxuICAgICAgLm1hcChrID0+IGsuc3BsaXQoXCIuXCIpKS5tYXAoZSA9PiBgJHtlWzJdLnRvVXBwZXJDYXNlKCl9ICR7ZVsxXS5zdWJzdHJpbmcoMSl9YCk7XG5cbiAgICByZXR1cm4geG9yKHNlcnZlcmxlc3NSZXF1ZXN0cywgc3dhZ2dlclJlcXVlc3RzKTtcbiAgfTtcblxuICByZXR1cm4ge1xuICAgIHdyYXAsXG4gICAgZ2VuZXJhdGVTd2FnZ2VyOiAoZXhpc3RpbmcgPSB7fSkgPT4gc3dhZ2dlcihlbmRwb2ludHMsIGV4aXN0aW5nKSxcbiAgICBnZW5lcmF0ZURpZmZlcmVuY2UsXG4gICAgQXBpRXJyb3I6IHJlc3BvbnNlLkFwaUVycm9yLFxuICAgIEFwaVJlc3BvbnNlOiByZXNwb25zZS5BcGlSZXNwb25zZSxcbiAgICBKc29uUmVzcG9uc2U6IHJlc3BvbnNlLkpzb25SZXNwb25zZSxcbiAgICBTdHI6IHBhcmFtLlN0cixcbiAgICBFbWFpbDogcGFyYW0uRW1haWwsXG4gICAgUmVnRXg6IHBhcmFtLlJlZ0V4LFxuICAgIEJvb2w6IHBhcmFtLkJvb2xcbiAgfTtcbn07XG4iXX0=
const get = require("lodash.get");
const response = require("./response");

@@ -17,2 +18,3 @@

}
this.name = name;

@@ -22,5 +24,5 @@ this.position = position;

this.type = null;
}
} // eslint-disable-next-line class-methods-use-this
// eslint-disable-next-line class-methods-use-this
validate(value) {

@@ -32,2 +34,3 @@ return true;

const result = get(event, `${positionMapping[this.position]}.${this.name}`);
if (result === undefined) {

@@ -42,4 +45,6 @@ if (this.required) {

}
return result;
}
}

@@ -55,8 +60,12 @@

let valid = super.validate(value);
if (!(typeof value === 'string' || value instanceof String)) {
valid = false;
}
return valid;
}
}
module.exports.Str = (...args) => new Str(...args);

@@ -72,8 +81,12 @@

let valid = super.validate(value);
if (!value.match(this.regex)) {
valid = false;
}
return valid;
}
}
module.exports.RegEx = (...args) => new RegEx(...args);

@@ -85,3 +98,5 @@

}
}
module.exports.Email = (...args) => new Email(...args);

@@ -98,3 +113,6 @@

}
}
module.exports.Bool = (...args) => new Bool(...args);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9wYXJhbS5qcyJdLCJuYW1lcyI6WyJnZXQiLCJyZXF1aXJlIiwicmVzcG9uc2UiLCJwb3NpdGlvbk1hcHBpbmciLCJxdWVyeSIsImpzb24iLCJwYXRoIiwiaGVhZGVyIiwiY29udGV4dCIsIlBhcmFtIiwiY29uc3RydWN0b3IiLCJuYW1lIiwicG9zaXRpb24iLCJyZXF1aXJlZCIsIk9iamVjdCIsImtleXMiLCJpbmRleE9mIiwiRXJyb3IiLCJqb2luIiwidHlwZSIsInZhbGlkYXRlIiwidmFsdWUiLCJldmVudCIsInJlc3VsdCIsInVuZGVmaW5lZCIsIkFwaUVycm9yIiwiU3RyIiwiYXJncyIsInZhbGlkIiwiU3RyaW5nIiwibW9kdWxlIiwiZXhwb3J0cyIsIlJlZ0V4IiwicmVnZXgiLCJtYXRjaCIsIkVtYWlsIiwiQm9vbCJdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTUEsTUFBTUMsUUFBUSxZQUFSLENBQVo7O0FBQ0EsTUFBTUMsV0FBV0QsUUFBUSxZQUFSLENBQWpCOztBQUVBLE1BQU1FLGtCQUFrQjtBQUN0QkMsU0FBTyx1QkFEZTtBQUV0Qk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LTE7XG4gIH1cbn1cbm1vZHVsZS5leHBvcnRzLkJvb2wgPSAoLi4uYXJncykgPT4gbmV3IEJvb2woLi4uYXJncyk7XG4iXX0=

@@ -10,4 +10,7 @@ class ApiError extends Error {

}
}
module.exports.ApiErrorClass = ApiError;
module.exports.ApiError = (...args) => new ApiError(...args);

@@ -21,8 +24,10 @@

}
}
module.exports.ApiResponseClass = ApiResponse;
module.exports.ApiResponse = (...args) => new ApiResponse(...args);
// --------------------------
module.exports.ApiResponse = (...args) => new ApiResponse(...args); // --------------------------
class JsonResponse extends ApiResponse {

@@ -32,3 +37,6 @@ constructor(payload, ...args) {

}
}
module.exports.JsonResponse = (...args) => new JsonResponse(...args);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9yZXNwb25zZS5qcyJdLCJuYW1lcyI6WyJBcGlFcnJvciIsIkVycm9yIiwiY29uc3RydWN0b3IiLCJtZXNzYWdlIiwic3RhdHVzQ29kZSIsIm1lc3NhZ2VJZCIsInVuZGVmaW5lZCIsImNvbnRleHQiLCJuYW1lIiwiY2FwdHVyZVN0YWNrVHJhY2UiLCJtb2R1bGUiLCJleHBvcnRzIiwiQXBpRXJyb3JDbGFzcyIsImFyZ3MiLCJBcGlSZXNwb25zZSIsInBheWxvYWQiLCJoZWFkZXJzIiwiQXBpUmVzcG9uc2VDbGFzcyIsIkpzb25SZXNwb25zZSIsIkpTT04iLCJzdHJpbmdpZnkiXSwibWFwcGluZ3MiOiJBQUFBLE1BQU1BLFFBQU4sU0FBdUJDLEtBQXZCLENBQTZCO0FBQzNCQyxjQUFZQyxPQUFaLEVBQXFCQyxhQUFhLEdBQWxDLEVBQXVDQyxZQUFZQyxTQUFuRCxFQUE4REMsVUFBVUQsU0FBeEUsRUFBbUY7QUFDakYsVUFBTUgsT0FBTjtBQUNBLFNBQUtLLElBQUwsR0FBWSxLQUFLTixXQUFMLENBQWlCTSxJQUE3QjtBQ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dzKSA9PiBuZXcgQXBpUmVzcG9uc2UoLi4uYXJncyk7XG5cbi8vIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG5cbmNsYXNzIEpzb25SZXNwb25zZSBleHRlbmRzIEFwaVJlc3BvbnNlIHtcbiAgY29uc3RydWN0b3IocGF5bG9hZCwgLi4uYXJncykge1xuICAgIHN1cGVyKEpTT04uc3RyaW5naWZ5KHBheWxvYWQpLCAuLi5hcmdzKTtcbiAgfVxufVxubW9kdWxlLmV4cG9ydHMuSnNvblJlc3BvbnNlID0gKC4uLmFyZ3MpID0+IG5ldyBKc29uUmVzcG9uc2UoLi4uYXJncyk7XG4iXX0=
const SwaggerParser = require('swagger-parser');
const merge = require("./util/merge")([
"swagger",
"produces",
"paths.*.*.parameters",
"paths.*.*.consumes"
], [
"paths.*.*.description"
]);
const merge = require("./util/merge")(["swagger", "produces", "paths.*.*.parameters", "paths.*.*.consumes"], ["paths.*.*.description"]);

@@ -22,18 +15,14 @@ module.exports = (endpoints, existing) => {

};
Object.keys(endpoints).forEach((request) => {
const parameters = endpoints[request]
.filter(p => ["json", "context"].indexOf(p.position) === -1)
.map(p => Object.assign(
{
name: p.name,
required: p.required,
type: p.type,
format: p.constructor.name,
in: p.position
},
p.regex === undefined ? {} : { pattern: p.regex.toString() }
));
Object.keys(endpoints).forEach(request => {
const parameters = endpoints[request].filter(p => ["json", "context"].indexOf(p.position) === -1).map(p => Object.assign({
name: p.name,
required: p.required,
type: p.type,
format: p.constructor.name,
in: p.position
}, p.regex === undefined ? {} : {
pattern: p.regex.toString()
}));
const jsonParams = endpoints[request].filter(p => p.position === "json");
const jsonParams = endpoints[request]
.filter(p => p.position === "json");
if (jsonParams.length !== 0) {

@@ -47,9 +36,8 @@ parameters.push({

properties: jsonParams.reduce((prev, p) => Object.assign(prev, {
[p.name]: Object.assign(
{
type: p.type,
format: p.constructor.name
},
p.regex === undefined ? {} : { pattern: p.regex.toString() }
)
[p.name]: Object.assign({
type: p.type,
format: p.constructor.name
}, p.regex === undefined ? {} : {
pattern: p.regex.toString()
})
}), {})

@@ -61,5 +49,4 @@ }

const description = [];
const contextParams = endpoints[request]
.filter(p => p.position === "context")
.map(p => p.name);
const contextParams = endpoints[request].filter(p => p.position === "context").map(p => p.name);
if (contextParams.length !== 0) {

@@ -82,3 +69,2 @@ description.push(`Internally contexts are used: ${contextParams.join(", ")}`);

});
const result = JSON.parse(JSON.stringify(existing));

@@ -88,1 +74,2 @@ merge(result, data);

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9zd2FnZ2VyLmpzIl0sIm5hbWVzIjpbIlN3YWdnZXJQYXJzZXIiLCJyZXF1aXJlIiwibWVyZ2UiLCJtb2R1bGUiLCJleHBvcnRzIiwiZW5kcG9pbnRzIiwiZXhpc3RpbmciLCJkYXRhIiwic3dhZ2dlciIsInByb2R1Y2VzIiwiaW5mbyIsInRpdGxlIiwidmVyc2lvbiIsInBhdGhzIiwiT2JqZWN0Iiwia2V5cyIsImZvckVhY2giLCJyZXF1ZXN0IiwicGFyYW1ldGVycyIsImZpbHRlciIsInAiLCJpbmRleE9mIiwicG9zaXRpb24iLCJtYXAiLCJhc3NpZ24iLCJuYW1lIiwicmVxdWlyZWQiLCJ0eXBlIiwiZm9ybWF0IiwiY29uc3RydWN0b3IiLCJpbiIsInJlZ2V4IiwidW5kZWZpbmVkIiwicGF0dGVybiIsInRvU3RyaW5nIiwianNvblBhcmFtcyIsImxlbmd0aCIsInB1c2giLCJzY2hlbWEiLCJwcm9wZXJ0aWVzIiwicmVkdWNlIiwicHJldiIsImRlc2NyaXB0aW9uIiwiY29udGV4dFBhcmFtcyIsImpvaW4iLCJzcGxpdCIsInRvTG93ZXJDYXNlIiwiY29uc3VtZXMiLCJyZXNwb25zZXMiLCJkZWZhdWx0IiwicmVzdWx0IiwiSlNPTiIsInBhcnNlIiwic3RyaW5naWZ5IiwidmFsaWRhdG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LnBhcmFtZXRlcnNcIixcbiAgXCJwYXRocy4qLiouY29uc3VtZXNcIlxuXSwgW1xuICBcInBhdGhzLiouKi5kZXNjcmlwdGlvblwiXG5dKTtcblxubW9kdWxlLmV4cG9ydHMgPSAoZW5kcG9pbnRzLCBleGlzdGluZykgPT4ge1xuICBjb25zdCBkYXRhID0ge1xuICAgIHN3YWdnZXI6IFwiMi4wXCIsXG4gICAgcHJvZHVjZXM6IFtcImFwcGxpY2F0aW9uL2pzb25cIl0sXG4gICAgaW5mbzoge1xuICAgICAgdGl0bGU6IFwiQXBpIE5hbWVcIixcbiAgICAgIHZlcnNpb246IFwiMC4wLjFcIlxuICAgIH0sXG4gICAgcGF0aHM6IHt9XG4gIH07XG4gIE9iamVjdC5rZXlzKGVuZHBvaW50cykuZm9yRWFjaCgocmVxdWVzdCkgPT4ge1xuICAgIGNvbnN0IHBhcmFtZXRlcnMgPSBlbmRwb2ludHNbcmVxdWVzdF1cbiAgICAgIC5maWx0ZXIocCA9PiBbXCJqc29uXCIsIFwiY29udGV4dFwiXS5pbmRleE9mKHAucG9zaXRpb24pID09PSAtMSlcbiAgICAgIC5tYXAocCA9PiBPYmplY3QuYXNzaWduKFxuICAgICAgICB7XG4gICAgICAgICAgbmFtZTogcC5uYW1lLFxuICAgICAgICAgIHJlcXVpcmVkOiBwLnJlcXVpcmVkLFxuICAgICAgICAgIHR5cGU6IHAudHlwZSxcbiAgICAgICAgICBmb3JtYXQ6IHAuY29uc3RydWN0b3IubmFtZSxcbiAgICAgICAgICBpbjogcC5wb3NpdGlvblxuICAgICAgICB9LFxuICAgICAgICBwLnJlZ2V4ID09PSB1bmRlZmluZWQgPyB7fSA6IHsgcGF0dGVybjogcC5yZWdleC50b1N0cmluZygpIH1cbiAgICAgICkpO1xuXG4gICAgY29uc3QganNvblBhcmFtcyA9IGVuZHBvaW50c1tyZXF1ZXN0XVxuICAgICAgLmZpbHRlcihwID0+IHAucG9zaXRpb24gPT09IFwianNvblwiKTtcbiAgICBpZiAoanNvblBhcmFtcy5sZW5ndGggIT09IDApIHtcbiAgICAgIHBhcmFtZXRlcnMucHVzaCh7XG4gICAgICAgIGluOiBcImJvZHlcIixcbiAgICAgICAgbmFtZTogXCJib2R5UGFyYW1EYXRhXCIsXG4gICAgICAgIHNjaGVtYToge1xuICAgICAgICAgIHR5cGU6IFwib2JqZWN0XCIsXG4gICAgICAgICAgcmVxdWlyZWQ6IGpzb25QYXJhbXMuZmlsdGVyKHAgPT4gcC5yZXF1aXJlZCkubWFwKHAgPT4gcC5uYW1lKSxcbiAgICAgICAgICBwcm9wZXJ0aWVzOiBqc29uUGFyYW1zLnJlZHVjZSgocHJldiwgcCkgPT4gT2JqZWN0LmFzc2lnbihwcmV2LCB7XG4gICAgICAgICAgICBbcC5uYW1lXTogT2JqZWN0LmFzc2lnbihcbiAgICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIHR5cGU6IHAudHlwZSxcbiAgICAgICAgICAgICAgICBmb3JtYXQ6IHAuY29uc3RydWN0b3IubmFtZVxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBwLnJlZ2V4ID09PSB1bmRlZmluZWQgPyB7fSA6IHsgcGF0dGVybjogcC5yZWdleC50b1N0cmluZygpIH1cbiAgICAgICAgICAgIClcbiAgICAgICAgICB9KSwge30pXG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgIH1cblxuICAgIGNvbnN0IGRlc2NyaXB0aW9uID0gW107XG4gICAgY29uc3QgY29udGV4dFBhcmFtcyA9IGVuZHBvaW50c1tyZXF1ZXN0XVxuICAgICAgLmZpbHRlcihwID0+IHAucG9zaXRpb24gPT09IFwiY29udGV4dFwiKVxuICAgICAgLm1hcChwID0+IHAubmFtZSk7XG4gICAgaWYgKGNvbnRleHRQYXJhbXMubGVuZ3RoICE9PSAwKSB7XG4gICAgICBkZXNjcmlwdGlvbi5wdXNoKGBJbnRlcm5hbGx5IGNvbnRleHRzIGFyZSB1c2VkOiAke2NvbnRleHRQYXJhbXMuam9pbihcIiwgXCIpfWApO1xuICAgIH1cblxuICAgIGRhdGEucGF0aHNbYC8ke3JlcXVlc3Quc3BsaXQoXCIgXCIpWzFdfWBdID0ge1xuICAgICAgW3JlcXVlc3Quc3BsaXQoXCIgXCIpWzBdLnRvTG93ZXJDYXNlKCldOiB7XG4gICAgICAgIGNvbnN1bWVzOiBbXCJhcHBsaWNhdGlvbi9qc29uXCJdLFxuICAgICAgICBkZXNjcmlwdGlvbjogZGVzY3JpcHRpb24uam9pbihcIlxcblwiKSxcbiAgICAgICAgcGFyYW1ldGVycyxcbiAgICAgICAgcmVzcG9uc2VzOiB7XG4gICAgICAgICAgZGVmYXVsdDoge1xuICAgICAgICAgICAgZGVzY3JpcHRpb246IFwiVW5leHBlY3RlZCBFcnJvclwiXG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfTtcbiAgfSk7XG5cbiAgY29uc3QgcmVzdWx0ID0gSlNPTi5wYXJzZShKU09OLnN0cmluZ2lmeShleGlzdGluZykpO1xuICBtZXJnZShyZXN1bHQsIGRhdGEpO1xuICByZXR1cm4gU3dhZ2dlclBhcnNlci52YWxpZGF0ZShyZXN1bHQpO1xufTtcbiJdfQ==

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

module.exports = (needles) => {
module.exports = needles => {
const compiledSearch = needles.map(n => new RegExp(`^${n.replace(/\./g, "\\.").replace(/\*/g, "[^.]+?")}$`));

@@ -7,5 +7,7 @@

const selector = hierarchy.join(".");
if (compiledSearch.some(search => selector.match(search))) {
result.push(selector);
}
if (haystack instanceof Object) {

@@ -17,3 +19,3 @@ if (Array.isArray(haystack)) {

} else {
Object.keys(haystack).forEach((key) => {
Object.keys(haystack).forEach(key => {
result.push(...find(haystack[key], hierarchy.concat([key])));

@@ -23,2 +25,3 @@ });

}
return result;

@@ -29,1 +32,2 @@ };

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dG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B1c2goc2VsZWN0b3IpO1xuICAgIH1cbiAgICBpZiAoaGF5c3RhY2sgaW5zdGFuY2VvZiBPYmplY3QpIHtcbiAgICAgIGlmIChBcnJheS5pc0FycmF5KGhheXN0YWNrKSkge1xuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGhheXN0YWNrLmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgcmVzdWx0LnB1c2goLi4uZmluZChoYXlzdGFja1tpXSwgaGllcmFyY2h5LmNvbmNhdChbaV0pKSk7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIE9iamVjdC5rZXlzKGhheXN0YWNrKS5mb3JFYWNoKChrZXkpID0+IHtcbiAgICAgICAgICByZXN1bHQucHVzaCguLi5maW5kKGhheXN0YWNrW2tleV0sIGhpZXJhcmNoeS5jb25jYXQoW2tleV0pKSk7XG4gICAgICAgIH0pO1xuICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gcmVzdWx0O1xuICB9O1xuXG4gIHJldHVybiBmaW5kO1xufTtcbiJdfQ==
const get = require("lodash.get");
const set = require("lodash.set");
const defaultsdeep = require("lodash.defaultsdeep");
const Find = require("./find");

@@ -9,9 +12,9 @@

const findContains = Find(contains);
return (target, data) => {
defaultsdeep(target, data);
findExact(data).forEach(m => set(target, m, get(data, m)));
findContains(data).forEach((m) => {
findContains(data).forEach(m => {
const current = get(target, m);
const shouldContain = get(data, m);
if ((current || "").indexOf(shouldContain) === -1) {

@@ -23,1 +26,2 @@ set(target, m, [current, shouldContain].filter(e => e !== undefined).join("\n"));

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL21lcmdlLmpzIl0sIm5hbWVzIjpbImdldCIsInJlcXVpcmUiLCJzZXQiLCJkZWZhdWx0c2RlZXAiLCJGaW5kIiwibW9kdWxlIiwiZXhwb3J0cyIsImV4YWN0IiwiY29udGFpbnM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Y3VycmVudCwgc2hvdWxkQ29udGFpbl0uZmlsdGVyKGUgPT4gZSAhPT0gdW5kZWZpbmVkKS5qb2luKFwiXFxuXCIpKTtcbiAgICAgIH1cbiAgICB9KTtcbiAgfTtcbn07XG4iXX0=

@@ -20,11 +20,17 @@ {

"lambda-tdd": "1.11.15",
"js-gardener": "1.15.0",
"js-gardener": "1.16.0",
"nyc": "11.6.0",
"semantic-release": "15.1.5"
"semantic-release": "15.1.5",
"babel-cli": "7.0.0-beta.3"
},
"version": "1.12.6",
"version": "1.12.7",
"scripts": {
"test": "node gardener && nyc mocha --recursive",
"test": "npm run clean && npm run gardener && npm run test-simple",
"coveralls": "node ./node_modules/coveralls/bin/coveralls.js < ./coverage/lcov.info",
"semantic-release": "semantic-release"
"semantic-release": "npm run clean-build && semantic-release",
"clean": "rm -rf lib",
"build": "npx babel src --out-dir lib --source-maps inline --copy-files --include-dotfiles",
"clean-build": "npm run clean && npm run build",
"test-simple": "nyc mocha --recursive",
"gardener": "node gardener"
},

@@ -80,3 +86,4 @@ "homepage": "https://github.com/simlu/lambda-serverless-api#readme",

"coverage/*",
"flow-typed/*"
"flow-typed/*",
"lib/*"
],

@@ -83,0 +90,0 @@ "reporter": [

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