Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

bring together development with master #198

Open
wants to merge 34 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
06fc052
Change to allow startsWith to be supported instead of just startswith
mlesswing Mar 21, 2014
611be8e
Added hooks to add and remove items from the external index as well a…
mlesswing Mar 21, 2014
a68cf7e
Added EXAMPLE of how to extend functions to an entity
mlesswing Mar 21, 2014
1397c91
cleanup of filed from the fork process
mlesswing Mar 21, 2014
1a89d14
Changes to the build system to facilitate the fork
mlesswing Mar 22, 2014
a887b8f
Further changes to the NPM package.json
mlesswing Mar 22, 2014
184ec87
Fixed a typo in the README and incremented the version
mlesswing Mar 22, 2014
0b0f0ed
remove extraneous build information
mlesswing Mar 26, 2014
a8bf2f8
Merge remote-tracking branch 'upstream/development' into development
mlesswing Mar 26, 2014
d7600ac
removed writing INDEX to disk
mlesswing Mar 26, 2014
be6a1c9
incremented NPM version number
mlesswing Mar 26, 2014
1f2ea14
incremented version number
mlesswing Mar 26, 2014
121fe22
incremented version number
mlesswing Mar 26, 2014
e68bc37
incremented version number
mlesswing Mar 26, 2014
461d33e
incremented version number
mlesswing Mar 26, 2014
7857e5e
increment version number
mlesswing Mar 27, 2014
1b8e807
Changes author to CRT
mlesswing Mar 27, 2014
f91beec
finished work on using MongoDB indexes to enforce uniqueness
mlesswing Mar 27, 2014
7f6c77b
metrics added to the PATCH process
mlesswing Mar 31, 2014
d2af6dc
increment version number
mlesswing Mar 31, 2014
0c7c3f8
Fix for post-pended NULL route
mlesswing Aug 7, 2014
d2e8bf4
sync to JayData 1.3.6
mlesswing Mar 22, 2015
bc9c2a9
increment NPM version numer
mlesswing Mar 22, 2015
f430285
start of libRETS provider addition
mlesswing Apr 21, 2015
1ee202b
cleanup unused npm directory
mlesswing Apr 21, 2015
d1bd6b3
updated the readme for the npm package
mlesswing Apr 21, 2015
9356a1c
change npm package description
mlesswing Apr 21, 2015
8451a25
fix to make libRETS build for distribution
mlesswing Apr 22, 2015
5e7d3e4
allow librets storage provider to register
mlesswing Apr 24, 2015
de0cdeb
add librets storage provider to index.js through Makefile
mlesswing Apr 24, 2015
c444b01
correct isSupported function
mlesswing Apr 24, 2015
313c6f2
cleaned up return on _getServer
mlesswing Apr 24, 2015
bc5a75c
always use connections, without option to pass a server object
mlesswing Apr 24, 2015
379a3dc
changed default url and removed need to have a database name
mlesswing Apr 24, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions CREDITS.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// JayData 1.0.4
// JayData-RESO 1.0.0
// Dual licensed under MIT and GPL v2
// Copyright JayStack Technologies (http://jaydata.org/licensing)
// Copyright JayStack Technologies (http://jaydata.org/licensing) and National Association of REALTORS
//
// JayData is a standards-based, cross-platform Javascript library and a set of
// practices to access and manipulate data from various online and offline sources.
//
// Credits:
// Hajnalka Battancs, D�niel J�zsef, J�nos Roden, L�szl� Horv�th, P�ter Nochta
// P�ter Zentai, R�bert B�nay, Szabolcs Czinege, Viktor Borza, Viktor L�z�r,
// Zolt�n Gyebrovszki, G�bor Dolla
// Original Jaydata development Team, Mark Lesswing
//
// More info: http://jaydata.org
// More info: http://jaydata.org and http://crt.blogs.realtor.org
34 changes: 34 additions & 0 deletions JayDataModules/angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,40 @@ angular.module('jaydata', ['ng', ['$provide', function ($provide) {
return Object.prototype.hasOwnProperty.apply(this, arguments);
}

$data.Queryable.prototype.toLiveArrayEx = function (options, resultHolder) {
if (Array.isArray(options)) {
resultHolder = options;
otions = undefined;
}
resultHolder = resultHolder || [];
options = options || {};
var self = this, scope = options.scope || $rootScope;

function thunk(newDefer) {
self.toArray()
.then(function (items) {
resultHolder.length = 0;
items.forEach(function (item) {
resultHolder.push(item);
})
newDefer.resolve(resultHolder);
})
.fail(newDefer.reject)
.then(function () {
scope.$apply();
});
}

function refresh() {
var defer = $.Deferred(thunk);
defer.promise(resultHolder);
return resultHolder;
}
resultHolder.refresh = refresh;

return refresh();
}

$data.Queryable.prototype.toLiveArray = function (cb) {
var _this = this;

Expand Down
20 changes: 10 additions & 10 deletions JayDataModules/kendo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
kendo.data.Model.fn.init.call(this, data);
}
});
$data.kendo.attachMode = true;
if ($data.EntityAttachMode) {
$data.kendo.attachMode = $data.EntityAttachMode.KeepChanges;
}

var kendoTypeMap = {
"$data.Blob": "string",
Expand Down Expand Up @@ -91,11 +95,9 @@
//}
}

//console.dir(memberDefinitions.getPublicMappedMethods());
var modelDefinition = {
fields: fields,
init: function (data) {
//console.dir(arguments);
var ctxType = options && options.owningContextType || undefined;

var contextSetTypes = [];
Expand Down Expand Up @@ -514,7 +516,6 @@

$data.Trace.log(promises);
jQuery.when.apply(this, promises).then(function (items, total) {
console.dir(arguments);
//var result = items.map(function (item) { return item instanceof $data.Entity ? new model(item.initData) : item; });
var result = items.map(function (item) {
var d = (item instanceof $data.Entity) ? item.initData : item;
Expand Down Expand Up @@ -555,7 +556,6 @@
});
}
else {
console.dir(ctx.storeToken);
model[0]
.innerInstance()
.save(ctx.storeToken)
Expand All @@ -577,7 +577,7 @@
return item.innerInstance()
});
items.forEach(function (item) {
ctx.attach(item, true);
ctx.attach(item, $data.kendo.attachMode);
});
ctx.saveChanges().then(function () {
options.success();
Expand All @@ -588,7 +588,7 @@
});
}
else {
model[0].innerInstance().save().then(function (item) {
model[0].innerInstance().save(undefined, undefined, $data.kendo.attachMode).then(function (item) {
options.success();
}).fail(function () {
//alert("error in update")
Expand Down Expand Up @@ -677,9 +677,9 @@
ds = ds || {};
//unless user explicitly opts out server side logic
//we just force it.
ds.serverPaging = ds.serverPaging || true;
ds.serverFiltering = ds.serverFiltering || true;
ds.serverSorting = ds.serverSorting || true;
ds.serverPaging = ds.serverPaging === undefined ? true : ds.serverPaging;
ds.serverFiltering = ds.serverFiltering === undefined ? true : ds.serverFiltering;
ds.serverSorting = ds.serverSorting === undefined ? true : ds.serverSorting;
ds.pageSize = ds.pageSize === undefined ? $data.kendo.defaultPageSize : ds.pageSize;

var TransportClass = self.asKendoRemoteTransportClass(model);
Expand Down Expand Up @@ -708,4 +708,4 @@
refresh: function () {
}
});
})($data);
})($data);
10 changes: 10 additions & 0 deletions JayService/JSObjectAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ $data.Class.define("$data.JSObjectAdapter", null, null, {
var methodArgs = self.resolveArguments(req, serviceInstance, memberInfo);

if (memberInfo.method instanceof Array ? memberInfo.method.indexOf(req.method) >= 0 : memberInfo.method === req.method){

req.reso.memberName = memberName;
req.reso.namespace = "System";

oDataBuilderCfg = {
version: 'V2',
baseUrl: req.fullRoute,
Expand All @@ -78,6 +82,9 @@ $data.Class.define("$data.JSObjectAdapter", null, null, {
if (member) {
var esProc = new $data.JayService.OData.EntitySetProcessor(memberName, serviceInstance, { top: serviceInstance.storageProvider.providerConfiguration.responseLimit || $data.JayService.OData.Defaults.defaultResponseLimit });

req.reso.memberName = memberName;
req.reso.namespace = member.elementType.namespace;

oDataBuilderCfg = {
version: 'V2',
baseUrl: req.fullRoute,
Expand Down Expand Up @@ -344,6 +351,9 @@ $data.Class.define("$data.JSObjectAdapter", null, null, {
defer.resolve(new $data.EmptyServiceResult(404));
}
} else {

request.reso.resultSize = 1;

defer.resolve(result);
}

Expand Down
2 changes: 1 addition & 1 deletion JayService/JayService.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ $data.Class.define("$data.JayService", null, null, {
if (req.connection.encrypted || req.headers['X-Forwarded-Protocol'] === 'https' || req.headers['x-forwarded-protocol'] === 'https')
schema += 's';

req.fullRoute = (req.baseRoute || (schema + '://' + req.headers.host)) + app.route;
req.fullRoute = (req.baseRoute || (schema + '://' + req.headers.host)) + (app.route || req.baseUrl || req.originalUrl.replace(req.url, ''));
}
}
},
Expand Down
16 changes: 14 additions & 2 deletions JayService/OData/BatchProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@
this._discoverNavigations(changeRequest, referenceData, itemType);
var entity = new itemType(changeRequest.data, { converters: $data.oDataConverter.fromDb });
referenceData[refId].resultObject = entity;
setInfo.set.add(entity);

request.reso.memberName = setInfo.set.name;
request.reso.namespace = itemType.namespace;
setInfo.set.add(entity, request);

break;
case 'MERGE':
case 'PATCH':
Expand All @@ -188,6 +192,10 @@
var entity = new itemType(changeRequest.data, { converters: $data.oDataConverter.fromDb });
referenceData[refId].resultObject = entity;

request.reso.memberName = setInfo.set.name;
request.reso.namespace = itemType.namespace;
setInfo.set.attach(entity, false, request);

setInfo.set.attach(entity);
entity.changedProperties = entity.getType().memberDefinitions.getPublicMappedProperties().filter(function(p){
if (entity[p.name] === undefined) return false;
Expand All @@ -199,7 +207,11 @@
case 'DELETE':
var entity = new itemType(setInfo.idObj);
referenceData[refId].resultObject = entity;
setInfo.set.remove(entity);

request.reso.memberName = setInfo.set.name;
request.reso.namespace = itemType.namespace;
setInfo.set.remove(entity, request);

break;
default:
break;
Expand Down
17 changes: 12 additions & 5 deletions JayService/OData/EntitySetProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@
var parsed = $data.JayService.OData.Utils.parseUrlPart(uri, this.context);
var entity = new parsed.set.createNew(parsed.idObj);
bodyData[i] = entity;
parsed.set.attach(entity);
parsed.set.attach(entity, false, req);
}
}
}

var entity = new this.entitySet.createNew(bodyData, { converters: $data.oDataConverter.fromDb });
this.entitySet.add(entity);

this.entitySet.add(entity, req);

this.context.saveChanges({
success: function () {
res.statusCode = 201;
Expand Down Expand Up @@ -98,13 +100,13 @@
var parsed = $data.JayService.OData.Utils.parseUrlPart(uri, this.context);
var entity = new parsed.set.createNew(parsed.idObj);
bodyData[i] = entity;
parsed.set.attach(entity);
parsed.set.attach(entity, false, req);
}
}
}

var entity = new this.entitySet.createNew(bodyData, { converters: $data.oDataConverter.fromDb });
this.entitySet.attach(entity);
this.entitySet.attach(entity, false, req);
entity.changedProperties = entity.getType().memberDefinitions.getPublicMappedProperties().filter(function(p){
if (entity[p.name] === undefined) return false;
if (p.computed) return false;
Expand All @@ -127,7 +129,9 @@
self.BatchDeleteFromEntitySet(req, config, cbWrapper);
} else {
if (this.member.idObject) {
this.entitySet.remove(this.member.idObject);

this.entitySet.remove(this.member.idObject, req);

this.context.saveChanges({
success: function () {
//return with no content
Expand Down Expand Up @@ -191,6 +195,9 @@
config.includes = result.includes;
this.context.executeQuery(new $data.Queryable(this.entitySet, result.expression), {
success: function (contextResult) {

req.reso.resultSize = contextResult.length;

if (self.member.valueRequeset) {
// request pattern: /EntitySet(key)/Field/$value
self.prepareSimpleResponse(contextResult, self.member.selectedField, self.entitySet, callback);
Expand Down
11 changes: 9 additions & 2 deletions JaySvcUtil/JaySvcUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,8 @@ $data.Class.define('$data.MetadataLoaderClass', null, null, {
"http://schemas.microsoft.com/ado/2008/09/edm": "V2",
"http://schemas.microsoft.com/ado/2009/11/edm": "V3",
"http://schemas.microsoft.com/ado/2007/05/edm": "V11",
"http://schemas.microsoft.com/ado/2009/08/edm": "V22"
"http://schemas.microsoft.com/ado/2009/08/edm": "V22",
"http://docs.oasis-open.org/odata/ns/edm": "V4"
}
},
_maxDataServiceVersions: {
Expand All @@ -621,7 +622,8 @@ $data.Class.define('$data.MetadataLoaderClass', null, null, {
"http://schemas.microsoft.com/ado/2008/09/edm": "2.0",
"http://schemas.microsoft.com/ado/2009/11/edm": "3.0",
"http://schemas.microsoft.com/ado/2007/05/edm": "2.0",
"http://schemas.microsoft.com/ado/2009/08/edm": "2.0"
"http://schemas.microsoft.com/ado/2009/08/edm": "2.0",
"http://docs.oasis-open.org/odata/ns/edm": "4.0"
}
},
_supportedODataVersionXSLT: {
Expand Down Expand Up @@ -1109,6 +1111,7 @@ $data.Class.define('$data.MetadataLoaderClass', null, null, {
" <xsl:variable name=\"memberDefinition\">\r\n" +
" <xsl:if test=\"parent::edm:EntityType/edm:Key/edm:PropertyRef[@Name = current()/@Name]\"><attribute name=\"key\">true</attribute></xsl:if>\r\n" +
" <xsl:apply-templates select=\"@*[local-name() != 'Name']\" mode=\"render-field\" />\r\n" +
" <xsl:if test=\"local-name() = 'NavigationProperty' and current()[not(@Partner) and current()/@Type]\"><attribute name=\"inverseProperty\">'$$unbound'</attribute></xsl:if>\r\n" +
" </xsl:variable>'<xsl:value-of select=\"@Name\"/>': { <xsl:choose><xsl:when test=\"function-available('msxsl:node-set')\"><xsl:for-each select=\"msxsl:node-set($memberDefinition)/*\">'<xsl:if test=\"@extended = 'true'\">$</xsl:if><xsl:value-of select=\"@name\"/>':<xsl:value-of select=\".\"/>\r\n" +
" <xsl:if test=\"position() != last()\">,<xsl:text> </xsl:text>\r\n" +
" </xsl:if> </xsl:for-each></xsl:when>\r\n" +
Expand All @@ -1121,6 +1124,10 @@ $data.Class.define('$data.MetadataLoaderClass', null, null, {
" <xsl:template match=\"@Name\" mode=\"render-field\">\r\n" +
" </xsl:template>\r\n" +
"\r\n" +
" <xsl:template match=\"@Partner\" mode=\"render-field\">\r\n" +
" <attribute name=\"inverseProperty\">'<xsl:value-of select=\".\"/>'</attribute>\r\n" +
" </xsl:template>\r\n" +
"\r\n" +
" <xsl:template match=\"@Type\" mode=\"render-field\">\r\n" +
" <xsl:choose>\r\n" +
" <xsl:when test=\"starts-with(., 'Collection')\">\r\n" +
Expand Down
2 changes: 1 addition & 1 deletion MIT-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012 JayStack Technologies LLC. http://jaydata.org/licensing
Copyright (c) 2014 National Association of REALTORS. http://crt.blogs.realtor.org


Permission is hereby granted, free of charge, to any person obtaining
Expand Down
Loading