@aws-amplify/graphql-transformer-core
Version:
A framework to transform from GraphQL SDL to AWS CloudFormation.
31 lines • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppSyncFunctionConfiguration = void 0;
const aws_appsync_1 = require("aws-cdk-lib/aws-appsync");
const constructs_1 = require("constructs");
const utils_1 = require("./utils");
const function_runtime_1 = require("./utils/function-runtime");
class AppSyncFunctionConfiguration extends constructs_1.Construct {
constructor(scope, id, props) {
var _a;
super(scope, id);
const runtimeSpecificProps = (0, function_runtime_1.getRuntimeSpecificFunctionProps)(this, props);
this.function = new aws_appsync_1.CfnFunctionConfiguration(this, `${id}.AppSyncFunction`, {
name: id,
apiId: props.api.apiId,
functionVersion: '2018-05-29',
description: props.description,
dataSourceName: props.dataSource instanceof aws_appsync_1.BaseDataSource ? props.dataSource.ds.attrName : props.dataSource,
...runtimeSpecificProps,
});
(0, utils_1.setResourceName)(this.function, { name: id });
props.api.addSchemaDependency(this.function);
if (props.dataSource instanceof aws_appsync_1.BackedDataSource) {
this.function.addDependency((_a = props.dataSource) === null || _a === void 0 ? void 0 : _a.ds);
}
this.arn = this.function.attrFunctionArn;
this.functionId = this.function.attrFunctionId;
}
}
exports.AppSyncFunctionConfiguration = AppSyncFunctionConfiguration;
//# sourceMappingURL=appsync-function.js.map