Comparing version 2.9.1 to 2.10.1
@@ -26,3 +26,3 @@ import { ParsedQuery, ParsedExpr } from "./specs/CQN" | ||
*/ | ||
export interface compile { | ||
export const compile : { | ||
for: { | ||
@@ -41,4 +41,4 @@ odata (model:csn) : csn | ||
(csn: csn) : { | ||
for: ( output: 'json' | 'yaml' | 'yml' | 'sql' | 'cdl' | 'edm' | 'edmx' ) => csn | ||
to: ( output: 'json' | 'yaml' | 'yml' | 'sql' | 'cdl' | 'edm' | 'edmx' ) => string | ||
for: ( output: 'json' | 'yaml' | 'yml' | 'sql' | 'cdl' | 'edm' | 'edmx', options? ) => csn | ||
to: ( output: 'json' | 'yaml' | 'yml' | 'sql' | 'cdl' | 'edm' | 'edmx', options? ) => string | ||
} | ||
@@ -45,0 +45,0 @@ } |
@@ -60,4 +60,4 @@ const fs = require('../../lib/utils/fs'), {path}=fs | ||
const cwd = path.resolve(o.project||'.'), sep = path.sep | ||
const cds = _cds.in (cwd); if (_conf) cds.config = cds.config.for(_conf) | ||
const dest = path.resolve (cwd, o.dest || cds.config.build.dest || '.') | ||
const cds = _cds.in (cwd); if (_conf) cds.env = cds.env.for(_conf) | ||
const dest = path.resolve (cwd, o.dest || cds.env.build.dest || '.') | ||
const _local = filename => filename.replace (cwd+sep,'') | ||
@@ -76,3 +76,3 @@ | ||
// Do not throw an error in case no modules are found that need to be build. | ||
// If cf push is executed on some on the service module folder its contents will be deployed to target root | ||
// If cf push is executed on some on the service module folder its contents will be deployed to target root | ||
// without enclosing service module folder - postinstall would fail in such a scenario. | ||
@@ -115,3 +115,3 @@ console.log("No modules to build found in '" + cwd + "'. Nothing to be done."); | ||
const mt = type.name ? type : ModuleTypes.find (mt => mt.name === type) | ||
const _conf = cds.config [mt.conf] | ||
const _conf = cds.env [mt.conf] | ||
@@ -123,3 +123,3 @@ if (_conf && _conf.model) { // configured... | ||
if (!model) throw new Error( | ||
`No models found for ${m} as configured in '${cds.config._source || JSON.stringify(cds.config)}'` | ||
`No models found for ${m} as configured in '${cds.env._source || JSON.stringify(cds.env)}'` | ||
) | ||
@@ -147,3 +147,3 @@ const folder = fs.isdir(Array.isArray(m) ? m = m[0] : m) || path.dirname(m) | ||
function _found (mt, folder, models) { | ||
let o = Object.assign ({__proto__:mt}, cds.config[mt.conf], { | ||
let o = Object.assign ({__proto__:mt}, cds.env[mt.conf], { | ||
models, folder, sql, | ||
@@ -150,0 +150,0 @@ }) |
@@ -72,3 +72,3 @@ module.exports = Object.assign ( build, { | ||
if (cds.config.build.version >= 3) return require('./all')({ project:project, __proto__:options }) | ||
if (cds.env.build.version >= 3) return require('./all')({ project:project, __proto__:options }) | ||
@@ -78,5 +78,5 @@ const logger = options.log || console.log | ||
const toProjectPath = (filename) => path.resolve(project, filename) | ||
config = config || cds.config | ||
config = config || cds.env | ||
config.data = config.data || {} | ||
const sql_mapping = config.data.sql_mapping | ||
const sql_mapping = config.sql_mapping | ||
const outputPaths = [] | ||
@@ -109,3 +109,3 @@ | ||
} | ||
// TODO find a way to handle test config as normal cds.config | ||
// TODO find a way to handle test config as normal cds.env | ||
const p = compile(models.map(toProjectPath), { to: 'hana', sql_mapping, extraArtifacts: true, dest: outDir, log }) | ||
@@ -112,0 +112,0 @@ .then(() => displayResultPaths(log.files, `Compiled '${toRelPaths([modelPath])}' to`, logger)) |
@@ -22,3 +22,3 @@ const fs = require('../../../lib/utils/fs'), {path}=fs | ||
let o = Object.assign ({}, this.config.odata, options) | ||
let o = Object.assign ({}, this.env.odata, options) | ||
let edmx = this.compile(m).to('edmx',o) | ||
@@ -25,0 +25,0 @@ let service = this.reflect(m).find (this.service) |
@@ -13,3 +13,3 @@ const path = require('path'); | ||
// in case of java services, add service models to db models | ||
if (this.resolve(path.join(options.folder, 'pom.xml')) && this.config.data && this.config.data.includeServiceViews !== false) { | ||
if (this.resolve(path.join(options.folder, 'pom.xml')) && this.env.data && this.env.data.includeServiceViews !== false) { | ||
const db = this.all.find(m => m.category === 'db') // REVISIT: what to do in case of more than one db module? | ||
@@ -28,4 +28,4 @@ if (db) db.models.push(...options.models) | ||
service: 'all' | ||
}, options, this.config.odata) | ||
o.sql_mapping = this.config.data.sql_mapping | ||
}, options, this.env.odata) | ||
o.sql_mapping = this.env.data.sql_mapping | ||
@@ -32,0 +32,0 @@ // csn for service providers |
@@ -13,3 +13,3 @@ const path = require('path') | ||
if (this.resolve(path.join(options.folder, 'package.json')) && this.config.data && this.config.data.includeServiceViews !== false) { | ||
if (this.resolve(path.join(options.folder, 'package.json')) && this.env.data && this.env.data.includeServiceViews !== false) { | ||
const db = this.all.find(m => m.category === 'db') // REVISIT: what to do in case of more than one db module? | ||
@@ -16,0 +16,0 @@ if (db) db.models.push(...options.models) |
@@ -22,3 +22,3 @@ #!/usr/bin/env node | ||
s: 'serve', | ||
e: 'eval', | ||
e: 'env', | ||
r: 'repl', | ||
@@ -32,3 +32,3 @@ i: 'init', | ||
'-?': 'help', | ||
'-e': 'eval' | ||
'-e': 'env' | ||
}[cmd] || cmd | ||
@@ -57,4 +57,3 @@ | ||
if (options['sql']) require ('../lib/index.js').config.data.sql_mapping = options.sql | ||
if (options['new-csn']) require ('../lib/index.js').config.build.new_csn = true | ||
if (options['new-csn']) require ('../lib/index.js').env.cdsv.new_csn = true | ||
@@ -61,0 +60,0 @@ // finally run the command |
@@ -15,16 +15,33 @@ module.exports = Object.assign(deploy, { | ||
function deploy ([model], options) { | ||
function deploy ([model], {to:url}) { | ||
const cds = require('../lib/index') | ||
if (!model) model = cds.config.data.model | ||
cds.connect(options.to).deploy(model || 'db') | ||
.then(() => { | ||
return cds.disconnect() | ||
}) | ||
.catch(e => { | ||
if (!model && e.code === 'MODEL_NOT_FOUND') { | ||
throw new Error('Please specify a data model or configure one in package.json#cds.data.model') | ||
} | ||
const db = cds.connect (url) | ||
const o = db.options || {} | ||
if (!model) model = o.model || cds.env.data.model || 'srv' | ||
else o.model = model | ||
throw e | ||
}) | ||
db.deploy (model) | ||
.then (() => cds.disconnect()) | ||
.catch (e => { | ||
if (!model && e.code === 'MODEL_NOT_FOUND') { | ||
throw new Error('Please specify a data model or configure one in package.json#cds.data.model') | ||
} else throw e | ||
}) | ||
if (url) registerDatasource (url, model) | ||
} | ||
function registerDatasource (url, model) { try { | ||
const package_json = require('path') .resolve ('package.json') | ||
const pj = require (package_json) | ||
if (pj.cds && pj.services && pj.services.db) return | ||
const conf = (pj.cds || (pj.cds={})) .services || (pj.cds.services = {}) | ||
conf.db = Object.assign({},conf.db, { url, model }) | ||
const write = require('util').promisify (require('fs').writeFile) | ||
write (package_json, JSON.stringify(pj,null,' ')).then (()=> | ||
console.log (' - updated package.json') | ||
) | ||
} catch(e){/* ignore */}} | ||
/* eslint no-console: off */ |
@@ -13,5 +13,5 @@ module.exports = Object.assign (help, {help:` | ||
*b* | *build* ...whole modules or projects | ||
*i* | *init* ...jump-starts a new project | ||
*n* | *new* ...create a new project | ||
*i* | *init* ...jump-starts a new project | ||
*e* | *eval* ...javascript code from the cmd line | ||
*e* | *env* get/set current cds configuration | ||
*r* | *repl* cds's REPL (> _http://nodejs.org/api/repl.html_) | ||
@@ -18,0 +18,0 @@ *h* | *help* shows usage for cds and individual commands |
@@ -1,1 +0,65 @@ | ||
module.exports = require('./init') | ||
module.exports = Object.assign (_new, { | ||
options: ['--modules'], | ||
help:` | ||
# SYNOPSIS | ||
*cds new* [<dir>] [<options>] | ||
Creates a new project in the given directory | ||
# OPTIONS | ||
*--modules [<modules>]* | ||
A comma-separated list of the modules to be created | ||
Valid modules are app, srv, db | ||
# EXAMPLES | ||
*cds* new project | ||
*cds* new project --modules app,db | ||
*cds* new project --modules app | ||
`}) | ||
function _new (args, options) { | ||
const generator = requireDynamic('@sap/generator-cds') | ||
return generator.new(args, options) | ||
} | ||
function requireDynamic(name) { | ||
if (global.__cds_bin) { | ||
// Add the global cds to the module resolve path. Allows finding the module | ||
// even if we are in a project with a local cds installed. | ||
const path = require('path') | ||
module.paths.push(path.resolve(global.__cds_bin, '../node_modules')) | ||
} | ||
try { | ||
return require(name) | ||
} catch (e) { | ||
console.log(`\n This feature requires the module ${name} to be installed.\n` + | ||
` --> Running "npm install -g ${name}"\n`) | ||
const { execSync } = require('child_process') | ||
try { | ||
execSync(`npm install -g ${name}`, { shell: true, stdio: 'inherit' }) | ||
} catch (e) { | ||
e.message = `Tried to run "npm install -g ${name}" but failed.` + | ||
` --> Try to install ${name} manually.` | ||
throw e | ||
} | ||
try { | ||
return require(name) | ||
} catch (e) { | ||
e.message = `Installed ${name} but still cannot resolve it.` + | ||
` --> Try to install ${name} manually.` | ||
throw e | ||
} | ||
} | ||
} | ||
/* eslint no-console:0 */ |
@@ -1,9 +0,30 @@ | ||
module.exports = Object.assign (/TODO/, { options: [], help: ` | ||
module.exports = Object.assign (run, { help: ` | ||
# SYNOPSIS | ||
*cds run* in [ safari | chrome ] < node module | cds model > | ||
*cds run* [ <project> ] | ||
Runs *cds* in Safari or Chrome. Just give it a try... | ||
(so far only on OS X, sorry - feel invited to contribute ;). | ||
Starts an http server which loads models from the given folder, or from | ||
the current working directory if omitted, and generically serves all | ||
services defined in the found models. | ||
`}) | ||
`}) | ||
function run (projects, options) { | ||
if (projects.length > 0) { | ||
let {fork} = require ('child_process'), port = 4004 | ||
for (let each of projects) { | ||
console.log (`[cds] - running ${each}...`) | ||
fork (__filename, { cwd:each, env:{PORT: port++} }) | ||
} | ||
} | ||
else run_current (options) | ||
} | ||
const serve = require ('./serve') | ||
function run_current (options) { | ||
return serve ('all', options) | ||
} | ||
if (!module.parent) run_current() | ||
/* eslint no-console:off */ |
@@ -10,3 +10,3 @@ module.exports = Object.assign ( serve, { | ||
Starts an http server which generically services the specified service(s). | ||
Starts an http server which generically serves the specified service(s). | ||
If used with _all_ for the services, it will look up according configuration | ||
@@ -19,6 +19,15 @@ from _package.json_ or _.cdsrc.json_ and serve each configured service. | ||
function serve (models, options={}) { | ||
if (cds.config.data.driver) cds.connect() | ||
const app = cds.serve (models, options) | ||
return app.listen() .catch (console.error) | ||
const dso = cds.env.data.driver ? cds.env.data : cds.env.services.db | ||
const ready = dso ? ( | ||
dso.model ? cds.load (dso.model) .then (m => { | ||
cds.connect() | ||
cds.session.model = cds.linked(m) | ||
}) | ||
: Promise.resolve (cds.connect()) | ||
) : Promise.resolve () | ||
ready.then (()=>{ | ||
const app = cds.serve (models, options) | ||
return app.listen() .catch (console.error) | ||
}) | ||
} | ||
/* eslint no-console:off */ |
@@ -9,10 +9,16 @@ module.exports.parseArgs = (cmd, args) => { | ||
_flags.push('--new-csn') | ||
_options.push('--sql') | ||
const _other = { | ||
flags: { '--new-csn':1 }, | ||
options: { '--sql':1 }, | ||
} | ||
if (args.length>0) for (let i = 0; i < args.length; ++i) { | ||
let a = args[i] | ||
if (!a.startsWith('-')) { | ||
argv.push(a) | ||
continue | ||
} | ||
let ox = _shortcuts.indexOf(a) | ||
if (ox >= 0) { | ||
if (ox > _options.length) { options[_flags[ox].slice(2)] = true; continue } | ||
if (ox >= _options.length) { options[_flags[ox].slice(2)] = true; continue } | ||
else a = _options[ox] | ||
@@ -26,10 +32,17 @@ } else { | ||
let optValue = true | ||
if (args[i + 1] && !args[i + 1].startsWith('-')) { i++; optValue = args[i] } | ||
if (args[i+1]) optValue = args[++i] | ||
options[_options[ox].slice(2)] = optValue | ||
continue | ||
} | ||
if (a.startsWith('-')) throw new Error('invalid option: ' + a) | ||
else argv.push(a) | ||
if (a in _other.options) { | ||
options[a] = args[++i] | ||
continue | ||
} | ||
if (a in _other.flags) { | ||
options[a] = true | ||
continue | ||
} | ||
throw new Error('invalid option: ' + a) | ||
} | ||
return { argv, options } | ||
} |
const debug = process.env.DEBUG | ||
// https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences | ||
const term = { | ||
reset: '\x1b[0m', | ||
bold: '\x1b[1m', | ||
red: '\x1b[91m', | ||
green: '\x1b[32m', | ||
yellow: '\x1b[33m' | ||
reset: '\x1b[0m', // Default | ||
bold: '\x1b[1m', // Bold/Bright | ||
red: '\x1b[91m', // Bright Foreground Red | ||
green: '\x1b[32m', // Foreground Green | ||
orange: '\x1b[38;2;255;140;0m' // darker orange, works with bright and dark background | ||
} | ||
const asErr = module.exports.error = o => debug ? o : as(term.red + term.bold, o) | ||
module.exports.warn = o => as(term.yellow, o) | ||
module.exports.warn = o => as(term.orange, o) | ||
module.exports.info = o => as(term.green, o) | ||
@@ -13,0 +15,0 @@ |
@@ -9,2 +9,15 @@ # Change Log | ||
## Version 2.10.0 | ||
### Added | ||
- Draft support | ||
### Fixes | ||
- Enhanced server.js to also include links to entities | ||
### Also see | ||
- Changes of `@sap/cds-compiler` 1.1.3 | ||
- Changes of `@sap/cds-reflect` 1.7.0 | ||
- Changes of `@sap/cds-ql` 0.11.0 | ||
- Changes of `@sap/cds-services` 0.11.0 | ||
## Version 2.9.1 | ||
@@ -11,0 +24,0 @@ ### Fixes |
@@ -19,5 +19,5 @@ const core = require ('@sap/cds-reflect'), $=require; require = (id)=> lazy=> $(id) // eslint-disable-line | ||
// Helpers | ||
in: cwd => !cwd ? cds : {__proto__:cds, cwd, config:cds.config.in(cwd) }, | ||
in: cwd => !cwd ? cds : {__proto__:cds, cwd, env:cds.env.in(cwd) }, | ||
require: require ('./utils/require-local'), | ||
config: require ('./utils/config'), | ||
env: require ('./utils/config'), | ||
write: require ('./utils/write'), | ||
@@ -27,2 +27,6 @@ home: lazy => __dirname.slice(0,-4), | ||
}) .lazify() | ||
// Compatibility | ||
get config(){ return this.env }, | ||
}) | ||
cds.lazify() |
const cds = require('../index') | ||
const cdsv = require('@sap/cds-compiler') | ||
const configuredSqlMapping = (o = {}) => o.sql || o.sql_mapping || cds.config.data.sql_mapping | ||
const configuredSqlMapping = (o = {}) => o.sql || o.sql_mapping || cds.env.data.sql_mapping | ||
const conf = cds.config && cds.config.cdsv || {} | ||
const conf = cds.env && cds.env.cdsv || {} | ||
const _ = o => Object.assign (o||{},conf) | ||
@@ -40,10 +40,10 @@ | ||
if (!forOData && model._csn) return model._csn | ||
let xsn = model, csn = cds.config.build.new_csn ? cdsv.compactModel (xsn) : cdsv.toCsn (xsn) | ||
let xsn = model, csn = cds.env.build.new_csn ? cdsv.compactModel (xsn) : cdsv.toCsn (xsn) | ||
// FIXME: That's just ugly, bad and awfully slow, and the last one is likely critical | ||
csn = JSON.parse (JSON.stringify (csn, (key, value) => { | ||
if (key === 'indexNo') return | ||
if (key === 'origin') return | ||
// if (key === 'foreignKeys') return | ||
return value | ||
})) | ||
// csn = JSON.parse (JSON.stringify (csn, (key, value) => { | ||
// if (key === 'indexNo') return | ||
// if (key === 'origin') return | ||
// // if (key === 'foreignKeys') return | ||
// return value | ||
// })) | ||
for (let s in xsn.sources) { | ||
@@ -50,0 +50,0 @@ if (xsn.sources[s].namespace) |
@@ -112,2 +112,3 @@ const cdsv = require('./cdsv') | ||
function _2odata (csn,o={}, requested) { | ||
if (!o.version && requested === 'edmx') o.version = cds.env.odata.version | ||
o.json = (o.version !== 'v2'); | ||
@@ -114,0 +115,0 @@ o.xml = o.combined = o.separate = true |
@@ -7,3 +7,3 @@ const cds = require ('../index') | ||
const conf = cds.config && cds.config.i18n || {} | ||
const conf = cds.env && cds.env.i18n || {} | ||
const DefaultLanguage = conf.default_language || 'en' | ||
@@ -10,0 +10,0 @@ const FallbackBundle = conf.fallback_bundle || '' |
module.exports = cds_connect | ||
const cds = require ('../index') | ||
const conf = cds.env.services || {} | ||
const ql = require ('@sap/cds-ql'); ql.inject (cds) | ||
@@ -8,16 +9,34 @@ const _cached = {} | ||
function cds_connect (options) { | ||
function cds_connect (datasource, _options) { | ||
if (typeof options === 'string' && options.startsWith('local:')) { | ||
return cds.service.client.for (options.slice(6)) | ||
if (!datasource || typeof datasource === 'object') [ datasource, _options ] = [ 'db', datasource||{} ] | ||
if (datasource.startsWith('local:')) { | ||
return cds.service.client.for (datasource.slice(6)) | ||
} | ||
const o = Object.assign ({}, conf[datasource], _options) | ||
function _unfold (url) { | ||
if (url) { | ||
const [driver,tail] = url.split(':') | ||
if (tail) { | ||
o.driver = driver | ||
o.url = tail | ||
} | ||
} | ||
} | ||
_unfold (datasource) | ||
// _unfold (o.url) | ||
if (singleton) return singleton | ||
const datasource = !options ? 'default' : (options.url || options.name || options.database) | ||
if (_cached[datasource]) return _cached[datasource] | ||
const ds = _cached[datasource] = ql.connect.connect (options) | ||
// Prepare the effective options by the ones configured for the datasource | ||
// overlayed with the ones provided programmatically | ||
const ds = _cached[datasource] = ql.connect.connect (o) | ||
ds.options = o | ||
if (!cds.session || datasource == 'default' || options.default || options.primary) { | ||
if (!cds.session || datasource == 'default' || o.default || o.primary) { | ||
// Decorate cds to serve as a shortcut to the primary session | ||
@@ -32,3 +51,4 @@ Object.defineProperties (cds, { | ||
}) | ||
cds.session = cds.data = {source: ds} | ||
cds.session = ds | ||
cds.options = o | ||
} | ||
@@ -45,3 +65,3 @@ | ||
function _2sql (name) { | ||
const sqlm = cds.config.data.sql_mapping | ||
const sqlm = cds.env.sql_mapping || cds.env.data.sql_mapping | ||
if (sqlm === 'quoted' || sqlm === 'hdbcds') return `"${name}"` | ||
@@ -57,2 +77,2 @@ else return name.replace (/\./g,'_') | ||
Object.assign (global, cds_connect.ql = ql.statements) | ||
cds_connect.to = cds_connect | ||
cds_connect.to = cds_connect |
@@ -27,4 +27,4 @@ /*USAGE:*/() => { | ||
if (model === 'all' || model[0] === 'all') { | ||
const _m = this.config.service.model | ||
model = _m ? cds.resolve(_m) : [ 'srv', 'services' ].find (m => cds.resolve(m)) | ||
const _m = this.env.service.model | ||
model = _m ? cds.resolve(_m) : [ 'srv', 'services', '.' ].find (m => cds.resolve(m)) | ||
if (!model) throw new Error (`[cds] - \n | ||
@@ -70,7 +70,5 @@ No service models found in current working directory. | ||
/** Construct and launch an express app with the providers */ | ||
listen (port = process.env.PORT || 4004, callback = undefined) { | ||
listen() { | ||
let app = require('./server') | ||
return this.in(app).then(() => app.listen(port, callback || ( | ||
() => console.log(`\n cds.server listens at http://localhost:${port} \n`) | ||
))) | ||
return this.in(app) .then (app.run) | ||
}, | ||
@@ -87,3 +85,3 @@ | ||
function _addProviders (csn, o = options, n = 0) { | ||
console.log(`[cds] - loaded service definitions from \n\n ${csn._sources.map(_local).join('\n ')} \n`) | ||
console.log(`[cds] - loaded service definitions from\n\n ${csn._sources.map(_local).join('\n ')}\n`) | ||
cds.reflect(csn) .foreach (cds.service, def => { | ||
@@ -95,3 +93,3 @@ if (o.service && o.service != def.name || def['@cds.ignore']) return | ||
const path = service.path = _path4(def, o.at) | ||
console.log('[cds] - serving', def.name, 'at', path, impl ? '- impl: ' + _local(impl._source) : '') | ||
console.log (`[cds] - serving ${def.name} at ${path}${impl ? ' - impl: ' + _local(impl._source) : ''}`) | ||
providers.push (service) | ||
@@ -98,0 +96,0 @@ if (o.service) return service |
@@ -1,16 +0,42 @@ | ||
const cds = require ('..') | ||
const cds = require ('../index') | ||
const app = cds.require('express')() | ||
let _index_html = null | ||
module.exports = app.get ('/', (_,res) => res.send (_index_html || (_index_html = ` | ||
app.run = (callback) => { | ||
let [,cmd] = process.argv | ||
if (!cmd || cmd.endsWith('cds')) cmd = 'cds' | ||
if (!cmd || cmd.endsWith('cds/bin/run.js')) cmd = 'cds run in '+ process.cwd() | ||
const index_html = ` | ||
<html> | ||
<body style="font-family:sans-serif; font-weight:400; font-size: 15pt"> | ||
<p> Generic cds.server | ||
<ul> | ||
${ cds.service.providers.map ( | ||
each => `<li><a href="${each.path}/$metadata">${each.path}</a></li>` | ||
) .join('') } | ||
</ul> | ||
<body style="margin: 44px; font-family: xChalkboard, sans-serif"> | ||
<h1 style="font-weight:200">Welcome to <i>cds.services</i></h1> | ||
<p> These are the services and entities currently served through | ||
<br><i>${cmd} ${process.argv.slice(2).join(' ')}</i>... | ||
${ cds.service.providers.map (service => { | ||
const srv = service.path | ||
return ` | ||
<h3> | ||
<a href="${srv}">${srv}</a>/ | ||
<a href="${srv}/$metadata">$metadata</a> | ||
</h3> | ||
<ul> | ||
${Object.keys (service.entities).map (e => | ||
`\t\t\t\t<li><a href="${srv}/${e}">${e}</a></li> | ||
`).join('')} | ||
</ul>` | ||
}) .join('')} | ||
</body> | ||
</html> | ||
`))) | ||
` | ||
app.get ('/', (_,res) => res.send (index_html)) | ||
const { PORT=4004 } = process.env | ||
return app.listen (PORT, callback || ( | ||
() => console.log(`[cds] - server listens at http://localhost:${PORT}\n`) | ||
)) | ||
} | ||
module.exports = app | ||
/* eslint no-console:off */ |
module.exports = { | ||
build: { version: 1.4 }, | ||
data: { sql_mapping:"plain" }, | ||
build: { version: 1.4, dest:'.' }, | ||
odata: { version:"v2" }, | ||
service: {}, | ||
services: { db: { _model:'srv' } }, | ||
i18n: { | ||
@@ -10,2 +10,14 @@ folders: ['_i18n', 'i18n', 'assets/i18n'], | ||
}, | ||
cdsv: { | ||
// toSql: { associations: "joins" }, | ||
// new_csn: true, | ||
smart: { | ||
// toMany: true | ||
} | ||
}, | ||
sql_mapping:"plain", | ||
// for compatibility | ||
data: {}, | ||
service: {}, | ||
} |
@@ -77,3 +77,6 @@ const ENV = '['+( process.env.NODE_ENV || process.env.CDS_ENV || 'dev' )+']' | ||
function _fix (conf) { | ||
if (conf.build.new_csn) conf.cdsv.new_csn = conf.build.new_csn | ||
if (conf.service.odata) conf.odata = conf.service.odata | ||
if (conf.data && conf.data.sql_mapping) conf.sql_mapping = conf.data.sql_mapping | ||
else (conf.data || (conf.data={})) .sql_mapping = conf.sql_mapping | ||
return conf | ||
@@ -80,0 +83,0 @@ } |
@@ -21,6 +21,6 @@ const path = require ('path') | ||
if (p) fs.access (p, rw, _absent => { | ||
if (_absent) mkdirp (path.dirname(p), ()=> fs.mkdir(p, done)) | ||
else done() | ||
if (_absent) mkdirp (path.dirname(p), ()=> fs.mkdir(p, ()=>done(p))) | ||
else done(p) | ||
}) | ||
else done() | ||
else done(p) | ||
} | ||
@@ -27,0 +27,0 @@ |
{ | ||
"name": "@sap/cds", | ||
"version": "2.9.1", | ||
"version": "2.10.1", | ||
"dependencies": { | ||
"@sap/cds-compiler": { | ||
"version": "1.1.2" | ||
"version": "1.1.3" | ||
}, | ||
"@sap/cds-hana": { | ||
"version": "0.8.0" | ||
"version": "0.9.0" | ||
}, | ||
"@sap/cds-ql": { | ||
"version": "0.10.0" | ||
"version": "0.11.0" | ||
}, | ||
"@sap/cds-reflect": { | ||
"version": "1.6.0" | ||
"version": "1.7.0" | ||
}, | ||
"@sap/cds-services": { | ||
"version": "0.10.1" | ||
"version": "0.11.0" | ||
}, | ||
"@sap/cds-sql": { | ||
"version": "0.10.0" | ||
"version": "0.11.0" | ||
}, | ||
"@sap/cds-sqlite": { | ||
"version": "0.8.0" | ||
"version": "0.9.0" | ||
}, | ||
@@ -26,0 +26,0 @@ "@sap/odata-v4": { |
@@ -1,1 +0,1 @@ | ||
{"bin":{"cds":"bin/cds.js"},"bundleDependencies":false,"dependencies":{"@sap/cds-compiler":"1.1.2","@sap/cds-ql":"0.10.0","@sap/cds-reflect":"1.6.0","@sap/cds-services":"0.10.1","fs-extra":"5.0.0"},"deprecated":false,"description":"Entry Point and API Facade for CDS","devDependencies":{"eslint":"^4.19.0","express":"^4.16.2","hasbin":"^1.2.3","jest":"^23.4.0","jest-junit":"^5.1.0","sqlite3":"4.0.1","supertest":"^3.0.0"},"engines":{"node":">= 6.12.0"},"jest":{"testEnvironment":"node","reporters":["default","jest-junit"],"roots":["<rootDir>/bin/","<rootDir>/lib/","<rootDir>/tests/"],"moduleDirectories":["node_modules"],"modulePathIgnorePatterns":["/_out/","/edmx/","/projects/"],"moduleFileExtensions":["js","json","cds","properties"],"coverageDirectory":"reports/coverage","coverageReporters":["lcov","text"],"collectCoverageFrom":["lib/**","bin/**","!bin/init/**","!**/*.json"],"testPathIgnorePatterns":["/node_modules/","/integration/"],"verbose":true},"jest-junit":{"suiteName":"jest tests","output":"reports/sonar/test-reporter.xml","classNameTemplate":"{classname}-{title}","titleTemplate":"{classname}-{title}","ancestorSeparator":" › ","usePathForSuiteName":"true"},"main":"lib/index.js","name":"@sap/cds","scripts":{"beforePublish":"rm bin/.dev-internal.js","dedupe":"npm dedupe","lint":"eslint .","test":"jest --coverage && npm run test:new && npm run lint","test:all":"jest --coverage --testPathIgnorePatterns /node_modules/","test:integration":"jest --testRegex integration.*\\.js --testPathIgnorePatterns /node_modules/","test:new":"jest --testRegex test-new\\.js","test:watch":"jest --watchAll"},"typings":"apis/cds.d.ts","version":"2.9.1","license":"SEE LICENSE IN developer-license-3.1.txt"} | ||
{"bin":{"cds":"bin/cds.js"},"bundleDependencies":false,"dependencies":{"@sap/cds-compiler":"1.1.3","@sap/cds-ql":"0.11.0","@sap/cds-reflect":"1.7.0","@sap/cds-services":"0.11.0","fs-extra":"5.0.0"},"deprecated":false,"description":"Entry Point and API Facade for CDS","devDependencies":{"eslint":"^4.19.0","express":"^4.16.2","hasbin":"^1.2.3","jest":"^23.4.0","jest-junit":"^5.1.0","sqlite3":"4.0.1","supertest":"^3.0.0"},"engines":{"node":">= 6.12.0"},"jest":{"testEnvironment":"node","reporters":["default","jest-junit"],"roots":["<rootDir>/bin/","<rootDir>/lib/","<rootDir>/tests/"],"moduleDirectories":["node_modules"],"modulePathIgnorePatterns":["/_out/","/edmx/","/projects/"],"moduleFileExtensions":["js","json","cds","properties"],"coverageDirectory":"reports/coverage","coverageReporters":["lcov","text"],"collectCoverageFrom":["lib/**","bin/**","!bin/init/**","!**/*.json"],"testPathIgnorePatterns":["/node_modules/","/integration/"],"verbose":true},"jest-junit":{"suiteName":"jest tests","output":"reports/sonar/test-reporter.xml","classNameTemplate":"{classname}-{title}","titleTemplate":"{classname}-{title}","ancestorSeparator":" › ","usePathForSuiteName":"true"},"main":"lib/index.js","name":"@sap/cds","scripts":{"beforePublish":"rm bin/.dev-internal.js","dedupe":"npm dedupe","lint":"eslint .","test":"jest --coverage && npm run test:new && npm run lint","test:all":"jest --coverage --testPathIgnorePatterns /node_modules/","test:integration":"jest --testRegex integration.*\\.js --testPathIgnorePatterns /node_modules/","test:new":"jest --testRegex test-new\\.js","test:watch":"jest --watchAll"},"typings":"apis/cds.d.ts","version":"2.10.1","license":"SEE LICENSE IN developer-license-3.1.txt"} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
356405
64
3072
48
6
+ Added@sap/cds-compiler@1.1.3(transitive)
+ Added@sap/cds-hana@0.9.0(transitive)
+ Added@sap/cds-ql@0.11.0(transitive)
+ Added@sap/cds-reflect@1.7.0(transitive)
+ Added@sap/cds-services@0.11.0(transitive)
+ Added@sap/cds-sql@0.11.0(transitive)
+ Added@sap/cds-sqlite@0.9.0(transitive)
+ Added@sap/odata-v4@1.7.0(transitive)
- Removed@sap/cds-compiler@1.1.2(transitive)
- Removed@sap/cds-hana@0.8.0(transitive)
- Removed@sap/cds-ql@0.10.0(transitive)
- Removed@sap/cds-reflect@1.6.0(transitive)
- Removed@sap/cds-services@0.10.1(transitive)
- Removed@sap/cds-sql@0.10.0(transitive)
- Removed@sap/cds-sqlite@0.8.0(transitive)
- Removed@sap/odata-v4@1.9.0(transitive)
Updated@sap/cds-compiler@1.1.3
Updated@sap/cds-ql@0.11.0
Updated@sap/cds-reflect@1.7.0
Updated@sap/cds-services@0.11.0