Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98577c1ecc | ||
|
|
e8cd0e3231 | ||
|
|
0a552b4346 | ||
|
|
6367081e9d | ||
|
|
3e73683d99 | ||
|
|
2b345ca447 | ||
|
|
20593f2fa2 | ||
|
|
ca45aa1cf7 | ||
|
|
e408836c2a | ||
|
|
3000a9e2df | ||
|
|
b83236de2a | ||
|
|
46b3b8aaec | ||
|
|
59f5c82684 |
9
.env
9
.env
@@ -1 +1,8 @@
|
|||||||
cds.features.snapi = y
|
cds.features.snapi = true
|
||||||
|
cds.odata.version = v4
|
||||||
|
cds.odata.containment = true
|
||||||
|
cds.odata.proxies = true
|
||||||
|
cds.odata.format = structured
|
||||||
|
cds.cdsc.beta.uniqueconstraints = true
|
||||||
|
cds.cdsc.beta.aspectCompositions = true
|
||||||
|
cds.cdsc.severities.unexpected-key = info
|
||||||
|
|||||||
28
.github/workflows/node.js.yml
vendored
Normal file
28
.github/workflows/node.js.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
||||||
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||||
|
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [10.x, 12.16.2]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- run: npm install
|
||||||
|
- run: npm test
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Find here a collection of samples for the [SAP Cloud Application Programming Model](https://cap.cloud.sap) organized in a simplistic [monorepo setup](samples.md#all-in-one-monorepo). → See [**Overview** of contained samples](samples.md)
|
Find here a collection of samples for the [SAP Cloud Application Programming Model](https://cap.cloud.sap) organized in a simplistic [monorepo setup](samples.md#all-in-one-monorepo). → See [**Overview** of contained samples](samples.md)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Preliminaries
|
### Preliminaries
|
||||||
|
|
||||||
@@ -39,19 +40,19 @@ After that open this link in your browser: [http://localhost:4004](http://localh
|
|||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
Run the provided tests with [_jest_](http://jestjs.io) or [_mocha_](http://mochajs.org), e.g.:
|
Run the provided tests with [_jest_](http://jestjs.io) or [_mocha_](http://mochajs.org), for example:
|
||||||
```sh
|
```sh
|
||||||
npx jest
|
npx jest
|
||||||
```
|
```
|
||||||
> While mocha is a bit smaller and faster, jest runs tests in parallel and isolation which allows to run all tests.
|
> While mocha is a bit smaller and faster, jest runs tests in parallel and isolation, which allows to run all tests.
|
||||||
|
|
||||||
|
|
||||||
## Get Support
|
## Get Support
|
||||||
|
|
||||||
Check out the cap docs at [https://cap.cloud.sap](https://cap.cloud.sap). <br>
|
Check out the documentation at [https://cap.cloud.sap](https://cap.cloud.sap). <br>
|
||||||
In case you find a bug or need support, please [open an issue in here](https://github.com/SAP-samples/cloud-cap-samples/issues/new).
|
In case you find a bug or need support, please [open an issue in here](https://github.com/SAP-samples/cloud-cap-samples/issues/new).
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](/LICENSE) file.
|
Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](/LICENSE) file.
|
||||||
|
|||||||
8
orders/.env
Normal file
8
orders/.env
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
cds.features.snapi = true
|
||||||
|
cds.odata.version = v4
|
||||||
|
cds.odata.containment = true
|
||||||
|
cds.odata.proxies = true
|
||||||
|
cds.odata.format = structured
|
||||||
|
cds.cdsc.beta.uniqueconstraints = true
|
||||||
|
cds.cdsc.beta.aspectCompositions = true
|
||||||
|
cds.cdsc.severities.unexpected-key = info
|
||||||
5
recap/assoc-paths-w-filters.cds
Normal file
5
recap/assoc-paths-w-filters.cds
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
using { sap.capire.bookshop.Authors } from '@capire/bookshop';
|
||||||
|
|
||||||
|
define view Foo as select from Authors {
|
||||||
|
ID, name, books[where title like 'Cat%'].currency.code
|
||||||
|
};
|
||||||
27
recap/extend-w-named-aspects.cds
Normal file
27
recap/extend-w-named-aspects.cds
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using { User, cuid, managed } from '@sap/cds/common';
|
||||||
|
|
||||||
|
// Looks like inheritance, but isn't
|
||||||
|
entity Foo @bar : cuid, managed { bar:Car; }
|
||||||
|
|
||||||
|
// It's just syntactical sugar for Aspects
|
||||||
|
entity Boo {}
|
||||||
|
extend Boo with cuid;
|
||||||
|
extend Boo with managed;
|
||||||
|
extend Boo with { bar:Car; }
|
||||||
|
annotate Boo with @bar;
|
||||||
|
|
||||||
|
// There's close to no limits
|
||||||
|
entity Moo : Foo {}
|
||||||
|
entity Zoo {}; extend Zoo with Foo;
|
||||||
|
|
||||||
|
// This one will apply to all uses above
|
||||||
|
type Car : String;
|
||||||
|
annotate Car with @car;
|
||||||
|
|
||||||
|
// And these to all uses here and wherever else
|
||||||
|
extend managed with {
|
||||||
|
notes : String;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CDS is built with CDS
|
||||||
|
annotate cds.UUID with @odata.Type: 'Edm.Integer';
|
||||||
10
recap/extending-views.cds
Normal file
10
recap/extending-views.cds
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using { CatalogService } from '@capire/bookshop';
|
||||||
|
|
||||||
|
extend sap.capire.bookshop.Books with {
|
||||||
|
ISBN : String;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** your docs go here */
|
||||||
|
extend projection CatalogService.Books with {
|
||||||
|
ISBN
|
||||||
|
}
|
||||||
@@ -34,7 +34,7 @@ cds.once('served', async()=>{
|
|||||||
|
|
||||||
// Other bootstrapping events you could hook in to...
|
// Other bootstrapping events you could hook in to...
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
cds.on('boostrap',(app) => {/* ... */})
|
cds.on('bootstrap',(app) => {/* ... */})
|
||||||
cds.on('loaded', (model) => {/* ... */})
|
cds.on('loaded', (model) => {/* ... */})
|
||||||
cds.on('connect', (srv) => {/* ... */})
|
cds.on('connect', (srv) => {/* ... */})
|
||||||
cds.on('serving', (srv) => {/* ... */})
|
cds.on('serving', (srv) => {/* ... */})
|
||||||
|
|||||||
@@ -359,6 +359,11 @@ describe('cds.ql → cqn', () => {
|
|||||||
CQL`SELECT from Foo where x in (SELECT y from Bar)`
|
CQL`SELECT from Foo where x in (SELECT y from Bar)`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// using query api
|
||||||
|
expect(SELECT.from('Books').where(
|
||||||
|
`author.name in`, SELECT('name').from('Authors'))).to.eql(CQL`SELECT from Books where author.name in (SELECT name from Authors)`
|
||||||
|
)
|
||||||
|
|
||||||
// in classical semi joins
|
// in classical semi joins
|
||||||
expect(
|
expect(
|
||||||
SELECT('x').from(Foo) .where ( `exists`,
|
SELECT('x').from(Foo) .where ( `exists`,
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ describe('Localized Data', () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('supports @cds.localized:false', async ()=>{
|
xit('supports @cds.localized:false', async ()=>{
|
||||||
const { data } = await GET(`/browse/BooksSans?&$select=title,localized_title&$expand=currency&$filter=locale eq 'de' or locale eq null`, {
|
const { data } = await GET(`/browse/BooksSans?&$select=title,localized_title&$expand=currency&$filter=locale eq 'de' or locale eq null`, {
|
||||||
headers: { 'Accept-Language': 'de' },
|
headers: { 'Accept-Language': 'de' },
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user