"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "ApiOutput", {
  enumerable: true,
  get: function () {
    return _pulumiAws.ApiOutput;
  }
});
exports.createApiApp = createApiApp;
var _enterprise = require("@webiny/pulumi-aws/enterprise");
var _plugins = require("../api/plugins");
var _pulumiAws = require("@webiny/pulumi-aws");
function createApiApp(projectAppParams = {}) {
  const builtInPlugins = [_plugins.ensureCoreDeployed, _plugins.injectWcpTelemetryClientCode, _plugins.generateCommonHandlers, _plugins.executeDataMigrations];
  if (projectAppParams.elasticSearch || projectAppParams.openSearch) {
    builtInPlugins.push(_plugins.generateDdbEsHandlers);
  } else {
    builtInPlugins.push(_plugins.generateDdbHandlers);
  }
  const customPlugins = projectAppParams.plugins ? [...projectAppParams.plugins] : [];
  return {
    id: "api",
    name: "API",
    description: "Represents cloud infrastructure needed for supporting your project's (GraphQL) API.",
    cli: {
      // Default args for the "yarn webiny watch ..." command.
      watch: {
        // Watch five levels of dependencies, starting from this project application.
        depth: 5,
        // By default, we only enable local development for the "graphql" function.
        // This can be changed down the line by passing another set of values
        // to the "watch" command.
        function: "graphql"
      }
    },
    pulumi: (0, _enterprise.createApiPulumiApp)(projectAppParams),
    plugins: [builtInPlugins, customPlugins]
  };
}

//# sourceMappingURL=createApiApp.js.map