Compare commits

..

4 Commits

Author SHA1 Message Date
Christian Georgi
ae1129ebab Better email address 2025-04-02 13:02:17 +02:00
ajinkyapatil8190
815a4e9a64 Reuse Version update from dep to toml 2025-03-07 14:05:38 +01:00
Ajinkya Patil
14ac3efaa1 Update dep5 2025-02-25 20:09:17 +01:00
Ajinkya Patil
9c476eb348 Adding the reuse badge 2025-02-25 20:08:49 +01:00
9 changed files with 14 additions and 129 deletions

View File

@@ -1,29 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: cloud-cap-samples
Upstream-Contact: <Christian Georgi (christian.georgi@sap.com)>
Source: https://github.com/SAP-samples/cloud-cap-samples
Disclaimer: The code in this project may include calls to APIs (“API Calls”) of
SAP or third-party products or services developed outside of this project
(“External Products”).
“APIs” means application programming interfaces, as well as their respective
specifications and implementing code that allows software to communicate with
other software.
API Calls to External Products are not licensed under the open source license
that governs this project. The use of such API Calls and related External
Products are subject to applicable additional agreements with the relevant
provider of the External Products. In no event shall the open source license
that governs this project grant any rights in or to any External Products,or
alter, expand or supersede any terms of the applicable additional agreements.
If you have a valid license agreement with SAP for the use of a particular SAP
External Product, then you may make use of any API Calls included in this
projects code for that SAP External Product, subject to the terms of such
license agreement. If you do not have a valid license agreement for the use of
a particular SAP External Product, then you may only make use of any API Calls
in this project for that SAP External Product for your internal, non-productive
and non-commercial test and evaluation of such API Calls. Nothing herein grants
you any rights to use or access any SAP External Product, or provide any third
parties the right to use of access any SAP External Product, through API Calls.
Files: *
Copyright: 2019-2020 SAP SE or an SAP affiliate company and cap-cloud-samples
License: Apache-2.0

View File

@@ -1,3 +1,6 @@
[![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/cloud-cap-samples)](https://api.reuse.software/info/github.com/SAP-samples/cloud-cap-samples)
# Welcome to cap/samples # Welcome to cap/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). 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).

11
REUSE.toml Normal file
View File

@@ -0,0 +1,11 @@
version = 1
SPDX-PackageName = "cloud-cap-samples"
SPDX-PackageSupplier = "<CAP (cap@sap.com)>"
SPDX-PackageDownloadLocation = "https://github.com/SAP-samples/cloud-cap-samples"
SPDX-PackageComment = "The code in this project may include calls to APIs (“API Calls”) of\n SAP or third-party products or services developed outside of this project\n (“External Products”).\n “APIs” means application programming interfaces, as well as their respective\n specifications and implementing code that allows software to communicate with\n other software.\n API Calls to External Products are not licensed under the open source license\n that governs this project. The use of such API Calls and related External\n Products are subject to applicable additional agreements with the relevant\n provider of the External Products. In no event shall the open source license\n that governs this project grant any rights in or to any External Products,or\n alter, expand or supersede any terms of the applicable additional agreements.\n If you have a valid license agreement with SAP for the use of a particular SAP\n External Product, then you may make use of any API Calls included in this\n projects code for that SAP External Product, subject to the terms of such\n license agreement. If you do not have a valid license agreement for the use of\n a particular SAP External Product, then you may only make use of any API Calls\n in this project for that SAP External Product for your internal, non-productive\n and non-commercial test and evaluation of such API Calls. Nothing herein grants\n you any rights to use or access any SAP External Product, or provide any third\n parties the right to use of access any SAP External Product, through API Calls."
[[annotations]]
path = "**.**"
precedence = "aggregate"
SPDX-FileCopyrightText = "2019-2025 SAP SE or an SAP affiliate company and cap-cloud-samples"
SPDX-License-Identifier = "Apache-2.0"

View File

@@ -13,7 +13,6 @@
"@cap-js/sqlite": "*" "@cap-js/sqlite": "*"
}, },
"dependencies": { "dependencies": {
"@cap-js/ord": "2",
"@sap/cds": ">=7", "@sap/cds": ">=7",
"express": "^4.17.1" "express": "^4.17.1"
}, },

View File

@@ -1 +0,0 @@
// just a dummy tag file to be identified as a plugin

View File

@@ -1,12 +0,0 @@
{
"name": "@cap-js/ord",
"version": "2.0.0",
"cds": {
"requires": {
"SAP ORD Service": {
"model": "@cap-js/ord/srv/ord-service",
"service": "OrdService"
}
}
}
}

View File

@@ -1,12 +0,0 @@
// @requires: 'ORDconsumer'
@rest @path:'/ord/v1'
service OrdService {
@readonly entity documents {
key id: String;
}
@readonly entity csn {
key id: String;
}
function api (service: String, format: String) returns {};
}

View File

@@ -1,73 +0,0 @@
import cds from '@sap/cds'
export class OrdService extends cds.ApplicationService {
init(){
this.on('READ','documents', req => {
let csn = cds.context?.model || cds.model
return { ord: csn }
})
/**
* Just an example to do something with id, if given.
* Try it out with URLs like that:
*
* - http://localhost:4004/ord/v1/documents
* - http://localhost:4004/ord/v1/documents/CatalogService
* - http://localhost:4004/ord/v1/documents/CatalogService.Books
* - http://localhost:4004/ord/v1/documents/CatalogService.Authors
*/
this.on('READ','csn', req => {
let csn = cds.context?.model || cds.model
let { id } = req.data
if (id) csn = csn.definitions[id] || 'not in model!'
return { id, csn }
})
/**
* Just an example to serve arbitrary content with a function.
* Try it out with URLs like that:
*
* - http://localhost:4004/ord/v1/api?service=CatalogService
* - http://localhost:4004/ord/v1/api?service=CatalogService&format=edmx
* - http://localhost:4004/ord/v1/api?service=CatalogService&format=edmx-v2
* - http://localhost:4004/ord/v1/api?service=CatalogService&format=openapi
*/
this.on('api', req => {
let csn = cds.context?.model || cds.model
let { service, format = 'csn' } = req.data
let { res } = req.http
if (format === 'csn') {
if (!service) return res.send(csn)
service = csn.services[service]
return res.send({ definitions: [ service, ...service.entities ] .reduce ((all,e) => {
let d = all[e.name] = {...e}
delete d.projection // not part of the API
delete d.query // not part of the API
return all
},{})})
}
let api = cds.compile(csn).to[format]({service})
return res.send(api)
})
/**
* Example how to register arbitrary express routes,
* and map them to our service's interface.
* Try it out with URLs like that:
*
* - http://localhost:4004/ord/v1/csn/CatalogService
* - http://localhost:4004/ord/v1/edmx/CatalogService
* - http://localhost:4004/ord/v1/openapi/CatalogService
* - http://localhost:4004/ord/v1/asyncapi/CatalogService
*
* NOTE: we add cds.middlewares.before to the route, which gives us all
* the context and auth handling, which is also available to CAP services.
*/
cds.app.get (`${this.path}/:api?/:service?`, cds.middlewares.before, req => {
const { api, service } = req.params
return this.api (service, api)
})
return super.init()
}
}

View File

@@ -15,7 +15,6 @@
"./fiori", "./fiori",
"./hello", "./hello",
"./media", "./media",
"./ord",
"./orders", "./orders",
"./loggers", "./loggers",
"./reviews" "./reviews"