UNPKG

@sap/cds-dk

Version:

Command line client and development toolkit for the SAP Cloud Application Programming Model

239 lines (196 loc) 6.34 kB
const cds = require('../../cds') const srvNode4 = path => ({ in: 'modules', where: { type: 'nodejs', path } }) const srvJava4 = path => ({ in: 'modules', where: { type: 'java', path } }) // REVISIT: Clean up const isJava = process.argv[process.argv.indexOf('--add') + 1].split(/[,\s+]/).includes('java') || cds.env['project-nature'] === 'java' || cds.cli.options?.add?.has('java') || process.argv.includes('--java') const srv4 = isJava ? srvJava4 : srvNode4 const approuter = { in: 'modules', where: { type: 'approuter.nodejs' } } const xsuaa = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'xsuaa', 'parameters.service-plan': 'application' } } const xsuaa4 = plan => ({ in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'xsuaa', 'parameters.service-plan': plan } }) const destination = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'destination' } } const destinations = { in: 'modules', where: { type: 'com.sap.application.content', 'build-parameters.no-source': true } } const destinationSideBySideExtensibility = { in: [destinations, 'parameters.content.subaccount.destinations' ], where: { URL: '~{srv-api/srv-url}', Authentication: 'OAuth2ClientCredentials' } } const connectivity = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'connectivity' } } const redis = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'redis-cache' } } const enterpriseMessaging = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'enterprise-messaging' } } const kafkaMessaging = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'kafka' } } const applicationLogging = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'application-logs' } } const attachments = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'objectstore' } } const malwareScanner = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'malware-scanner' } } const hdbDeployer = { in: 'modules', where: { type: 'hdb' } } const hdiContainer = { in: 'resources', where: { type: 'com.sap.xs.hdi-container' } } const notificationTypesDeployer = { in: 'modules', where: { type: 'nodejs', name: 'notification-content-deployment' } } const serviceManager = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'service-manager', 'parameters.service-plan': 'container' } } const postgres = { in: 'resources', where: { 'parameters.service': 'postgresql-db' } } const postgresDeployer = { in: 'modules', where: { type: 'nodejs', path: 'gen/pg' } } const saasRegistry = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'saas-registry' } } const subscriptionManager = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'subscription-manager' } } const srvApi4 = srv => ({ in: [srv, 'provides'], where: { name: 'srv-api', 'properties.srv-url': '${default-url}' } }) const mtxSidecar4 = path => ({ in: 'modules', where: { type: 'nodejs', path } }) const providedMtxApiSidecar4 = mtxSidecar => ({ in: [mtxSidecar, 'provides'], where: { name: 'mtx-api', 'properties.mtx-url': '${default-url}' } }) const requiredMtxApi = { in: [approuter, 'requires'], where: { 'properties.name': 'mtx-api', 'properties.url': '~{mtx-url}' } } const providedAppApi = { in: [approuter, 'provides'], where: { name: 'app-api', 'properties.app-protocol': '${protocol}', 'properties.app-uri': '${default-uri}' } } const requiredAppApi4 = module => ({ in: [module, 'requires'], where: { name: 'app-api' } }) const requiredMtxSidecarApi4 = srv => ({ in: [srv, 'requires'], where: { 'properties.CDS_MULTITENANCY_SIDECAR_URL': '~{mtx-url}' } }) const requiredJavaApprouterApi4 = srv => ({ in: [srv, 'requires'], where: { 'properties.CDS_MULTITENANCY_APPUI_URL': '~{url}' } }) const providedJavaApprouterApi = { in: [approuter, 'requires'], where: { 'properties.url': '${default-url}' } } const approuterMTXRoute = { in: 'routes', where: { source: '^/-/cds/.*', destination: 'mtx-api', authenticationType: 'none' } } const approuterMTXRouteJava = { in: 'routes', where: { source: '^/mt/.*', destination: 'srv-api', authenticationType: 'none' } } const html5RepoHost = { in: 'resources', where: { 'parameters.service': 'html5-apps-repo', 'parameters.service-plan': 'app-host' } } const html5Runtime = { in: 'resources', where: { 'parameters.service': 'html5-apps-repo', 'parameters.service-plan': 'app-runtime' } } const appDeployer = { in: 'modules', where: { type: 'com.sap.application.content', path: isJava ? '.' : 'gen' } } const portal = { in: 'resources', where: { 'parameters.service': 'portal' }, } const portalDeployer = { in: 'modules', where: { type: 'com.sap.application.content', path: 'app/portal' } } const auditlog = { in: 'resources', where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'auditlog' } } module.exports = { srv4, approuter, xsuaa, xsuaa4, destination, destinations, destinationSideBySideExtensibility, connectivity, enterpriseMessaging, kafkaMessaging, hdbDeployer, hdiContainer, notificationTypesDeployer, serviceManager, postgres, postgresDeployer, saasRegistry, subscriptionManager, redis, srvApi4, mtxSidecar4, providedMtxApiSidecar4, requiredMtxApi, requiredMtxSidecarApi4, providedAppApi, requiredAppApi4, requiredJavaApprouterApi4, providedJavaApprouterApi, applicationLogging, approuterMTXRoute, approuterMTXRouteJava, html5RepoHost, html5Runtime, appDeployer, portal, portalDeployer, auditlog, attachments, malwareScanner, }