Compare commits
5 Commits
recap
...
openSAP-we
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62f32abf74 | ||
|
|
536282388c | ||
|
|
75e767ed5c | ||
|
|
ba1eead6db | ||
|
|
8233703815 |
8
.env
8
.env
@@ -1,8 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
{
|
{
|
||||||
"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": 2018
|
"ecmaVersion": 2018
|
||||||
|
|||||||
28
.github/workflows/node.js.yml
vendored
28
.github/workflows/node.js.yml
vendored
@@ -1,28 +0,0 @@
|
|||||||
# 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,5 +13,3 @@ target/
|
|||||||
connection.properties
|
connection.properties
|
||||||
default-env.json
|
default-env.json
|
||||||
packages/messageBox
|
packages/messageBox
|
||||||
reviews/msg-box
|
|
||||||
reviews/db/test.db
|
|
||||||
|
|||||||
20
.vscode/extensions.json
vendored
20
.vscode/extensions.json
vendored
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
// 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": [
|
|
||||||
// "CDS Editor !",
|
|
||||||
"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": [
|
|
||||||
|
|
||||||
]
|
|
||||||
}
|
|
||||||
32
.vscode/launch.json
vendored
32
.vscode/launch.json
vendored
@@ -5,24 +5,16 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "bookshop",
|
"name": "bookshop", "request": "launch", "type": "node", "runtimeExecutable": "npx", "runtimeArgs": [ "-n" ],
|
||||||
"cwd": "${workspaceFolder}/bookshop",
|
"args": [ "--", "cds", "run", "--in-memory" ],
|
||||||
"request": "launch",
|
"cwd": "${workspaceFolder}/packages/bookshop",
|
||||||
"type": "node",
|
|
||||||
"runtimeExecutable": "npx",
|
|
||||||
"runtimeArgs": ["-n"],
|
|
||||||
"args": ["--", "cds", "run", "--with-mocks", "--in-memory?"],
|
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"skipFiles": ["<node_internals>/**"]
|
"skipFiles": ["<node_internals>/**"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Fiori App",
|
"name": "cds run ...", "request": "launch", "type": "node", "runtimeExecutable": "npx", "runtimeArgs": [ "-n" ],
|
||||||
"cwd": "${workspaceFolder}/fiori",
|
"args": [ "--", "cds", "run", "--with-mocks", "--in-memory?" ],
|
||||||
"request": "launch",
|
"cwd": "${workspaceFolder}/packages/${input:service}",
|
||||||
"type": "node",
|
|
||||||
"runtimeExecutable": "npx",
|
|
||||||
"runtimeArgs": ["-n"],
|
|
||||||
"args": ["--", "cds", "run", "--with-mocks", "--in-memory?"],
|
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"skipFiles": ["<node_internals>/**"]
|
"skipFiles": ["<node_internals>/**"]
|
||||||
}
|
}
|
||||||
@@ -30,9 +22,15 @@
|
|||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"type": "pickString",
|
"type": "pickString",
|
||||||
"id": "sample",
|
"id": "service",
|
||||||
"description": "Which sample do you want to start?",
|
"description": "Which service do you want to start?",
|
||||||
"options": ["bookshop", "fiori", "reviews", "reviews/test/bookshop"],
|
"options": [
|
||||||
|
"bookshop",
|
||||||
|
"bookstore",
|
||||||
|
"media-server",
|
||||||
|
"office-supplies",
|
||||||
|
"reviews-service"
|
||||||
|
],
|
||||||
"default": "bookshop"
|
"default": "bookshop"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
14
.vscode/tasks.json
vendored
14
.vscode/tasks.json
vendored
@@ -4,12 +4,14 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"type": "npm",
|
"type": "npm", "script": "watch", "path": "packages/bookshop/",
|
||||||
"script": "jest",
|
"options": { "env": { "PORT": "4004" }},
|
||||||
"group": {
|
"presentation": { "group": "A" }
|
||||||
"kind": "test",
|
},
|
||||||
"isDefault": true
|
{
|
||||||
}
|
"type": "npm", "script": "watch", "path": "packages/reviews-service/",
|
||||||
|
"options": { "env": { "PORT": "5005" }},
|
||||||
|
"presentation": { "group": "A" }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
379
LICENSE
379
LICENSE
@@ -1,217 +1,190 @@
|
|||||||
Apache License
|
SAP SAMPLE CODE LICENSE AGREEMENT
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
Please scroll down and read the following SAP Sample Code License Agreement
|
||||||
|
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. Definitions.
|
1. LICENSE: Subject to the terms of this Agreement, SAP grants You a nonexclusive,
|
||||||
|
non-transferable, non-sublicensable, revocable, royalty-free,
|
||||||
|
limited license to use, copy, and modify the Sample Code solely for Your internal
|
||||||
|
business purposes.
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
2. RESTRICTIONS: You must not use the Sample Code to: (a) impair, degrade or
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
reduce the performance or security of any SAP products, services or related
|
||||||
|
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.
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
3. INTELLECTUAL PROPERTY: SAP or its licensors retain all ownership and
|
||||||
the copyright owner that is granting the License.
|
intellectual property rights in and to the Sample Code and SAP Products. In
|
||||||
|
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.
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
4. SAP AND THIRD PARTY APIS: The Sample Code may include API (application
|
||||||
other entities that control, are controlled by, or are under common
|
programming interface) calls to SAP and third-party products or services. The
|
||||||
control with that entity. For the purposes of this definition,
|
access or use of the third-party products and services to which the API calls
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
are directed may be subject to additional terms and conditions between you and
|
||||||
direction or management of such entity, whether by contract or
|
SAP or such third parties. You (and not SAP) are solely responsible for
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
understanding and complying with any additional terms and conditions that apply
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
to the access or use of those APIs and/or third-party products and services.
|
||||||
|
SAP does not grant You any rights in or to these APIs, products or services
|
||||||
|
under this Agreement.
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
5. FREE AND OPEN SOURCE COMPONENTS: The Sample Code may include third party
|
||||||
exercising permissions granted by this License.
|
free or open source components ("FOSS Components"). You may have additional
|
||||||
|
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.
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
8. LIMITATION OF LIABILITY:
|
||||||
including but not limited to software source code, documentation
|
a) If You are located outside the US or Canada: IRRESPECTIVE OF THE LEGAL
|
||||||
source, and configuration files.
|
REASONS, SAP SHALL ONLY BE LIABLE FOR DAMAGES UNDER THIS AGREEMENT IF SUCH
|
||||||
|
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.
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
9. INDEMNITY: You will fully indemnify, hold harmless and defend SAP against
|
||||||
transformation or translation of a Source form, including but
|
law suits based on any claim: (a) that any of Your products, services or related
|
||||||
not limited to compiled object code, generated documentation,
|
technology that are based on or incorporate the Sample Code infringes or
|
||||||
and conversions to other media types.
|
misappropriates any patent, copyright, trademark, trade secrets, or other
|
||||||
|
proprietary rights of a third party, or (b) related to Your alleged violation
|
||||||
|
of the terms of this Agreement.
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
10. EXPORT: The Sample Code is subject to German, EU and US export control
|
||||||
Object form, made available under the License, as indicated by a
|
regulations. You confirm that: a) You will not use the Sample Code for, and
|
||||||
copyright notice that is included in or attached to the work
|
will not allow the Sample Code to be used for, any purposes prohibited by
|
||||||
(an example is provided in the Appendix below).
|
German, EU and US law, including, without limitation, for the development,
|
||||||
|
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.
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
11. SUPPORT: SAP does not offer support for the Sample Code.
|
||||||
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.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
12. TERM AND TERMINATION: You may terminate this Agreement by destroying all
|
||||||
the original version of the Work and any modifications or additions
|
copies of the Sample Code in Your possession or control. SAP may terminate Your
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
license to use the Sample Code immediately if You fail to comply with any of
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
the terms of this Agreement, or, for SAP's convenience by providing you with
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
ten (10) days written notice of termination. In case of termination or
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
expiration of this Agreement, You must immediately destroy all copies of the
|
||||||
means any form of electronic, verbal, or written communication sent
|
Sample Code in your possession or control. In the event Your Company is acquired
|
||||||
to the Licensor or its representatives, including but not limited to
|
(by merger, purchase of stock, assets or intellectual property or exclusive
|
||||||
communication on electronic mailing lists, source code control systems,
|
license), or You become employed, by a direct competitor of SAP, then this
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
Agreement and all licenses granted to You in this Agreement shall immediately
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
terminate upon the date of such acquisition or change of employment.
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
13. LAW/VENUE:
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
a) If You are located outside the US or Canada: This Agreement is governed by
|
||||||
subsequently incorporated within the Work.
|
and construed in accordance with the laws of Germany 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 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.
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
14. MISCELLANEOUS: This Agreement is the complete agreement between the parties
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
respecting the Sample Code. This Agreement supersedes all prior or
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
contemporaneous agreements or representations with regards to the Sample Code.
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
If any term of this Agreement is found to be invalid or unenforceable, the
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
surviving provisions shall remain effective. SAP's failure to enforce any right
|
||||||
Work and such Derivative Works in Source or Object form.
|
or provisions stipulated in this Agreement will not constitute a waiver of such
|
||||||
|
provision, or any other provision of this Agreement.
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
v1.0-071618
|
||||||
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
Normal file
1
NOTICE
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
|
||||||
50
README.md
50
README.md
@@ -1,58 +1,42 @@
|
|||||||
# Welcome to cap/samples
|
# Welcome to SAP Cloud Application Programming model samples
|
||||||
|
|
||||||
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 the samples for the openSAP course [Building Applications with the SAP Cloud Application Programming Model](https://open.sap.com/courses/cp7).
|
||||||
|
|
||||||

|
## Get Access to SAP Business Application Studio
|
||||||
|
The recommended environment for the course is SAP Business Application Studio. Watch [unit 2 of week 1](https://open.sap.com/courses/cp7/items/51pzQUzbXHr2kdbOmVs6jI) for how to get access.
|
||||||
|
|
||||||
### Preliminaries
|
## Setup
|
||||||
|
|
||||||
1. [Install @sap/cds-dk](https://cap.cloud.sap/docs/get-started/) as documented in [capire](https://cap.cloud.sap)
|
In SAP Business Application Studio, open a terminal.
|
||||||
2. _Optional:_ [Use Visual Studio Code](https://cap.cloud.sap/docs/get-started/in-vscode)
|
Then clone the repo with this specific branch:
|
||||||
|
|
||||||
|
|
||||||
### Download
|
|
||||||
|
|
||||||
Clone this repo as shown below, if you have [git](https://git-scm.com/downloads) installed,
|
|
||||||
otherwise [download as zip file](archive/master.zip).
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/sap-samples/cloud-cap-samples samples
|
git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week2-unit3
|
||||||
cd samples
|
cd projects/cloud-cap-samples
|
||||||
```
|
```
|
||||||
|
|
||||||
### Setup
|
In the `cloud-cap-samples` folder run:
|
||||||
|
|
||||||
In the samples folder run:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run
|
## Run
|
||||||
|
|
||||||
With that you're ready to run the samples, for example:
|
|
||||||
|
|
||||||
|
Now you're ready to run the samples, for example:
|
||||||
```sh
|
```sh
|
||||||
cds watch bookshop
|
cd packages/bookshop
|
||||||
|
cds watch
|
||||||
```
|
```
|
||||||
|
|
||||||
After that open this link in your browser: [http://localhost:4004](http://localhost:4004)
|
After that, watch out for the little popup in the lower right corner of SAP Business Application Studio that asks you to open the application in your browser.
|
||||||
|
|
||||||
### 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
|
## Get Support
|
||||||
|
|
||||||
Check out the documentation at [https://cap.cloud.sap](https://cap.cloud.sap). <br>
|
Check out the cap docs at 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) 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.
|
Copyright (c) 2020 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.
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
cds.features.snapi = y
|
|
||||||
25
bookshop/.vscode/launch.json
vendored
25
bookshop/.vscode/launch.json
vendored
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
// 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>/**"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
// Incorporate pre-build extensions from...
|
|
||||||
using from '@capire/common';
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/* 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()
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
<!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>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
ID;parent_ID;name
|
|
||||||
10;;Fiction
|
|
||||||
11;10;Drama
|
|
||||||
12;10;Poetry
|
|
||||||
13;10;Fantasy
|
|
||||||
14;10;Science Fiction
|
|
||||||
15;10;Romance
|
|
||||||
16;10;Mystery
|
|
||||||
17;10;Thriller
|
|
||||||
18;10;Dystopia
|
|
||||||
19;10;Fairy Tale
|
|
||||||
20;;Non-Fiction
|
|
||||||
21;20;Biography
|
|
||||||
22;20;Autobiography
|
|
||||||
23;20;Essay
|
|
||||||
24;20;Speech
|
|
||||||
|
500 Internal Server Error
Gitea Version: 1.24.4 |