claudia-api-builder
Advanced tools
Comparing version 2.5.1 to 3.0.0
{ | ||
"name": "claudia-api-builder", | ||
"version": "2.5.1", | ||
"version": "3.0.0", | ||
"description": "Simplify AWS ApiGateway handling", | ||
@@ -37,3 +37,2 @@ "license": "MIT", | ||
"devDependencies": { | ||
"bluebird": "^3.3.0", | ||
"eslint": "^3.12.2", | ||
@@ -40,0 +39,0 @@ "eslint-config-crockford": "^0.2.0", |
@@ -50,2 +50,2 @@ # Claudia API Builder | ||
MIT | ||
[MIT](LICENSE) |
# Release history | ||
## 2.5.1, 7 June 2017 | ||
- easier handling for Lambda environment and stage variables, using `{mergeVars: true}` | ||
## 2.4.2, 3 May 2017 | ||
@@ -4,0 +8,0 @@ |
const util = require('util'), | ||
convertApiGWProxyRequest = require('./convert-api-gw-proxy-request'), | ||
sequentialPromiseMap = require('./sequential-promise-map'), | ||
lowercaseKeys = require('./lowercase-keys'); | ||
@@ -9,2 +10,3 @@ module.exports = function ApiBuilder(options) { | ||
customCorsMaxAge, | ||
customResponses, | ||
unsupportedEventCallback, | ||
@@ -273,3 +275,3 @@ authorizers, | ||
self.apiConfig = function () { | ||
const result = {version: 3, routes: methodConfigurations}; | ||
const result = {version: 4, routes: methodConfigurations}; | ||
if (customCorsHandler !== undefined) { | ||
@@ -290,2 +292,5 @@ result.corsHandlers = !!customCorsHandler; | ||
} | ||
if (customResponses) { | ||
result.customResponses = customResponses; | ||
} | ||
return result; | ||
@@ -379,3 +384,3 @@ }; | ||
if (typeof stepFunction !== 'function') { | ||
throw new Error('addPostDeployStep requires a function as the first argument'); | ||
throw new Error('addPostDeployStep requires a function as the second argument'); | ||
} | ||
@@ -404,5 +409,5 @@ if (postDeploySteps[name]) { | ||
if (typeof options[configOption] === 'string') { | ||
return utils.Promise.resolve(options[configOption]); | ||
return Promise.resolve(options[configOption]); | ||
} else { | ||
return prompter(prompt, utils.Promise); | ||
return prompter(prompt); | ||
} | ||
@@ -421,3 +426,3 @@ }; | ||
executeStepMapper = function (stepName) { | ||
return utils.Promise.resolve() | ||
return Promise.resolve() | ||
.then(() => postDeploySteps[stepName](options, lambdaDetails, utils)) | ||
@@ -427,5 +432,5 @@ .then(result => stepResults[stepName] = result); | ||
if (!steps.length) { | ||
return utils.Promise.resolve(false); | ||
return Promise.resolve(false); | ||
} | ||
return utils.Promise.map(steps, executeStepMapper, {concurrency: 1}) | ||
return sequentialPromiseMap(steps, executeStepMapper) | ||
.then(() => stepResults); | ||
@@ -451,2 +456,17 @@ }; | ||
}; | ||
self.setGatewayResponse = function (responseType, config) { | ||
if (!responseType || typeof responseType !== 'string') { | ||
throw new Error('response type must be a string'); | ||
} | ||
if (!config || typeof config !== 'object' || Object.keys(config).length === 0) { | ||
throw new Error(`Response type ${responseType} configuration is invalid`); | ||
} | ||
if (!customResponses) { | ||
customResponses = {}; | ||
} | ||
if (customResponses[responseType]) { | ||
throw new Error(`Response type ${responseType} is already defined`); | ||
} | ||
customResponses[responseType] = config; | ||
}; | ||
binaryMediaTypes = defaultBinaryMediaTypes; | ||
@@ -453,0 +473,0 @@ requestFormat = getRequestFormat(options && options.requestFormat); |
/*global require, module, process */ | ||
const readline = require('readline'); | ||
module.exports = function ask(question, PromiseImpl) { | ||
module.exports = function ask(question) { | ||
'use strict'; | ||
return new PromiseImpl((resolve, reject) => { | ||
return new Promise((resolve, reject) => { | ||
const rl = readline.createInterface({ | ||
@@ -8,0 +8,0 @@ input: process.stdin, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29745
5
13
637