Any chance to make Javascript RO API calls synchron

Hi Guys
Our company is considering using DataAbstract in conjunction with AngluarJS to create a single page web application so I implemented a simple prototype. During the implementation process I was faced with the following issues:

  1. Creating instances of TROComplex on the client side using Javascript

Observed Problem:


When I am calling a remobjects function using a TROComplex as an argument,
I need to setup every member of that TROComplex explicitly. Otherwise the
deserizalizer on the server side will complain about null values.

I realize there is a helper function which initializes a TROComplex taking
a json structure as input as shown in the sample. However, omitting one of
the required values within that json structure lets that helper function crash,
so still have to setup every member explicitly, although in a slightly shorter notation.

This leads to ridiculously bloated and error prone code all over the place.
Also consider this - whenever we add a member inside the RODL, the existing javascript
codebase doesn’t work anymore since missing a member will end in a
javascript runtime error as mentioned.

Example:


   new TObjectListOptions().fromObject({
     ParentObjectID: 0,
     ObjectIDs: [],
     ParentObjectIDs: [],
     RecurseLevel: 0,
     ObjectType: '',
     SysType: '',
     ObjectStatus: 1,
     ListByCategories: false,
     TreeModeOrdered: false,
     HideSysTypes: false,
     ExtendObjects: false,
     ExtendPathTokens: false,
     SearchOptions: null,
     GetAccessRightState: false,
     ListObjectShortNames: false,
     IgnoreListHide: false,
     Favorites: false,
     Filter: {
       EvenMore: 'blubb',
       EvenEvenMore: 'blubb',
       ... (even freaking more)
     },
     Limit: -1
  });

My suggestested solution:


I examined the sourcecode and realized, that the datatype of all those members are known,
when those objects are being instantiated. Why not initializing all members by a datatype
dependant default value instead of null?

I would suggest the following ruleset:
string => ‘’,
boolean => false,
number => 0,
function => skip,
object =>

  1. Problem with the JSON Deserizalizer

Observed problem:


The JSON Deserializer crashes on the client, if a TROComplex is being transmitted over a
RemObjects.SDK.JSONMessage - if it contains another TROComplex, which wasn’t assigned on the server.

Example:


function GetTerm(const ObjectID: Integer): TTerm; 
begin
  Result := TTerm.Create;

  // omitting this line results in a crash when trying to deserialize this term
  // on the javascript client using a RemObjects.SDK.JSONMessage.
  Result.EventSchedule := TEventSchedule.Create;
end;

My suggestested solution:


check for null for all members in the javascript json deserizalizer

  1. Problem with wrong Message

Observed Problem:


When I create a new RemoteDataAdapter in the javascript client as show in the sample,
a BinMessage is being used as transmission message type even though I defined a JSONDataStreamer.
This makes no sense whatsoever in my opinion.

Example:


var adapter = new RemObjects.DataAbstract.RemoteDataAdapter(
  'http://localhost/nexus/json',
  'DisposalService', '',
  RemObjects.DataAbstract.JSONDataStreamer);

My suggestested solution:


I examined the sourcecode and realized, that the ROService function
selects the used message type based on the root path (in our case ‘/nexus’).
In order to select a JSONMessage, the root path HAS TO BE ‘/json’.
Why not using the selected DataStreamer as condition for the Message?
Or does it anywhere make sense to use a BinMessage, but a JSONDataStreamer?

  1. DataAbstract for Javascript uses ECMA 5.1 features

I realized that DataAbstract for Javascript uses some ECMA Script 5.1 features likes
getters and setters which is not supported on IE8 and below. Is that correct?

What are your suggestions?
Best regards

Thanks, logged as bugs://71063