Compare commits
4 Commits
eslint-fla
...
multimodul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61d6c0d58f | ||
|
|
4179493ce7 | ||
|
|
d08749fd21 | ||
|
|
be5696b14e |
43
bookstore/mta.yaml
Normal file
43
bookstore/mta.yaml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
_schema-version: '3.1'
|
||||||
|
ID: capire.bookstore
|
||||||
|
version: 1.0.0
|
||||||
|
description: "A simple CAP project."
|
||||||
|
parameters:
|
||||||
|
enable-parallel-deployments: true
|
||||||
|
build-parameters:
|
||||||
|
before-all:
|
||||||
|
- builder: custom
|
||||||
|
commands:
|
||||||
|
- npm ci
|
||||||
|
- npx cds build --production
|
||||||
|
modules:
|
||||||
|
- name: bookstore-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: srv-api # required by consumers of CAP services (e.g. approuter)
|
||||||
|
properties:
|
||||||
|
srv-url: ${default-url}
|
||||||
|
requires:
|
||||||
|
- name: bookstore-destination
|
||||||
|
- name: bookstore-messaging
|
||||||
|
- name: samples-db
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- name: bookstore-destination
|
||||||
|
type: org.cloudfoundry.managed-service
|
||||||
|
parameters:
|
||||||
|
service: destination
|
||||||
|
service-plan: lite
|
||||||
|
- name: bookstore-messaging
|
||||||
|
type: org.cloudfoundry.managed-service
|
||||||
|
parameters:
|
||||||
|
service: enterprise-messaging
|
||||||
|
service-plan: default
|
||||||
|
path: ./event-mesh.json
|
||||||
@@ -21,14 +21,32 @@
|
|||||||
"model": "@capire/orders"
|
"model": "@capire/orders"
|
||||||
},
|
},
|
||||||
"messaging": {
|
"messaging": {
|
||||||
"[development]": { "kind": "file-based-messaging" },
|
"[development]": {
|
||||||
"[hybrid]": { "kind": "enterprise-messaging-shared" },
|
"kind": "file-based-messaging"
|
||||||
"[production]": { "kind": "enterprise-messaging" }
|
},
|
||||||
|
"[hybrid]": {
|
||||||
|
"kind": "enterprise-messaging-shared"
|
||||||
|
},
|
||||||
|
"[production]": {
|
||||||
|
"kind": "enterprise-messaging"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"db": {
|
"db": { "kind": "sql" },
|
||||||
"kind": "sql"
|
"[multimodule]": {
|
||||||
|
"db": {
|
||||||
|
"kind": "sqlite",
|
||||||
|
"impl": "@cap-js/sqlite",
|
||||||
|
"credentials": {
|
||||||
|
"url": "../db.sqlite"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"log": { "service": true }
|
"log": {
|
||||||
|
"service": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@sap/cds-dk": "^7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
5
db/sqlite/index.cds
Normal file
5
db/sqlite/index.cds
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
using from '@capire/bookstore';
|
||||||
|
using from '@capire/common';
|
||||||
|
using from '@capire/orders';
|
||||||
|
using from '@capire/reviews';
|
||||||
|
using from '@capire/fiori';
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
const globals = require("globals");
|
|
||||||
const js = require('@eslint/js');
|
|
||||||
const cds = require('@sap/eslint-plugin-cds');
|
|
||||||
|
|
||||||
module.exports = [
|
|
||||||
cds.configs.recommended,
|
|
||||||
{
|
|
||||||
"files": ["**/*.js"],
|
|
||||||
...js.configs.recommended,
|
|
||||||
"languageOptions": {
|
|
||||||
"globals": {
|
|
||||||
...globals.browser,
|
|
||||||
...globals.node,
|
|
||||||
...globals.jest,
|
|
||||||
...globals.mocha,
|
|
||||||
"es2022": true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
...js.configs.recommended.rules,
|
|
||||||
"no-console": "off",
|
|
||||||
"require-atomic-updates": "off",
|
|
||||||
"require-await": "warn",
|
|
||||||
"no-unused-vars": ["warn", { "argsIgnorePattern": "_" }]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
12
fiori/app/router/package.json
Normal file
12
fiori/app/router/package.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "approuter",
|
||||||
|
"dependencies": {
|
||||||
|
"@sap/approuter": "^16.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "node node_modules/@sap/approuter/approuter.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
22
fiori/app/router/xs-app.json
Normal file
22
fiori/app/router/xs-app.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"welcomeFile": "app/index.html",
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"source": "^/app/(.*)$",
|
||||||
|
"target": "$1",
|
||||||
|
"localDir": ".",
|
||||||
|
"cacheControl": "no-cache, no-store, must-revalidate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "^/appconfig/",
|
||||||
|
"localDir": ".",
|
||||||
|
"cacheControl": "no-cache, no-store, must-revalidate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "^/(.*)$",
|
||||||
|
"target": "$1",
|
||||||
|
"destination": "srv-api",
|
||||||
|
"csrfProtection": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1 +1,2 @@
|
|||||||
using from './db/common';
|
using from './db/common';
|
||||||
|
using from './app/services';
|
||||||
69
fiori/mta.yaml
Normal file
69
fiori/mta.yaml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
_schema-version: '3.1'
|
||||||
|
ID: capire.fiori
|
||||||
|
version: 1.0.0
|
||||||
|
description: "A simple CAP project."
|
||||||
|
parameters:
|
||||||
|
enable-parallel-deployments: true
|
||||||
|
build-parameters:
|
||||||
|
before-all:
|
||||||
|
- builder: custom
|
||||||
|
commands:
|
||||||
|
- npm ci
|
||||||
|
- npx cds build --production
|
||||||
|
modules:
|
||||||
|
- name: fiori-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: srv-api # required by consumers of CAP services (e.g. approuter)
|
||||||
|
properties:
|
||||||
|
srv-url: ${default-url}
|
||||||
|
requires:
|
||||||
|
- name: fiori-auth
|
||||||
|
- name: fiori-destination
|
||||||
|
- name: fiori-messaging
|
||||||
|
- name: samples-db
|
||||||
|
|
||||||
|
- name: fiori
|
||||||
|
type: approuter.nodejs
|
||||||
|
path: app/router
|
||||||
|
parameters:
|
||||||
|
keep-existing-routes: true
|
||||||
|
disk-quota: 256M
|
||||||
|
memory: 256M
|
||||||
|
requires:
|
||||||
|
- name: srv-api
|
||||||
|
group: destinations
|
||||||
|
properties:
|
||||||
|
name: srv-api # must be used in xs-app.json as well
|
||||||
|
url: ~{srv-url}
|
||||||
|
forwardAuthToken: true
|
||||||
|
- name: fiori-auth
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- name: fiori-auth
|
||||||
|
type: org.cloudfoundry.managed-service
|
||||||
|
parameters:
|
||||||
|
service: xsuaa
|
||||||
|
service-plan: application
|
||||||
|
path: ./xs-security.json
|
||||||
|
config:
|
||||||
|
xsappname: fiori-${org}-${space}
|
||||||
|
tenant-mode: dedicated
|
||||||
|
- name: fiori-destination
|
||||||
|
type: org.cloudfoundry.managed-service
|
||||||
|
parameters:
|
||||||
|
service: destination
|
||||||
|
service-plan: lite
|
||||||
|
- name: fiori-messaging
|
||||||
|
type: org.cloudfoundry.managed-service
|
||||||
|
parameters:
|
||||||
|
service: enterprise-messaging
|
||||||
|
service-plan: default
|
||||||
|
path: ./event-mesh.json
|
||||||
@@ -38,6 +38,15 @@
|
|||||||
"db": {
|
"db": {
|
||||||
"kind": "sql"
|
"kind": "sql"
|
||||||
},
|
},
|
||||||
|
"[multimodule]": {
|
||||||
|
"db": {
|
||||||
|
"kind": "sqlite",
|
||||||
|
"impl": "@cap-js/sqlite",
|
||||||
|
"credentials": {
|
||||||
|
"url": "../db.sqlite"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"db-ext": {
|
"db-ext": {
|
||||||
"[development]": {
|
"[development]": {
|
||||||
"model": "db/sqlite"
|
"model": "db/sqlite"
|
||||||
|
|||||||
22
fiori/xs-security.json
Normal file
22
fiori/xs-security.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"scopes": [
|
||||||
|
{
|
||||||
|
"name": "$XSAPPNAME.emcallback",
|
||||||
|
"description": "Enterprise-Messaging Callback Access",
|
||||||
|
"grant-as-authority-to-apps": [
|
||||||
|
"$XSSERVICENAME(fiori-messaging)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "$XSAPPNAME.emmanagement",
|
||||||
|
"description": "Enterprise-Messaging Management Access"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": [],
|
||||||
|
"role-templates": [],
|
||||||
|
"authorities-inheritance": false,
|
||||||
|
"authorities": [
|
||||||
|
"$XSAPPNAME.emmanagement",
|
||||||
|
"$XSAPPNAME.mtcallback"
|
||||||
|
]
|
||||||
|
}
|
||||||
27
mta.yaml
Normal file
27
mta.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
_schema-version: '3.1'
|
||||||
|
ID: capire.samples
|
||||||
|
version: 2.0.0
|
||||||
|
description: "A monorepo with several samples for CAP."
|
||||||
|
parameters:
|
||||||
|
enable-parallel-deployments: true
|
||||||
|
build-parameters:
|
||||||
|
before-all:
|
||||||
|
- builder: custom
|
||||||
|
commands:
|
||||||
|
- npm ci
|
||||||
|
- npx cds build --production --ws
|
||||||
|
modules:
|
||||||
|
- name: samples-db-deployer
|
||||||
|
type: hdb
|
||||||
|
path: gen/db
|
||||||
|
parameters:
|
||||||
|
buildpack: nodejs_buildpack
|
||||||
|
requires:
|
||||||
|
- name: samples-db
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- name: samples-db
|
||||||
|
type: com.sap.xs.hdi-container
|
||||||
|
parameters:
|
||||||
|
service: hana
|
||||||
|
service-plan: hdi-shared
|
||||||
12
orders/app/router/package.json
Normal file
12
orders/app/router/package.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "approuter",
|
||||||
|
"dependencies": {
|
||||||
|
"@sap/approuter": "^16.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "node node_modules/@sap/approuter/approuter.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
22
orders/app/router/xs-app.json
Normal file
22
orders/app/router/xs-app.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"welcomeFile": "app/index.html",
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"source": "^/app/(.*)$",
|
||||||
|
"target": "$1",
|
||||||
|
"localDir": ".",
|
||||||
|
"cacheControl": "no-cache, no-store, must-revalidate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "^/appconfig/",
|
||||||
|
"localDir": ".",
|
||||||
|
"cacheControl": "no-cache, no-store, must-revalidate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "^/(.*)$",
|
||||||
|
"target": "$1",
|
||||||
|
"destination": "srv-api",
|
||||||
|
"csrfProtection": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
55
orders/mta.yaml
Normal file
55
orders/mta.yaml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
_schema-version: '3.1'
|
||||||
|
ID: capire.orders
|
||||||
|
version: 1.0.0
|
||||||
|
description: "A simple CAP project."
|
||||||
|
parameters:
|
||||||
|
enable-parallel-deployments: true
|
||||||
|
build-parameters:
|
||||||
|
before-all:
|
||||||
|
- builder: custom
|
||||||
|
commands:
|
||||||
|
- npm ci
|
||||||
|
- npx cds build --production
|
||||||
|
modules:
|
||||||
|
- name: orders-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: srv-api # required by consumers of CAP services (e.g. approuter)
|
||||||
|
properties:
|
||||||
|
srv-url: ${default-url}
|
||||||
|
requires:
|
||||||
|
- name: orders-auth
|
||||||
|
|
||||||
|
- name: orders
|
||||||
|
type: approuter.nodejs
|
||||||
|
path: app/router
|
||||||
|
parameters:
|
||||||
|
keep-existing-routes: true
|
||||||
|
disk-quota: 256M
|
||||||
|
memory: 256M
|
||||||
|
requires:
|
||||||
|
- name: srv-api
|
||||||
|
group: destinations
|
||||||
|
properties:
|
||||||
|
name: srv-api # must be used in xs-app.json as well
|
||||||
|
url: ~{srv-url}
|
||||||
|
forwardAuthToken: true
|
||||||
|
- name: orders-auth
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- name: orders-auth
|
||||||
|
type: org.cloudfoundry.managed-service
|
||||||
|
parameters:
|
||||||
|
service: xsuaa
|
||||||
|
service-plan: application
|
||||||
|
path: ./xs-security.json
|
||||||
|
config:
|
||||||
|
xsappname: orders-${org}-${space}
|
||||||
|
tenant-mode: dedicated
|
||||||
@@ -4,5 +4,19 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capire/common": "*",
|
"@capire/common": "*",
|
||||||
"@sap/cds": ">=5"
|
"@sap/cds": ">=5"
|
||||||
|
},
|
||||||
|
"cds": {
|
||||||
|
"requires": {
|
||||||
|
"db": { "kind": "sql" },
|
||||||
|
"[multimodule]": {
|
||||||
|
"db": {
|
||||||
|
"kind": "sqlite",
|
||||||
|
"impl": "@cap-js/sqlite",
|
||||||
|
"credentials": {
|
||||||
|
"url": "../db.sqlite"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
5
orders/xs-security.json
Normal file
5
orders/xs-security.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"scopes": [],
|
||||||
|
"attributes": [],
|
||||||
|
"role-templates": []
|
||||||
|
}
|
||||||
447
package-lock.json
generated
447
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@@ -5,6 +5,7 @@
|
|||||||
"repository": "https://github.com/sap-samples/cloud-cap-samples.git",
|
"repository": "https://github.com/sap-samples/cloud-cap-samples.git",
|
||||||
"author": "daniel.hutzel@sap.com",
|
"author": "daniel.hutzel@sap.com",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@sap-cloud-sdk/resilience": "^3.14.0",
|
||||||
"@sap/cds": ">=7"
|
"@sap/cds": ">=7"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
@@ -21,12 +22,12 @@
|
|||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@cap-js/sqlite": "^1",
|
"@cap-js/sqlite": "^1",
|
||||||
"@sap/eslint-plugin-cds": "^3",
|
"@sap/cds-dk": "^7",
|
||||||
|
"@sap/eslint-plugin-cds": "^2.6.1",
|
||||||
"axios": "^1",
|
"axios": "^1",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"chai-subset": "^1.6.0",
|
"chai-subset": "^1.6.0",
|
||||||
"eslint": "^9",
|
|
||||||
"semver": "^7"
|
"semver": "^7"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -52,6 +53,16 @@
|
|||||||
"parallel": true,
|
"parallel": true,
|
||||||
"timeout": 6666
|
"timeout": 6666
|
||||||
},
|
},
|
||||||
|
"cds": {
|
||||||
|
"requires": {
|
||||||
|
"db": {
|
||||||
|
"kind": "sql",
|
||||||
|
"[development]": {
|
||||||
|
"model": "db/sqlite"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"license": "SEE LICENSE IN LICENSE",
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,17 @@
|
|||||||
"[hybrid]": { "kind": "enterprise-messaging-shared" },
|
"[hybrid]": { "kind": "enterprise-messaging-shared" },
|
||||||
"[production]": { "kind": "enterprise-messaging" }
|
"[production]": { "kind": "enterprise-messaging" }
|
||||||
},
|
},
|
||||||
"db": { "kind": "sql" }
|
|
||||||
|
"db": { "kind": "sql" },
|
||||||
|
"[multimodule]": {
|
||||||
|
"db": {
|
||||||
|
"kind": "sqlite",
|
||||||
|
"impl": "@cap-js/sqlite",
|
||||||
|
"credentials": {
|
||||||
|
"url": "../db.sqlite"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user