Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] plugin bootstrapping with extensibility #53

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
Binary file added db.sqlite-shm
Binary file not shown.
Empty file added db.sqlite-wal
Empty file.
1 change: 1 addition & 0 deletions ext/.cdsrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
26 changes: 26 additions & 0 deletions ext/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": "eslint:recommended",
"env": {
"es2022": true,
"node": true,
"jest": true,
"mocha": true
},
"globals": {
"SELECT": true,
"INSERT": true,
"UPSERT": true,
"UPDATE": true,
"DELETE": true,
"CREATE": true,
"DROP": true,
"CDL": true,
"CQL": true,
"CXL": true,
"cds": true
},
"rules": {
"no-console": "off",
"require-atomic-updates": "off"
}
}
34 changes: 34 additions & 0 deletions ext/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# CAP ext
_out
*.db
*.sqlite
connection.properties
default-*.json
.cdsrc-private.json
gen/
node_modules/
target/

# Web IDE, App Studio
.che/
.gen/

# MTA
*_mta_build_tmp
*.mtar
mta_archives/

# Other
.DS_Store
*.orig
*.log

*.iml
*.flattened-pom.xml

# IDEs
# .vscode
# .idea

# @cap-js/cds-typer
@cds-models
18 changes: 18 additions & 0 deletions ext/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"SAPSE.vscode-cds",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"mechatroner.rainbow-csv",
"qwtel.sqlite-viewer",
"humao.rest-client"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [

]
}
20 changes: 20 additions & 0 deletions ext/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "cds serve",
"request": "launch",
"type": "node",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "cds",
"args": [
"serve",
"--with-mocks",
"--in-memory?"
],
"skipFiles": [
"<node_internals>/**"
]
}
]
}
25 changes: 25 additions & 0 deletions ext/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "cds watch",
"command": "cds",
"args": ["watch"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"type": "shell",
"label": "cds serve",
"command": "cds",
"args": ["serve", "--with-mocks", "--in-memory?"],
"problemMatcher": []
}
]
}
25 changes: 25 additions & 0 deletions ext/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Getting Started

Welcome to your new project.

It contains these folders and files, following our recommended project layout:

File or Folder | Purpose
---------|----------
`app/` | content for UI frontends goes here
`db/` | your domain models and data go here
`srv/` | your service models and code go here
`package.json` | project metadata and configuration
`readme.md` | this getting started guide


## Next Steps

- Open a new terminal and run `cds watch`
- (in VS Code simply choose _**Terminal** > Run Task > cds watch_)
- Start adding content, for example, a [db/schema.cds](db/schema.cds).


## Learn More

Learn more at https://cap.cloud.sap/docs/get-started/.
6 changes: 6 additions & 0 deletions ext/db/ext.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace x_ext; // for new entities like SalesRegion below
using from '_base';

extend sap.capire.incidents.Incidents with { foo: String};

annotate ProcessorService.Incidents with @UI.LineItem : [..., { Value: foo}];
21 changes: 21 additions & 0 deletions ext/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "ext",
"version": "1.0.0",
"description": "A simple CAP project.",
"repository": "<Add your repository here>",
"license": "UNLICENSED",
"private": true,
"dependencies": {
"@sap/cds": "^7",
"express": "^4"
},
"devDependencies": {
"@cap-js/sqlite": "^1"
},
"scripts": {
"start": "cds-serve"
},
"cds": {
"extends": "_base"
}
}
19 changes: 19 additions & 0 deletions mtx/sidecar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "incidents-mtx",
"dependencies": {
"@sap/cds": "^7",
"@sap/cds-hana": "^2",
"@sap/cds-mtxs": "^1.9",
"@sap/xssec": "^3",
"express": "^4"
},
"devDependencies": {
"@cap-js/sqlite": "^1"
},
"scripts": {
"start": "cds-serve"
},
"cds": {
"profile": "mtx-sidecar"
}
}
25 changes: 19 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"dummy": 0
},
"dependencies": {
"@cap-js/change-tracking": "^1.0.5",
"@sap/cds": ">=7",
"@sap/cds-mtxs": "^1.9",
"express": "^4"
},
"devDependencies": {
Expand All @@ -24,7 +26,6 @@
"chai-subset": "^1.6.0"
},
"scripts": {
"watch": "cds watch",
"start": "cds-serve",
"test": "npx jest --silent",
"add-change-tracking": "npm add @cap-js/change-tracking && cp xmpls/change-tracking.cds ./srv && cp xmpls/change-tracking.test.js ./test",
Expand All @@ -39,7 +40,9 @@
"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"
Expand All @@ -50,20 +53,30 @@
"[development]": {
"users": {
"alice": {
"tenant": "t1",
"roles": [
"support",
"admin"
"admin",
"cds.Subscriber",
"cds.ExtensionDeveloper"
]
},
"bob": {
"bob": { "tenant" : "t1",
"roles": [
"support"
]
}
}
}
}
}
},
"[production]": {
"multitenancy": true,
"extensibility": true
},
"multitenancy": true,
"extensibility": true
},
"profile": "with-mtx-sidecar"
},
"private": true
}
11 changes: 11 additions & 0 deletions srv/change-tracking.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using { ProcessorService.Incidents } from './services';

annotate Incidents with {
customer @changelog: [customer.name];
title @changelog;
status @changelog;
}

annotate Incidents.conversation with @changelog: [author, timestamp] {
message @changelog @Common.Label: 'Message';
}
Loading
Loading