@makeflow/gateway-server
Advanced tools
Comparing version 0.1.0-alpha.12 to 0.1.0-alpha.13
@@ -106,3 +106,3 @@ "use strict"; | ||
_a = _e.sent(), type = _a.type, source = _a.source, _b = _a.parameters, parametersConfig = _b === void 0 ? [] : _b, _c = _a.manual, manual = _c === void 0 ? true : _c; | ||
_d = filterParameters(parameters, parametersConfig), filteredParameters = _d.filteredParameters, deniedParameters = _d.deniedParameters; | ||
_d = filterAndSerializeParameters(parameters, parametersConfig), filteredParameters = _d.filteredParameters, deniedParameters = _d.deniedParameters; | ||
command = { | ||
@@ -360,16 +360,18 @@ name: name, | ||
} | ||
function filterParameters(parameters, parametersConfigs) { | ||
function filterAndSerializeParameters(parameters, parametersConfigs) { | ||
var _a = parametersConfigs.reduce(function (reducer, config) { | ||
var filteredParameters = reducer.filteredParameters, missingParameters = reducer.missingParameters; | ||
if (typeof config === 'string') { | ||
filteredParameters[config] = parameters[config]; | ||
var parameterName = typeof config === 'object' ? config.name : config; | ||
var parameterRequired = typeof config === 'object' ? config.required : false; | ||
var parameterValue = parameters[parameterName]; | ||
var serializedValue = typeof parameterValue === 'object' | ||
? JSON.stringify(parameterValue) | ||
: parameterValue; | ||
if (serializedValue !== undefined) { | ||
filteredParameters[parameterName] = serializedValue; | ||
} | ||
else if (typeof config === 'object') { | ||
var parameter = parameters[config.name]; | ||
if (config.required && typeof parameter === 'undefined') { | ||
missingParameters.push(config.name); | ||
else { | ||
if (parameterRequired) { | ||
missingParameters.push(parameterName); | ||
} | ||
else { | ||
filteredParameters[config.name] = parameters[config.name]; | ||
} | ||
} | ||
@@ -376,0 +378,0 @@ return reducer; |
@@ -390,2 +390,3 @@ "use strict"; | ||
var field = typeof parameter === 'object' ? parameter.field : undefined; | ||
var fieldData = typeof parameter === 'object' ? parameter.fieldData : undefined; | ||
if (!field) { | ||
@@ -400,2 +401,3 @@ return undefined; | ||
displayName: displayName, | ||
data: fieldData, | ||
}; | ||
@@ -402,0 +404,0 @@ } |
{ | ||
"name": "@makeflow/gateway-server", | ||
"description": "Makeflow gateway server package", | ||
"version": "0.1.0-alpha.12", | ||
"version": "0.1.0-alpha.13", | ||
"author": "Chengdu Mufan Technology Co., Ltd.", | ||
@@ -18,3 +18,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@makeflow/gateway-shared": "^0.1.0-alpha.12", | ||
"@makeflow/gateway-shared": "^0.1.0-alpha.13", | ||
"@makeflow/types": "^0.1.3", | ||
@@ -60,3 +60,3 @@ "@makeflow/types-nominal": "^0.1.1", | ||
}, | ||
"gitHead": "094c7d53e3215ba65bc38d5804f2623eb4001337" | ||
"gitHead": "13abe1837af592f9592a4bfa9fc86f17b2aad571" | ||
} |
@@ -110,3 +110,3 @@ import {exec as _exec, execFile as _execFile} from 'child_process'; | ||
let {filteredParameters, deniedParameters} = filterParameters( | ||
let {filteredParameters, deniedParameters} = filterAndSerializeParameters( | ||
parameters, | ||
@@ -364,3 +364,3 @@ parametersConfig, | ||
function filterParameters( | ||
function filterAndSerializeParameters( | ||
parameters: CommandParameters, | ||
@@ -379,11 +379,18 @@ parametersConfigs: CommandConfigParameter[], | ||
if (typeof config === 'string') { | ||
filteredParameters[config] = parameters[config]; | ||
} else if (typeof config === 'object') { | ||
let parameter = parameters[config.name]; | ||
let parameterName = typeof config === 'object' ? config.name : config; | ||
let parameterRequired = | ||
typeof config === 'object' ? config.required : false; | ||
if (config.required && typeof parameter === 'undefined') { | ||
missingParameters.push(config.name); | ||
} else { | ||
filteredParameters[config.name] = parameters[config.name]; | ||
let parameterValue = parameters[parameterName]; | ||
let serializedValue = | ||
typeof parameterValue === 'object' | ||
? JSON.stringify(parameterValue) | ||
: parameterValue; | ||
if (serializedValue !== undefined) { | ||
filteredParameters[parameterName] = serializedValue; | ||
} else { | ||
if (parameterRequired) { | ||
missingParameters.push(parameterName); | ||
} | ||
@@ -390,0 +397,0 @@ } |
@@ -390,2 +390,4 @@ import {URL} from 'url'; | ||
let field = typeof parameter === 'object' ? parameter.field : undefined; | ||
let fieldData = | ||
typeof parameter === 'object' ? parameter.fieldData : undefined; | ||
@@ -403,2 +405,3 @@ if (!field) { | ||
displayName, | ||
data: fieldData, | ||
}; | ||
@@ -405,0 +408,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
229847
4547