Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
350bbaa
Workaround for xtravels
BobdenOs Aug 4, 2025
a223f50
Add hybrid profile and Data Sphere export script
BobdenOs Aug 9, 2025
156cdd0
Merged main into cafe
danjoa Aug 12, 2025
b16ebfc
Merge branch 'main' into cafe
danjoa Aug 12, 2025
9cf85e6
Remove unused 'textAspect' symbol from Data Sphere index
danjoa Aug 12, 2025
0ada422
Adopt simple comments
BobdenOs Aug 12, 2025
94a40d7
Merge branch 'main' into cafe
danjoa Aug 12, 2025
f9b432a
.
danjoa Aug 13, 2025
36def81
Switch to generating .env files
BobdenOs Aug 13, 2025
c5b5c2f
version 0.1.2
danjoa Aug 14, 2025
afc2c6b
API readonly
danjoa Aug 14, 2025
71d789c
cleanup
danjoa Aug 14, 2025
cb71c24
.
danjoa Aug 14, 2025
57d84fb
.
danjoa Aug 14, 2025
eb95bdc
rm exported apis
danjoa Aug 14, 2025
a3d549b
add generated apis to .gitignore
danjoa Aug 14, 2025
d2aae4f
-> .cdsrc.yaml
danjoa Aug 15, 2025
e66fd93
Merge branch 'main' into cafe
danjoa Aug 15, 2025
451febb
Added readme
danjoa Aug 17, 2025
662770f
Merge branch 'main' into cafe
danjoa Aug 18, 2025
9553ecf
Merge remote-tracking branch 'origin/main' into cafe
danjoa Aug 21, 2025
7e915bc
Merge branch 'main' into cafe
danjoa Aug 26, 2025
8ded31b
Merge branch 'main' into cafe
danjoa Aug 28, 2025
3e59b85
Restored readme from main
danjoa Aug 29, 2025
e9c01d0
Merge branch 'main' into cafe
danjoa Sep 2, 2025
d36d1f0
named apis
danjoa Sep 3, 2025
2efbb58
Merge branch 'main' into cafe
danjoa Sep 3, 2025
96d62a3
Merge branch 'main' into cafe
danjoa Sep 4, 2025
da5959f
rm .cdsrc.yaml
danjoa Sep 4, 2025
8bdeb03
Merge branch 'main' into cafe
danjoa Sep 4, 2025
9b0d47e
Merge branch 'main' into cafe
danjoa Sep 4, 2025
b2ce706
Merge branch 'main' into cafe
danjoa Sep 4, 2025
2e8be40
Merge branch 'main' into cafe
danjoa Sep 4, 2025
7ebc8a5
Merge branch 'main' into cafe
danjoa Sep 5, 2025
0007187
Merge branch 'main' into cafe
danjoa Sep 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .plugins/datasphere/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
const model = require('../../csn.json')

// Remove includes as Data Sphere doesn't support them
for (const name in model.definitions) {
const def = model.definitions[name]
const includes = def.includes
if (!includes) continue
for (const include of includes) {
const i = model.definitions[include]
def.elements = { ...def.elements, ...i.elements }
}
delete def.includes
}

// Inline custom types to simplify managed association removal
for (const name in model.definitions) {
const def = model.definitions[name]
const elements = def.elements
if (!elements) continue
for (const col in elements) {
const element = elements[col]
const customType = model.definitions[element.type]
if (!customType) continue
elements[col] = { ...customType, kind: undefined }
}
}

// Remove managed association as Data Sphere doesn't support them
for (const name in model.definitions) {
const def = model.definitions[name]
const elements = def.elements
if (!elements) continue
for (const col in elements) {
const element = elements[col]

// Data Sphere doesn't know that value.xpr is a thing that is supposed to be supported
if (element.value && element.value.xpr) {
element.xpr = element.value.xpr
delete element.value
}
if (!(element.type in { 'cds.Association': 1, 'cds.Composition': 1 })) continue
if (!element.keys) continue
const keys = element.keys
const on = []
let first = true
for (const k of keys) {
if (first) first = false
else on.push('and')
const foreignKey = `${col}_${k.ref[0]}`
on.push(
{ ref: [col, k.ref[0]] },
'=',
{ ref: [foreignKey] },
)
const target = model.definitions[element.target]
elements[foreignKey] = { ...target.elements[k.ref[0]], key: element.key }
}
delete element.keys
delete element.key
element.on = on
}
}

// Collect all @data.product service to convert to Data Sphere annotation
const dataProductServices = []
for (const name in model.definitions) {
const def = model.definitions[name]
if (def.kind !== 'service' || !def['@data.product']) continue
dataProductServices.push(name)
}

// Just keep entities as Data Sphere doesn't handle the other types
for (const name in model.definitions) {
const def = model.definitions[name]
if (def.kind === 'entity') continue
delete model.definitions[name]
}

// Enhance all the entities with Data Sphere annotations for compatibility
for (const name in model.definitions) {
const def = model.definitions[name]
if (def.kind !== 'entity') continue
// Data Sphere delta deployment doesn't guarantee that these annotation are computed correctly
delete def['@cds.autoexpose']
delete def['@cds.persistence.skip']

def['@DataWarehouse.consumption.external'] = dataProductServices.some(s => name.startsWith(s))
def['@ObjectModel.modelingPattern'] = { '#': 'DATA_STRUCTURE' }
def['@ObjectModel.supportedCapabilities'] = [{ '#': 'DATA_STRUCTURE' }]
if (def.projection) def['@DataWarehouse.sqlEditor.query'] = `SELECT * FROM "${def.projection.from.ref[0]}"`
}



const fs = require('node:fs')
const path = require('node:path')

const dataSphereString = JSON.stringify(model, null, 2)
.replace(/\.texts"/g, '_texts"')

fs.writeFileSync(
path.resolve(path.dirname(require.resolve('../../gen/index.json')), 'datasphere.json'),
dataSphereString
)
7 changes: 7 additions & 0 deletions db/src/.hdiconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move that to gen

"file_suffixes": {
"hdbrole": {
"plugin_name": "com.sap.hana.di.role"
}
}
}
98 changes: 98 additions & 0 deletions db/src/public.hdbrole
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move that to gen

"role": {
"name": "PUBLIC#",
"object_privileges": [
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_AIRLINES",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_AIRPORTS",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_COUNTRIES",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_COUNTRIES_TEXTS",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_CURRENCIES",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_CURRENCIES_TEXTS",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_FLIGHTS",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_LANGUAGES",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_LANGUAGES_TEXTS",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_SUPPLEMENTTYPES",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_SUPPLEMENTTYPES_TEXTS",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_SUPPLEMENTS",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
},
{
"name": "SAP_CAPIRE_FLIGHTS_DATA_SUPPLEMENTS_TEXTS",
"type": "VIEW",
"privileges_with_grant_option": [
"SELECT"
]
}
]
}
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "@capire/xflights",
"version": "0.1.3",
"description": "CAP sample for master data service",
"scripts": {
"datasphere": "cds compile ./index.cds -o ./gen && node ./.plugins/datasphere/index.js"
},
"dependencies": {
"@cap-js/hana": "^2.1.2",
"@sap/cds": ">=9",
Expand Down