Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 18 additions & 4 deletions .vitepress/languages/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
import cds from './cds.tmLanguage.json' with {type:'json'}
import csv from './csv.tmLanguage.json' with {type:'json'}
import log from './log.tmLanguage.json' with {type:'json'}
import scsv from './scsv.tmLanguage.json' with {type:'json'}
import { bundledLanguages } from 'shiki'
import cds from './cds.tmLanguage.json' with { type: 'json' }
import csv from './csv.tmLanguage.json' with { type: 'json' }
import log from './log.tmLanguage.json' with { type: 'json' }
import scsv from './scsv.tmLanguage.json' with { type: 'json' }

import type { LanguageInput } from 'shiki'

export default [

{ ...cds, aliases:['cds','cdl','dcl','cql'] },
{ ...csv, aliases:['csv','csvc'] },
{ ...scsv, aliases:['csvs'] },
{ ...log, aliases:['log','logs'] },
() => langAlias('php', 'httpc'),

] as LanguageInput[]

async function langAlias(targetLang: keyof typeof bundledLanguages, alias: string) {
const grammars = (await bundledLanguages[targetLang]()).default
const targetScope = `source.${targetLang}`
return grammars.map(g => g.scopeName === targetScope
? { ...g, aliases: [...(g.aliases ?? []), alias] }
: g,
)
}
5 changes: 4 additions & 1 deletion .vitepress/theme/components/cds-playground/highlighter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import languages from '../../../languages'
const highlighter = await createHighlighter({
themes: ['github-dark', 'github-light'],
langs: ['javascript', 'js', 'sql', 'typescript', 'vue', ...languages],
langAlias: Object.fromEntries( languages.map(l => l.aliases?.map(alias => [alias, l.name])) )
langAlias: Object.fromEntries(languages.flatMap(l => {
if (!l || typeof l !== 'object' || !Array.isArray(l.aliases) || !l.name) return []
return l.aliases.map(alias => [alias, l.name])
}))
})

export default highlighter
6 changes: 3 additions & 3 deletions guides/uis/fiori.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ Draft locks are not applied when creating drafts for new entities, as there is n

The HTTP requests sent from Fiori clients that deal with drafts are as follows:

```php:line-numbers [Requests to <i>draft</i> data]
```httpc:line-numbers [Requests to <i>draft</i> data]
POST /Foo/draftNew //> NEW
POST /Foo(ID,IsActiveEntity=true)/draftEdit //> EDIT
GET /Foo(ID,IsActiveEntity=false) //> READ
Expand Down Expand Up @@ -347,7 +347,7 @@ Content-Type: application/json

Add `IsActiveEntity=true` as a key parameter to your requests to address *active* data directly, bypassing potentially existing drafts, for example:

```php:line-numbers [Requests to <i>active</i> data]
```httpc:line-numbers [Requests to <i>active</i> data]
POST /Books { IsActiveEntity:true, ... } //> CREATE
PATCH /Books(ID=201,IsActiveEntity=true) {...} //> UPDATE
DELETE /Books(ID=201,IsActiveEntity=true) //> DELETE
Expand All @@ -362,7 +362,7 @@ While this was always possible in CAP Java before, it's available for CAP Node.j

Going one step further, we assume `IsActiveEntity=true` by default, so that clients which don't know anything about drafts, or don't want to deal with them, can simply ignore any draft-specific requests and parameters:

```php:line-numbers [Draft-agnostic requests to <i>active</i> data]
```httpc:line-numbers [Draft-agnostic requests to <i>active</i> data]
POST /Foo //> CREATE
GET /Foo(ID) //> READ
PATCH /Foo(ID) {...} //> UPDATE
Expand Down
Loading