diff --git a/CREDITS.txt b/CREDITS.txt
index 6d7d3fa5..bc1f57e1 100644
--- a/CREDITS.txt
+++ b/CREDITS.txt
@@ -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
diff --git a/JayDataModules/angular.js b/JayDataModules/angular.js
index f071be9b..2b1427e1 100644
--- a/JayDataModules/angular.js
+++ b/JayDataModules/angular.js
@@ -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;
diff --git a/JayDataModules/kendo.js b/JayDataModules/kendo.js
index 4034657c..20037d1f 100644
--- a/JayDataModules/kendo.js
+++ b/JayDataModules/kendo.js
@@ -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",
@@ -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 = [];
@@ -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;
@@ -555,7 +556,6 @@
});
}
else {
- console.dir(ctx.storeToken);
model[0]
.innerInstance()
.save(ctx.storeToken)
@@ -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();
@@ -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")
@@ -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);
@@ -708,4 +708,4 @@
refresh: function () {
}
});
-})($data);
\ No newline at end of file
+})($data);
diff --git a/JayService/JSObjectAdapter.js b/JayService/JSObjectAdapter.js
index 8a39ab06..5d43ed7c 100644
--- a/JayService/JSObjectAdapter.js
+++ b/JayService/JSObjectAdapter.js
@@ -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,
@@ -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,
@@ -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);
}
diff --git a/JayService/JayService.js b/JayService/JayService.js
index 1b2f075b..782c7212 100644
--- a/JayService/JayService.js
+++ b/JayService/JayService.js
@@ -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, ''));
}
}
},
diff --git a/JayService/OData/BatchProcessor.js b/JayService/OData/BatchProcessor.js
index 12b217ec..f9e4f40e 100644
--- a/JayService/OData/BatchProcessor.js
+++ b/JayService/OData/BatchProcessor.js
@@ -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':
@@ -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;
@@ -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;
diff --git a/JayService/OData/EntitySetProcessor.js b/JayService/OData/EntitySetProcessor.js
index c462b7a5..8b8b78f9 100644
--- a/JayService/OData/EntitySetProcessor.js
+++ b/JayService/OData/EntitySetProcessor.js
@@ -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;
@@ -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;
@@ -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
@@ -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);
diff --git a/JaySvcUtil/JaySvcUtil.js b/JaySvcUtil/JaySvcUtil.js
index a441aeef..205fa99a 100644
--- a/JaySvcUtil/JaySvcUtil.js
+++ b/JaySvcUtil/JaySvcUtil.js
@@ -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: {
@@ -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: {
@@ -1109,6 +1111,7 @@ $data.Class.define('$data.MetadataLoaderClass', null, null, {
" \r\n" +
" true\r\n" +
" \r\n" +
+ " '$$unbound'\r\n" +
" '': { '$':\r\n" +
" , \r\n" +
" \r\n" +
@@ -1121,6 +1124,10 @@ $data.Class.define('$data.MetadataLoaderClass', null, null, {
" \r\n" +
" \r\n" +
"\r\n" +
+ " \r\n" +
+ " ''\r\n" +
+ " \r\n" +
+ "\r\n" +
" \r\n" +
" \r\n" +
" \r\n" +
diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt
index cb1501ff..04302300 100644
--- a/MIT-LICENSE.txt
+++ b/MIT-LICENSE.txt
@@ -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
diff --git a/Makefile b/Makefile
index eed5bb31..5bfae19e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,7 @@
-VERSION = '1.3.6'
+VERSION = '2.0.5'
TARGET_DIR = ./build
RELEASE_DIR = ./release
TEMP_DIR = $(TARGET_DIR)/tmp
-MODULE_DIR = $(TARGET_DIR)/jaydatamodules
-PROVIDERS_DIR = $(TARGET_DIR)/jaydataproviders
NPM_DIR = $(TARGET_DIR)/npm
NPM_BASE_DIR = ./npm
TYPESYSTEM_DIR = ./TypeSystem
@@ -42,8 +40,6 @@ TYPE_SYSTEM = $(TYPESYSTEM_DIR)/initializeJayData.js\
$(TYPESYSTEM_DIR)/Types/Converter.js\
$(TYPESYSTEM_DIR)/Extensions.js\
-VSDOC_SOURCE = $(TYPESYSTEM_DIR)/VS2010Intellisense.js\
-
JAYDATA_SOURCE = $(TYPES_DIR)/Expressions/ExpressionNode2.js\
$(TYPES_DIR)/Expressions/ArrayLiteralExpression.js\
$(TYPES_DIR)/Expressions/CallExpression.js\
@@ -117,7 +113,6 @@ JAYDATA_SOURCE = $(TYPES_DIR)/Expressions/ExpressionNode2.js\
$(TYPES_DIR)/ServiceOperation.js\
$(TYPES_DIR)/EntityWrapper.js\
$(TYPES_DIR)/Ajax/jQueryAjaxWrapper.js\
- $(TYPES_DIR)/Ajax/WinJSAjaxWrapper.js\
$(TYPES_DIR)/Ajax/ExtJSAjaxWrapper.js\
$(TYPES_DIR)/Ajax/AjaxStub.js\
$(TYPES_DIR)/StorageProviders/modelBinderConfigCompiler.js\
@@ -127,7 +122,6 @@ JAYDATA_SOURCE = $(TYPES_DIR)/Expressions/ExpressionNode2.js\
$(TYPES_DIR)/Authentication/BasicAuth.js\
$(JAYSVCUTIL_DIR)/JaySvcUtil.js\
$(BASEMODULE_DIR)/deferred.js\
- $(TYPES_DIR)/JayStorm.js\
JAYDATA_SERVER = $(BASEMODULE_DIR)/qDeferred.js\
$(JSERVICE_DIR)/Scripts/datajs-1.0.3-patched.js\
@@ -154,9 +148,6 @@ JAYDATA_SERVER = $(BASEMODULE_DIR)/qDeferred.js\
$(ODATAPARSER_DIR)/ODataEntityExpressionBuilder.js\
$(ODATAPARSER_DIR)/Visitors/ObjectLiteralBuilderVisitor.js\
-IndexedDbProvider = $(TYPES_DIR)/StorageProviders/IndexedDB/IndexedDBConverter.js\
- $(TYPES_DIR)/StorageProviders/IndexedDB/IndexedDBStorageProvider.js\
-
DbCommand = $(TYPES_DIR)/DbClient/DbCommand.js\
$(TYPES_DIR)/DbClient/DbConnection.js\
$(TYPES_DIR)/DbClient/OpenDatabaseClient/OpenDbCommand.js\
@@ -177,33 +168,6 @@ SqLiteProvider = $(DbCommand)\
$(TYPES_DIR)/StorageProviders/SqLite/SqlFilterCompiler.js\
$(TYPES_DIR)/StorageProviders/SqLite/ModelBinder/sqLite_ModelBinderCompiler.js\
-oDataProvider = $(TYPES_DIR)/StorageProviders/oData/oDataConverter.js\
- $(TYPES_DIR)/StorageProviders/oData/oDataProvider.js\
- $(TYPES_DIR)/StorageProviders/oData/oDataCompiler.js\
- $(TYPES_DIR)/StorageProviders/oData/oDataWhereCompiler.js\
- $(TYPES_DIR)/StorageProviders/oData/oDataOrderCompiler.js\
- $(TYPES_DIR)/StorageProviders/oData/oDataPagingCompiler.js\
- $(TYPES_DIR)/StorageProviders/oData/oDataProjectionCompiler.js\
-
-FacebookProvider = $(TYPES_DIR)/StorageProviders/Facebook/FacebookConverter.js\
- $(TYPES_DIR)/StorageProviders/Facebook/FacebookProvider.js\
- $(TYPES_DIR)/StorageProviders/Facebook/FacebookCompiler.js\
- $(TYPES_DIR)/StorageProviders/Facebook/EntitySets/FQL/user.js\
- $(TYPES_DIR)/StorageProviders/Facebook/EntitySets/FQL/friend.js\
- $(TYPES_DIR)/StorageProviders/Facebook/EntitySets/FQL/page.js\
- $(TYPES_DIR)/StorageProviders/Facebook/EntitySets/FQLContext.js\
-
-YQLProvider = $(TYPES_DIR)/StorageProviders/YQL/YQLConverter.js\
- $(TYPES_DIR)/StorageProviders/YQL/YQLProvider.js\
- $(TYPES_DIR)/StorageProviders/YQL/YQLCompiler.js\
- $(TYPES_DIR)/StorageProviders/YQL/EntitySets/geo.js\
- $(TYPES_DIR)/StorageProviders/YQL/EntitySets/YQLContext.js\
-
-InMemoryProvider = $(TYPES_DIR)/StorageProviders/InMemory/InMemoryConverter.js\
- $(TYPES_DIR)/StorageProviders/InMemory/InMemoryProvider.js\
- $(TYPES_DIR)/StorageProviders/InMemory/InMemoryCompiler.js\
- $(TYPES_DIR)/StorageProviders/InMemory/InMemoryFunctionCompiler.js\
-
MongoDbProvider = $(TYPES_DIR)/StorageProviders/InMemory/InMemoryConverter.js\
$(TYPES_DIR)/StorageProviders/mongoDB/mongoDBConverter.js\
$(TYPES_DIR)/StorageProviders/mongoDB/mongoDBModelBinderConfigCompiler.js\
@@ -216,92 +180,23 @@ MongoDbProvider = $(TYPES_DIR)/StorageProviders/InMemory/InMemoryConverter.js\
$(TYPES_DIR)/StorageProviders/mongoDB/mongoDBStorageProvider.js\
$(TYPES_DIR)/StorageProviders/mongoDB/ClientObjectID.js\
-StormProvider = $(TYPES_DIR)/StorageProviders/Storm/StormStorageProvider.js\
-
-WebApiProvider = $(TYPES_DIR)/StorageProviders/WebApi/WebApiConverter.js\
- $(TYPES_DIR)/StorageProviders/WebApi/WebApiProvider.js\
-
-DeferredModule = $(BASEMODULE_DIR)/deferred.js\
-
-ErrorHandlerModule = $(BASEMODULE_DIR)/errorhandler.js\
-
-FormBinderModule = $(BASEMODULE_DIR)/formBinder.js\
-
-HandlebarsModule = $(BASEMODULE_DIR)/handlebars.js\
-
-InMemoryModule = $(BASEMODULE_DIR)/inMemory.js\
-
-KendoModule = $(BASEMODULE_DIR)/kendo.js\
-
-KnockoutModule = $(BASEMODULE_DIR)/knockout.js\
-
-QDeferredModule = $(BASEMODULE_DIR)/qDeferred.js\
-
-SenchaModule = $(BASEMODULE_DIR)/sencha.js\
-
-TemplateModule = $(BASEMODULE_DIR)/template.js\
-
-ValidateModule = $(BASEMODULE_DIR)/validate.js\
-
-AngularModule = $(BASEMODULE_DIR)/angular.js\
-
-MsCrmModule = $(BASEMODULE_DIR)/jaydata.mscrm.js\
-
-MsCrmServerModule = $(BASEMODULE_DIR)/jaydata.mscrm.server.js\
-
+libRETSProvider = $(TYPES_DIR)/StorageProviders/InMemory/InMemoryConverter.js\
+ $(TYPES_DIR)/StorageProviders/libRETS/libRETSStorageProvider.js\
clean:
@@test ! -d $(TARGET_DIR) || rm -r $(TARGET_DIR)
@@test ! -d $(RELEASE_DIR) || rm -r $(RELEASE_DIR)
-modules: jaydatamodules
- @@rm -r $(TEMP_DIR)
-
release: all
@@echo "Create release folder..."
@@test -d $(RELEASE_DIR) || mkdir -p $(RELEASE_DIR)
- @@test -d $(RELEASE_DIR)/jaydatamodules || mkdir -p $(RELEASE_DIR)/jaydatamodules
- @@test -d $(RELEASE_DIR)/jaydataproviders || mkdir -p $(RELEASE_DIR)/jaydataproviders
- @@cp -r $(MODULE_DIR)/* $(RELEASE_DIR)/jaydatamodules
- @@cp -r $(PROVIDERS_DIR)/* $(RELEASE_DIR)/jaydataproviders
@@cp $(TARGET_DIR)/jaydata.js $(RELEASE_DIR)
@@cp $(TARGET_DIR)/jaydata.min.js $(RELEASE_DIR)
- @@cp $(TARGET_DIR)/jaydata-vsdoc.js $(RELEASE_DIR)
-all: jaydatavsdoc jaydatamin jaydata providers jaydatamodules npms
+all: jaydatamin jaydata npms
@@rm -r $(TEMP_DIR)
-npms: npmjaydata npmjaydata-core npmjaydata-server npmindexeddb npmsqlite npmodata npminmemory npmmongodb npmstorm npmwebapi
-
-npmjaydata-core: $(TYPE_SYSTEM) $(JAYDATA_SOURCE) $(CREDITS)
- @@echo "Building jaydata-core npm package..."
- @@test -d $(NPM_DIR)/jaydata-core || mkdir -p $(NPM_DIR)/jaydata-core
- @@cp -r $(NPM_BASE_DIR)/jaydata/* $(NPM_DIR)/jaydata-core
- @@cp -r $(TYPESYSTEM_DIR) $(NPM_DIR)/jaydata-core/lib
- @@cat $(NPM_DIR)/jaydata-core/lib/$(TYPE_SYSTEM_NPM) | \
- sed -e 's/$data.version = "JayData [0-9].[0-9].[0-9]"/$data.version = "JayData $(VERSION)"/;s/$data.versionNumber = "[0-9].[0-9].[0-9]"/$data.versionNumber = "$(VERSION)"/' > $(NPM_DIR)/jaydata-core/lib/$(TYPE_SYSTEM_NPM).bak
- @@mv $(NPM_DIR)/jaydata-core/lib/$(TYPE_SYSTEM_NPM).bak $(NPM_DIR)/jaydata-core/lib/$(TYPE_SYSTEM_NPM)
- @@rsync -R $(JAYDATA_SOURCE) $(NPM_DIR)/jaydata-core/lib
- @@cp -r $(GPL_LIC) $(NPM_DIR)/jaydata-core
- @@cp -r $(MIT_LIC) $(NPM_DIR)/jaydata-core
- @@cp -r $(CREDITS) $(NPM_DIR)/jaydata-core
- @$(foreach dir,$(TYPE_SYSTEM),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata-core/lib/index.js;)
- @$(foreach dir,$(JAYDATA_SOURCE),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata-core/lib/index.js;)
- @@echo 'module.exports = $$data;' >> $(NPM_DIR)/jaydata-core/lib/index.js
- @@sed -e 's/"dependencies": {},/"dependencies": {"datajs": "1.0.3", "q": "0.8.5", "qs": "0.5.0", "xmldom": "0.1.11", "url": ">0.0.1", "acorn": "0.1.0"},/;s/"name": "jaydata"/"name": "jaydata-core"/;s/jaydata@[0-9].[0-9].[0-9]/jaydata@$(VERSION)/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/' $(NPM_BASE_DIR)/jaydata/package.json > $(NPM_DIR)/jaydata-core/package.json
-
-npmjaydata-server: $(JAYDATA_SERVER) $(CREDITS)
- @@echo "Building jaydata-server npm package..."
- @@test -d $(NPM_DIR)/jaydata-server || mkdir -p $(NPM_DIR)/jaydata-server
- @@cp -r $(NPM_BASE_DIR)/provider/* $(NPM_DIR)/jaydata-server
- @@rsync -R $(JAYDATA_SERVER) $(NPM_DIR)/jaydata-server/lib
- @@cp -r $(GPL_LIC) $(NPM_DIR)/jaydata-server
- @@cp -r $(MIT_LIC) $(NPM_DIR)/jaydata-server
- @@cp -r $(CREDITS) $(NPM_DIR)/jaydata-server
- @@echo "try{ require('jaydata-core'); }catch(e){}" >> $(NPM_DIR)/jaydata-server/lib/index.js;
- @$(foreach dir,$(JAYDATA_SERVER),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata-server/lib/index.js;)
- @@echo 'module.exports = $$data;' >> $(NPM_DIR)/jaydata-server/lib/index.js
- @@sed -e 's/"name": "jaydata"/"name": "jaydata-server"/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/;s/"jaydata-core": "[0-9].[0-9].[0-9]"/"jaydata-core":"$(VERSION)"/' $(NPM_BASE_DIR)/provider/package.json > $(NPM_DIR)/jaydata-server/package.json
+npms: npmjaydata
npmjaydata: $(TYPE_SYSTEM) $(JAYDATA_SOURCE) $(CREDITS)
@@echo "Building jaydata npm package..."
@@ -312,318 +207,25 @@ npmjaydata: $(TYPE_SYSTEM) $(JAYDATA_SOURCE) $(CREDITS)
sed -e 's/$data.version = "JayData [0-9].[0-9].[0-9]"/$data.version = "JayData $(VERSION)"/;s/$data.versionNumber = "[0-9].[0-9].[0-9]"/$data.versionNumber = "$(VERSION)"/' > $(NPM_DIR)/jaydata/lib/$(TYPE_SYSTEM_NPM).bak
@@mv $(NPM_DIR)/jaydata/lib/$(TYPE_SYSTEM_NPM).bak $(NPM_DIR)/jaydata/lib/$(TYPE_SYSTEM_NPM)
@@rsync -R $(JAYDATA_SOURCE) $(NPM_DIR)/jaydata/lib
- @@rsync -R $(IndexedDbProvider) $(NPM_DIR)/jaydata/lib
@@rsync -R $(SqLiteProvider) $(NPM_DIR)/jaydata/lib
- @@rsync -R $(oDataProvider) $(NPM_DIR)/jaydata/lib
- @@rsync -R $(WebApiProvider) $(NPM_DIR)/jaydata/lib
- @@rsync -R $(InMemoryProvider) $(NPM_DIR)/jaydata/lib
@@rsync -R $(MongoDbProvider) $(NPM_DIR)/jaydata/lib
- @@rsync -R $(StormProvider) $(NPM_DIR)/jaydata/lib
- @@rsync -R $(FacebookProvider) $(NPM_DIR)/jaydata/lib
- @@rsync -R $(YQLProvider) $(NPM_DIR)/jaydata/lib
+ @@rsync -R $(libRETSProvider) $(NPM_DIR)/jaydata/lib
@@rsync -R $(JAYDATA_SERVER) $(NPM_DIR)/jaydata/lib
@@cp -r $(GPL_LIC) $(NPM_DIR)/jaydata
@@cp -r $(MIT_LIC) $(NPM_DIR)/jaydata
@@cp -r $(CREDITS) $(NPM_DIR)/jaydata
@$(foreach dir,$(TYPE_SYSTEM),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/index.js;)
@$(foreach dir,$(JAYDATA_SOURCE),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/index.js;)
- @@rm -f $(NPM_DIR)/jaydata/lib/indexeddb_index.js;)
- @$(foreach dir,$(IndexedDbProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/indexeddb_index.js;)
- @@rm -f $(NPM_DIR)/jaydata/lib/sqlite_index.js;)
@$(foreach dir,$(SqLiteProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/sqlite_index.js;)
- @@rm -f $(NPM_DIR)/jaydata/lib/odata_index.js;)
- @$(foreach dir,$(oDataProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/odata_index.js;)
- @@rm -f $(NPM_DIR)/jaydata/lib/webapi_index.js;)
- @$(foreach dir,$(WebApiProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/webapi_index.js;)
- @@rm -f $(NPM_DIR)/jaydata/lib/inmemory_index.js;)
- @$(foreach dir,$(InMemoryProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/inmemory_index.js;)
- @@rm -f $(NPM_DIR)/jaydata/lib/mongodb_index.js;)
@$(foreach dir,$(MongoDbProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/mongodb_index.js;)
- @@rm -f $(NPM_DIR)/jaydata/lib/storm_index.js;)
- @$(foreach dir,$(StormProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/storm_index.js;)
- @@rm -f $(NPM_DIR)/jaydata/lib/facebook_index.js;)
- @$(foreach dir,$(FacebookProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/facebook_index.js;)
- @@rm -f $(NPM_DIR)/jaydata/lib/yql_index.js;)
- @$(foreach dir,$(YQLProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/yql_index.js;)
- @@rm -f $(NPM_DIR)/jaydata/lib/service_index.js;)
+ @$(foreach dir,$(libRETSProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/librets_index.js;)
@$(foreach dir,$(JAYDATA_SERVER),echo "require('"$(dir)"');" >> $(NPM_DIR)/jaydata/lib/service_index.js;)
- @@echo "require('./indexeddb_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
@@echo "require('./sqlite_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
- @@echo "require('./odata_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
- @@echo "require('./webapi_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
- @@echo "require('./inmemory_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
@@echo "require('./mongodb_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
- @@echo "require('./storm_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
- @@echo "require('./facebook_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
- @@echo "require('./yql_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
+ @@echo "require('./librets_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
@@echo "require('./service_index.js');" >> $(NPM_DIR)/jaydata/lib/index.js;
@@echo 'module.exports = $$data;' >> $(NPM_DIR)/jaydata/lib/index.js
- @@sed -e 's/"dependencies": {},/"dependencies": {"datajs": "1.0.3", "q": "0.8.5", "qs": "0.5.0", "xmldom": "0.1.11", "url": ">0.0.1", "acorn": "0.1.0"},/;s/jaydata@[0-9].[0-9].[0-9]/jaydata@$(VERSION)/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/' $(NPM_BASE_DIR)/jaydata/package.json > $(NPM_DIR)/jaydata/package.json
-
-npmindexeddb: $(IndexedDbProvider) $(CREDITS)
- @@echo "Building IndexedDb provider npm package..."
- @@test -d $(NPM_DIR)/indexeddb || mkdir -p $(NPM_DIR)/indexeddb
- @@cp -r $(NPM_BASE_DIR)/provider/* $(NPM_DIR)/indexeddb
- @@rsync -R $(IndexedDbProvider) $(NPM_DIR)/indexeddb/lib
- @@cp -r $(GPL_LIC) $(NPM_DIR)/indexeddb
- @@cp -r $(MIT_LIC) $(NPM_DIR)/indexeddb
- @@cp -r $(CREDITS) $(NPM_DIR)/indexeddb
- @@echo "try{ require('jaydata-core'); }catch(e){}" >> $(NPM_DIR)/indexeddb/lib/index.js;
- @$(foreach dir,$(IndexedDbProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/indexeddb/lib/index.js;)
- @@echo 'module.exports = $$data;' >> $(NPM_DIR)/indexeddb/lib/index.js
- @@sed -e 's/"name": "jaydata"/"name": "jaydata-indexeddb"/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/;s/"jaydata-core": "[0-9].[0-9].[0-9]"/"jaydata-core":"$(VERSION)"/' $(NPM_BASE_DIR)/provider/package.json > $(NPM_DIR)/indexeddb/package.json
-
-npmsqlite: $(SqLiteProvider) $(CREDITS)
- @@echo "Building SqLiteProvider provider npm package..."
- @@test -d $(NPM_DIR)/sqlite || mkdir -p $(NPM_DIR)/sqlite
- @@cp -r $(NPM_BASE_DIR)/provider/* $(NPM_DIR)/sqlite
- @@rsync -R $(SqLiteProvider) $(NPM_DIR)/sqlite/lib
- @@cp -r $(GPL_LIC) $(NPM_DIR)/sqlite
- @@cp -r $(MIT_LIC) $(NPM_DIR)/sqlite
- @@cp -r $(CREDITS) $(NPM_DIR)/sqlite
- @@echo "try{ require('jaydata-core'); }catch(e){}" >> $(NPM_DIR)/sqlite/lib/index.js;
- @$(foreach dir,$(SqLiteProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/sqlite/lib/index.js;)
- @@echo 'module.exports = $$data;' >> $(NPM_DIR)/sqlite/lib/index.js
- @@sed -e 's/"name": "jaydata"/"name": "jaydata-sqlite"/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/;s/"jaydata-core": "[0-9].[0-9].[0-9]"/"jaydata-core":"$(VERSION)"/' $(NPM_BASE_DIR)/provider/package.json > $(NPM_DIR)/sqlite/package.json
-
-npmodata: $(oDataProvider) $(CREDITS)
- @@echo "Building oDataProvider provider npm package..."
- @@test -d $(NPM_DIR)/odata || mkdir -p $(NPM_DIR)/odata
- @@cp -r $(NPM_BASE_DIR)/provider/* $(NPM_DIR)/odata
- @@rsync -R $(oDataProvider) $(NPM_DIR)/odata/lib
- @@cp -r $(GPL_LIC) $(NPM_DIR)/odata
- @@cp -r $(MIT_LIC) $(NPM_DIR)/odata
- @@cp -r $(CREDITS) $(NPM_DIR)/odata
- @@echo "require('datajs');" >> $(NPM_DIR)/odata/lib/index.js;
- @@echo "try{ require('jaydata-core'); }catch(e){}" >> $(NPM_DIR)/odata/lib/index.js;
- @$(foreach dir,$(oDataProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/odata/lib/index.js;)
- @@echo 'module.exports = $$data;' >> $(NPM_DIR)/odata/lib/index.js
- @@sed -e 's/"name": "jaydata"/"name": "jaydata-odata"/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/;s/"jaydata-core": "[0-9].[0-9].[0-9]"/"jaydata-core":"$(VERSION)","datajs": "1.0.3"/' $(NPM_BASE_DIR)/provider/package.json > $(NPM_DIR)/odata/package.json
-
-npmwebapi: $(WebApiProvider) $(CREDITS)
- @@echo "Building WebApiProvider provider npm package..."
- @@test -d $(NPM_DIR)/webapi || mkdir -p $(NPM_DIR)/webapi
- @@cp -r $(NPM_BASE_DIR)/provider/* $(NPM_DIR)/webapi
- @@rsync -R $(WebApiProvider) $(NPM_DIR)/webapi/lib
- @@cp -r $(GPL_LIC) $(NPM_DIR)/webapi
- @@cp -r $(MIT_LIC) $(NPM_DIR)/webapi
- @@cp -r $(CREDITS) $(NPM_DIR)/webapi
- @@echo "require('datajs');" >> $(NPM_DIR)/webapi/lib/index.js;
- @@echo "try{ require('jaydata-core'); }catch(e){}" >> $(NPM_DIR)/webapi/lib/index.js;
- @$(foreach dir,$(WebApiProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/webapi/lib/index.js;)
- @@echo 'module.exports = $$data;' >> $(NPM_DIR)/webapi/lib/index.js
- @@sed -e 's/"name": "jaydata"/"name": "jaydata-webapi"/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/;s/"jaydata-core": "[0-9].[0-9].[0-9]"/"jaydata-core":"$(VERSION)","datajs": "1.0.3"/' $(NPM_BASE_DIR)/provider/package.json > $(NPM_DIR)/webapi/package.json
-
-
-npminmemory: $(InMemoryProvider) $(CREDITS)
- @@echo "Building InMemoryProvider provider npm package..."
- @@test -d $(NPM_DIR)/inmemory || mkdir -p $(NPM_DIR)/inmemory
- @@cp -r $(NPM_BASE_DIR)/provider/* $(NPM_DIR)/inmemory
- @@rsync -R $(InMemoryProvider) $(NPM_DIR)/inmemory/lib
- @@cp -r $(GPL_LIC) $(NPM_DIR)/inmemory
- @@cp -r $(MIT_LIC) $(NPM_DIR)/inmemory
- @@cp -r $(CREDITS) $(NPM_DIR)/inmemory
- @@echo "try{ require('jaydata-core'); }catch(e){}" >> $(NPM_DIR)/inmemory/lib/index.js;
- @$(foreach dir,$(InMemoryProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/inmemory/lib/index.js;)
- @@echo 'module.exports = $$data;' >> $(NPM_DIR)/inmemory/lib/index.js
- @@sed -e 's/"name": "jaydata"/"name": "jaydata-inmemory"/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/;s/"jaydata-core": "[0-9].[0-9].[0-9]"/"jaydata-core":"$(VERSION)"/' $(NPM_BASE_DIR)/provider/package.json > $(NPM_DIR)/inmemory/package.json
-
-npmmongodb: $(MongoDbProvider) $(CREDITS)
- @@echo "Building MongoDbProvider provider npm package..."
- @@test -d $(NPM_DIR)/mongodb || mkdir -p $(NPM_DIR)/mongodb
- @@cp -r $(NPM_BASE_DIR)/provider/* $(NPM_DIR)/mongodb
- @@rsync -R $(MongoDbProvider) $(NPM_DIR)/mongodb/lib
- @@cp -r $(GPL_LIC) $(NPM_DIR)/mongodb
- @@cp -r $(MIT_LIC) $(NPM_DIR)/mongodb
- @@cp -r $(CREDITS) $(NPM_DIR)/mongodb
- @@echo "try{ require('jaydata-core'); }catch(e){}" >> $(NPM_DIR)/mongodb/lib/index.js;
- @$(foreach dir,$(MongoDbProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/mongodb/lib/index.js;)
- @@echo 'module.exports = $$data;' >> $(NPM_DIR)/mongodb/lib/index.js
- @@sed -e 's/"name": "jaydata"/"name": "jaydata-mongodb"/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/;s/"jaydata-core": "[0-9].[0-9].[0-9]"/"jaydata-core":"$(VERSION)"/' $(NPM_BASE_DIR)/provider/package.json > $(NPM_DIR)/mongodb/package.json
-
-npmstorm: $(StormProvider) $(CREDITS)
- @@echo "Building StormProvider provider npm package..."
- @@test -d $(NPM_DIR)/storm || mkdir -p $(NPM_DIR)/storm
- @@cp -r $(NPM_BASE_DIR)/provider/* $(NPM_DIR)/storm
- @@rsync -R $(StormProvider) $(NPM_DIR)/storm/lib
- @@cp -r $(GPL_LIC) $(NPM_DIR)/storm
- @@cp -r $(MIT_LIC) $(NPM_DIR)/storm
- @@cp -r $(CREDITS) $(NPM_DIR)/storm
- @@echo "try{ require('jaydata-core'); }catch(e){}" >> $(NPM_DIR)/storm/lib/index.js;
- @$(foreach dir,$(StormProvider),echo "require('"$(dir)"');" >> $(NPM_DIR)/storm/lib/index.js;)
- @@echo 'module.exports = $$data;' >> $(NPM_DIR)/storm/lib/index.js
- @@sed -e 's/"name": "jaydata"/"name": "jaydata-storm"/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/;s/"jaydata-core": "[0-9].[0-9].[0-9]"/"jaydata-core":"$(VERSION)","jaydata-inmemory": "$(VERSION)"/' $(NPM_BASE_DIR)/provider/package.json > $(NPM_DIR)/storm/package.json
-
-providers: indexeddbprovider sqliteprovider odataprovider facebookprovider yqlprovider inmemoryprovider mongodbprovider stormprovider webapiprovider
-
-indexeddbprovider: $(IndexedDbProvider) $(CREDITS)
- @@echo "Building IndexedDbProvider provider..."
- @@test -d $(PROVIDERS_DIR) || mkdir -p $(PROVIDERS_DIR)
- @@cat $(CREDITS) $(IndexedDbProvider) > $(PROVIDERS_DIR)/IndexedDbProvider.js
- @@java -jar $(COMPILER) --js $(PROVIDERS_DIR)/IndexedDbProvider.js --js_output_file $(TEMP_DIR)/IndexedDbProvider.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/IndexedDbProvider.min.js > $(PROVIDERS_DIR)/IndexedDbProvider.min.js
-
-sqliteprovider: $(SqLiteProvider) $(CREDITS)
- @@echo "Building SqLiteProvider provider..."
- @@test -d $(PROVIDERS_DIR) || mkdir -p $(PROVIDERS_DIR)
- @@cat $(CREDITS) $(SqLiteProvider) > $(PROVIDERS_DIR)/SqLiteProvider.js
- @@java -jar $(COMPILER) --js $(PROVIDERS_DIR)/SqLiteProvider.js --js_output_file $(TEMP_DIR)/SqLiteProvider.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/SqLiteProvider.min.js > $(PROVIDERS_DIR)/SqLiteProvider.min.js
-
-odataprovider: $(oDataProvider) $(CREDITS)
- @@echo "Building oDataProvider provider..."
- @@test -d $(PROVIDERS_DIR) || mkdir -p $(PROVIDERS_DIR)
- @@cat $(CREDITS) $(oDataProvider) > $(PROVIDERS_DIR)/oDataProvider.js
- @@java -jar $(COMPILER) --js $(PROVIDERS_DIR)/oDataProvider.js --js_output_file $(TEMP_DIR)/oDataProvider.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/oDataProvider.min.js > $(PROVIDERS_DIR)/oDataProvider.min.js
-
-webapiprovider: $(WebApiProvider) $(CREDITS)
- @@echo "Building WebApiProvider provider..."
- @@test -d $(PROVIDERS_DIR) || mkdir -p $(PROVIDERS_DIR)
- @@cat $(CREDITS) $(WebApiProvider) > $(PROVIDERS_DIR)/WebApiProvider.js
- @@java -jar $(COMPILER) --js $(PROVIDERS_DIR)/WebApiProvider.js --js_output_file $(TEMP_DIR)/WebApiProvider.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/WebApiProvider.min.js > $(PROVIDERS_DIR)/WebApiProvider.min.js
-
-facebookprovider: $(FacebookProvider) $(CREDITS)
- @@echo "Building FacebookProvider provider..."
- @@test -d $(PROVIDERS_DIR) || mkdir -p $(PROVIDERS_DIR)
- @@cat $(CREDITS) $(FacebookProvider) > $(PROVIDERS_DIR)/FacebookProvider.js
- @@java -jar $(COMPILER) --js $(PROVIDERS_DIR)/FacebookProvider.js --js_output_file $(TEMP_DIR)/FacebookProvider.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/FacebookProvider.min.js > $(PROVIDERS_DIR)/FacebookProvider.min.js
-
-yqlprovider: $(YQLProvider) $(CREDITS)
- @@echo "Building YQLProvider provider..."
- @@test -d $(PROVIDERS_DIR) || mkdir -p $(PROVIDERS_DIR)
- @@cat $(CREDITS) $(YQLProvider) > $(PROVIDERS_DIR)/YQLProvider.js
- @@java -jar $(COMPILER) --js $(PROVIDERS_DIR)/YQLProvider.js --js_output_file $(TEMP_DIR)/YQLProvider.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/YQLProvider.min.js > $(PROVIDERS_DIR)/YQLProvider.min.js
-
-inmemoryprovider: $(InMemoryProvider) $(CREDITS)
- @@echo "Building InMemoryProvider provider..."
- @@test -d $(PROVIDERS_DIR) || mkdir -p $(PROVIDERS_DIR)
- @@cat $(CREDITS) $(InMemoryProvider) > $(PROVIDERS_DIR)/InMemoryProvider.js
- @@java -jar $(COMPILER) --js $(PROVIDERS_DIR)/InMemoryProvider.js --js_output_file $(TEMP_DIR)/InMemoryProvider.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/InMemoryProvider.min.js > $(PROVIDERS_DIR)/InMemoryProvider.min.js
-
-mongodbprovider: $(MongoDbProvider) $(CREDITS)
- @@echo "Building MongoDbProvider provider..."
- @@test -d $(PROVIDERS_DIR) || mkdir -p $(PROVIDERS_DIR)
- @@cat $(CREDITS) $(MongoDbProvider) > $(PROVIDERS_DIR)/MongoDbProvider.js
- @@java -jar $(COMPILER) --js $(PROVIDERS_DIR)/MongoDbProvider.js --js_output_file $(TEMP_DIR)/MongoDbProvider.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/MongoDbProvider.min.js > $(PROVIDERS_DIR)/MongoDbProvider.min.js
-
-stormprovider: $(StormProvider) $(CREDITS)
- @@echo "Building StormProvider provider..."
- @@test -d $(PROVIDERS_DIR) || mkdir -p $(PROVIDERS_DIR)
- @@cat $(StormProvider) > $(PROVIDERS_DIR)/StormProvider.js
- @@java -jar $(COMPILER) --js $(PROVIDERS_DIR)/StormProvider.js --js_output_file $(TEMP_DIR)/StormProvider.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/StormProvider.min.js > $(PROVIDERS_DIR)/StormProvider.min.js
-
-jaydatamodules: deferredmodule errorhandlermodule formbindermodule handlebarsmodule inmemorymodule kendomodule knockoutmodule qdeferredmodule senchamodule templatemodule validatemodule mscrmmodule mscrmservermodule angularmodule
-
-deferredmodule: $(DeferredModule) $(CREDITS)
- @@echo "Building Deferred module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(DeferredModule) > $(MODULE_DIR)/deferred.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/deferred.js --js_output_file $(TEMP_DIR)/deferred.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/deferred.min.js > $(MODULE_DIR)/deferred.min.js
-
-errorhandlermodule: $(ErrorHandlerModule) $(CREDITS)
- @@echo "Building ErrorHandler module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(ErrorHandlerModule) > $(MODULE_DIR)/errorhandler.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/errorhandler.js --js_output_file $(TEMP_DIR)/errorhandler.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/errorhandler.min.js > $(MODULE_DIR)/errorhandler.min.js
-
-formbindermodule: $(FormBinderModule) $(CREDITS)
- @@echo "Building FormBinder module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(FormBinderModule) > $(MODULE_DIR)/formBinder.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/formBinder.js --js_output_file $(TEMP_DIR)/formBinder.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/formBinder.min.js > $(MODULE_DIR)/formBinder.min.js
-
-handlebarsmodule: $(HandlebarsModule) $(CREDITS)
- @@echo "Building Handlebars module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(HandlebarsModule) > $(MODULE_DIR)/handlebars.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/handlebars.js --js_output_file $(TEMP_DIR)/handlebars.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/handlebars.min.js > $(MODULE_DIR)/handlebars.min.js
-
-inmemorymodule: $(InMemoryModule) $(CREDITS)
- @@echo "Building InMemory module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(InMemoryModule) > $(MODULE_DIR)/inMemory.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/inMemory.js --js_output_file $(TEMP_DIR)/inMemory.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/inMemory.min.js > $(MODULE_DIR)/inMemory.min.js
-
-kendomodule: $(KendoModule) $(CREDITS)
- @@echo "Building Kendo module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(KendoModule) > $(MODULE_DIR)/kendo.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/kendo.js --js_output_file $(TEMP_DIR)/kendo.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/kendo.min.js > $(MODULE_DIR)/kendo.min.js
-
-knockoutmodule: $(KnockoutModule) $(CREDITS)
- @@echo "Building Knockout module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(KnockoutModule) > $(MODULE_DIR)/knockout.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/knockout.js --js_output_file $(TEMP_DIR)/knockout.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/knockout.min.js > $(MODULE_DIR)/knockout.min.js
-
-qdeferredmodule: $(QDeferredModule) $(CREDITS)
- @@echo "Building QDeferred module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(QDeferredModule) > $(MODULE_DIR)/qDeferred.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/qDeferred.js --js_output_file $(TEMP_DIR)/qDeferred.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/qDeferred.min.js > $(MODULE_DIR)/qDeferred.min.js
-
-senchamodule: $(SenchaModule) $(CREDITS)
- @@echo "Building Sencha module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(SenchaModule) > $(MODULE_DIR)/sencha.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/sencha.js --js_output_file $(TEMP_DIR)/sencha.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/sencha.min.js > $(MODULE_DIR)/sencha.min.js
-
-templatemodule: $(TemplateModule) $(CREDITS)
- @@echo "Building Template module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(TemplateModule) > $(MODULE_DIR)/template.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/template.js --js_output_file $(TEMP_DIR)/template.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/template.min.js > $(MODULE_DIR)/template.min.js
-
-validatemodule: $(ValidateModule) $(CREDITS)
- @@echo "Building Validate module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(ValidateModule) > $(MODULE_DIR)/validate.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/validate.js --js_output_file $(TEMP_DIR)/validate.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/validate.min.js > $(MODULE_DIR)/validate.min.js
-
-angularmodule: $(AngularModule) $(CREDITS)
- @@echo "Building Angular module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(AngularModule) > $(MODULE_DIR)/angular.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/angular.js --js_output_file $(TEMP_DIR)/angular.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/angular.min.js > $(MODULE_DIR)/angular.min.js
-
-mscrmmodule: $(MsCrmModule) $(CREDITS)
- @@echo "Building MsCrm module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(MsCrmModule) > $(MODULE_DIR)/jaydata.mscrm.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/jaydata.mscrm.js --js_output_file $(TEMP_DIR)/jaydata.mscrm.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/jaydata.mscrm.min.js > $(MODULE_DIR)/jaydata.mscrm.min.js
-
-mscrmservermodule: $(MsCrmServerModule) $(CREDITS)
- @@echo "Building MsCrm Server module..."
- @@test -d $(MODULE_DIR) || mkdir -p $(MODULE_DIR)
- @@cat $(CREDITS) $(MsCrmServerModule) > $(MODULE_DIR)/jaydata.mscrm.server.js
- @@java -jar $(COMPILER) --js $(MODULE_DIR)/jaydata.mscrm.server.js --js_output_file $(TEMP_DIR)/jaydata.mscrm.server.min.js
- @@cat $(CREDITS) $(TEMP_DIR)/jaydata.mscrm.server.min.js > $(MODULE_DIR)/jaydata.mscrm.server.min.js
-
-jaydatavsdoc: jaydata $(CREDITS)
- @@echo "Building JayData vsdoc version..."
- @@test -d $(TEMP_DIR) || mkdir -p $(TEMP_DIR)
- @@cat $(VSDOC_SOURCE) $(TEMP_DIR)/jaydata.js > $(TEMP_DIR)/jaydata-vsdoc.js
- @@cat $(CREDITS) $(TEMP_DIR)/jaydata-vsdoc.js > $(TARGET_DIR)/jaydata-vsdoc.js
+ @@sed -e 's/"dependencies": {},/"dependencies": {"datajs": "1.0.3", "q": "0.8.5", "qs": "2.2.4", "xmldom": "0.1.11", "url": ">0.0.1", "acorn": "0.1.0","jaydata-librets": "*"},/;s/jaydata@[0-9].[0-9].[0-9]/jaydata@$(VERSION)/;s/"version": "[0-9].[0-9].[0-9]"/"version": "$(VERSION)"/' $(NPM_BASE_DIR)/jaydata/package.json > $(NPM_DIR)/jaydata/package.json
jaydatamin: jaydata $(CREDITS)
@@echo "Minifying JayData library..."
@@ -648,7 +250,5 @@ $(CREDITS): $(CREDITS_BASE)
@@test -d $(TEMP_DIR) || mkdir -p $(TEMP_DIR)
@@sed -e 's/JayData [0-9].[0-9].[0-9]/JayData $(VERSION)/' $(CREDITS_BASE) > $(CREDITS)
--include ./Pro/Makefile
-
.PHONY: JayDataMin JayData JayDataStandaloneMin JayDataStandalone All
diff --git a/Scripts/datajs-1.0.3-patched.js b/Scripts/datajs-1.0.3-patched.js
new file mode 100644
index 00000000..a78dacdd
--- /dev/null
+++ b/Scripts/datajs-1.0.3-patched.js
@@ -0,0 +1,7518 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// datajs.js
+
+(function (window, undefined) {
+ if (!window.datajs) {
+ window.datajs = {};
+ }
+
+ if (!window.OData) {
+ window.OData = {};
+ }
+
+ var datajs = window.datajs;
+ var odata = window.OData;
+
+
+ // Provides an enumeration of possible kinds of payloads.
+ var PAYLOADTYPE_BATCH = "b";
+ var PAYLOADTYPE_COMPLEXTYPE = "c";
+ var PAYLOADTYPE_ENTRY = "entry"; // This is used when building the payload.
+ var PAYLOADTYPE_FEEDORLINKS = "f";
+ var PAYLOADTYPE_PRIMITIVETYPE = "p";
+ var PAYLOADTYPE_SVCDOC = "s";
+ var PAYLOADTYPE_UNKNOWN = "u";
+ var PAYLOADTYPE_NONE = "n";
+
+ // Provides an enumeration of possible kinds of properties.
+ var PROPERTYKIND_COMPLEX = "c";
+ var PROPERTYKIND_DEFERRED = "d";
+ var PROPERTYKIND_INLINE = "i";
+ var PROPERTYKIND_PRIMITIVE = "p";
+ var PROPERTYKIND_NONE = "n";
+
+ var assigned = function (value) {
+ /// Checks whether the specified value is different from null and undefined.
+ /// Value to check.
+ /// true if the value is assigned; false otherwise.
+ return value !== null && value !== undefined;
+ };
+
+ var contains = function (arr, item) {
+ /// Checks whether the specified item is in the array.
+ /// Array to check in.
+ /// Item to look for.
+ /// true if the item is contained, false otherwise.
+
+ var i, len;
+ for (i = 0, len = arr.length; i < len; i++) {
+ if (arr[i] === item) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
+ var defined = function (a, b) {
+ /// Given two values, picks the first one that is not undefined.
+ /// First value.
+ /// Second value.
+ /// a if it's a defined value; else b.
+ return (a !== undefined) ? a : b;
+ };
+
+ var delay = function (callback) {
+ /// Delays the invocation of the specified function until execution unwinds.
+ /// Callback function.
+ if (arguments.length === 1) {
+ window.setTimeout(callback, 0);
+ return;
+ }
+
+ var args = Array.prototype.slice.call(arguments, 1);
+ window.setTimeout(function () {
+ callback.apply(this, args);
+ }, 0);
+ };
+
+
+ var forEachSchema = function (metadata, callback) {
+ /// Invokes a function once per schema in metadata.
+ /// Metadata store; one of edmx, schema, or an array of any of them.
+ /// Callback function to invoke once per schema.
+ ///
+ /// The first truthy value to be returned from the callback; null or the last falsy value otherwise.
+ ///
+
+ if (!metadata) {
+ return null;
+ }
+
+ if (isArray(metadata)) {
+ var i, len, result;
+ for (i = 0, len = metadata.length; i < len; i++) {
+ result = forEachSchema(metadata[i], callback);
+ if (result) {
+ return result;
+ }
+ }
+
+ return null;
+ } else {
+ if (metadata.dataServices) {
+ return forEachSchema(metadata.dataServices.schema, callback);
+ }
+
+ return callback(metadata);
+ }
+ };
+
+ var isDateTimeOffset = function (value) {
+ /// Checks whether a Date object is DateTimeOffset value
+ /// Value to check.
+ /// true if the value is a DateTimeOffset, false otherwise.
+ return (value.__edmType === "Edm.DateTimeOffset" || (!value.__edmType && value.__offset));
+ };
+
+ var formatMilliseconds = function (ms, ns) {
+ /// Formats a millisecond and a nanosecond value into a single string.
+ /// Number of milliseconds to format.
+ /// Number of nanoseconds to format.
+ /// Formatted text.
+ /// If the value is already as string it's returned as-is.
+
+ // Avoid generating milliseconds if not necessary.
+ if (ms === 0) {
+ ms = "";
+ } else {
+ ms = "." + formatNumberWidth(ms.toString(), 3);
+ }
+ if (ns > 0) {
+ if (ms === "") {
+ ms = ".000";
+ }
+ ms += formatNumberWidth(ns.toString(), 4);
+ }
+ return ms;
+ };
+
+ var formatDateTimeOffset = function (value) {
+ /// Formats a DateTime or DateTimeOffset value a string.
+ /// Value to format.
+ /// Formatted text.
+ /// If the value is already as string it's returned as-is.
+
+ if (typeof value === "string") {
+ return value;
+ }
+
+ var hasOffset = isDateTimeOffset(value);
+ var offset = getCanonicalTimezone(value.__offset);
+ if (hasOffset && offset !== "Z") {
+ // We're about to change the value, so make a copy.
+ value = new Date(value.valueOf());
+
+ var timezone = parseTimezone(offset);
+ var hours = value.getUTCHours() + (timezone.d * timezone.h);
+ var minutes = value.getMinutes() + (timezone.d * timezone.m);
+
+ value.setUTCHours(hours, minutes);
+ } else if (!hasOffset) {
+ // Don't suffix a 'Z' for Edm.DateTime values.
+ offset = "";
+ }
+
+ var year = value.getUTCFullYear();
+ var month = value.getUTCMonth() + 1;
+ var sign = "";
+ if (year <= 0) {
+ year = -(year - 1);
+ sign = "-";
+ }
+
+ var ms = formatMilliseconds(value.getUTCMilliseconds(), value.__ns);
+
+ return sign +
+ formatNumberWidth(year, 4) + "-" +
+ formatNumberWidth(month, 2) + "-" +
+ formatNumberWidth(value.getUTCDate(), 2) + "T" +
+ formatNumberWidth(value.getUTCHours(), 2) + ":" +
+ formatNumberWidth(value.getUTCMinutes(), 2) + ":" +
+ formatNumberWidth(value.getUTCSeconds(), 2) +
+ ms + offset;
+ };
+
+ var formatDuration = function (value) {
+ /// Converts a duration to a string in xsd:duration format.
+ /// Object with ms and __edmType properties.
+ /// String representation of the time object in xsd:duration format.
+
+ var ms = value.ms;
+
+ var sign = "";
+ if (ms < 0) {
+ sign = "-";
+ ms = -ms;
+ }
+
+ var days = Math.floor(ms / 86400000);
+ ms -= 86400000 * days;
+ var hours = Math.floor(ms / 3600000);
+ ms -= 3600000 * hours;
+ var minutes = Math.floor(ms / 60000);
+ ms -= 60000 * minutes;
+ var seconds = Math.floor(ms / 1000);
+ ms -= seconds * 1000;
+
+ return sign + "P" +
+ formatNumberWidth(days, 2) + "DT" +
+ formatNumberWidth(hours, 2) + "H" +
+ formatNumberWidth(minutes, 2) + "M" +
+ formatNumberWidth(seconds, 2) +
+ formatMilliseconds(ms, value.ns) + "S";
+ };
+
+ var formatNumberWidth = function (value, width, append) {
+ /// Formats the specified value to the given width.
+ /// Number to format (non-negative).
+ /// Minimum width for number.
+ /// Flag indicating if the value is padded at the beginning (false) or at the end (true).
+ /// Text representation.
+ var result = value.toString(10);
+ while (result.length < width) {
+ if (append) {
+ result += "0";
+ } else {
+ result = "0" + result;
+ }
+ }
+
+ return result;
+ };
+
+ var getCanonicalTimezone = function (timezone) {
+ /// Gets the canonical timezone representation.
+ /// Timezone representation.
+ /// An 'Z' string if the timezone is absent or 0; the timezone otherwise.
+
+ return (!timezone || timezone === "Z" || timezone === "+00:00" || timezone === "-00:00") ? "Z" : timezone;
+ };
+
+ var invokeRequest = function (request, success, error, handler, httpClient, context) {
+ /// Sends a request containing OData payload to a server.
+ /// Object that represents the request to be sent..
+ /// Callback for a successful read operation.
+ /// Callback for handling errors.
+ /// Handler for data serialization.
+ /// HTTP client layer.
+ /// Context used for processing the request
+ return httpClient.request(request, function (response) {
+ try {
+ if (response.headers) {
+ normalizeHeaders(response.headers);
+ }
+
+ if (response.data === undefined) {
+ handler.read(response, context);
+ }
+ } catch (err) {
+ if (err.request === undefined) {
+ err.request = request;
+ }
+ if (err.response === undefined) {
+ err.response = response;
+ }
+ error(err);
+ return;
+ }
+
+ success(response.data, response);
+ }, error);
+ };
+
+ var isArray = function (value) {
+ /// Checks whether the specified value is an array object.
+ /// Value to check.
+ /// true if the value is an array object; false otherwise.
+
+ return Object.prototype.toString.call(value) === "[object Array]";
+ };
+
+ var isDate = function (value) {
+ /// Checks whether the specified value is a Date object.
+ /// Value to check.
+ /// true if the value is a Date object; false otherwise.
+
+ return Object.prototype.toString.call(value) === "[object Date]";
+ };
+
+ var lookupProperty = function (properties, name) {
+ /// Looks up a property by name.
+ /// Array of property objects as per EDM metadata.
+ /// Name to look for.
+ /// The property object; null if not found.
+
+ if (properties) {
+ var i, len;
+ for (i = 0, len = properties.length; i < len; i++) {
+ if (properties[i].name === name) {
+ return properties[i];
+ }
+ }
+ }
+
+ return null;
+ };
+
+ var lookupTypeInMetadata = function (name, metadata, kind) {
+ /// Looks up a type object by name.
+ /// Name, possibly null or empty.
+ /// Metadata store; one of edmx, schema, or an array of any of them.
+ /// Kind of type to look for; one of 'entityType' or 'complexType'.
+ /// An type description if the name is found; null otherwise.
+
+ return (name) ? forEachSchema(metadata, function (schema) {
+ return lookupTypeInSchema(name, schema, kind);
+ }) : null;
+ };
+
+ var lookupComplexType = function (name, metadata) {
+ /// Looks up a complex type object by name.
+ /// Name, possibly null or empty.
+ /// Metadata store; one of edmx, schema, or an array of any of them.
+ /// A complex type description if the name is found; null otherwise.
+
+ return lookupTypeInMetadata(name, metadata, "complexType");
+ };
+
+ var lookupEntityType = function (name, metadata) {
+ /// Looks up an entity type object by name.
+ /// Name, possibly null or empty.
+ /// Metadata store; one of edmx, schema, or an array of any of them.
+ /// An entity type description if the name is found; null otherwise.
+
+ return lookupTypeInMetadata(name, metadata, "entityType");
+ };
+
+ //// Commented out - metadata is largely optional and we don't rely on it to this extent.
+ //// var lookupEntityTypeForNavigation = function (navigationProperty, metadata) {
+ //// /// Looks up the target entity type for a navigation property.
+ //// ///
+ //// ///
+ //// /// The entity type metadata for the specified property, null if not found.
+ //// var rel = navigationProperty.relationship;
+ //// var association = forEachSchema(metadata, function (schema) {
+ //// // The name should be the namespace qualified name in 'ns'.'type' format.
+ //// var nameOnly = removeNamespace(schema["namespace"], rel);
+ //// var associations = schema.association;
+ //// if (nameOnly && associations) {
+ //// var i, len;
+ //// for (i = 0, len = associations.length; i < len; i++) {
+ //// if (associations[i].name === nameOnly) {
+ //// return associations[i];
+ //// }
+ //// }
+ //// }
+ //// });
+ //// var result = null;
+ //// if (association) {
+ //// var end = association.end[0];
+ //// if (end.role !== navigationProperty.toRole) {
+ //// end = association.end[1];
+ //// // For metadata to be valid, end.role === navigationProperty.toRole now.
+ //// }
+ //// result = lookupEntityType(end.type, metadata);
+ //// }
+ //// return result;
+ //// };
+
+ var removeNamespace = function (ns, fullName) {
+ /// Given an expected namespace prefix, removes it from a full name.
+ /// Expected namespace.
+ /// Full name in 'ns'.'name' form.
+ /// The local name, null if it isn't found in the expected namespace.
+
+ if (fullName.indexOf(ns) === 0 && fullName.charAt(ns.length) === ".") {
+ return fullName.substr(ns.length + 1);
+ }
+
+ return null;
+ };
+
+ var lookupTypeInSchema = function (name, metadata, kind) {
+ /// Looks up an entity type object by name.
+ /// Name (assigned).
+ /// Metadata store; one of edmx, schema.
+ /// Kind of type to look for; one of 'entityType' or 'complexType'.
+ /// An entity type description if the name is found; null otherwise.
+ ///
+ /// metadata is considered an edmx object if it contains a dataServices object.
+ ///
+
+ if (metadata) {
+ // The name should be the namespace qualified name in 'ns'.'type' format.
+ var nameOnly = removeNamespace(metadata["namespace"], name);
+ var types = metadata[kind];
+ if (nameOnly && types) {
+ var i, len;
+ for (i = 0, len = types.length; i < len; i++) {
+ if (types[i].name === nameOnly) {
+ return types[i];
+ }
+ }
+ }
+ }
+
+ return null;
+ };
+
+ var normalHeaders = {
+ "accept": "Accept",
+ "content-type": "Content-Type",
+ "dataserviceversion": "DataServiceVersion",
+ "maxdataserviceversion": "MaxDataServiceVersion"
+ };
+
+ var normalizeHeaders = function (headers) {
+ /// Normalizes headers so they can be found with consistent casing.
+ /// Dictionary of name/value pairs.
+
+ for (var name in headers) {
+ var lowerName = name.toLowerCase();
+ var normalName = normalHeaders[lowerName];
+ if (normalName && name !== normalName) {
+ var val = headers[name];
+ delete headers[name];
+ headers[normalName] = val;
+ }
+ }
+ };
+
+ var undefinedDefault = function (value, defaultValue) {
+ /// Returns a default value in place of undefined.
+ /// Value to check.
+ /// Value to return if value is undefined.
+ /// value if it's defined; defaultValue otherwise.
+ ///
+ /// This should only be used for cases where falsy values are valid;
+ /// otherwise the pattern should be 'x = (value) ? value : defaultValue;'.
+ ///
+ return (value !== undefined) ? value : defaultValue;
+ };
+
+ var parseInt10 = function (value) {
+ /// Parses a value in base 10.
+ /// String value to parse.
+ /// The parsed value, NaN if not a valid value.
+
+ return parseInt(value, 10);
+ };
+
+
+ // The captured indices for this expression are:
+ // 0 - complete input
+ // 1 - direction
+ // 2,3,4 - years, months, days
+ // 5,6,7,8 - hours, minutes, seconds, miliseconds
+
+ var parseTimeRE = /^([+-])?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)(?:\.(\d+))?S)?)?/;
+
+ var parseDuration = function (duration) {
+ /// Parses a string in xsd:duration format.
+ /// Duration value.
+ ///
+ /// This method will throw an exception if the input string has a year or a month component.
+ ///
+ /// Object representing the time
+
+ var parts = parseTimeRE.exec(duration);
+
+ if (parts === null) {
+ throw { message: "Invalid duration value." };
+ }
+
+ var years = parts[2] || "0";
+ var months = parts[3] || "0";
+ var days = parseInt10(parts[4] || 0);
+ var hours = parseInt10(parts[5] || 0);
+ var minutes = parseInt10(parts[6] || 0);
+ var seconds = parseFloat(parts[7] || 0);
+
+ if (years !== "0" || months !== "0") {
+ throw { message: "Unsupported duration value." };
+ }
+
+ var ms = parts[8];
+ var ns = 0;
+ if (!ms) {
+ ms = 0;
+ } else {
+ if (ms.length > 7) {
+ throw { message: "Cannot parse duration value to given precision." };
+ }
+
+ ns = formatNumberWidth(ms.substring(3), 4, true);
+ ms = formatNumberWidth(ms.substring(0, 3), 3, true);
+
+ ms = parseInt10(ms);
+ ns = parseInt10(ns);
+ }
+
+ ms += seconds * 1000 + minutes * 60000 + hours * 3600000 + days * 86400000;
+
+ if (parts[1] === "-") {
+ ms = -ms;
+ }
+
+ var result = { ms: ms, __edmType: "Edm.Time" };
+
+ if (ns) {
+ result.ns = ns;
+ }
+ return result;
+ };
+
+ var parseTimezone = function (timezone) {
+ /// Parses a timezone description in (+|-)nn:nn format.
+ /// Timezone offset.
+ ///
+ /// An object with a (d)irection property of 1 for + and -1 for -,
+ /// offset (h)ours and offset (m)inutes.
+ ///
+
+ var direction = timezone.substring(0, 1);
+ direction = (direction === "+") ? 1 : -1;
+
+ var offsetHours = parseInt10(timezone.substring(1));
+ var offsetMinutes = parseInt10(timezone.substring(timezone.indexOf(":") + 1));
+ return { d: direction, h: offsetHours, m: offsetMinutes };
+ };
+
+ var payloadTypeOf = function (data) {
+ /// Determines the kind of payload applicable for the specified value.
+ /// Value to check.
+ /// One of the values declared on the payloadType object.
+
+ switch (typeof (data)) {
+ case "object":
+ if (!data) {
+ return PAYLOADTYPE_NONE;
+ }
+ if (isArray(data) || isArray(data.results)) {
+ return PAYLOADTYPE_FEEDORLINKS;
+ }
+ if (data.__metadata && data.__metadata.uri !== undefined) {
+ return PAYLOADTYPE_ENTRY;
+ }
+ if (isArray(data.EntitySets)) {
+ return PAYLOADTYPE_SVCDOC;
+ }
+ if (isArray(data.__batchRequests)) {
+ return PAYLOADTYPE_BATCH;
+ }
+ if (isDate(data)) {
+ return PAYLOADTYPE_PRIMITIVETYPE;
+ }
+
+ return PAYLOADTYPE_COMPLEXTYPE;
+
+ case "string":
+ case "number":
+ case "boolean":
+ return PAYLOADTYPE_PRIMITIVETYPE;
+ }
+
+ return PAYLOADTYPE_UNKNOWN;
+ };
+
+ var prepareRequest = function (request, handler, context) {
+ /// Prepares a request object so that it can be sent through the network.
+ /// Object that represents the request to be sent.
+ /// Handler for data serialization
+ /// Context used for preparing the request
+
+ // Default to GET if no method has been specified.
+ if (!request.method) {
+ request.method = "GET";
+ }
+
+ if (!request.headers) {
+ request.headers = {};
+ } else {
+ normalizeHeaders(request.headers);
+ }
+
+ if (request.headers.Accept === undefined) {
+ request.headers.Accept = handler.accept;
+ }
+
+ if (assigned(request.data) && request.body === undefined) {
+ handler.write(request, context);
+ }
+
+ if (!assigned(request.headers.MaxDataServiceVersion)) {
+ request.headers.MaxDataServiceVersion = handler.maxDataServiceVersion || "1.0";
+ }
+ };
+
+ var propertyKindOf = function (value) {
+ /// Determines the kind of property for the specified value.
+ /// Value to check.
+ /// One of the values declared on the propertyKind object.
+
+ switch (payloadTypeOf(value)) {
+ case PAYLOADTYPE_COMPLEXTYPE:
+ if (value.__deferred && value.__deferred.uri) {
+ return PROPERTYKIND_DEFERRED;
+ }
+
+ return PROPERTYKIND_COMPLEX;
+
+ case PAYLOADTYPE_FEEDORLINKS:
+ case PAYLOADTYPE_ENTRY:
+ return PROPERTYKIND_INLINE;
+
+ case PAYLOADTYPE_PRIMITIVETYPE:
+ return PROPERTYKIND_PRIMITIVE;
+ }
+ return PROPERTYKIND_NONE;
+ };
+
+ var throwErrorCallback = function (error) {
+ /// Default error handler.
+ /// Error to handle.
+ throw error;
+ };
+
+ var trimString = function (str) {
+ /// Removes leading and trailing whitespaces from a string.
+ /// String to trim
+ /// The string with no leading or trailing whitespace.
+
+ if (str.trim) {
+ return str.trim();
+ }
+
+ return str.replace(/^\s+|\s+$/g, '');
+ };
+
+ // Regular expression that splits a uri into its components:
+ // 0 - is the matched string.
+ // 1 - is the scheme.
+ // 2 - is the authority.
+ // 3 - is the path.
+ // 4 - is the query.
+ // 5 - is the fragment.
+ var uriRegEx = /^([^:\/?#]+:)?(\/\/[^\/?#]*)?([^?#:]+)?(\?[^#]*)?(#.*)?/;
+ var uriPartNames = ["scheme", "authority", "path", "query", "fragment"];
+
+ var getURIInfo = function (uri) {
+ /// Gets information about the components of the specified URI.
+ /// URI to get information from.
+ ///
+ /// An object with an isAbsolute flag and part names (scheme, authority, etc.) if available.
+ ///
+
+ var result = { isAbsolute: false };
+
+ if (uri) {
+ var matches = uriRegEx.exec(uri);
+ if (matches) {
+ var i, len;
+ for (i = 0, len = uriPartNames.length; i < len; i++) {
+ if (matches[i + 1]) {
+ result[uriPartNames[i]] = matches[i + 1];
+ }
+ }
+ }
+ if (result.scheme) {
+ result.isAbsolute = true;
+ }
+ }
+
+ return result;
+ };
+
+ var getURIFromInfo = function (uriInfo) {
+ /// Builds a URI string from its components.
+ /// An object with uri parts (scheme, authority, etc.).
+ /// URI string.
+
+ return "".concat(
+ uriInfo.scheme || "",
+ uriInfo.authority || "",
+ uriInfo.path || "",
+ uriInfo.query || "",
+ uriInfo.fragment || "");
+ };
+
+ // Regular expression that splits a uri authority into its subcomponents:
+ // 0 - is the matched string.
+ // 1 - is the userinfo subcomponent.
+ // 2 - is the host subcomponent.
+ // 3 - is the port component.
+ var uriAuthorityRegEx = /^\/{0,2}(?:([^@]*)@)?([^:]+)(?::{1}(\d+))?/;
+
+ // Regular expression that matches percentage enconded octects (i.e %20 or %3A);
+ var pctEncodingRegEx = /%[0-9A-F]{2}/ig;
+
+ var normalizeURICase = function (uri) {
+ /// Normalizes the casing of a URI.
+ /// URI to normalize, absolute or relative.
+ /// The URI normalized to lower case.
+
+ var uriInfo = getURIInfo(uri);
+ var scheme = uriInfo.scheme;
+ var authority = uriInfo.authority;
+
+ if (scheme) {
+ uriInfo.scheme = scheme.toLowerCase();
+ if (authority) {
+ var matches = uriAuthorityRegEx.exec(authority);
+ if (matches) {
+ uriInfo.authority = "//" +
+ (matches[1] ? matches[1] + "@" : "") +
+ (matches[2].toLowerCase()) +
+ (matches[3] ? ":" + matches[3] : "");
+ }
+ }
+ }
+
+ uri = getURIFromInfo(uriInfo);
+
+ return uri.replace(pctEncodingRegEx, function (str) {
+ return str.toLowerCase();
+ });
+ };
+
+ var normalizeURI = function (uri, base) {
+ /// Normalizes a possibly relative URI with a base URI.
+ /// URI to normalize, absolute or relative.
+ /// Base URI to compose with.
+ /// The composed URI if relative; the original one if absolute.
+
+ if (!base) {
+ return uri;
+ }
+
+ var uriInfo = getURIInfo(uri);
+ if (uriInfo.isAbsolute) {
+ return uri;
+ }
+
+ var baseInfo = getURIInfo(base);
+ var normInfo = {};
+ var path;
+
+ if (uriInfo.authority) {
+ normInfo.authority = uriInfo.authority;
+ path = uriInfo.path;
+ normInfo.query = uriInfo.query;
+ } else {
+ if (!uriInfo.path) {
+ path = baseInfo.path;
+ normInfo.query = uriInfo.query || baseInfo.query;
+ } else {
+ if (uriInfo.path.charAt(0) === '/') {
+ path = uriInfo.path;
+ } else {
+ path = mergeUriPathWithBase(uriInfo.path, baseInfo.path);
+ }
+ normInfo.query = uriInfo.query;
+ }
+ normInfo.authority = baseInfo.authority;
+ }
+
+ normInfo.path = removeDotsFromPath(path);
+
+ normInfo.scheme = baseInfo.scheme;
+ normInfo.fragment = uriInfo.fragment;
+
+ return getURIFromInfo(normInfo);
+ };
+
+ var mergeUriPathWithBase = function (uriPath, basePath) {
+ /// Merges the path of a relative URI and a base URI.
+ /// Base URI path.
+ /// A string with the merged path.
+
+ var path = "/";
+ var end;
+
+ if (basePath) {
+ end = basePath.lastIndexOf("/");
+ path = basePath.substring(0, end);
+
+ if (path.charAt(path.length - 1) !== "/") {
+ path = path + "/";
+ }
+ }
+
+ return path + uriPath;
+ };
+
+ var removeDotsFromPath = function (path) {
+ /// Removes the special folders . and .. from a URI's path.
+ /// URI path component.
+ /// Path without any . and .. folders.
+
+ var result = "";
+ var segment = "";
+ var end;
+
+ while (path) {
+ if (path.indexOf("..") === 0 || path.indexOf(".") === 0) {
+ path = path.replace(/^\.\.?\/?/g, "");
+ } else if (path.indexOf("/..") === 0) {
+ path = path.replace(/^\/\..\/?/g, "/");
+ end = result.lastIndexOf("/");
+ if (end === -1) {
+ result = "";
+ } else {
+ result = result.substring(0, end);
+ }
+ } else if (path.indexOf("/.") === 0) {
+ path = path.replace(/^\/\.\/?/g, "/");
+ } else {
+ segment = path;
+ end = path.indexOf("/", 1);
+ if (end !== -1) {
+ segment = path.substring(0, end);
+ }
+ result = result + segment;
+ path = path.replace(segment, "");
+ }
+ }
+ return result;
+ };
+
+
+ var ticks = 0;
+
+ var canUseJSONP = function (request) {
+ ///
+ /// Checks whether the specified request can be satisfied with a JSONP request.
+ ///
+ /// Request object to check.
+ /// true if the request can be satisfied; false otherwise.
+
+ // Requests that 'degrade' without changing their meaning by going through JSONP
+ // are considered usable.
+ //
+ // We allow data to come in a different format, as the servers SHOULD honor the Accept
+ // request but may in practice return content with a different MIME type.
+ if (request.method && request.method !== "GET") {
+ return false;
+ }
+
+ return true;
+ };
+
+ var createIFrame = function (url) {
+ /// Creates an IFRAME tag for loading the JSONP script
+ /// The source URL of the script
+ /// The IFRAME tag
+ var iframe = window.document.createElement("IFRAME");
+ iframe.style.display = "none";
+
+ var attributeEncodedUrl = url.replace(/&/g, "&").replace(/"/g, """).replace(/\