Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ resources/

# VitePress
_docs/.vitepress/cache

# secrets
cert
*.mtaext
notes.txt
84 changes: 84 additions & 0 deletions mta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
_schema-version: '3.1'
ID: cap.incidents
version: 1.0.0
description: "S/4HANA to @capire/incidents"

parameters:
enable-parallel-deployments: true

build-parameters:
before-all:
- builder: custom
commands:
- npm ci
- npx cds build --production
# deploy the sqlite db
- npx cds deploy
- cp db.sqlite gen/srv

modules:
- name: incidents-srv
type: nodejs
path: gen/srv
parameters:
buildpack: nodejs_buildpack
readiness-health-check-type: http
readiness-health-check-http-endpoint: /health
build-parameters:
builder: npm
provides:
- name: incidents-srv-api
properties:
url: ${default-url} #> needed in webhookUrl and home-url below
requires:
- name: incidents-logs
- name: incidents-destination
- name: incidents-ias
parameters:
config:
credential-type: X509_GENERATED
app-identifier: cap.incidents #> any value, e.g., reuse MTA ID
- name: incidents-event-broker
parameters:
config:
authentication-type: X509_IAS

resources:
- name: incidents-logs
type: org.cloudfoundry.managed-service
parameters:
service: application-logs
service-plan: lite
- name: incidents-destination
type: org.cloudfoundry.managed-service
parameters:
service: destination
service-plan: lite
- name: incidents-event-broker
type: org.cloudfoundry.managed-service
parameters:
service: event-broker
service-plan: event-connectivity
config:
# unique identifier for this event broker instance
# should start with own namespace (i.e., "foo.bar") and may not be longer than 15 characters
systemNamespace: cap.incidents
webhookUrl: ~{incidents-srv-api/url}/-/cds/event-broker/webhook
requires:
- name: incidents-srv-api
- name: incidents-ias
type: org.cloudfoundry.managed-service
requires:
- name: incidents-srv-api
processed-after:
# for consumed-services (cf. below), incidents-event-broker must already exist
# -> ensure incidents-ias is created after incidents-event-broker
- incidents-event-broker
parameters:
service: identity
service-plan: application
config:
consumed-services:
- service-instance-name: incidents-event-broker
display-name: cap.incidents #> any value, e.g., reuse MTA ID
home-url: ~{incidents-srv-api/url}
68 changes: 52 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,25 @@
"dummy": 0
},
"dependencies": {
"@sap/cds": ">=7",
"@cap-js/sqlite": "^1",
"@sap-cloud-sdk/connectivity": "^3.17.0",
"@sap-cloud-sdk/http-client": "^3.17.0",
"@sap-cloud-sdk/resilience": "^3.17.0",
"@sap/cds": "^8",
"express": "^4"
},
"devDependencies": {
"@cap-js/sqlite": "^1.0.1",
"@sap/cds-dk": "^8",
"@sap/ux-specification": "^1.108.4",
"axios": "^1.4.0",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"chai-subset": "^1.6.0"
},
"scripts": {
"build": "mbt build -t gen --mtar mta.tar",
"deploy": "cf deploy gen/mta.tar",
"undeploy": "cf undeploy cap.incidents --delete-services --delete-service-keys",
"watch": "cds watch",
"start": "cds-serve",
"test": "npx jest --silent",
Expand All @@ -38,29 +45,58 @@
"reset": "read -p 'This will irreversibly reset your working directory including ALL files in this git repo. Continue?' -n 1 -r && echo && if [[ $REPLY =~ ^[Yy]$ ]]; then git clean -fd && git reset --hard && npm i; fi"
},
"jest": {
"modulePathIgnorePatterns": ["<rootDir>/xmpls/"]
"modulePathIgnorePatterns": [
"<rootDir>/xmpls/"
]
},
"sapux": [
"app/incidents"
],
"cds": {
"requires": {
"auth": {
"[development]": {
"users": {
"alice": {
"roles": [
"support",
"admin"
]
},
"bob": {
"roles": [
"support"
]
}
"kind": "mocked",
"users": {
"alice": {
"roles": [
"support",
"admin"
]
},
"bob": {
"roles": [
"support"
]
}
}
},
"db": {
"kind": "sqlite",
"credentials": {
"url": "db.sqlite",
"[test]": {
"url": ":memory:"
}
}
},
"messaging": {
"kind": "event-broker",
"[test]": {
"kind": "local-messaging"
}
},
"my-ias": {
"vcap": {
"label": "identity"
}
},
"API_BUSINESS_PARTNER": {
"kind": "odata-v2",
"model": "srv/external/API_BUSINESS_PARTNER",
"credentials": {
"destination": "S4HANA",
"path": "/sap/opu/odata/sap/API_BUSINESS_PARTNER"
}
}
}
},
Expand Down
Loading