Skip to content

Commit 9f3946b

Browse files
cleanup example project (#416)
* cleanup example project * wip * wip * wip * Potential fix for code scanning alert no. 18: Cache Poisoning via execution of untrusted code Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for code scanning alert no. 20: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * wip * wip --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent c40840a commit 9f3946b

18 files changed

+171
-263
lines changed

.github/workflows/main-ci.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# This workflow will protect the main branch by testing and linting new PRs and commits
22

33
name: Main CI
4+
permissions:
5+
contents: read
46

57
on:
68
push:
@@ -46,7 +48,23 @@ jobs:
4648
- uses: actions/checkout@v4
4749
- uses: actions/setup-node@v4
4850
with:
49-
node-version: 18
51+
node-version: 24
5052
cache: "npm"
5153
- run: npm ci --package-lock
5254
- run: npm run lint:ci
55+
56+
example-cap-server:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout safe merge ref
60+
uses: actions/checkout@v4
61+
with:
62+
ref: refs/pull/${{ github.event.pull_request.number }}/merge
63+
persist-credentials: false
64+
65+
- uses: actions/setup-node@v4
66+
with:
67+
node-version: 24
68+
cache: "npm"
69+
- run: npm ci --package-lock
70+
- run: npm run test --prefix example-cap-server

.github/workflows/main-pr.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
- uses: actions/setup-node@v6
2929
with:
3030
node-version: ${{ matrix.node-version }}
31-
cache: "npm"
3231

3332
- run: npm ci --package-lock
3433

@@ -61,7 +60,21 @@ jobs:
6160

6261
- uses: actions/setup-node@v4
6362
with:
64-
node-version: 18
65-
cache: "npm"
63+
node-version: 24
6664
- run: npm ci --package-lock
6765
- run: npm run lint:ci
66+
67+
example-cap-server:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Checkout safe merge ref
71+
uses: actions/checkout@v4
72+
with:
73+
ref: refs/pull/${{ github.event.pull_request.number }}/merge
74+
persist-credentials: false
75+
76+
- uses: actions/setup-node@v4
77+
with:
78+
node-version: 24
79+
- run: npm ci --package-lock
80+
- run: npm run test --prefix example-cap-server

.gitignore

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -39,84 +39,17 @@ target/report/
3939
zdm_report.json
4040

4141
# test csn
42-
srv/test-csn.json
4342

44-
# test e2e needed chrome driver version created localy
45-
test/e2e/util/chromeDriverVersion.json
46-
# created via pageIndexer.js
47-
test/e2e/pageobjects/index.js
43+
test-integration/_env/db/*
4844

4945
example-cap-server/data
5046
example-cap-server/package-lock.json
5147

5248
# sqlite
5349
*.db-journal
5450
*.sqlite-journal
55-
56-
# mta
57-
*.mtar
58-
.mta/
59-
.afc_mta_build_tmp/
60-
mta-op-*/
61-
Makefile_*.mta
62-
mta_archives/
63-
64-
# notification types
65-
srv/util-service/notification-service/notificationTypes.json
66-
67-
# UI
68-
app/**/dist
69-
di.code-validation.core_issues.json
70-
!app/**/changes_preview.js
71-
!app/**/sap-ui-cachebuster-info.json
72-
73-
app-deployer/resources
74-
maintenance/dist
75-
76-
# frontend test metadata generated by npm run test:frontend:updateMetadata
77-
app/*/webapp/localService/*.xml
78-
79-
# frontend mock and extension files
80-
app/**/UIAdaptation_index.html
81-
app/**/changes_preview.js
82-
app/**/sap-ui-cachebuster-info.json
83-
app/**/extended_runnable_file.html
84-
app/**/mock_preview_sapui5.html
85-
app/**/fioriHtmlRunner.html
86-
app/**/visual_ext_index.html
87-
app/**/webapp/visual_ext_index.html
88-
app/**/.user.project.json
89-
90-
# mtx
91-
.mtxcache.json
51+
*.sqlite
9252

9353
# default env
9454
default-env.json
9555

96-
# appInfo
97-
appInfo.json
98-
99-
# performance measurement
100-
stress-test-times-*.csv
101-
stress-test-kpis-*.json
102-
read-sql-statements-temp-logs.json
103-
read-sql-scenario-temp-logs.json
104-
/stress-test/src/warmup-stress-test-requests.json
105-
/stress-test/src/warmup-stress-test-scenarios.json
106-
107-
# stryker temp files
108-
.stryker-tmp
109-
110-
#piper and sapCumulusUpload
111-
.pipeline/defaults.yaml
112-
.pipeline/commonPipelineEnvironment/
113-
.pipeline/default_pipeline_environment.yml
114-
.pipeline/piper-defaults.yml
115-
.pipeline/tmp/
116-
sap-piper
117-
118-
test-integration/_env/db
119-
*.hdbmigrationtable
120-
test-integration/_env/db/last-dev
121-
122-
/dist/

example-cap-server/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
# Example CAP Server
1+
# How to get started
2+
3+
- `npm start` to start server
4+
- `npm run subscribeTenants` to subscribe tenants to the CAP service
5+
- restart server `npm start` for event-queue to start processing events

example-cap-server/bin/subscribteTenants.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

example-cap-server/data/.gitkeep

Whitespace-only changes.

example-cap-server/jest.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
3+
module.exports = {
4+
testTimeout: 600000,
5+
};

example-cap-server/package.json

Lines changed: 41 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,81 +4,56 @@
44
"version": "1.0.0",
55
"scripts": {
66
"postinstall": "npm run copy-library",
7-
"start": "cds-serve",
8-
"watch": "cds watch",
9-
"subscribeTenants": "node bin/subscribteTenants.js",
7+
"start": "cds-serve --with-mtx",
8+
"watch": "cds watch --with-mtx",
9+
"subscribeTenants": "cds subscribe t1 --to http://localhost:4004 -u yves: && cds subscribe t2 --to http://localhost:4004 -u yves: && cds subscribe t3 --to http://localhost:4004 -u yves:",
1010
"dev": "npm run copy-library && npm run subscribeTenants && npm start",
11-
"copy-library": "npx shx rm -rf node_modules/@cap-js-community/event-queue && npx shx mkdir -p node_modules/@cap-js-community/event-queue && npx shx cp -R ../package.json ../index.cds ../cds-plugin.js ../src ../db node_modules/@cap-js-community/event-queue"
11+
"copy-library": "npx shx rm -rf node_modules/@cap-js-community/event-queue && npx shx mkdir -p node_modules/@cap-js-community/event-queue && npx shx cp -R ../package.json ../index.cds ../cds-plugin.js ../src ../srv ../db node_modules/@cap-js-community/event-queue",
12+
"test": "CDS_ENV=test node --test"
1213
},
1314
"dependencies": {
1415
"@cap-js-community/event-queue": "file:..",
15-
"@cap-js/audit-logging": "^0.8.2",
16-
"@sap/cds": "^8.8.2",
17-
"@sap/cds-mtxs": "^2.6.1",
18-
"express": "^4.21.2",
19-
"verror": "^1.10.1"
16+
"@cap-js/audit-logging": "^1.1.1",
17+
"@sap/cds": "^9.5.1",
18+
"@sap/cds-mtxs": "^3.5.0",
19+
"express": "^4.21.2"
2020
},
2121
"devDependencies": {
22-
"@cap-js/sqlite": "1.9.0",
22+
"@cap-js/sqlite": "2.1.0",
2323
"eslint": "8.56.0",
2424
"eslint-config-prettier": "9.0.0",
25-
"prettier": "3.5.3",
26-
"sqlite3": "5.1.7",
25+
"prettier": "3.7.4",
2726
"redis": "^4.7.0",
28-
"cron-parser": "^5.0.5",
29-
"@sap/xssec": "^3.6.2"
27+
"@sap/xssec": "^4.11.2",
28+
"@cap-js-community/common": "^0.3.2",
29+
"@cap-js/cds-test": "^0",
30+
"jest": "30.2.0",
31+
"cron-parser": "5.4.0",
32+
"yaml": "2.8.2"
3033
},
3134
"cds": {
3235
"eventQueue": {
33-
"plugin": true,
34-
"runInterval": 300000,
35-
"useAsCAPQueue": true,
36-
"thresholdLoggingEventProcessing": 5000,
37-
"cleanupLocksAndEventsForDev": true,
38-
"events": {
39-
"Mail/Single": {
40-
"impl": "./srv/EventQueueMail",
41-
"load": 10,
42-
"parallelEventProcessing": 5
43-
}
44-
},
45-
"periodicEvents": {
46-
"HealthCheck/DB": {
47-
"impl": "./srv/EventQueueHealthCheckDb",
48-
"load": 10,
49-
"transactionMode": "alwaysRollback",
50-
"interval": 15
51-
},
52-
"HealthCheck/DB-as-cron": {
53-
"impl": "./srv/EventQueueHealthCheckDb",
54-
"load": 10,
55-
"transactionMode": "alwaysRollback",
56-
"cron": "*/15 * * * * *"
57-
}
58-
}
36+
"useAsCAPQueue": true
5937
},
6038
"requires": {
61-
"outbox": true,
39+
"outbox": false,
6240
"multitenancy": true,
41+
"[test]": {
42+
"multitenancy": false,
43+
"cds.xt.ModelProviderService": false,
44+
"cds.xt.SaasProvisioningService": false,
45+
"cds.xt.DeploymentService": false,
46+
"cds.xt.ExtensibilityService": false
47+
},
6348
"cds.xt.ModelProviderService": true,
6449
"cds.xt.SaasProvisioningService": true,
6550
"cds.xt.DeploymentService": true,
6651
"cds.xt.ExtensibilityService": false,
67-
"db": {
68-
"[development]": {
69-
"kind": "sqlite",
70-
"credentials": {
71-
"database": "data/event-queue-demo.sqlite"
72-
},
73-
"schema_evolution": ""
74-
}
75-
},
7652
"task-service": {
77-
"impl": "./example-cap-server/srv/facade/task-service.js",
78-
"outbox": {
79-
"kind": "persistent-outbox",
53+
"impl": "./srv/facade/task-service.js",
54+
"queued": {
55+
"kind": "persistent-queue",
8056
"load": 60,
81-
"transactionMode": "isolated",
8257
"events": {
8358
"syncJobs": {
8459
"load": 10,
@@ -88,8 +63,18 @@
8863
}
8964
},
9065
"mail-service": {
91-
"impl": "./example-cap-server/srv/facade/mail-service.js"
66+
"impl": "./srv/facade/mail-service.js",
67+
"queued": {
68+
"kind": "persistent-queue"
69+
}
70+
},
71+
"[production]": {
72+
"multitenancy": true
73+
},
74+
"[with-mtx]": {
75+
"multitenancy": true
9276
}
93-
}
77+
},
78+
"profile": "with-mtx-sidecar"
9479
}
9580
}

example-cap-server/srv/EventQueueClusteredMail.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

example-cap-server/srv/EventQueueCryptoHash.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)