Skip to content

Commit

Permalink
Merge pull request #4 from plezan/master
Browse files Browse the repository at this point in the history
Handle pipelines
  • Loading branch information
horiuchi authored Nov 13, 2023
2 parents 7bdb4b0 + 2609767 commit 89838f3
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ export function buildAmplifyConfig(
resolvers: Object.values(config.resolvers)
.map((r) => buildResolver(r, config, servicePath))
.filter(nonNullable),
functions: Object.values(config.pipelineFunctions).map(buildFunction),
functions: Object.values(config.pipelineFunctions)
.map((f) => buildFunction(f, config, servicePath))
.filter(nonNullable),
dataSources: Object.values(config.dataSources)
.map((d) => buildDataSource(d, service, options))
.filter(nonNullable),
Expand Down Expand Up @@ -381,14 +383,26 @@ function buildResolver(
}

function buildFunction(
config: DeepResolved<PipelineFunctionConfig>,
pipelineFunctionConfig: DeepResolved<PipelineFunctionConfig>,
config: Config,
servicePath: string,
): AppSyncSimulatorFunctionsConfig {
return {
name: config.name,
dataSourceName: config.dataSource,
requestMappingTemplateLocation: config.request ?? '',
responseMappingTemplateLocation: config.response ?? '',
};
name: pipelineFunctionConfig.name,
dataSourceName: pipelineFunctionConfig.dataSource,
requestMappingTemplate: buildMappingTemplate(
pipelineFunctionConfig,
'request',
config,
servicePath,
),
responseMappingTemplate: buildMappingTemplate(
pipelineFunctionConfig,
'response',
config,
servicePath,
),
} as unknown as AppSyncSimulatorFunctionsConfig; // Temp fix until amplify-appsync-simulator typings are fixed
}

function buildMappingTemplate(
Expand Down

0 comments on commit 89838f3

Please sign in to comment.