Adjusting odata paths for cds7 (#543)

* Adjusting odata paths for cds7

* Still using old sqlite3

* npm ci

* Remove Node 14 tests
This commit is contained in:
Daniel Hutzel
2023-07-05 11:07:20 +02:00
committed by GitHub
parent c089c9777b
commit 96473d45c8
8 changed files with 923 additions and 252 deletions

View File

@@ -16,7 +16,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [18.x, 16.x, 14.x] node-version: [18.x, 16.x]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -1,5 +1,5 @@
/* global Vue axios */ //> from vue.html /* global Vue axios */ //> from vue.html
const GET = (url) => axios.get('/-data'+url) const GET = (url) => axios.get('/odata/v4/-data'+url)
const storageGet = (key, def) => localStorage.getItem('data-viewer:'+key) || def const storageGet = (key, def) => localStorage.getItem('data-viewer:'+key) || def
const storageSet = (key, val) => localStorage.setItem('data-viewer:'+key, val) const storageSet = (key, val) => localStorage.setItem('data-viewer:'+key, val)
const columnKeysFirst = (c1, c2) => { const columnKeysFirst = (c1, c2) => {

View File

@@ -33,7 +33,7 @@
"resources": "resources.json", "resources": "resources.json",
"dataSources": { "dataSources": {
"main": { "main": {
"uri": "/v2/browse", "uri": "/odata/v2/browse",
"type": "OData", "type": "OData",
"settings": { "settings": {
"annotations": ["localAnnotations"], "annotations": ["localAnnotations"],

View File

@@ -3,6 +3,6 @@ const cds = require("@sap/cds")
const proxy = require('@cap-js-community/odata-v2-adapter') const proxy = require('@cap-js-community/odata-v2-adapter')
const opts = global.it ? { target:'auto' } : {} // for tests, set 'auto' to detect port dynamically const opts = global.it ? { target:'auto' } : {} // for tests, set 'auto' to detect port dynamically
cds.on('bootstrap', app => app.use(proxy(opts))) // install proxy cds.on('bootstrap', app => app.use(proxy(opts))) // install proxy
cds.log('cov2ap','silent') // suppress anoying log outpout, e.g. for `npm run mocha -- --reporter nyan` // cds.log('cov2ap','silent') // suppress anoying log outpout, e.g. for `npm run mocha -- --reporter nyan`
module.exports = require('@capire/bookstore/server.js') module.exports = require('@capire/bookstore/server.js')

View File

@@ -8,7 +8,7 @@
"i18n": "i18n/i18n.properties", "i18n": "i18n/i18n.properties",
"dataSources": { "dataSources": {
"OrdersService": { "OrdersService": {
"uri": "/orders/", "uri": "/odata/v4/orders/",
"type": "OData", "type": "OData",
"settings": { "settings": {
"odataVersion": "4.0" "odataVersion": "4.0"

1158
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,8 @@
"chai": "^4.3.4", "chai": "^4.3.4",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"chai-subset": "^1.6.0", "chai-subset": "^1.6.0",
"semver": "^7" "semver": "^7",
"sqlite3": "^5"
}, },
"scripts": { "scripts": {
"cleanup": "rm -rf node_modules && rm -rf */node_modules && rm -rf */*/node_modules", "cleanup": "rm -rf node_modules && rm -rf */node_modules && rm -rf */*/node_modules",

View File

@@ -8,7 +8,7 @@ describe('cap/samples - Fiori APIs - v2', function() {
// if (this.timeout) this.timeout(1e6) // if (this.timeout) this.timeout(1e6)
it('serves $metadata documents in v2', async () => { it('serves $metadata documents in v2', async () => {
const { headers, data } = await GET `/v2/browse/$metadata` const { headers, data } = await GET `/odata/v2/browse/$metadata`
expect(headers).to.contain({ expect(headers).to.contain({
'content-type': 'application/xml', 'content-type': 'application/xml',
'dataserviceversion': '2.0', 'dataserviceversion': '2.0',
@@ -17,7 +17,7 @@ describe('cap/samples - Fiori APIs - v2', function() {
}) })
it('serves Books in v2', async () => { it('serves Books in v2', async () => {
const { data } = await GET `/v2/browse/Books` const { data } = await GET `/odata/v2/browse/Books`
expect(data).to.containSubset({d:{results:[]}}) expect(data).to.containSubset({d:{results:[]}})
expect(data.d.results.length).to.be.greaterThanOrEqual(5) expect(data.d.results.length).to.be.greaterThanOrEqual(5)
}) })