@sap/xsodata 8.1.0 → 8.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +13 -11
  3. package/documentation/aggregations.md +46 -0
  4. package/documentation/annotations.md +401 -0
  5. package/documentation/authorization.md +94 -0
  6. package/documentation/calcviewSample.md +17 -0
  7. package/documentation/code_samples_pure_node/direct_use__multi_services/index.js +49 -0
  8. package/documentation/code_samples_pure_node/direct_use__multi_services/package.json +8 -0
  9. package/documentation/code_samples_pure_node/direct_use__multi_services/services/demo.xsodata +7 -0
  10. package/documentation/code_samples_pure_node/direct_use__multi_services/services/demo_nav.xsodata +47 -0
  11. package/documentation/code_samples_pure_node/direct_use__single_service/index.js +48 -0
  12. package/documentation/code_samples_pure_node/direct_use__single_service/package.json +8 -0
  13. package/documentation/code_samples_pure_node/direct_use__single_service/services/demo.xsodata +7 -0
  14. package/documentation/code_samples_pure_node/expressjs__multi_services/index.js +53 -0
  15. package/documentation/code_samples_pure_node/expressjs__multi_services/package.json +11 -0
  16. package/documentation/code_samples_pure_node/expressjs__multi_services/public/index.html +27 -0
  17. package/documentation/code_samples_pure_node/expressjs__multi_services/services/demo.xsodata +7 -0
  18. package/documentation/code_samples_pure_node/expressjs__multi_services/services/demo_nav.xsodata +47 -0
  19. package/documentation/code_samples_pure_node/expressjs__single_service/index.js +52 -0
  20. package/documentation/code_samples_pure_node/expressjs__single_service/package.json +11 -0
  21. package/documentation/code_samples_pure_node/expressjs__single_service/public/index.html +18 -0
  22. package/documentation/code_samples_pure_node/expressjs__single_service/services/demo.xsodata +7 -0
  23. package/documentation/code_samples_pure_node/readme.md +32 -0
  24. package/documentation/customExits.md +270 -0
  25. package/documentation/db.md +35 -0
  26. package/documentation/debugView.md +13 -0
  27. package/documentation/generatedKeys.md +58 -0
  28. package/documentation/limitations.md +20 -0
  29. package/documentation/modes.md +48 -0
  30. package/documentation/readme.md +83 -0
  31. package/documentation/supportedMethods.md +28 -0
  32. package/documentation/supportedSystemQueryOptions.md +75 -0
  33. package/documentation/typemapping.md +32 -0
  34. package/documentation/xsodataEbnf.md +88 -0
  35. package/documentation/xsodataSettings.md +97 -0
  36. package/lib/db/dbSegment.js +1 -1
  37. package/package.json +18 -15
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ var http = require("http");
4
+ var path = require('path');
5
+ var logger = require('<winston_api_like_logger>');
6
+ var xsOData = require('./../../../index');
7
+
8
+ logger.level = 'warn';
9
+
10
+ //Webserver configuration
11
+ var webServerPort = 8019;
12
+ var hostPortName = "localhost:" + webServerPort;
13
+
14
+ //OData handler configuration
15
+ var configuration = {
16
+ //Here serviceConfiguration points to a directory: so the first uri segment behind the port
17
+ //must contain the name of the xsodata file to use. E.g. for name demo.xsodata:
18
+ //http://localhost/demo.xsodata/$metadata
19
+ "serviceConfiguration": path.join(__dirname, "services"),
20
+ "defaultSchema": 'REFSCENARIO',
21
+ "dbConfiguration": {
22
+ "host": "<your host>",
23
+ "port": 1234,
24
+ "user": "<your user>",
25
+ "password": "<your password>"
26
+ },
27
+ "logger": logger
28
+ };
29
+
30
+ //Instantiate ODataHandler
31
+ var handler = new xsOData.ODataHandler(configuration);
32
+
33
+ var webServer = http.createServer(function (request, response) {
34
+ if (request.url.indexOf("favicon.ico") === -1) {
35
+ try {
36
+ handler.processRequest(request, response, null, function done() {
37
+ console.log("processed request " + request.url);
38
+ });
39
+ } catch (ex) {
40
+ console.log(ex);
41
+ }
42
+ }
43
+ });
44
+
45
+ webServer.listen(webServerPort, function () {
46
+ console.log("Listen on localhost:" + webServerPort);
47
+ console.log("Service url for demo : http://" + hostPortName + '/demo.xsodata');
48
+ console.log("Service url for demo_nav: http://" + hostPortName + '/demo_nav.xsodata');
49
+ });
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "direct_use__multi_sevices",
3
+ "description": "Plain nodejs webserver forwarding all requests to the xsodata module",
4
+ "version": "0.0.1",
5
+ "scripts": {
6
+ "start": "node index.js"
7
+ }
8
+ }
@@ -0,0 +1,7 @@
1
+ service namespace "REFSCENARIO" {
2
+ "xsodata.refscenario.tables::Employees" as "Employees";
3
+ "xsodata.refscenario.tables::Teams" as "Teams";
4
+ "xsodata.refscenario.tables::Rooms" as "Rooms";
5
+ "xsodata.refscenario.tables::Managers" as "Managers";
6
+ "xsodata.refscenario.tables::Buildings" as "Buildings";
7
+ }
@@ -0,0 +1,47 @@
1
+ service namespace "REFSCENARIO" {
2
+ "REFSCENARIO"."xsodata.refscenario.tables::Employees" as "Employees"
3
+ navigates (
4
+ "ManagerEmployees" as "ne_Manager" from principal,
5
+ "TeamEmployees" as "ne_Team" from principal,
6
+ "RoomEmployees" as "ne_Room" from principal
7
+ );
8
+
9
+ "xsodata.refscenario.tables::Teams" as "Teams"
10
+ navigates (
11
+ "TeamEmployees" as "nt_Employees" from dependent
12
+ );
13
+
14
+ "xsodata.refscenario.tables::Rooms" as "Rooms"
15
+ navigates (
16
+ "RoomEmployees" as "nr_Employees" from dependent,
17
+ "BuildingsRooms" as "nr_Building" from principal
18
+ );
19
+
20
+ "xsodata.refscenario.tables::Managers" as "Managers"
21
+ navigates (
22
+ "ManagerEmployees" as "nm_Employees" from dependent
23
+ );
24
+
25
+
26
+ "xsodata.refscenario.tables::Buildings" as "Buildings"
27
+ navigates (
28
+ "BuildingsRooms" as "nb_Rooms" from dependent
29
+ );
30
+
31
+ association "ManagerEmployees"
32
+ principal "Employees"("EmployeeId") multiplicity "*"
33
+ dependent "Managers"("EmployeeId") multiplicity "1";
34
+
35
+ association "TeamEmployees"
36
+ principal "Employees"("TeamId") multiplicity "*"
37
+ dependent "Teams"("Id") multiplicity "1";
38
+
39
+ association "RoomEmployees"
40
+ principal "Employees"("RoomId") multiplicity "*"
41
+ dependent "Rooms"("Id") multiplicity "1";
42
+
43
+ association "BuildingsRooms"
44
+ principal "Rooms"("BuildingId") multiplicity "*"
45
+ dependent "Buildings"("Id") multiplicity "1";
46
+
47
+ }
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ var http = require("http");
4
+ var path = require('path');
5
+ var logger = require('<winston_api_like_logger>');
6
+ var xsOData = require('./../../../index');
7
+
8
+ logger.level = 'warn';
9
+
10
+ //Webserver configuration
11
+ var webServerPort = 8019;
12
+ var hostPortName = "localhost:" + webServerPort;
13
+
14
+ //OData handler configuration
15
+ var configuration = {
16
+ //Here serviceConfiguration points to a single directory: so the first uri segment behind the port
17
+ //must contain the name of the xsodata file to use. E.g. for name demo.xsodata:
18
+ //http://localhost/demo.xsodata/$metadata
19
+ "serviceConfiguration": path.join(__dirname, "services/demo.xsodata"),
20
+ "defaultSchema": 'REFSCENARIO',
21
+ "dbConfiguration": {
22
+ "host": "<your host>",
23
+ "port": 1234,
24
+ "user": "<your user>",
25
+ "password": "<your password>"
26
+ },
27
+ "logger": logger
28
+ };
29
+
30
+ //Instantiate ODataHandler
31
+ var handler = new xsOData.ODataHandler(configuration);
32
+
33
+ var webServer = http.createServer(function (request, response) {
34
+ if (request.url.indexOf("favicon.ico") === -1) {
35
+ try {
36
+ handler.processRequest(request, response, null, function done() {
37
+ console.log("processed request " + request.url);
38
+ });
39
+ } catch (ex) {
40
+ console.log(ex);
41
+ }
42
+ }
43
+ });
44
+
45
+ webServer.listen(webServerPort, function () {
46
+ console.log("Listen on localhost:" + webServerPort);
47
+ console.log("Service url for demo : http://" + hostPortName + '/?$format=json');
48
+ });
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "direct_use__single_sevice",
3
+ "description": "Plain nodejs webserver forwarding all requests to the xsodata module",
4
+ "version": "0.0.1",
5
+ "scripts": {
6
+ "start": "node index.js"
7
+ }
8
+ }
@@ -0,0 +1,7 @@
1
+ service namespace "REFSCENARIO" {
2
+ "xsodata.refscenario.tables::Employees" as "Employees";
3
+ "xsodata.refscenario.tables::Teams" as "Teams";
4
+ "xsodata.refscenario.tables::Rooms" as "Rooms";
5
+ "xsodata.refscenario.tables::Managers" as "Managers";
6
+ "xsodata.refscenario.tables::Buildings" as "Buildings";
7
+ }
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var logger = require('<winston_api_like_logger>');
5
+ var express = require('express');
6
+ var xsOData = require('./../../../index');
7
+
8
+ logger.level = 'warn';
9
+
10
+ //Webserver configuration
11
+ var webServerPort = 8019;
12
+ var hostPortName = "localhost:" + webServerPort;
13
+ var odataPrefix = '/odata';
14
+
15
+ //OData handler configuration
16
+ var configuration = {
17
+ //Here serviceConfiguration points to a directory: so the first uri segment behind the port
18
+ //must contain the name of the xsodata file to use. E.g. for name demo.xsodata:
19
+ //http://localhost/odata/demo.xsodata/$metadata
20
+ "serviceConfiguration": path.join(__dirname, "services"),
21
+ "defaultSchema": 'REFSCENARIO',
22
+ "dbConfiguration": {
23
+ "host": "<your host>",
24
+ "port": 1234,
25
+ "user": "<your user>",
26
+ "password": "<your password>"
27
+ },
28
+ "logger": logger
29
+ };
30
+
31
+
32
+ //Instantiate ODataHandler
33
+ var handler = new xsOData.ODataHandler(configuration);
34
+
35
+
36
+ //express stuff
37
+ var app = express();
38
+
39
+ app.use(odataPrefix, function (req, res, next) {
40
+ handler.processRequest(req, res, req.baseUrl, function done() {
41
+ console.log("processed odata request " + req.url);
42
+ });
43
+ return;
44
+ });
45
+
46
+ app.use(express.static('public'));
47
+
48
+ app.listen(webServerPort, function () {
49
+ console.log("Listen on localhost:" + webServerPort);
50
+ console.log("Index url for demo : http://" + hostPortName + '/index.html');
51
+ console.log("Service url for demo : http://" + hostPortName + odataPrefix + '/demo.xsodata');
52
+ console.log("Service url for demo_nav: http://" + hostPortName + odataPrefix + '/demo_nav.xsodata');
53
+ });
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "expressjs",
3
+ "description": "",
4
+ "version": "0.0.1",
5
+ "scripts": {
6
+ "start": "node index.js"
7
+ },
8
+ "dependencies": {
9
+ "express": "^4.13.3"
10
+ }
11
+ }
@@ -0,0 +1,27 @@
1
+ <html>
2
+ <head>
3
+ <title>xsodata with expressjs sample</title>
4
+ </head>
5
+ <body bgcolor=white>
6
+ <ul>
7
+ <li>
8
+ Demo Service Url: <a href="/odata/demo.xsodata/">http://localhost:8019/odata/demo.xsodata/</a>
9
+ </li>
10
+ <li>
11
+ Demo Metadata Url: <a href="/odata/demo.xsodata/$metadata">http://localhost:8019/odata/demo.xsodata/$metadata</a>
12
+ </li>
13
+ <li>
14
+ Demo Employee Url: <a href="/odata/demo.xsodata/Employees?$format=json">http://localhost:8019/odata/demo.xsodata/Employees?$format=json</a>
15
+ </li>
16
+ <li>
17
+ Demo Nav Service Url: <a href="/odata/demo_nav.xsodata/">http://localhost:8019/odata/demo_nav.xsodata/</a>
18
+ </li>
19
+ <li>
20
+ Demo Nav Metadata Url: <a href="/odata/demo_nav.xsodata/$metadata">http://localhost:8019/odata/demo_nav.xsodata/$metadata</a>
21
+ </li>
22
+ <li>
23
+ Demo Nav Employee Url: <a href="/odata/demo_nav.xsodata/Employees?$format=json">http://localhost:8019/odata/demo_nav.xsodata/Employees?$format=json</a>
24
+ </li>
25
+ </ul>
26
+ </body>
27
+ </html>
@@ -0,0 +1,7 @@
1
+ service namespace "REFSCENARIO" {
2
+ "xsodata.refscenario.tables::Employees" as "Employees";
3
+ "xsodata.refscenario.tables::Teams" as "Teams";
4
+ "xsodata.refscenario.tables::Rooms" as "Rooms";
5
+ "xsodata.refscenario.tables::Managers" as "Managers";
6
+ "xsodata.refscenario.tables::Buildings" as "Buildings";
7
+ }
@@ -0,0 +1,47 @@
1
+ service namespace "REFSCENARIO" {
2
+ "REFSCENARIO"."xsodata.refscenario.tables::Employees" as "Employees"
3
+ navigates (
4
+ "ManagerEmployees" as "ne_Manager" from principal,
5
+ "TeamEmployees" as "ne_Team" from principal,
6
+ "RoomEmployees" as "ne_Room" from principal
7
+ );
8
+
9
+ "xsodata.refscenario.tables::Teams" as "Teams"
10
+ navigates (
11
+ "TeamEmployees" as "nt_Employees" from dependent
12
+ );
13
+
14
+ "xsodata.refscenario.tables::Rooms" as "Rooms"
15
+ navigates (
16
+ "RoomEmployees" as "nr_Employees" from dependent,
17
+ "BuildingsRooms" as "nr_Building" from principal
18
+ );
19
+
20
+ "xsodata.refscenario.tables::Managers" as "Managers"
21
+ navigates (
22
+ "ManagerEmployees" as "nm_Employees" from dependent
23
+ );
24
+
25
+
26
+ "xsodata.refscenario.tables::Buildings" as "Buildings"
27
+ navigates (
28
+ "BuildingsRooms" as "nb_Rooms" from dependent
29
+ );
30
+
31
+ association "ManagerEmployees"
32
+ principal "Employees"("EmployeeId") multiplicity "*"
33
+ dependent "Managers"("EmployeeId") multiplicity "1";
34
+
35
+ association "TeamEmployees"
36
+ principal "Employees"("TeamId") multiplicity "*"
37
+ dependent "Teams"("Id") multiplicity "1";
38
+
39
+ association "RoomEmployees"
40
+ principal "Employees"("RoomId") multiplicity "*"
41
+ dependent "Rooms"("Id") multiplicity "1";
42
+
43
+ association "BuildingsRooms"
44
+ principal "Rooms"("BuildingId") multiplicity "*"
45
+ dependent "Buildings"("Id") multiplicity "1";
46
+
47
+ }
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var logger = require('<winston_api_like_logger>');
5
+ var express = require('express');
6
+ var xsOData = require('./../../../index');
7
+
8
+ logger.level = 'warn';
9
+
10
+ //Webserver configuration
11
+ var webServerPort = 8019;
12
+ var hostPortName = "localhost:" + webServerPort;
13
+ var odataPrefix = '/odata';
14
+
15
+ //OData handler configuration
16
+ var configuration = {
17
+ //Here serviceConfiguration points to a single directory: so the first uri segment behind the port
18
+ //must contain the name of the xsodata file to use. E.g. for name demo.xsodata:
19
+ //http://localhost/demo.xsodata/$metadata
20
+ "serviceConfiguration": path.join(__dirname, "services/demo.xsodata"),
21
+ "defaultSchema": 'REFSCENARIO',
22
+ "dbConfiguration": {
23
+ "host": "<your host>",
24
+ "port": 1234,
25
+ "user": "<your user>",
26
+ "password": "<your password>"
27
+ },
28
+ "logger": logger
29
+ };
30
+
31
+
32
+ //Instantiate ODataHandler
33
+ var handler = new xsOData.ODataHandler(configuration);
34
+
35
+
36
+ //express stuff
37
+ var app = express();
38
+
39
+ app.use(odataPrefix, function (req, res, next) {
40
+ handler.processRequest(req, res, req.baseUrl, function done() {
41
+ console.log("processed odata request " + req.url);
42
+ });
43
+ return;
44
+ });
45
+
46
+ app.use(express.static('public'));
47
+
48
+ app.listen(webServerPort, function () {
49
+ console.log("Listen on localhost:" + webServerPort);
50
+ console.log("Index url for demo : http://" + hostPortName + odataPrefix + '/odata/index.html');
51
+ console.log("Service url for demo : http://" + hostPortName + odataPrefix + '/');
52
+ });
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "expressjs",
3
+ "description": "",
4
+ "version": "0.0.1",
5
+ "scripts": {
6
+ "start": "node index.js"
7
+ },
8
+ "dependencies": {
9
+ "express": "^4.13.3"
10
+ }
11
+ }
@@ -0,0 +1,18 @@
1
+ <html>
2
+ <head>
3
+ <title>xsodata with expressjs sample</title>
4
+ </head>
5
+ <body bgcolor=white>
6
+ <ul>
7
+ <li>
8
+ Service url: <a href="/odata/">http://localhost:8019/odata/</a>
9
+ </li>
10
+ <li>
11
+ Metadata url: <a href="/odata/$metadata">http://localhost:8019/odata/$metadata</a>
12
+ </li>
13
+ <li>
14
+ Employee url: <a href="/odata/Employees?$format=json">http://localhost:8019/odata/Employees?$format=json</a>
15
+ </li>
16
+ </ul>
17
+ </body>
18
+ </html>
@@ -0,0 +1,7 @@
1
+ service namespace "REFSCENARIO" {
2
+ "xsodata.refscenario.tables::Employees" as "Employees";
3
+ "xsodata.refscenario.tables::Teams" as "Teams";
4
+ "xsodata.refscenario.tables::Rooms" as "Rooms";
5
+ "xsodata.refscenario.tables::Managers" as "Managers";
6
+ "xsodata.refscenario.tables::Buildings" as "Buildings";
7
+ }
@@ -0,0 +1,32 @@
1
+ xsodata code samples without xsjs
2
+ =================================
3
+
4
+ These are samples that are using the XSOData library directly (means without a HANA XSA server).
5
+ The code samples can be used as a reference for own web servers exporting OData payloads.
6
+
7
+ ### Prerequisites
8
+ - Node.js 0.12.7 installed
9
+
10
+ ### Content
11
+
12
+ - direct_use__multi_services
13
+ A plain node http server using the odata handler serving all xsodata files from a directory
14
+ - direct_use__single_service
15
+ A plain node http server using the odata handler
16
+ - expressjs__multi_services
17
+ An express server using the odata handler serving all xsodata files from a directory
18
+ - expressjs__single_service
19
+ An express server using the odata handler to serve a single xsodata file
20
+
21
+ To execute the examples please perform the following steps:
22
+ - create the database table you want to expose
23
+ - adopt the *.xsodata samples file to use your own tables
24
+ - provide db configuration (host,user,password) in the index.js files
25
+ - start via:
26
+ ```sh
27
+ $ cd documentation/examples/direct_use__single_service
28
+ $ npm install
29
+ $ npm start
30
+ # The output will tell you the URL to use
31
+ ```
32
+ - test in browser for example via url http://localhost/demo.xsodata/$metadata