htammen / n-odata-server Goto Github PK
View Code? Open in Web Editor NEWNode.js OData Server
Home Page: http://htammen.github.io/n-odata-server/
License: MIT License
Node.js OData Server
Home Page: http://htammen.github.io/n-odata-server/
License: MIT License
The preferred way to integrate modules like n-odata-server into loopback applications is via middleware.json. Currently the integration is done via component-config.json and defining routes internally by n-odata-server.
It should be possible to use the recommended way via middleware.json cause this allows a more fine grained definition of when the n-odata-server will be invoked during the processing of a request.
TypeScript creates an error cause the typings type definition (v0.8) does not match the used xmlbuilder version (v0.4.1).
Update to newest xmlbuilder version.
Error is:
Error:(134, 7) TS2345: Argument of type '{ [x: number]: undefined; "edmx:Edmx": { "@xmlns:edmx": string; "@xmlns:m": string; "@Version": s...' is not assignable to parameter of type 'string'.
As of Aug 30th, 2016 (#dc346c424fbef73cabc73576169ffdbabc05cb47) MERGE/PATCH via POST requests did not work anymore. Clients often use this workaround cause direct MERGE/PATCH request sometimes don't pass the firewall of enterprises.
This should work now again.
for single entity requests like
http://0.0.0.0:3000/odata/People('2')
Metadata is not provided. Current result looks like this:
{
"d": {
"firstname": "Helmut",
"lastname": "Tammen",
"gender": null,
"age": null,
"id": 2
}
}
Import the pull request from renanwilliams from Github
Write a getting started tutorial that demonstrates the creation of a simple OData API leveraging n-odata-server.
BelongsTo relationship in some cases ran into an error.
Fixed
More unit tests should be implemented. Therefore some examples how to handle the promises that are spread around the source code should be created
If loopback has a model with deep properties, isn't supported
It's a bit cumbersome to run the scripts for updating and installing the npm packages and corresponding typings. We need a script for this.
OData filter is currently not completely implemented. Only basic filter options are supported.
See methods ODataGetBase._applyFilter
and ODataGetBase._convertAstToLoopbackFilter
for details.
Hello @htammen,
We created an OData app based on your tutorials and we used the IdInjection set to true in the model json. It works just fine.
However, we are trying to consume this data on SAP Analytics Cloud and we are getting the error:
"Attribute should specify a namespace qualified name or an alias qualified name" when we try to create a model from the service.
The reason for this error is that the id type is 'ObjectId'. When we disable IdInjection and set the id the field to be a string, its type turns Edm.String and we do not get the error anymore. However, then we are not able fetch any entries from the entity as we get the error "TypeError: Cannot read property 'property' of undefined"
Do you know if it is possible to change the default type of the property when IdInjection is activated?
Thanks
Support to create annotations in metadata document
In a entity $count if the URL have any $filter is not considered and the count returns the full number
if your service is running on port 3000 and you have a reverse proxy on port 80, when you access on port 80 the metadata section still show as 3000
Integrate Travis CI into the build / test process of n-odata-server. Travis CI is free for open source projects.
https://docs.travis-ci.com/
The widely used method commons._getRequestModelClass threw error when loopback has not defined ModelClass.definition._ids. Don't know why this is not defined in some cases even though there is a id column but it happens.
Fixed this issue.
Hi @htammen,
I wanted to try your n-odata-server, but I guess LoopBack evolved into a version not compatible with yours. First, the link "Look here for details on installing and creating a loopback application" in Prerequisites is dead. Second, installation of LoopBack via "npm install -g strongloop" throws lots of warnings about deprecated components, and also lots of errors.
So I installed via "npm install -g @loopback/cli", and successfully created the LoopBack 4 ToDo Application (app, model, datasource, repository and controller), which works fine.
But as I understand out of your description, there should be a directory server with the files component-config.json and middleware.json, which should be enhanced with some coding, after installing the n-odata-server. But this directory does not exist.
Could you please revise your project.
Thanks,
chilkm
Properties of associated objects are referred in OData with / but in
loopback with .
With this change it is possible to filter for referred properties
Include a feature to support $format=xsl to export the result to MS Excel
HI,
Does your repo is supporting the scenario which I provide edmx/ metadata XML and
it will generate service which can answer the calls according to the edm structure ?
Thanks,
Jenney
Hi!
I get an error after running the grunt-ts task and restarting the app:
C:\Users\jrueckert\workspace\Komplex-e\Komplex-e_head\js-loopback\node_modules\n-odata-server\lib\odata.js:23
this.oDataGet = new ODataGetV2.ODataGet();
^
TypeError: Cannot set property 'oDataGet' of undefined
at _handleODataVersion2 (C:\Users\jrueckert\workspace\Komplex-e\Komplex-e_head\js-loopback\node_modules\n-odata-server\lib\odata.js:23:19)
at module.exports (C:\Users\jrueckert\workspace\Komplex-e\Komplex-e_head\js-loopback\node_modules\n-odata-server\lib\odata.js:169:30)
at C:\Users\jrueckert\workspace\Komplex-e\Komplex-e_head\js-loopback\node_modules\loopback-boot\lib\executor.js:425:5
at Array.forEach (native)
at setupComponents (C:\Users\jrueckert\workspace\Komplex-e\Komplex-e_head\js-loopback\node_modules\loopback-boot\lib\executor.js:418:27)
at execute (C:\Users\jrueckert\workspace\Komplex-e\Komplex-e_head\js-loopback\node_modules\loopback-boot\lib\executor.js:35:3)
at bootLoopBackApp (C:\Users\jrueckert\workspace\Komplex-e\Komplex-e_head\js-loopback\node_modules\loopback-boot\index.js:140:3)
at Object. (C:\Users\jrueckert\workspace\Komplex-e\Komplex-e_head\js-loopback\server\server.js:21:1)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
I didn't change either the grunt config nor any of the files. After that i played around with the grunt-ts config and reinstalled the typings aswell, but no success so far. Any guess what might be wrong?
Thanks in advance!
Regards
Johannes
Currently, n-data-server seems to expose also models which are set to non-public like this:
"ACL": {
"dataSource": "db",
"public": false
},
To be in-line with loopback, this should not be the case.
Fixed. HasOne relationships leads to a timeout error when requesting data of this relationship.
Example:
Imagine a product that has exactly one productDetail object connected to it via a hasOne relationship
{
"name": "Product",
"plural": "Products",
"base": "PersistedModel",
...
"relations": {
"ProductDetails": {
"type": "hasOne",
"model": "ProductDetail",
"foreignKey": "productId"
}
},
}
The following request did not work
http://0.0.0.0:3000/odata/Products(4)/ProductDetails
The problem is fixed now. Since release 0.3.10 in which some restructuring has happened this was not implemented anymore. Reimplemented it
While creating entity i want to add some business logic and also want to create related entities, Where can i update them ?
@htammen please help as it is important
When I try access myserver:3000/odata/$metadata it's returning this error:
[INFO] console - TypeError: commons.getPluralForModel is not a function
at Metadata. (D:\Node\of-api\node_modules\n-odata-server\lib\base\metadata\metadata.js:55:34)
at Array.forEach (native)
at Metadata.buildMetadata (D:\Node\of-api\node_modules\n-odata-server\lib\base\metadata\metadata.js:18:28)
at ODataGet._getMetadataDocument (D:\Node\of-api\node_modules\n-odata-server\lib\v2\get\odata_get.js:68:38)
at ODataGet.handleGet (D:\Node\of-api\node_modules\n-odata-server\lib\v2\get\odata_get.js:31:38)
at _handleGet (D:\Node\of-api\node_modules\n-odata-server\lib\odata.js:140:19)
at D:\Node\of-api\node_modules\n-odata-server\lib\odata.js:35:32
at Layer.handle as handle_request
at trim_prefix (D:\Node\of-api\node_modules\express\lib\router\index.js:312:13)
at D:\Node\of-api\node_modules\express\lib\router\index.js:280:7
However when I access just /odata it's showing the correct document.
Hello,
did you manage to add support for oData Service operation?
Dear Mr. Tammen,
first of all thank you for this module.
I am trying to setup the node.js based ODATA server and experiencing the problem described below:
[2017-12-08 21:03:49.464] [ERROR] console - (node:2489) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): Error: Missing attribute value for attribute Type of element Property
As the result I cannot properly work with the odata server. Target is in final end to use the server in conjunction with openui5/sapui5 app using ODATA.
I thank you in advance for the help
Best Regards / Mit freundlichen Grüßen
Igor Abelev
node verion = 9.0.0
n-odata version = 0.4.1
If an entity have a $expand relation and it have Date fields, the conversion to /Date(timestamp) is not applied.
Currently n-odata-server comes with log4js (which is not a common choice) but unfortunately, it's not possible to provide an own logger and neither it seems to be possible to even configure the existing one (which seems to create the file n_odata_server.log
). This makes it hardly usable for a production scenario.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.