Socket
Socket
Sign inDemoInstall

@sap/cds-services

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/cds-services - npm Package Compare versions

Comparing version 0.9.0 to 0.9.2

lib/services/handlers/onCreateDraft.js

16

CHANGELOG.md

@@ -19,2 +19,18 @@ # Changelog

## Version 0.9.2 - 2018-09-05
### Changed
- Improved npm-shrinkwrap
## Version 0.9.1 - 2018-09-03
### Added
- Create draft
### Removed
- implicit dependency to @sap/cds-sql
## Version 0.9.0 - 2018-08-28

@@ -21,0 +37,0 @@

6

lib/adapter/odata-v4/handlers/create.js

@@ -17,3 +17,7 @@ const {Components: {DATA_CREATE_HANDLER}} = require('@sap/odata-v4')

service.processEvent('CREATE', getContextObject(DATA_CREATE_HANDLER, service, req))
const context = getContextObject(DATA_CREATE_HANDLER, service, req)
const entity = context.target
const event = entity['@odata.draft.enabled'] ? 'CREATE_DRAFT' : 'CREATE'
service.processEvent(event, context)
.then((result) => {

@@ -20,0 +24,0 @@ next(null, toODataResult(result[0]))

2

lib/adapter/odata-v4/odata-to-cqn/readToCQN.js
const QueryOptions = require('@sap/odata-v4').QueryOptions
const {getColumns} = require('@sap/cds-sql').utils
const getColumns = require('../../../services/utils/columns')

@@ -4,0 +4,0 @@ const {FeatureNotSupported} = require('../../../errors')

const finalOn = require('./finalOn')
const notFound = require('./notFound')
const onCreate = require('./onCreate')
const onCreateDraft = require('./onCreateDraft')
const onDelete = require('./onDelete')

@@ -15,2 +16,3 @@ const onRead = require('./onRead')

onCreate,
onCreateDraft,
onRead,

@@ -17,0 +19,0 @@ onUpdate,

const {EventHandlerNotDefined, NotInModel} = require('../../errors')
const DEFAULT_EVENTS = ['CREATE', 'DELETE', 'READ', 'UPDATE', 'COMMIT', 'ROLLBACK']
const DEFAULT_EVENTS = ['CREATE', 'CREATE_DRAFT', 'DELETE', 'READ', 'UPDATE', 'COMMIT', 'ROLLBACK']
const TRANSACTION_EVENTS = ['COMMIT', 'ROLLBACK']

@@ -4,0 +4,0 @@

@@ -11,2 +11,22 @@ const {FeatureNotSupported} = require('../../errors/index')

class On extends Base {
_calculateDefaultHandlerCount (definition) {
if (definition['@readonly']) {
return 1
}
if (definition['@insertonly']) {
if (definition['@odata.draft.enabled']) {
return 2
}
return 1
} else {
if (definition['@odata.draft.enabled']) {
return 5
}
return 4
}
}
/**

@@ -26,3 +46,3 @@ * Constructs the on middleware handler.

if (definition.kind === 'entity' && definition.name.startsWith(service)) {
this._defaultHandlerCount += (definition['@readonly'] || definition['@insertonly']) ? 1 : 4
this._defaultHandlerCount += this._calculateDefaultHandlerCount(definition)
}

@@ -29,0 +49,0 @@ })

@@ -110,3 +110,3 @@ const getDiff = require('./utils/diff')

_addDefaultOnHandler () {
const {finalOn, onCreate, onRead, onUpdate, onDelete} = require('./handlers')
const {finalOn, onCreate, onCreateDraft, onRead, onUpdate, onDelete} = require('./handlers')

@@ -117,10 +117,13 @@ for (const entity of this._getServiceEntities()) {

.reject(['CREATE', 'UPDATE', 'DELETE'], entity.name)
} else if (entity['@insertonly']) {
this.on('CREATE', entity, onCreate)
.reject(['READ', 'UPDATE', 'DELETE'], entity.name)
} else {
this.on('CREATE', entity, onCreate)
.on('READ', entity, onRead)
.on('UPDATE', entity, onUpdate)
.on('DELETE', entity, onDelete)
const service = entity['@odata.draft.enabled']
? this.on('CREATE_DRAFT', entity, onCreateDraft).on('CREATE', entity, onCreate)
: this.on('CREATE', entity, onCreate)
if (entity['@insertonly']) {
service.reject(['READ', 'UPDATE', 'DELETE'], entity.name)
} else {
service.on('READ', entity, onRead)
.on('UPDATE', entity, onUpdate)
.on('DELETE', entity, onDelete)
}
}

@@ -127,0 +130,0 @@ }

{
"name": "@sap/cds-services",
"version": "0.9.0",
"version": "0.9.2",
"dependencies": {
"@sap/cds-hana": {
"version": "0.7.1"
},
"@sap/cds-ql": {
"version": "0.9.0",
"dependencies": {
"@sap/cds-hana": {
"version": "0.7.0",
"dependencies": {
"@sap/cds-sql": {
"version": "0.9.1"
}
}
},
"@sap/cds-sql": {
"version": "0.9.1"
},
"@sap/cds-sqlite": {
"version": "0.7.0",
"dependencies": {
"@sap/cds-sql": {
"version": "0.9.1"
}
}
},
"generic-pool": {
"version": "3.4.2"
},
"uuid": {
"version": "3.2.1"
}
}
"version": "0.9.1"
},
"@sap/cds-sql": {
"version": "0.9.2"
},
"@sap/cds-sqlite": {
"version": "0.7.1"
},
"@sap/odata-v4": {
"version": "1.6.1",
"dependencies": {
"big.js": {
"version": "5.1.2"
},
"xmlbuilder": {
"version": "10.0.0"
}
}
"version": "1.6.1"
},
"big.js": {
"version": "5.1.2"
},
"generic-pool": {
"version": "3.4.2"
},
"uuid": {
"version": "3.2.1"
},
"xmlbuilder": {
"version": "10.0.0"
}
}
}

@@ -1,1 +0,1 @@

{"bundleDependencies":false,"dependencies":{"@sap/cds-ql":"0.9.0","@sap/odata-v4":"^1.6.0"},"deprecated":false,"description":"This package handles the generation of an OData service using the provided model. It is possible to start N services per server and each service has its own endpoint. This package also offers the possibility to register custom handlers for performing create, read, update and delete operations.","devDependencies":{"@sap/audit-logging":"^2.2.4","@sap/cds":"git://github.wdf.sap.corp/cdx/cds","@sap/cds-tech-service":"git://github.wdf.sap.corp/cds-runtime/tech-service.git","@sap/instance-manager":"^1.3.0","@sap/xssec":"^2.1.0","express":"^4.16.0","hdb":"^0.16.0","jest":"^23.4.0","jest-junit":"^5.1.0","jsdoc-to-markdown":"^4.0.0","passport":"^0.4.0","passport-http":"^0.3.0","sqlite3":"4.0.1","standard":"^11.0.0","standard-reporter":"^1.0.0","supertest":"^3.1.0"},"engines":{"node":">= 6.11.0"},"jest":{"testEnvironment":"node"},"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-services","scripts":{"build":"npm run test && npm run jsdoc2md","clean":"rm -rf reports && rm -f npm-debug.log","jsdoc2md":"jsdoc2md --param-list-format list lib/*.js lib/*/*.js > docs/api.md","lint":"([ -d reports ] || mkdir reports) && standard --env jest && standard | standard-reporter --checkstyle > reports/eslint.jslint.xml","start":"node app/app.js","test":"npm run clean && npm run lint && npm run test-unit && npm run test-integration","test-integration":"jest --config=jest-integration.json && [ -e reports/sonar/test-reporter.xml ] && mv reports/sonar/test-reporter.xml reports/sonar/test-integration.xml","test-unit":"jest --config=jest-unit.json && [ -e reports/sonar/test-reporter.xml ] && mv reports/sonar/test-reporter.xml reports/sonar/test-unit.xml"},"standard":{"env":["jest"],"globals":["jest"]},"version":"0.9.0","license":"SEE LICENSE IN developer-license-3.1.txt"}
{"bundleDependencies":false,"dependencies":{"@sap/cds-ql":"0.9.1","@sap/odata-v4":"^1.6.0"},"deprecated":false,"description":"This package handles the generation of an OData service using the provided model. It is possible to start N services per server and each service has its own endpoint. This package also offers the possibility to register custom handlers for performing create, read, update and delete operations.","devDependencies":{"@sap/audit-logging":"^2.2.4","@sap/cds":"git://github.wdf.sap.corp/cdx/cds","@sap/cds-tech-service":"git://github.wdf.sap.corp/cds-runtime/tech-service.git","@sap/instance-manager":"^1.3.0","@sap/xssec":"^2.1.0","express":"^4.16.0","hdb":"^0.16.0","jest":"^23.4.0","jest-junit":"^5.1.0","jsdoc-to-markdown":"^4.0.0","passport":"^0.4.0","passport-http":"^0.3.0","sqlite3":"4.0.1","standard":"^11.0.0","standard-reporter":"^1.0.0","supertest":"^3.1.0"},"engines":{"node":">= 6.11.0"},"jest":{"testEnvironment":"node"},"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-services","scripts":{"build":"npm run test && npm run jsdoc2md","clean":"rm -rf reports && rm -f npm-debug.log","jsdoc2md":"jsdoc2md --param-list-format list lib/*.js lib/*/*.js > docs/api.md","lint":"([ -d reports ] || mkdir reports) && standard --env jest && standard | standard-reporter --checkstyle > reports/eslint.jslint.xml","start":"node app/app.js","test":"npm run clean && npm run lint && npm run test-unit && npm run test-integration","test-integration":"jest --config=jest-integration.json && [ -e reports/sonar/test-reporter.xml ] && mv reports/sonar/test-reporter.xml reports/sonar/test-integration.xml","test-unit":"jest --config=jest-unit.json && [ -e reports/sonar/test-reporter.xml ] && mv reports/sonar/test-reporter.xml reports/sonar/test-unit.xml"},"standard":{"env":["jest"],"globals":["jest"]},"version":"0.9.2","license":"SEE LICENSE IN developer-license-3.1.txt"}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc