@aws-amplify/data-schema
Advanced tools
Comparing version 0.14.12 to 0.14.13
@@ -158,3 +158,3 @@ "use strict"; | ||
} | ||
function transformFunctionHandler(handlers, callSignature) { | ||
function transformFunctionHandler(handlers, functionFieldName) { | ||
let gqlHandlerContent = ''; | ||
@@ -168,5 +168,3 @@ const lambdaFunctionDefinition = {}; | ||
else if (typeof handlerData.getInstance === 'function') { | ||
const fnBaseName = `Fn${capitalize(callSignature)}`; | ||
const fnNameSuffix = idx === 0 ? '' : `${idx + 1}`; | ||
const fnName = fnBaseName + fnNameSuffix; | ||
const fnName = `Fn${capitalize(functionFieldName)}${idx === 0 ? '' : `${idx + 1}`}`; | ||
lambdaFunctionDefinition[fnName] = handlerData; | ||
@@ -176,3 +174,3 @@ gqlHandlerContent += `@function(name: "${fnName}") `; | ||
else { | ||
throw new Error(`Invalid value specified for ${callSignature} handler.function(). Expected: defineFunction or string.`); | ||
throw new Error(`Invalid value specified for ${functionFieldName} handler.function(). Expected: defineFunction or string.`); | ||
} | ||
@@ -246,3 +244,3 @@ }); | ||
if (isFunctionHandler(handlers)) { | ||
({ gqlHandlerContent, lambdaFunctionDefinition } = transformFunctionHandler(handlers, callSignature)); | ||
({ gqlHandlerContent, lambdaFunctionDefinition } = transformFunctionHandler(handlers, typeName)); | ||
} | ||
@@ -828,3 +826,3 @@ else if (functionRef) { | ||
const jsFunctions = []; | ||
let lambdaFunctions = {}; | ||
const lambdaFunctions = {}; | ||
const customSqlDataSourceStrategies = []; | ||
@@ -867,3 +865,3 @@ const databaseType = schema.data.configuration.database.engine === 'dynamodb' | ||
const { gqlField, models, jsFunctionForField, lambdaFunctionDefinition, customSqlDataSourceStrategy, } = transformCustomOperations(typeDef, typeName, mostRelevantAuthRules, databaseType, getRefType); | ||
lambdaFunctions = lambdaFunctionDefinition; | ||
Object.assign(lambdaFunctions, lambdaFunctionDefinition); | ||
topLevelTypes.push(...models); | ||
@@ -870,0 +868,0 @@ if (jsFunctionForField) { |
{ | ||
"name": "@aws-amplify/data-schema", | ||
"version": "0.14.12", | ||
"version": "0.14.13", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
731046
4150