jaystack / jaydata

Notice: this library isn't maintained anymore
http://jaydata.org
GNU General Public License v2.0
352 stars 95 forks source link

General questions about the project #266

Open canibanoglu opened 8 years ago

canibanoglu commented 8 years ago

Hello,

I've been trying to use jaydata in a project and right from the get go I have had problems. It feels like I'm fighting an uphill battle and finding answers is almost impossible because of the content that is related to jaydata is on average pretty old. The examples, tutorials and documentation on the site leaves a lot to be desired and since the way your code works, it's almost impossible to get more information by debugging your source code.

It looks like GitHub is the place you are most active on and I thought this may be the best place for me to get some answers to my questions.

A little about the project: We're using angular2 on top of .NET WebAPI with oData 4. I have been trying to integrate jaydata into the project for the last couple of days with various problems. I got it to work for making the metadata query to the server but I can't get very far from there.

It does work for most of the basic stuff, I can get the entities from the DB, follow just one level of 1..N relations but that's it.

So here are my questions:

  1. Do you plan to support proper modules on npm? Installing jaydata with npm install has no effect but create garbage. requireing it doesn't work as expected and even your angular2 seed project uses static jaydata files instead of proper npm modules. Morever, a simple npm install jaydata doesn't get me the latest version, it gets me 1.3.6. If the objective behind putting jaydata on npm is to just have another source code delivery system, that should be mentioned somewhere. When I install a module through npm I expect it to fully work with normal Node style requires.
  2. Error messages are extremely uninformative. Really, there have been times when I thought that these messages were there just to spite me.
  3. Documentation and examples could be a LOT better. Apart from being very outdated following the documentation leads to errors. I couldn't get the thisArg parameter to most of your Queryable object methods to get to work. context.Sites.orderBy(x => x[this.name], { name: 'Name' } ) should work. But here's the error message I get

MemberNotFound: Unknown member undefined on type Site

What? I know for a fact that Name is a member of Site and where does the undefined come from? Maybe there is an error with the above but I have had no luck finding the error by making searches, going through your documentation or debugging your source code. Please see number 2.

  1. Without proper projections there's absolutely no reason for me (or anyone) to use jaydata. I was excited about creating view models by using projections but their extremely limited abilities make this impossible. Computed fields in projections are a joke. The most I can do is to create a projection with all the fields that I know I will need and do the actual computing myself in the toArray callback, which kinda defeats the purpose. Or do the actual heavy lifting on the backend and leave jaydata the trivially easy task of creating a one to one member mapping.

I could probably go on and on. I'm terribly sorry if this is too harsh but for a company which proudly says that it has received massive funding your product leaves a lot to be desired. I have wasted too much time on this and all I wanted to do was to use your library to build a nice table by using jQuery DataTables.

Now, I wouldn't be surprised at all if this got deleted or I'm called names and I frankly don't care right now. I probably will lose the job I have because I have wasted too much time working on trivial tasks by trying to use this product and I simply wanted to express my frustrations.

bstaley commented 8 years ago

Hello,

I feel your frustration. Documentation really needs an update. I tend to fallback on the api documentation. Though even that tends to be hard to navigate. I also agree that things seem to be really hard to trace.

That being said, I am working on a similar project(Angular 2 and OData v4). I can try to lend a hand to get you through some of this.

  1. I also had an issue with this. Even after setting everything up with npm and systemjs I had to add a script ref in my index.html for jaydata.js. It appears in order to bootstrap your provider jaydata searches the location found in that script ref.
  2. Ill defer to someone official.
  3. I think the issue with this is this.name is undefined. From what i have found you only need to supply the thisArg for string queries. So the following might work with either context.Sites.orderBy(x => x.Name) or context.Sites.orderBy('it[this.name]', { name: 'Name' } ).

Let me know if any of that was helpful. If so, and you have more questions I can try to help some more.

Thanks,

Brandon

canibanoglu commented 8 years ago

Hello Brandon,

Thanks a lot for your comment. I know that context.Sites.orderBy(x => x.Name) works but I was actually trying to make the field a dynamic one because I was planning to come up with a component that would help me implement other listing components. The above snippet would be used to sort the data based on what the user selects and instead of writing a lot of switch cases I thought I could use the "API" this way after seeing a similar example with .filter. Checked the documentation, both methods have the same signature and I simply assumed that this would be OK.

I don't know though, I honestly fail to see the advantage of jaydata at this point.