Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
e4fd59a
initial cxl diagrams
Akatuoro Nov 26, 2025
f2b2611
add some first drawings
patricebender Nov 28, 2025
06639e7
more diagrams
patricebender Nov 28, 2025
589aa42
add links and clickable diagrams to CXL
patricebender Nov 28, 2025
5f579bf
more diagrams
patricebender Dec 1, 2025
db13438
some text
Akatuoro Dec 1, 2025
6dd2daa
Merge branch 'cxl' of https://github.com/cap-js/docs into cxl
Akatuoro Dec 1, 2025
4522abf
recangular entities
patricebender Dec 2, 2025
57a75dc
Merge remote-tracking branch 'origin/cxl' into cxl
patricebender Dec 2, 2025
ca9858b
functions with method style
Akatuoro Dec 2, 2025
45bf61b
add intro and some samples for ref
patricebender Dec 3, 2025
784e99c
spelling
patricebender Dec 3, 2025
493b3ee
update
Akatuoro Dec 4, 2025
ac6159e
minor changes to diagram
patricebender Dec 4, 2025
db644c2
small infix filter update
Akatuoro Dec 4, 2025
709f355
adjustements
patricebender Dec 8, 2025
e9bec18
make imports relative
Akatuoro Dec 9, 2025
6e25e92
fix formatting -> disable word-wrap and text formatting
Akatuoro Dec 9, 2025
c6fffef
some more samples
patricebender Dec 9, 2025
137166f
Merge remote-tracking branch 'origin/cxl' into cxl
patricebender Dec 9, 2025
1fe6bec
fix
Akatuoro Dec 9, 2025
8f56dd6
adjustements to drawings and more samples
patricebender Dec 9, 2025
c22f480
css
Akatuoro Dec 9, 2025
925d0af
more finetuning
patricebender Dec 9, 2025
0038356
review notes
patricebender Dec 9, 2025
13ce622
fix size for smaller diagrams
Akatuoro Dec 11, 2025
4d8f4ba
update ref diagram and apply review feedback
Akatuoro Dec 11, 2025
4a61002
fix diagram
Akatuoro Dec 12, 2025
ecc934f
associations as predefined joins and set theory
Akatuoro Dec 12, 2025
7623638
.
Akatuoro Dec 15, 2025
fdb8336
apply review feedback
Akatuoro Dec 15, 2025
e650688
WIP: infix notation
patricebender Dec 16, 2025
3e1de7c
todos
Akatuoro Dec 16, 2025
745d47d
work through some todos, add samples
patricebender Dec 16, 2025
124010c
Merge remote-tracking branch 'origin/main' into cxl
patricebender Dec 16, 2025
346affe
link to md
patricebender Dec 16, 2025
09b48c0
apply review feedback
Akatuoro Dec 17, 2025
842fdbd
leaf elements
Akatuoro Dec 17, 2025
439bbbb
examples, todos
Akatuoro Dec 17, 2025
544482e
add first venn digram
patricebender Dec 18, 2025
1a2d79b
add first venn digram
patricebender Dec 18, 2025
3a05a6f
sets diagram
Akatuoro Dec 18, 2025
245e6c3
set theory
Akatuoro Dec 18, 2025
ca9f554
math expressions
Akatuoro Dec 18, 2025
e54664f
apply review comments
Akatuoro Dec 18, 2025
b92f9f5
add cql-draft and resolve minimum todos for merge
patricebender Dec 19, 2025
7a7eec0
package-lock
Akatuoro Dec 19, 2025
f82b0d7
Set theory graphics with syntax coloring
swaldmann Dec 19, 2025
5bd9e2d
remove duplicate diagram
Akatuoro Dec 19, 2025
932c424
Apply suggestions from code review
Akatuoro Dec 19, 2025
84632de
fix
Akatuoro Dec 19, 2025
d2b337f
Merge branch 'cxl' of https://github.com/cap-js/docs into cxl
Akatuoro Dec 19, 2025
87366e4
Merge remote-tracking branch 'origin/main' into cxl
Akatuoro Dec 23, 2025
25c2fce
Books.title -> title
Akatuoro Dec 23, 2025
395a800
lower case null, true, false
Akatuoro Dec 23, 2025
c653408
Merge branch 'main' into cxl
Akatuoro Jan 5, 2026
34cb885
add examples
Akatuoro Jan 5, 2026
1115e2c
move to cql + learn-more links
Akatuoro Jan 5, 2026
ab2e0d1
todos + move parts out
Akatuoro Jan 8, 2026
8a07425
Merge remote-tracking branch 'origin/main' into cxl
Akatuoro Jan 8, 2026
77b964c
fix
Akatuoro Jan 8, 2026
768fac2
.
Akatuoro Jan 8, 2026
a73acf6
ready for merge
Akatuoro Jan 8, 2026
d742c11
remove binding parameter for first version
Akatuoro Jan 8, 2026
4f87d16
move diagrams
Akatuoro Jan 8, 2026
306f51a
fix diagram whitespace
Akatuoro Jan 8, 2026
2994ffc
apply review feedback
Akatuoro Jan 8, 2026
f77f4a5
infix filter examples
Akatuoro Jan 9, 2026
dc19472
apply review comments
Akatuoro Jan 9, 2026
d481bb9
apply review comment
Akatuoro Jan 9, 2026
460dec8
expr in annotations
Akatuoro Jan 12, 2026
0b5a073
chore: terminal symbols with rounded corners
patricebender Jan 12, 2026
ed55e2c
Merge remote-tracking branch 'origin/main' into cxl
patricebender Jan 12, 2026
f328c00
chore: remove portable functions, point to new section
patricebender Jan 12, 2026
43e98bb
fix diagrams
Akatuoro Jan 12, 2026
b639de0
fix diagram
Akatuoro Jan 12, 2026
4df0961
fix link
Akatuoro Jan 12, 2026
8f79807
chore: one more sample in intro section
patricebender Jan 13, 2026
7939906
Merge branch 'main' into cxl
patricebender Jan 13, 2026
a57c977
chore: DateTime is not a literal
patricebender Jan 14, 2026
bfcf8af
chore: move literals and ops up
patricebender Jan 14, 2026
8b6f859
chore: some samples for literals
patricebender Jan 14, 2026
d064183
chore: smoother entry section
patricebender Jan 14, 2026
e1d3cc3
apply review comments
Akatuoro Jan 14, 2026
2086a33
remove forward-declared join section
Akatuoro Jan 14, 2026
8030c18
move out ordering term
Akatuoro Jan 14, 2026
a723690
move out ordering term
Akatuoro Jan 14, 2026
efeb5d8
remove unused diagram
Akatuoro Jan 14, 2026
1749d5d
live cql eval
Akatuoro Jan 15, 2026
f98119f
working vitepress build
Akatuoro Jan 19, 2026
2b73751
use monaco editor
Akatuoro Jan 19, 2026
489f62c
move out monaco editor
Akatuoro Jan 19, 2026
ad71b3b
theming
Akatuoro Jan 19, 2026
67c854a
syntax highlight with @shikijs/monaco
Akatuoro Jan 19, 2026
88da9ad
play icon
Akatuoro Jan 19, 2026
5e8abd4
improved ux
Akatuoro Jan 20, 2026
d124fdc
fix
Akatuoro Jan 20, 2026
0383f98
sql logging
Akatuoro Jan 20, 2026
f834081
better ux
Akatuoro Jan 20, 2026
adf9531
improve ux
Akatuoro Jan 20, 2026
20fe327
Merge remote-tracking branch 'origin/main' into live-cql
Akatuoro Jan 20, 2026
931f290
fixes
Akatuoro Jan 20, 2026
5d568e5
style fix and hint
Akatuoro Jan 20, 2026
6523422
Merge remote-tracking branch 'origin/main' into live-cql
Akatuoro Feb 2, 2026
b3717ca
add template functionality
Akatuoro Feb 2, 2026
292ea1c
centralize cds initialization
Akatuoro Feb 2, 2026
c31a80c
resolve warnings, small fixes
Akatuoro Feb 4, 2026
5984a5e
fixes
Akatuoro Feb 9, 2026
c69ff10
tmp styling
Akatuoro Feb 9, 2026
750b740
equal shiki and monaco layouts
Akatuoro Feb 12, 2026
fbe4155
move to .vitepress
Akatuoro Feb 12, 2026
81db04c
live code in md
Akatuoro Feb 12, 2026
59bacda
copy button and language
Akatuoro Feb 12, 2026
e054913
avoid dynamic import
Akatuoro Feb 12, 2026
1b771c8
switch in monaco only when loaded
Akatuoro Feb 12, 2026
d7ce0d7
account for syntax highlighting
Akatuoro Feb 12, 2026
fb17230
Merge remote-tracking branch 'origin/main' into live-cql
Akatuoro Feb 12, 2026
fe2c7a2
css fixes
Akatuoro Feb 14, 2026
baca189
deselecting result tabs
Akatuoro Feb 16, 2026
9d6baf9
enhance model
Akatuoro Feb 16, 2026
05706fe
use live code for samples
Akatuoro Feb 16, 2026
63cf656
Merge remote-tracking branch 'origin/main' into live-cql
Akatuoro Feb 16, 2026
6536b42
explicit sqlite-wasm for npm ci
Akatuoro Feb 16, 2026
3bb6594
Merge remote-tracking branch 'origin/main' into live-cql
Akatuoro Feb 17, 2026
03ed7da
only load if dependency is installed
Akatuoro Feb 19, 2026
02abe29
lint
Akatuoro Feb 19, 2026
c18ea77
wait for highlighting before showing editor
Akatuoro Feb 19, 2026
e09c47e
add missing dependencies
Akatuoro Feb 19, 2026
0305ad6
context for snippet checker
Akatuoro Feb 19, 2026
c790c27
fix copy
Akatuoro Feb 20, 2026
6050685
update package-lock
Akatuoro Feb 20, 2026
5905581
Merge remote-tracking branch 'origin/main' into live-cql
Akatuoro Feb 20, 2026
ece95d2
cleanup
Akatuoro Feb 20, 2026
d5f9c1c
updated introduction
Akatuoro Feb 20, 2026
5388373
workaround for checker
Akatuoro Feb 20, 2026
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
9 changes: 9 additions & 0 deletions .vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const base = process.env.GH_BASE || '/docs/'
// Construct vitepress config object...
import path from 'node:path'
import { defineConfig } from 'vitepress'
import playground from './lib/playground'
import languages from './languages'
import { Menu } from './menu.js'

Expand Down Expand Up @@ -79,6 +80,12 @@ const config = defineConfig({
],

vite: {
plugins: [...playground.plugins()],
esbuild: {
supported: {
'top-level-await': true //browsers can handle top-level-await features
},
},
build: {
chunkSizeWarningLimit: 6000, // chunk for local search index dominates
},
Expand Down Expand Up @@ -194,11 +201,13 @@ if (process.env.VITE_CAPIRE_EXTRA_ASSETS) {
import { dl } from '@mdit/plugin-dl'
import * as MdAttrsPropagate from './lib/md-attrs-propagate'
import * as MdTypedModels from './lib/md-typed-models'
import * as MdLiveCode from './lib/playground/md-live-code'
import * as MdDiagramSvg from './lib/md-diagram-svg'

config.markdown.config = md => {
MdAttrsPropagate.install(md)
MdTypedModels.install(md)
MdLiveCode.install(md)
MdDiagramSvg.install(md)
md.use(dl)
}
Expand Down
23 changes: 23 additions & 0 deletions .vitepress/lib/playground/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import templates from './vite-plugin-templates'
import path from 'path'

let enabled = false
let plugins = () => []

try {
const { node, cap } = await import('vite-plugin-cds')
plugins = () => {
return [node(), cap(), templates([path.join(__dirname, 'templates')])]
}
enabled = true
}
catch {
// eslint-disable-next-line no-console
console.error('live code not available - run `npm i` to update your modules')
}

export {
enabled,
plugins,
}
export default { enabled, plugins }
54 changes: 54 additions & 0 deletions .vitepress/lib/playground/md-live-code.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { MarkdownRenderer, MarkdownEnv } from 'vitepress'
import { dirname, join, relative, resolve } from 'path'
import { enabled } from '.'

export function install(md: MarkdownRenderer) {
if (!enabled) return
const fence = md.renderer.rules.fence
md.renderer.rules.fence = (tokens, idx, options, env: MarkdownEnv, ...args) => {

const { info } = tokens[idx]
const [language, live, ...rest] = info.split(' ')
if (live === 'live') {
const mdDir = dirname(env.realPath ?? env.path)
const filePath = './' + relative(mdDir, join(__dirname, '../../theme/components/playground/LiveCode.vue'))
const imp = `import LiveCode from "${filePath}";`
insertScriptSetup(env, imp)

const opts = Object.fromEntries(['as'].map(key => {
const idx = rest.findIndex(k => k === key)
return idx > -1 ? [key, rest.splice(idx+1, 1)[0]] : [];
}))
const props = {
language: opts.as ?? language,
}
const flags = ['readonly'].filter(k => rest.includes(k))

const content = tokens[idx].content.trim()
return `<LiveCode initialQuery="${md.utils.escapeHtml(content)}" ${Object.entries(props).map(([k, v]) => `${k}="${v}"`)} ${flags.join(' ')}></LiveCode>`
}
return fence!(tokens, idx, options, env, ...args)
}
}

function insertScriptSetup(env: MarkdownEnv, imp: string) {
const sfcBlocks = env.sfcBlocks!
if (!sfcBlocks.scriptSetup) {
sfcBlocks.scriptSetup = {
content: '<script setup>\n</script>',
contentStripped: '\n',
tagClose: '</script>',
tagOpen: '<script setup>',
type: 'script'
}
sfcBlocks.scripts.push(sfcBlocks.scriptSetup)
}

const { scriptSetup } = sfcBlocks
const { tagOpen, tagClose, contentStripped: rest } = scriptSetup

if (!scriptSetup.content.includes(imp)) {
scriptSetup.contentStripped = `${imp}\n${rest}`
scriptSetup.content = `${tagOpen}${imp}\n${rest}${tagClose}`
}
}
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ID,title,descr,author_ID,stock,price,currency_code,genre_ID
201,Wuthering Heights,"Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym ""Ellis Bell"". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850.",101,12,11.11,GBP,11aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
207,Jane Eyre,"Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name ""Currer Bell"", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism.",107,11,12.34,GBP,11aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa

Check warning on line 3 in .vitepress/lib/playground/templates/bookshop/db/data/sap.capire.bookshop-Books.csv

View check run for this annotation

In Solidarity / Inclusive Language

Match Found

Please consider an alternative to `master`. Possibilities include: `primary`, `main`, `leader`, `active`, `writer`
Raw output
/\b(?!masterdata|masterdata\w+\b)master/gi
251,The Raven,"""The Raven"" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word ""Nevermore"". The poem makes use of folk, mythological, religious, and classical references.",150,333,13.13,USD,16aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
252,Eleonora,"""Eleonora"" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively ""happy"" ending.",150,555,14,USD,15aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
271,Catweazle,"Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts.",170,22,150,JPY,13aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ID_texts,ID,locale,title,descr
d2a65a27-9f2a-480f-bc38-84ee8ec5c13e,201,de,Sturmhöhe,"Sturmhöhe (Originaltitel: Wuthering Heights) ist der einzige Roman der englischen Schriftstellerin Emily Brontë (1818–1848). Der 1847 unter dem Pseudonym Ellis Bell veröffentlichte Roman wurde vom viktorianischen Publikum weitgehend abgelehnt, heute gilt er als ein Klassiker der britischen Romanliteratur des 19. Jahrhunderts."
8c42c706-a979-41cf-9ffe-91e6cf1383a0,201,fr,Les Hauts de Hurlevent,"Les Hauts de Hurlevent (titre original : Wuthering Heights), parfois orthographié Les Hauts de Hurle-Vent, est l'unique roman d'Emily Brontë, publié pour la première fois en 1847 sous le pseudonyme d’Ellis Bell. Loin d'être un récit moralisateur, Emily Brontë achève néanmoins le roman dans une atmosphère sereine, suggérant le triomphe de la paix et du Bien sur la vengeance et le Mal."
9e1c4c81-dc90-4600-85b1-e9dd4bf12ce0,207,de,Jane Eyre,"Jane Eyre. Eine Autobiographie (Originaltitel: Jane Eyre. An Autobiography), erstmals erschienen im Jahr 1847 unter dem Pseudonym Currer Bell, ist der erste veröffentlichte Roman der britischen Autorin Charlotte Brontë und ein Klassiker der viktorianischen Romanliteratur des 19. Jahrhunderts. Der Roman erzählt in Form einer Ich-Erzählung die Lebensgeschichte von Jane Eyre (ausgesprochen /ˌdʒeɪn ˈɛə/), die nach einer schweren Kindheit eine Stelle als Gouvernante annimmt und sich in ihren Arbeitgeber verliebt, jedoch immer wieder um ihre Freiheit und Selbstbestimmung kämpfen muss. Als klein, dünn, blass, stets schlicht dunkel gekleidet und mit strengem Mittelscheitel beschrieben, gilt die Heldin des Romans Jane Eyre nicht zuletzt aufgrund der Kino- und Fernsehversionen der melodramatischen Romanvorlage als die bekannteste englische Gouvernante der Literaturgeschichte"
9be0524b-4cb9-4fc1-9dc2-d65b1c13cf53,252,de,Eleonora,"“Eleonora” ist eine Erzählung von Edgar Allan Poe. Sie wurde 1841 erstveröffentlicht. In ihr geht es um das Paradox der Treue in der Treulosigkeit."
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ID,parent_ID,name
10aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,,Fiction
11aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,10aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Drama
12aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,10aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Poetry
13aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,10aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Fantasy
131aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,13aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Fairy Tale
132aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,13aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Epic Fantasy
133aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,13aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,High Fantasy
134aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,13aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Gothic
14aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,10aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Science Fiction
141aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,14aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Utopian and Dystopian
1411aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,141aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Utopian
1412aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,141aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Dystopian
14121aaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,1412aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Cyberpunk
141211aa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,14121aaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Steampunk
142aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,14aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Space Opera
143aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,14aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Time Travel
144aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,14aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Tech Noir
15aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,10aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Romance
151aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,15aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Contemporary Romance
152aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,15aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Historical Romance
153aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,15aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Romantic Suspense
16aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,10aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Mystery
161aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,16aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Crime
1611aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,161aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Thriller
16111aaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,1611aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Police Procedural
16112aaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,1611aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Legal Thriller
16113aaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,1611aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Medical Thriller
16114aaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,1611aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Spy Thriller
1612aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,161aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Detective
1613aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,161aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Suspense
162aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,16aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Noir
1621aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,162aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Nordic Noir
1622aaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,162aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Tart Noir
163aaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,16aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Cozy Mystery
17aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,10aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Adventure
18aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,10aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Short Story
19aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,10aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Graphic Novel
20aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,,Non-Fiction
21aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,20aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Biography
22aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,21aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Autobiography
23aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,20aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Essay
24aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,20aaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa,Speech
42 changes: 42 additions & 0 deletions .vitepress/lib/playground/templates/bookshop/db/schema.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using { Currency, cuid, managed, sap } from '@sap/cds/common';
namespace sap.capire.bookshop;

entity Books {
key ID : Integer;
author : Association to Authors @mandatory;
title : localized String @mandatory;
descr : localized String(2000);
genre : Association to Genres;
stock : Integer;
price : Price;
currency : Currency;

total = price * stock;
}

entity Authors {
key ID : Integer;
name : String @mandatory;
dateOfBirth : Date;
dateOfDeath : Date;
placeOfBirth : String;
placeOfDeath : String;
books : Association to many Books on books.author = $self;

cheapBooks = books[price < 19.99]; // based on `books` association
age = years_between(dateOfBirth, coalesce(dateOfDeath, date( $now )));
}

/** Hierarchically organized Code List for Genres */
entity Genres : cuid, sap.common.CodeList {
parent : Association to Genres;
children : Composition of many Genres on children.parent = $self;
}

type Price : Decimal(9,2);

// --------------------------------------------------------------------------------
// Temporary workaround for this situation:
// - Fiori apps in bookstore annotate Books with @fiori.draft.enabled.
// - Because of that .csv data has to eagerly fill in ID_texts column.
annotate Books with @fiori.draft.enabled;
3 changes: 3 additions & 0 deletions .vitepress/lib/playground/templates/bookshop/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# capire/bookshop

A copy of the [capire/bookshop](https://github.com/capire/bookshop) model.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using { sap.capire.bookshop as my } from '../db/schema';

service AdminService @(odata:'/admin') {
entity Authors as projection on my.Authors;
entity Books as projection on my.Books;
entity Genres as projection on my.Genres;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using { sap.capire.bookshop as my } from '../db/schema';

service CatalogService @(odata:'/browse') {

/** For displaying lists of Books */
@readonly entity ListOfBooks as projection on Books {
*, currency.symbol as currency,
}
excluding { descr };

/** For display in details pages */
@readonly entity Books as projection on my.Books {
*, // all fields with the following denormalizations:
author.name as author,
genre.name as genre,
} excluding { createdBy, modifiedBy };

@requires: 'authenticated-user'
action submitOrder ( book: Books:ID, quantity: Integer );
}
97 changes: 97 additions & 0 deletions .vitepress/lib/playground/vite-plugin-templates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import type { Plugin, ResolvedConfig } from 'vite';
import cds from '@sap/cds';
import fs from 'fs/promises';
import path from 'path';

/**
* Vite plugin to load templates from specified directories.
* @example
* defineConfig({
* plugins: [ templates([".vitepress/templates"]) ]
* })
*/
function templates(sources : string[] = [] ): Plugin {
const RESOLVED_ID = '\0templates:';
let config: ResolvedConfig;
let resolvedSources: string[] = sources;

async function walk(dirPath: string): Promise<string[]> {
const entries = await fs.readdir(dirPath, { withFileTypes: true, recursive: true });
return entries.filter((e) => e.isFile()).map((e) => path.join(e.parentPath, e.name));
};

async function templateDirs(dir : string | string[]): Promise<string[]> {
if (Array.isArray(dir)) return Promise.all(dir.map(d => templateDirs(d))).then(arrs => arrs.flat());
const entries = await fs.readdir(dir, { withFileTypes: true });
return entries.filter((e) => e.isDirectory()).map((e) => path.join(dir, e.name));
}

async function buildTemplates(dir : string | string[]): Promise<Record<string, { path: string; content: string }[]>> {

const dirs = await templateDirs(dir);

const templates = await Promise.all(dirs.map(async (d) => {
const filesInTemplate = await walk(d);
const files = await Promise.all(filesInTemplate
.map(async (f) => {
const relPath = path.relative(d, f);
const content = await fs.readFile(f, 'utf8');
return {
path: relPath,
content,
};
}));
const name = path.basename(d);

// revisit: better way to include cds artifacts from npm modules?
files.push({
path: '@sap/cds/common',
content: JSON.stringify(await cds.load('@sap/cds/common')),
})

return {
name,
files
};
}));


return Object.fromEntries(templates.map(t => [t.name, t.files]));
}

function root(): string {
return config.root || process.cwd();
}

return {
name: 'templates-plugin',
enforce: 'pre',
configResolved(c) {
config = c;
resolvedSources = sources.map(s => path.resolve(root(), s));
},
resolveId(id) {
if (id === 'virtual:templates') {
return { id : RESOLVED_ID, attributes: { path: id } };
}
},
async load(id) {
if (id.startsWith(RESOLVED_ID)) {
const templates = await buildTemplates(resolvedSources);
return `export default ${JSON.stringify(templates, null, 2)};`;
}
},
async handleHotUpdate(ctx) {
if (resolvedSources.some(s => ctx.file.startsWith(s))) {
const mod = ctx.server.moduleGraph.getModuleById(RESOLVED_ID);
if (mod) {
ctx.server.moduleGraph.invalidateModule(mod);
return [mod];
}
}
},
};
}

export default templates;
export { templates };
Loading