Compare commits
200 Commits
CAA265-nod
...
enable-fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae20e682be | ||
|
|
53527aac50 | ||
|
|
04f9f2a06f | ||
|
|
fff62e68f1 | ||
|
|
bd65af43eb | ||
|
|
6f9133cd4f | ||
|
|
441c82b4c9 | ||
|
|
fa7cff4123 | ||
|
|
1b69064752 | ||
|
|
ada05cf279 | ||
|
|
4b78a8b637 | ||
|
|
ade170367b | ||
|
|
5c5afd2790 | ||
|
|
74ee6f34e4 | ||
|
|
9a9b7aeb86 | ||
|
|
cfc01bbc4f | ||
|
|
aaac6cc678 | ||
|
|
99fdf0c038 | ||
|
|
6ccecfecae | ||
|
|
e5f0a7ef73 | ||
|
|
de54f70570 | ||
|
|
e1c6118cb4 | ||
|
|
a3e4865d97 | ||
|
|
641df50422 | ||
|
|
0f026ed56c | ||
|
|
57a3c5f178 | ||
|
|
522ec8e071 | ||
|
|
7b1c3d8b3a | ||
|
|
5ba69b5021 | ||
|
|
fd796b54ef | ||
|
|
660344b623 | ||
|
|
d20c29a758 | ||
|
|
604cc0514c | ||
|
|
ff351455dd | ||
|
|
8f74bd32a9 | ||
|
|
c181afe8c6 | ||
|
|
9ade3e6b6a | ||
|
|
6f9737ae38 | ||
|
|
0a552b4346 | ||
|
|
6367081e9d | ||
|
|
3e73683d99 | ||
|
|
2b345ca447 | ||
|
|
20593f2fa2 | ||
|
|
ca45aa1cf7 | ||
|
|
e408836c2a | ||
|
|
3000a9e2df | ||
|
|
b83236de2a | ||
|
|
46b3b8aaec | ||
|
|
59f5c82684 | ||
|
|
bf20760a4f | ||
|
|
113852a518 | ||
|
|
e3670b5337 | ||
|
|
d0894e50d7 | ||
|
|
8a3681c391 | ||
|
|
278b9ebf7f | ||
|
|
0e27923739 | ||
|
|
0959a43fb9 | ||
|
|
3831951b65 | ||
|
|
50428b4d26 | ||
|
|
0ed239b28b | ||
|
|
63a617be65 | ||
|
|
e93c7648d1 | ||
|
|
2cefb0e829 | ||
|
|
3d150e8308 | ||
|
|
570f7a82de | ||
|
|
2bae61e99b | ||
|
|
31357cde95 | ||
|
|
93f4cd5c6e | ||
|
|
cf3c45466a | ||
|
|
b86d36373f | ||
|
|
4cc10826b7 | ||
|
|
0dcb669548 | ||
|
|
0fcd6db32d | ||
|
|
d0685e6d83 | ||
|
|
1b338e450c | ||
|
|
083266b11d | ||
|
|
6277f39aec | ||
|
|
834bcb79c0 | ||
|
|
97b946a3b8 | ||
|
|
212e43683e | ||
|
|
d2b267e683 | ||
|
|
4225b809c5 | ||
|
|
73760f6499 | ||
|
|
ef520571d5 | ||
|
|
caca6995a1 | ||
|
|
188d8430a2 | ||
|
|
f15a4f807e | ||
|
|
428f1ce29d | ||
|
|
b362d955c4 | ||
|
|
faa910161a | ||
|
|
db0658c785 | ||
|
|
b339e40ac1 | ||
|
|
fb5ca615e7 | ||
|
|
63be66e602 | ||
|
|
62efa30dc0 | ||
|
|
4f3d54fb87 | ||
|
|
2394a725e4 | ||
|
|
a8de029389 | ||
|
|
251d07f38e | ||
|
|
9ec7e67b17 | ||
|
|
6cf9a95d78 | ||
|
|
387ada93ca | ||
|
|
c63ac4783f | ||
|
|
2f837593b7 | ||
|
|
bdacbb6a35 | ||
|
|
1679764a7f | ||
|
|
c6de0be951 | ||
|
|
59aefda4b1 | ||
|
|
20eb7ab29c | ||
|
|
2c1d1646e1 | ||
|
|
94b1c7256b | ||
|
|
3d26f288f5 | ||
|
|
73d3352f90 | ||
|
|
84dbb94b5d | ||
|
|
d5db52264a | ||
|
|
9998997a73 | ||
|
|
7c953050f2 | ||
|
|
99cda67246 | ||
|
|
073b082935 | ||
|
|
3872ac21a3 | ||
|
|
76829742d8 | ||
|
|
4f28aa930c | ||
|
|
7ce20182c8 | ||
|
|
b32568047d | ||
|
|
3524d056f1 | ||
|
|
992018186f | ||
|
|
c0de1b2805 | ||
|
|
c3745777fb | ||
|
|
b922f4d1c6 | ||
|
|
92bf470989 | ||
|
|
c0486a1b7b | ||
|
|
fe1eb32926 | ||
|
|
4ae16e8fd2 | ||
|
|
e4983b8bde | ||
|
|
eefdf6c976 | ||
|
|
8613475988 | ||
|
|
8c50d05776 | ||
|
|
fb3cf9c315 | ||
|
|
f50e5312c3 | ||
|
|
79d624e798 | ||
|
|
d8d3b57929 | ||
|
|
48fa640f5b | ||
|
|
84a815e7e6 | ||
|
|
737027ded4 | ||
|
|
8c9e8a08dd | ||
|
|
ea01007716 | ||
|
|
531b6cbf69 | ||
|
|
ef43d31dd3 | ||
|
|
93579f83f2 | ||
|
|
2a78b8fb64 | ||
|
|
2744fe1d9c | ||
|
|
8429bdc9a3 | ||
|
|
946331168a | ||
|
|
ddb25d5ff5 | ||
|
|
125cb6e5c2 | ||
|
|
c6eb21ec51 | ||
|
|
cb066233c9 | ||
|
|
9921b2f3de | ||
|
|
26d7fc767c | ||
|
|
d9df2930cb | ||
|
|
658a961459 | ||
|
|
3731a7ea23 | ||
|
|
06755978b2 | ||
|
|
02469acebb | ||
|
|
e2b47228db | ||
|
|
13480ad99e | ||
|
|
8071faa62d | ||
|
|
9ea294586a | ||
|
|
a56a11ff3e | ||
|
|
b4084b45cb | ||
|
|
26e3c0d753 | ||
|
|
6d0194acc0 | ||
|
|
db75a99808 | ||
|
|
a04755efed | ||
|
|
6a9a1bc4d6 | ||
|
|
a0847e603f | ||
|
|
b1270bc0eb | ||
|
|
ba72d7f478 | ||
|
|
cd808c76dd | ||
|
|
3a77707f49 | ||
|
|
583c97a494 | ||
|
|
eb7431afed | ||
|
|
630bb2b19c | ||
|
|
f9a7aa59de | ||
|
|
c0bce5ae5b | ||
|
|
ad05e2b9db | ||
|
|
b7c2eee961 | ||
|
|
9205e0893a | ||
|
|
7137bf227e | ||
|
|
c2d0fba1d8 | ||
|
|
345d7fa37b | ||
|
|
88c1aa0282 | ||
|
|
c4cd02dbe9 | ||
|
|
b9269ad437 | ||
|
|
2783197f1c | ||
|
|
3238b8b045 | ||
|
|
dcac8fe7d2 | ||
|
|
cc3aca29ef | ||
|
|
baaa5ef7d7 | ||
|
|
e657683322 |
@@ -1,12 +1,14 @@
|
|||||||
{
|
{
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"env": {
|
"env": {
|
||||||
|
"browser": true,
|
||||||
"node": true,
|
"node": true,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"jest": true
|
"jest": true,
|
||||||
|
"mocha": true
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2017
|
"ecmaVersion": 2018
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"SELECT": true,
|
"SELECT": true,
|
||||||
|
|||||||
10
.github/ISSUE_TEMPLATE/question--feedback-or-bug-.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/question--feedback-or-bug-.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: Question, feedback or bug?
|
||||||
|
about: Use our community!
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Please use our community on https://answers.sap.com/tags/9f13aee1-834c-4105-8e43-ee442775e5ce
|
||||||
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
.gitignore
vendored
2
.gitignore
vendored
@@ -13,3 +13,5 @@ target/
|
|||||||
connection.properties
|
connection.properties
|
||||||
default-env.json
|
default-env.json
|
||||||
packages/messageBox
|
packages/messageBox
|
||||||
|
reviews/msg-box
|
||||||
|
reviews/db/test.db
|
||||||
|
|||||||
1
.mocharc.yml
Normal file
1
.mocharc.yml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
parallel: true
|
||||||
20
.vscode/extensions.json
vendored
Normal file
20
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
// 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",
|
||||||
|
"humao.rest-client",
|
||||||
|
"alexcvzz.vscode-sqlite",
|
||||||
|
"hbenl.vscode-mocha-test-adapter",
|
||||||
|
"sdras.night-owl"
|
||||||
|
],
|
||||||
|
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
||||||
|
"unwantedRecommendations": [
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
31
.vscode/launch.json
vendored
Normal file
31
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "bookshop",
|
||||||
|
"command": "cds watch bookshop",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "node-terminal",
|
||||||
|
"skipFiles": ["<node_internals>/**"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Fiori app",
|
||||||
|
"command": "cds watch fiori",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "node-terminal",
|
||||||
|
"skipFiles": ["<node_internals>/**"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "pickString",
|
||||||
|
"id": "sample",
|
||||||
|
"description": "Which sample do you want to start?",
|
||||||
|
"options": ["bookshop", "fiori", "reviews", "reviews/test/bookshop"],
|
||||||
|
"default": "bookshop"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.gitignore": true,
|
||||||
|
"**/.vscode": true
|
||||||
|
}
|
||||||
|
}
|
||||||
15
.vscode/tasks.json
vendored
Normal file
15
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "jest",
|
||||||
|
"group": {
|
||||||
|
"kind": "test",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
379
LICENSE
379
LICENSE
@@ -1,190 +1,217 @@
|
|||||||
SAP SAMPLE CODE LICENSE AGREEMENT
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
Please scroll down and read the following SAP Sample Code License Agreement
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
carefully ("Agreement"). By downloading, installing, or otherwise using the
|
|
||||||
SAP sample code or any materials that accompany the sample code documentation
|
|
||||||
(collectively, the "Sample Code"), You agree that this Agreement forms a legally
|
|
||||||
binding agreement between You ("You" or "Your") and SAP SE, for and on behalf
|
|
||||||
of itself and its subsidiaries and affiliates (as defined in Section 15 of the
|
|
||||||
German Stock Corporation Act), and You agree to be bound by all of the terms
|
|
||||||
and conditions stated in this Agreement. If You are trying to access or download
|
|
||||||
the Sample Code on behalf of Your employer or as a consultant or agent of a
|
|
||||||
third party (either "Your Company"), You represent and warrant that You have
|
|
||||||
the authority to act on behalf of and bind Your Company to the terms of this
|
|
||||||
Agreement and everywhere in this Agreement that refers to 'You' or 'Your' shall
|
|
||||||
also include Your Company. If You do not agree to these terms, do not attempt
|
|
||||||
to access or use the Sample Code.
|
|
||||||
|
|
||||||
1. LICENSE: Subject to the terms of this Agreement, SAP grants You a nonexclusive,
|
1. Definitions.
|
||||||
non-transferable, non-sublicensable, revocable, royalty-free,
|
|
||||||
limited license to use, copy, and modify the Sample Code solely for Your internal
|
|
||||||
business purposes.
|
|
||||||
|
|
||||||
2. RESTRICTIONS: You must not use the Sample Code to: (a) impair, degrade or
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
reduce the performance or security of any SAP products, services or related
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
technology (collectively, "SAP Products"); (b) enable the bypassing or
|
|
||||||
circumventing of SAP's license restrictions and/or provide users with access to
|
|
||||||
the SAP Products to which such users are not licensed; or (c) permit mass data
|
|
||||||
extraction from an SAP Product to a non-SAP Product, including use,
|
|
||||||
modification, saving or other processing of such data in the non-SAP Product.
|
|
||||||
Further, You must not: (i) provide or make the Sample Code available to any
|
|
||||||
third party other than your authorized employees, contractors and agents
|
|
||||||
(collectively, “Representatives”) and solely to be used by Your Representatives
|
|
||||||
for Your own internal business purposes; ii) remove or modify any marks or
|
|
||||||
proprietary notices from the Sample Code; iii) assign this Agreement, or any
|
|
||||||
interest therein, to any third party; (iv) use any SAP name, trademark or logo
|
|
||||||
without the prior written authorization of SAP; or (v) use the Sample Code to
|
|
||||||
modify an SAP Product or decompile, disassemble or reverse engineer an SAP
|
|
||||||
Product (except to the extent permitted by applicable law). You are responsible
|
|
||||||
for any breach of the terms of this Agreement by You or Your Representatives.
|
|
||||||
|
|
||||||
3. INTELLECTUAL PROPERTY: SAP or its licensors retain all ownership and
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
intellectual property rights in and to the Sample Code and SAP Products. In
|
the copyright owner that is granting the License.
|
||||||
exchange for the right to use, copy and modify the Sample Code provided under
|
|
||||||
this Agreement, You covenant not to assert any intellectual property rights in
|
|
||||||
or to any of Your products, services, or related technology that are based on
|
|
||||||
or incorporate the Sample Code against any individual or entity in respect of
|
|
||||||
any current or future SAP Products.
|
|
||||||
|
|
||||||
4. SAP AND THIRD PARTY APIS: The Sample Code may include API (application
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
programming interface) calls to SAP and third-party products or services. The
|
other entities that control, are controlled by, or are under common
|
||||||
access or use of the third-party products and services to which the API calls
|
control with that entity. For the purposes of this definition,
|
||||||
are directed may be subject to additional terms and conditions between you and
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
SAP or such third parties. You (and not SAP) are solely responsible for
|
direction or management of such entity, whether by contract or
|
||||||
understanding and complying with any additional terms and conditions that apply
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
to the access or use of those APIs and/or third-party products and services.
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
SAP does not grant You any rights in or to these APIs, products or services
|
|
||||||
under this Agreement.
|
|
||||||
|
|
||||||
5. FREE AND OPEN SOURCE COMPONENTS: The Sample Code may include third party
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
free or open source components ("FOSS Components"). You may have additional
|
exercising permissions granted by this License.
|
||||||
rights in such FOSS Components that are provided by the third party licensors
|
|
||||||
of those components.
|
|
||||||
6. THIRD PARTY DEPENDENCIES: The Sample Code may require third party software
|
|
||||||
dependencies ("Dependencies") for the use or operation of the Sample Code. These
|
|
||||||
Dependencies may be identified by SAP in Maven POM files, documentation or by
|
|
||||||
other means. SAP does not grant You any rights in or to such Dependencies under
|
|
||||||
this Agreement. You are solely responsible for the acquisition, installation
|
|
||||||
and use of such Dependencies.
|
|
||||||
7. WARRANTY:
|
|
||||||
a) If You are located outside the US or Canada: AS THE SAMPLE CODE IS PROVIDED
|
|
||||||
TO YOU FREE OF CHARGE, SAP DOES NOT GUARANTEE OR WARRANT ANY FEATURES OR
|
|
||||||
QUALITIES OF THE SAMPLE CODE OR GIVE ANY UNDERTAKING WITH REGARD TO ANY OTHER
|
|
||||||
QUALITY. NO SUCH WARRANTY OR UNDERTAKING SHALL BE IMPLIED BY YOU FROM ANY
|
|
||||||
DESCRIPTION IN THE SAMPLE CODE OR ANY OTHER MATERIALS, COMMUNICATION OR
|
|
||||||
ADVERTISEMENT. IN PARTICULAR, SAP DOES NOT WARRANT THAT THE SAMPLE CODE WILL BE
|
|
||||||
AVAILABLE UNINTERRUPTED, ERROR FREE, OR PERMANENTLY AVAILABLE. ALL WARRANTY
|
|
||||||
CLAIMS RESPECTING THE SAMPLE CODE ARE SUBJECT TO THE LIMITATION OF LIABILITY
|
|
||||||
STIPULATED IN SECTION 8 BELOW.
|
|
||||||
b) If You are located in the US or Canada: THE SAMPLE CODE IS LICENSED TO YOU
|
|
||||||
"AS IS", WITHOUT ANY WARRANTY, ESCROW, TRAINING, MAINTENANCE, OR SERVICE
|
|
||||||
OBLIGATIONS WHATSOEVER ON THE PART OF SAP. SAP MAKES NO EXPRESS OR IMPLIED
|
|
||||||
WARRANTIES OR CONDITIONS OF SALE OF ANY TYPE WHATSOEVER, INCLUDING BUT NOT
|
|
||||||
LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY AND OF FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. IN PARTICULAR, SAP DOES NOT WARRANT THAT THE SAMPLE CODE WILL BE
|
|
||||||
AVAILABLE UNINTERRUPTED, ERROR FREE, OR PERMANENTLY AVAILABLE. YOU ASSUME ALL
|
|
||||||
RISKS ASSOCIATED WITH THE USE OF THE SAMPLE CODE, INCLUDING WITHOUT LIMITATION
|
|
||||||
RISKS RELATING TO QUALITY, AVAILABILITY, PERFORMANCE, DATA LOSS, AND UTILITY IN
|
|
||||||
A PRODUCTION ENVIRONMENT.
|
|
||||||
c) For all locations: SAP DOES NOT MAKE ANY REPRESENTATIONS OR WARRANTIES IN
|
|
||||||
RESPECT OF THIRD PARTY DEPENDENCIES, APIS, PRODUCTS AND SERVICES, INCLUDING BUT
|
|
||||||
NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY AND OF FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. IN PARTICULAR, SAP DOES NOT WARRANT THAT THIRDPARTY
|
|
||||||
DEPENDENCIES, APIS, PRODUCTS AND SERVICES WILL BE AVAILABLE, ERROR FREE,
|
|
||||||
INTEROPERABLE WITH THE SAMPLE CODE, SUITABLE FOR ANY PARTICULAR PURPOSE OR NONINFRINGING.
|
|
||||||
YOU ASSUME ALL RISKS ASSOCIATED WITH THE USE OF THIRD
|
|
||||||
PARTY DEPENDENCIES, APIS, PRODUCTS AND SERVICES, INCLUDING WITHOUT LIMITATION
|
|
||||||
RISKS RELATING TO QUALITY, AVAILABILITY, PERFORMANCE, DATA LOSS, UTILITY IN A
|
|
||||||
PRODUCTION ENVIRONMENT, AND NON-INFRINGEMENT. IN NO EVENT WILL SAP BE LIABLE
|
|
||||||
DIRECTLY OR INDIRECTLY IN RESPECT OF ANY USE OF THIRD PARTY DEPENDENCIES, APIS,
|
|
||||||
PRODUCTS AND SERVICES BY YOU.
|
|
||||||
|
|
||||||
8. LIMITATION OF LIABILITY:
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
a) If You are located outside the US or Canada: IRRESPECTIVE OF THE LEGAL
|
including but not limited to software source code, documentation
|
||||||
REASONS, SAP SHALL ONLY BE LIABLE FOR DAMAGES UNDER THIS AGREEMENT IF SUCH
|
source, and configuration files.
|
||||||
DAMAGE (I) CAN BE CLAIMED UNDER THE GERMAN PRODUCT LIABILITY ACT OR (II) IS
|
|
||||||
CAUSED BY INTENTIONAL MISCONDUCT OF SAP OR (III) CONSISTS OF PERSONAL INJURY.
|
|
||||||
IN ALL OTHER CASES, NEITHER SAP NOR ITS EMPLOYEES, AGENTS AND SUBCONTRACTORS
|
|
||||||
SHALL BE LIABLE FOR ANY KIND OF DAMAGE OR CLAIMS HEREUNDER.
|
|
||||||
b) If You are located in the US or Canada: IN NO EVENT SHALL SAP BE LIABLE TO
|
|
||||||
YOU, YOUR COMPANY OR TO ANY THIRD PARTY FOR ANY DAMAGES IN AN AMOUNT IN EXCESS
|
|
||||||
OF $100 ARISING IN CONNECTION WITH YOUR USE OF OR INABILITY TO USE THE SAMPLE
|
|
||||||
CODE OR IN CONNECTION WITH SAP'S PROVISION OF OR FAILURE TO PROVIDE SERVICES
|
|
||||||
PERTAINING TO THE SAMPLE CODE, OR AS A RESULT OF ANY DEFECT IN THE SAMPLE COED.
|
|
||||||
THIS DISCLAIMER OF LIABILITY SHALL APPLY REGARDLESS OF THE FORM OF ACTION THAT
|
|
||||||
MAY BE BROUGHT AGAINST SAP, WHETHER IN CONTRACT OR TORT, INCLUDING WITHOUT
|
|
||||||
LIMITATION ANY ACTION FOR NEGLIGENCE. YOUR SOLE REMEDY IN THE EVENT OF BREACH
|
|
||||||
OF THIS AGREEMENT BY SAP OR FOR ANY OTHER CLAIM RELATED TO THE SAMPLE CODE SHALL
|
|
||||||
BE TERMINATION OF THIS AGREEMENT. NOTWITHSTANDING ANYTHING TO THE CONTRARY
|
|
||||||
HEREIN, UNDER NO CIRCUMSTANCES SHALL SAP OR ITS LICENSORS BE LIABLE TO YOU OR
|
|
||||||
ANY OTHER PERSON OR ENTITY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR
|
|
||||||
INDIRECT DAMAGES, LOSS OF GOOD WILL OR BUSINESS PROFITS, WORK STOPPAGE, DATA
|
|
||||||
LOSS, COMPUTER FAILURE OR MALFUNCTION, ANY AND ALL OTHER COMMERCIAL DAMAGES OR
|
|
||||||
LOSS, OR EXEMPLARY OR PUNITIVE DAMAGES.
|
|
||||||
|
|
||||||
9. INDEMNITY: You will fully indemnify, hold harmless and defend SAP against
|
"Object" form shall mean any form resulting from mechanical
|
||||||
law suits based on any claim: (a) that any of Your products, services or related
|
transformation or translation of a Source form, including but
|
||||||
technology that are based on or incorporate the Sample Code infringes or
|
not limited to compiled object code, generated documentation,
|
||||||
misappropriates any patent, copyright, trademark, trade secrets, or other
|
and conversions to other media types.
|
||||||
proprietary rights of a third party, or (b) related to Your alleged violation
|
|
||||||
of the terms of this Agreement.
|
|
||||||
|
|
||||||
10. EXPORT: The Sample Code is subject to German, EU and US export control
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
regulations. You confirm that: a) You will not use the Sample Code for, and
|
Object form, made available under the License, as indicated by a
|
||||||
will not allow the Sample Code to be used for, any purposes prohibited by
|
copyright notice that is included in or attached to the work
|
||||||
German, EU and US law, including, without limitation, for the development,
|
(an example is provided in the Appendix below).
|
||||||
design, manufacture or production of nuclear, chemical or biological weapons of
|
|
||||||
mass destruction; b) You are not located in Cuba, Iran, Sudan, Iraq, North
|
|
||||||
Korea, Syria, nor any other country to which the United States has prohibited
|
|
||||||
export or that has been designated by the U.S. Government as a "terrorist
|
|
||||||
supporting" country (any, an "US Embargoed Country"); c) You are not a citizen,
|
|
||||||
national or resident of, and are not under the control of, a US Embargoed
|
|
||||||
Country; d) You will not download or otherwise export or re-export the Sample
|
|
||||||
Code, directly or indirectly, to a US Embargoed Country nor to citizens,
|
|
||||||
nationals or residents of a US Embargoed Country; e) You are not listed on the
|
|
||||||
United States Department of Treasury lists of Specially Designated Nationals,
|
|
||||||
Specially Designated Terrorists, and Specially Designated Narcotic Traffickers,
|
|
||||||
nor listed on the United States Department of Commerce Table of Denial Orders
|
|
||||||
or any other U.S. government list of prohibited or restricted parties and f)
|
|
||||||
You will not download or otherwise export or re-export the Sample Code, directly
|
|
||||||
or indirectly, to persons on the above-mentioned lists.
|
|
||||||
|
|
||||||
11. SUPPORT: SAP does not offer support for the Sample Code.
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
12. TERM AND TERMINATION: You may terminate this Agreement by destroying all
|
"Contribution" shall mean any work of authorship, including
|
||||||
copies of the Sample Code in Your possession or control. SAP may terminate Your
|
the original version of the Work and any modifications or additions
|
||||||
license to use the Sample Code immediately if You fail to comply with any of
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
the terms of this Agreement, or, for SAP's convenience by providing you with
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
ten (10) days written notice of termination. In case of termination or
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
expiration of this Agreement, You must immediately destroy all copies of the
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
Sample Code in your possession or control. In the event Your Company is acquired
|
means any form of electronic, verbal, or written communication sent
|
||||||
(by merger, purchase of stock, assets or intellectual property or exclusive
|
to the Licensor or its representatives, including but not limited to
|
||||||
license), or You become employed, by a direct competitor of SAP, then this
|
communication on electronic mailing lists, source code control systems,
|
||||||
Agreement and all licenses granted to You in this Agreement shall immediately
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
terminate upon the date of such acquisition or change of employment.
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
13. LAW/VENUE:
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
a) If You are located outside the US or Canada: This Agreement is governed by
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
and construed in accordance with the laws of Germany without reference to its
|
subsequently incorporated within the Work.
|
||||||
conflicts of law principles. You and SAP agree to submit to the exclusive
|
|
||||||
jurisdiction of, and venue in, the courts located in Karlsruhe, Germany in any
|
|
||||||
dispute arising out of or relating to this Agreement or the Sample Code. The
|
|
||||||
United Nations Convention on Contracts for the International Sale of Goods shall
|
|
||||||
not apply to this Agreement.
|
|
||||||
b) If You are located in the US or Canada: This Agreement shall be governed by
|
|
||||||
and construed in accordance with the laws of the State of New York, USA without
|
|
||||||
reference to its conflicts of law principles. You and SAP agree to submit to
|
|
||||||
the exclusive jurisdiction of, and venue in, the courts located in New York,
|
|
||||||
New York, USA in any dispute arising out of or relating to this Agreement or
|
|
||||||
the Sample Code. The United Nations Convention on Contracts for the
|
|
||||||
International Sale of Goods shall not apply to this Agreement.
|
|
||||||
|
|
||||||
14. MISCELLANEOUS: This Agreement is the complete agreement between the parties
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
respecting the Sample Code. This Agreement supersedes all prior or
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
contemporaneous agreements or representations with regards to the Sample Code.
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
If any term of this Agreement is found to be invalid or unenforceable, the
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
surviving provisions shall remain effective. SAP's failure to enforce any right
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
or provisions stipulated in this Agreement will not constitute a waiver of such
|
Work and such Derivative Works in Source or Object form.
|
||||||
provision, or any other provision of this Agreement.
|
|
||||||
|
|
||||||
v1.0-071618
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
APIs
|
||||||
|
|
||||||
|
This project may include APIs to SAP or third-party products or services.
|
||||||
|
The use of these APIs, products and services may be subject to additional
|
||||||
|
agreements. In no event shall the application of the Apache Software
|
||||||
|
License, v.2 to this project grant any rights in or to these APIs,
|
||||||
|
products or services that would alter, expand, be inconsistent with,
|
||||||
|
or supersede any terms of these additional agreements. “API” means
|
||||||
|
application programming interfaces, as well as their respective
|
||||||
|
specifications and implementing code that allows other software
|
||||||
|
products to communicate with or call on SAP or third party products
|
||||||
|
or services (for example, SAP Enterprise Services, BAPIs, Idocs, RFCs
|
||||||
|
and ABAP calls or other user exits) and may be made available through
|
||||||
|
SAP or third party products, SDKs, documentation or other media.
|
||||||
|
|||||||
1
NOTICE
1
NOTICE
@@ -1 +0,0 @@
|
|||||||
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
|
|
||||||
84
README.md
84
README.md
@@ -1,58 +1,58 @@
|
|||||||
# cloud-cap-samples
|
# Welcome to cap/samples
|
||||||
|
|
||||||
This is a monorepository for sample projects on [SAP Cloud Application Programming Model](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/00823f91779d4d42aa29a498e0535cdf.html?q=cloud%20application%20programming%20model).
|
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)
|
||||||
|
|
||||||
## Description
|

|
||||||
|
|
||||||
This repository provides a list of samples and reusable packages created based on SAP Cloud Application Programming Model.
|
### Preliminaries
|
||||||
The SAP Cloud Application Programming Model enables you to quickly create business applications by allowing you to focus on your domain logic. It offers a consistent end-to-end programming model that includes languages, libraries and APIs tailored for full-stack development on SAP Cloud Platform.
|
|
||||||
|
|
||||||
The samples provided can be run in a local setup on SQLite Database.
|
1. [Install @sap/cds-dk](https://cap.cloud.sap/docs/get-started/) as documented in [capire](https://cap.cloud.sap)
|
||||||
|
2. _Optional:_ [Use Visual Studio Code](https://cap.cloud.sap/docs/get-started/in-vscode)
|
||||||
#### Samples:
|
|
||||||
* [bookstore](./packages/bookstore) - A variant of the bookshop application, built in a modular fashion on top of products-service and common reuse packages.
|
|
||||||
* [products-service](./packages/products-service) - A reuse package providing domain models and services to manage product catalogs.
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
* [Node.js](https://nodejs.org/en/) v8 or higher
|
|
||||||
* [Git](https://git-scm.com)
|
|
||||||
* [SQLite DB](https://www.sqlite.org/download.html) (Windows only; pre-installed on Mac/Linux)
|
|
||||||
|
|
||||||
#### Optional (if you want to import the code into an editor)
|
|
||||||
* [VS Code](https://code.visualstudio.com)
|
|
||||||
* [Add CDS extension to VS](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/be944d6d51f343f6b3f53c29c44ff00a.html)
|
|
||||||
|
|
||||||
## Download and Installation
|
|
||||||
|
|
||||||
#### Clone and build the application
|
|
||||||
`git clone https://github.com/SAP-samples/cloud-cap-samples.git`
|
|
||||||
|
|
||||||
`cd samples`
|
|
||||||
|
|
||||||
`npm install`
|
|
||||||
|
|
||||||
#### Run the samples
|
|
||||||
|
|
||||||
`npm run <sample name>`
|
|
||||||
|
|
||||||
|
|
||||||
## Limitations
|
### Download
|
||||||
|
|
||||||
None
|
Clone this repo as shown below, if you have [git](https://git-scm.com/downloads) installed,
|
||||||
|
otherwise [download as zip file](archive/master.zip).
|
||||||
|
|
||||||
## Known Issues
|
```sh
|
||||||
|
git clone https://github.com/sap-samples/cloud-cap-samples samples
|
||||||
|
cd samples
|
||||||
|
```
|
||||||
|
|
||||||
None
|
### Setup
|
||||||
|
|
||||||
## How to obtain support
|
In the samples folder run:
|
||||||
|
|
||||||
In case you find a bug, or you need additional support, please open an issue [here](https://github.wdf.sap.corp/staging-for-SAP-samples-public/cloud-cap-samples/issues) in GitHub.
|
```sh
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
## To-Do (upcoming changes)
|
### Run
|
||||||
|
|
||||||
|
With that you're ready to run the samples, for example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cds watch bookshop
|
||||||
|
```
|
||||||
|
|
||||||
|
After that open this link in your browser: [http://localhost:4004](http://localhost:4004)
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
Run the provided tests with [_jest_](http://jestjs.io) or [_mocha_](http://mochajs.org), for example:
|
||||||
|
```sh
|
||||||
|
npx jest
|
||||||
|
```
|
||||||
|
> While mocha is a bit smaller and faster, jest runs tests in parallel and isolation, which allows to run all tests.
|
||||||
|
|
||||||
|
|
||||||
|
## Get Support
|
||||||
|
|
||||||
|
Check out the documentation at [https://cap.cloud.sap](https://cap.cloud.sap). <br>
|
||||||
|
In case you have a question, find a bug, or otherwise need support, please use our [community](https://answers.sap.com/tags/9f13aee1-834c-4105-8e43-ee442775e5ce).
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under SAP Sample Code License Agreement, 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.
|
||||||
|
|
||||||
|
|||||||
1
bookshop/.env
Normal file
1
bookshop/.env
Normal file
@@ -0,0 +1 @@
|
|||||||
|
cds.features.snapi = y
|
||||||
25
bookshop/.vscode/launch.json
vendored
Normal file
25
bookshop/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Attach to...",
|
||||||
|
"type": "node",
|
||||||
|
"request": "attach",
|
||||||
|
"processId": "${command:PickProcess}",
|
||||||
|
"skipFiles": ["<node_internals>/**"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cds run",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"runtimeExecutable": "npx",
|
||||||
|
"runtimeArgs": ["-n"],
|
||||||
|
"args": ["--", "cds", "run", "--with-mocks", "--in-memory?"],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"skipFiles": ["<node_internals>/**"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
2
bookshop/app/index.cds
Normal file
2
bookshop/app/index.cds
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// Incorporate pre-build extensions from...
|
||||||
|
using from '@capire/common';
|
||||||
45
bookshop/app/vue/app.js
Normal file
45
bookshop/app/vue/app.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/* global Vue axios */ //> from vue.html
|
||||||
|
const $ = sel => document.querySelector(sel)
|
||||||
|
const GET = (url) => axios.get('/browse'+url)
|
||||||
|
const POST = (cmd,data) => axios.post('/browse'+cmd,data)
|
||||||
|
|
||||||
|
const books = new Vue ({
|
||||||
|
|
||||||
|
el:'#app',
|
||||||
|
|
||||||
|
data: {
|
||||||
|
list: [],
|
||||||
|
book: { descr:'( click on a row to see details... )' },
|
||||||
|
order: { amount:1, succeeded:'', failed:'' }
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
search: ({target:{value:v}}) => books.fetch (v && '$search='+v),
|
||||||
|
|
||||||
|
async fetch (_filter='') {
|
||||||
|
const columns = 'ID,title,author,price,stock', details = 'genre,currency'
|
||||||
|
const {data} = await GET(`/Books?$select=${columns}&$expand=${details}&${_filter}`)
|
||||||
|
books.list = data.value
|
||||||
|
},
|
||||||
|
|
||||||
|
async inspect () {
|
||||||
|
const book = books.book = books.list [event.currentTarget.rowIndex-1]
|
||||||
|
book.descr || await GET(`/Books/${book.ID}/descr/$value`) .then (({data}) => book.descr = data)
|
||||||
|
books.order = { amount:1 }
|
||||||
|
setTimeout (()=> $('form > input').focus(), 111)
|
||||||
|
},
|
||||||
|
|
||||||
|
submitOrder () { event.preventDefault()
|
||||||
|
const {book,order} = books, amount = parseInt (order.amount) || 1
|
||||||
|
POST(`/submitOrder`, { amount, book: book.ID })
|
||||||
|
.then (()=> books.order = { amount, succeeded: `Successfully orderd ${amount} item(s).` })
|
||||||
|
.catch (e=> books.order = { amount, failed: e.response.data.error.message })
|
||||||
|
GET(`/Books/${book.ID}/stock/$value`).then (res => book.stock = res.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// initially fill list of books
|
||||||
|
books.fetch()
|
||||||
59
bookshop/app/vue/index.html
Normal file
59
bookshop/app/vue/index.html
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title> Capire Books </title>
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/primitive-ui/dist/css/main.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
|
||||||
|
<style>
|
||||||
|
#books tr:hover { background: #f2f2f2; cursor: pointer; }
|
||||||
|
form { float:right; display:flex; flex-direction: row-reverse }
|
||||||
|
form #amount { width: 5em }
|
||||||
|
.is-success { color: #0d920d }
|
||||||
|
.has-error { color: #df1010 }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="small-container", style="margin-top: 70px;">
|
||||||
|
<div id='app'>
|
||||||
|
|
||||||
|
<h1> Capire Books </h1>
|
||||||
|
|
||||||
|
<input type="text" placeholder="Search..." @input="search">
|
||||||
|
|
||||||
|
<table id='books'>
|
||||||
|
<thead>
|
||||||
|
<th> Book </th>
|
||||||
|
<th> Author </th>
|
||||||
|
<th> Genre </th>
|
||||||
|
<th> Price </th>
|
||||||
|
</thead>
|
||||||
|
<tr v-for="book in list" v-bind:id="book.ID" v-on:click="inspect">
|
||||||
|
<td>{{ book.title }}</td>
|
||||||
|
<td>{{ book.author }}</td>
|
||||||
|
<td>{{ book.genre.name }}</td>
|
||||||
|
<td>{{ book.currency.symbol }} {{ book.price }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div v-if="book.title">
|
||||||
|
<label style="text-align:right">
|
||||||
|
<span class="is-success"> {{ order.succeeded }} </span>
|
||||||
|
<span class="has-error"> {{ order.failed }} </span>
|
||||||
|
{{ book.stock }} in stock
|
||||||
|
</label>
|
||||||
|
<form @submit="submitOrder">
|
||||||
|
<input type="number" id="amount" v-model="order.amount" v-bind:class="{ 'has-error': order.failed }">
|
||||||
|
<input type="submit" value="Order:" class="muted-button">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4> {{ book.title }} </h4>
|
||||||
|
<p> {{ book.descr }} </p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script src="app.js"></script>
|
||||||
|
</html>
|
||||||
5
bookshop/db/data/sap.capire.bookshop-Authors.csv
Normal file
5
bookshop/db/data/sap.capire.bookshop-Authors.csv
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ID;name;dateOfBirth;placeOfBirth;dateOfDeath;placeOfDeath
|
||||||
|
101;Emily Brontë;1818-07-30;Thornton, Yorkshire;1848-12-19;Haworth, Yorkshire
|
||||||
|
107;Charlotte Brontë;1818-04-21;Thornton, Yorkshire;1855-03-31;Haworth, Yorkshire
|
||||||
|
150;Edgar Allen Poe;1809-01-19;Boston, Massachusetts;1849-10-07;Baltimore, Maryland
|
||||||
|
170;Richard Carpenter;1929-08-14;King’s Lynn, Norfolk;2012-02-26;Hertfordshire, England
|
||||||
|
500 Internal Server Error
Gitea Version: 1.24.4 |