igniteui-webcomponents-datasources
Version:
Reference custom data providers for the Ignite UI Web Components data source.
7 lines • 87.2 kB
JavaScript
/*!
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("igniteui-webcomponents-core"),require("tslib")):"function"==typeof define&&define.amd?define(["exports","igniteui-webcomponents-core","tslib"],t):t((e=e||self)["igniteui-webcomponents-datasources"]={},e.igniteuiWebcomponentsCore,e.tslib)}(this,(function(e,t,r){"use strict";var i=function(){function e(e,t){this._name=null,this._isNullable=!1,this._type=null,this.name=e,this.type=t}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isNullable",{get:function(){return this._isNullable},set:function(e){this._isNullable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},set:function(e){this._type=e},enumerable:!1,configurable:!0}),e}();function o(e){return Array.from(t.fromEnum(e))}function n(e){var t,i;try{for(var o=r.__values(e),n=o.next();!n.done;n=o.next()){return n.value}}catch(e){t={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}throw new Error("Iterable contained no elements, expected at least one")}var s=function(){function e(){}return Object.defineProperty(e.prototype,"first",{get:function(){return this._first},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){return this._last},enumerable:!1,configurable:!0}),e.prototype.addFirst=function(e){if(null==this._first)this._first=new a(e),this._last=this._first;else{var t=this._first;this._first=new a(e),this._first.next=t,t.prev=this._first}},e.prototype.addLast=function(e){if(null==this._last)this._first=new a(e),this._last=this._first;else{var t=this._last;this._last=new a(e),this._last.prev=t,t.next=this._last}},e.prototype.removeFirst=function(){this.remove(this.first)},e.prototype.clear=function(){this._first=null,this._last=null},e.prototype.contains=function(e){for(var t=this.first;null!=t;){if(t.value===e)return!0;t=t.next}return!1},e.prototype.removeValue=function(e){for(var t=this.first;null!=t;){if(t.value===e)return void this.remove(t);t=t.next}},e.prototype.remove=function(e){this._first==e&&(this._first=e.next,null!=e.next&&(e.next.prev=null)),this._last==e&&(this._last=e.prev,null!=e.prev&&(e.prev.next=null)),null!=e.prev&&(e.prev.next=e.next),null!=e.next&&(e.next.prev=e.prev),e.next=null,e.prev=null},e}(),a=function(){function e(e){void 0!==e&&(this.value=e)}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"prev",{get:function(){return this._prev},set:function(e){this._prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"next",{get:function(){return this._next},set:function(e){this._next=e},enumerable:!1,configurable:!0}),e}(),u=function(){function e(e,t){this._properties=null,this._primaryKey=null,this._name=null,this.name=e,this.loadProperties(t),this.loadPrimaryKey(t)}return Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"properties",{get:function(){return null==this._properties&&(this._properties=new Map),this._properties},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"primaryKey",{get:function(){return null==this._primaryKey&&(this._primaryKey=[]),this._primaryKey},enumerable:!1,configurable:!0}),e.prototype.loadProperties=function(e){for(var r=o(e.elements()),n=r.length,s=t.XName.get("Name",""),a=t.XName.get("Type",""),u=0;u<n;u++){var p=r[u];if("Property"==p.name.localName){var l=p.attribute(s).value,c=p.attribute(a).value;this.properties.set(l,new i(l,c))}}},e.prototype.loadPrimaryKey=function(e){for(var r=o(e.elements()),i=r.length,n=t.XName.get("Name",""),s=0;s<i;s++){var a=r[s];if("Key"==a.name.localName)for(var u=o(a.elements()),p=u.length,l=0;l<p;l++){var c=u[l];"PropertyRef"==c.name.localName&&this.primaryKey.push(c.attribute(n).value)}}},e}(),p=function(){function e(e,t){if(this._entityName=null,this._entityNamespace=null,this._entityType=null,this._name=null,this.name=e,this.entityType=t,t.indexOf(".")>=0){var r=t.split(".");if(2==r.length)this.entityNamespace=r[0],this.entityName=r[1];else{var i=t.lastIndexOf(".");this.entityNamespace=t.substr(0,i),this.entityName=t.substr(i+1)}}else this.entityNamespace=t,this.entityName=t}return Object.defineProperty(e.prototype,"entityName",{get:function(){return this._entityName},set:function(e){this._entityName=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"entityNamespace",{get:function(){return this._entityNamespace},set:function(e){this._entityNamespace=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"entityType",{get:function(){return this._entityType},set:function(e){this._entityType=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!1,configurable:!0}),e}(),l=function(){function e(e,r,i,o,n){if(this._actualData=null,this._schema=null,this._pageIndex=0,this._groupInformation=null,this._summaryInformation=null,null==e)this._actualData=null;else{var s=e.value.length;this._actualData=[];for(var a=new Set,u=0;u<r.propertyNames.length;u++)r.propertyTypes[u]!=t.DataSourceSchemaPropertyType.DateTimeValue&&r.propertyTypes[u]!=t.DataSourceSchemaPropertyType.DateTimeOffsetValue||a.add(r.propertyNames[u]);for(var p=void 0,l=function(t){for(var r=e.value[t],i=new Map,o=Array.from(Object.keys(r)),n=o.map((function(e){return r[e]})),s=0;s<o.length;s++)p=n[s],a.has(o[s])&&(p=new Date(p)),i.set(o[s],p);c._actualData[t]=i},c=this,h=0;h<s;h++)l(h)}this._schema=r,this._groupInformation=i,this._summaryInformation=o,this._pageIndex=n}return e.prototype.count=function(){return this._actualData.length},e.prototype.getItemAtIndex=function(e){return this._actualData[e]},e.prototype.getItemValueAtIndex=function(e,t){var r=this._actualData[e];return r.has(t)?r.get(t):null},e.prototype.pageIndex=function(){return this._pageIndex},e.prototype.schema=function(){return this._schema},e.prototype.getGroupInformation=function(){return this._groupInformation},e.prototype.getSummaryInformation=function(){return this._summaryInformation},e}(),c=function(){function e(e,t,r){this._entities=null,this._entitySets=null,this._namespace=null,this.namespace=e,this.loadEntities(t),this.loadEntitySets(r)}return Object.defineProperty(e.prototype,"entities",{get:function(){return null==this._entities&&(this._entities=new Map),this._entities},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"entitySets",{get:function(){return null==this._entitySets&&(this._entitySets=new Map),this._entitySets},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"namespace",{get:function(){return this._namespace},set:function(e){this._namespace=e},enumerable:!1,configurable:!0}),e.prototype.loadEntities=function(e){for(var r=e,i=r.length,o=t.XName.get("Name",""),n=0;n<i;n++){var s=r[n],a=new u(s.attribute(o).value,s);this.entities.set(a.name,a)}},e.prototype.loadEntitySets=function(e){for(var r=e,i=r.length,o=t.XName.get("Name",""),n=t.XName.get("EntityType",""),s=0;s<i;s++){var a=r[s],u=new p(a.attribute(o).value,a.attribute(n).value);this.entitySets.set(u.name,u)}},e}(),h=function(){function e(r){if(this._entityTypeSchemaNamespace=null,this._entitySetSchemaNamespace=null,this._schema=null,null!=r){var i=t.XDocument.parse(r),s=o(n(t.fromEnum(n(t.fromEnum(i.elements())).elements())).elements1(t.XName.get("Schema",e.nS.namespaceName)));if(null!=s){for(var a=null,u=null,p=s.length,l=t.XName.get("EntityContainer",e.nS.namespaceName),h=t.XName.get("EntitySet",e.nS.namespaceName),d=t.XName.get("Namespace",""),f=t.XName.get("EntityType",e.nS.namespaceName),m=0;m<p;m++){if(s[m].nodeType==t.XmlNodeType.Element){var y=s[m];if(null==a){var g=o(y.elements1(l));null!=g&&g.length>0&&null!=(a=o(t.typeCast(t.XElement.$type,g[0]).elements1(h)))&&(this._entitySetSchemaNamespace=y.attribute(d).value)}null==u&&null!=(u=o(y.elements1(f)))&&(this._entityTypeSchemaNamespace=y.attribute(d).value)}}null!=a&&null!=u&&(this.schema=new c(this._entityTypeSchemaNamespace,u,a))}}}return Object.defineProperty(e.prototype,"schema",{get:function(){return this._schema},set:function(e){this._schema=e},enumerable:!1,configurable:!0}),e.prototype.getODataDataSourceSchema=function(e){var i,o,n,s;if(null==this.schema)return null;var a=[],u=[],p=[],l=this.schema.entitySets.get(e);if(null!=l){var c=this.schema.entities.get(l.entityName);if(null!=c){try{for(var h=r.__values(c.properties.values()),d=h.next();!d.done;d=h.next()){var f=d.value;a.push(f.name),"Edm.String"==f.type?u.push(t.DataSourceSchemaPropertyType.StringValue):"Edm.Int16"==f.type||"Edm.Int32"==f.type?u.push(t.DataSourceSchemaPropertyType.IntValue):"Edm.Double"==f.type?u.push(t.DataSourceSchemaPropertyType.DoubleValue):"Edm.Single"==f.type?u.push(t.DataSourceSchemaPropertyType.SingleValue):"Edm.Boolean"==f.type?u.push(t.DataSourceSchemaPropertyType.BooleanValue):"Edm.Byte"==f.type?u.push(t.DataSourceSchemaPropertyType.ShortValue):"Edm.DateTime"==f.type||"Edm.DateTimeOffset"==f.type?u.push(t.DataSourceSchemaPropertyType.DateTimeValue):"Edm.Int64"==f.type?u.push(t.DataSourceSchemaPropertyType.LongValue):"Edm.Decimal"==f.type?u.push(t.DataSourceSchemaPropertyType.DecimalValue):"Edm.SByte"==f.type?u.push(t.DataSourceSchemaPropertyType.ShortValue):u.push(t.DataSourceSchemaPropertyType.ObjectValue)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}try{for(var m=r.__values(c.primaryKey),y=m.next();!y.done;y=m.next()){var g=y.value;p.push(g)}}catch(e){n={error:e}}finally{try{y&&!y.done&&(s=m.return)&&s.call(m)}finally{if(n)throw n.error}}}}return new t.ODataDataSourceSchema(a,u,p)},e.nS=t.XNamespace.get("http://docs.oasis-open.org/odata/ns/edm"),e}(),d=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(i,e),i.$t=t.markType(i,"ODataVirtualDataSourceProviderTaskDataHolder",t.AsyncVirtualDataSourceProviderTaskDataHolder.$type),i}(t.AsyncVirtualDataSourceProviderTaskDataHolder),f=function(e){function i(i){var o,n,s=e.call(this,i)||this;if(s._baseUri=null,s._entitySet=null,s._sortDescriptions=null,s._groupDescriptions=null,s._filterExpressions=null,s._summaryDescriptions=null,s._desiredPropeties=null,s._schemaIncludedProperties=null,s._enableJsonp=!0,s._isAggregationSupported=!1,s._groupInformation=null,s._summaryInformation=null,s._filterString=null,s._selectedString=null,s.doWork=s.doWork.bind(s),s._baseUri=i.baseUri,s._entitySet=i.entitySet,s._sortDescriptions=i.sortDescriptions,s._groupDescriptions=i.groupDescriptions,null!=s._groupDescriptions&&s._groupDescriptions.size()>0){s._sortDescriptions=new t.SortDescriptionCollection;try{for(var a=r.__values(s.iter(i.sortDescriptions)),u=a.next();!u.done;u=a.next()){var p=u.value;s._sortDescriptions.add(p)}}catch(e){o={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}for(var l=0;l<s._groupDescriptions.size();l++)s._sortDescriptions.insert(l,s._groupDescriptions.get(l))}if(s._filterExpressions=i.filterExpressions,s._desiredPropeties=i.propertiesRequested,null!=i.schemaIncludedProperties){s._schemaIncludedProperties=new Set;for(l=0;l<i.schemaIncludedProperties.length;l++)s._schemaIncludedProperties.add(i.schemaIncludedProperties[l])}return s._summaryDescriptions=i.summaryDescriptions,s._summaryScope=i.summaryScope,s._enableJsonp=i.enableJsonp,s._isAggregationSupported=i.isAggregationSupported,window.setTimeout(s.doWork,100),s}return r.__extends(i,e),Object.defineProperty(i.prototype,"sortDescriptions",{get:function(){return this._sortDescriptions},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"filterExpressions",{get:function(){return this._filterExpressions},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"desiredProperties",{get:function(){return this._desiredPropeties},enumerable:!1,configurable:!0}),i.prototype.initialize=function(){e.prototype.initialize.call(this)},i.prototype.getTaskDataHolder=function(){return new d},i.prototype.getCompletedTaskData=function(t,r){e.prototype.getCompletedTaskData.call(this,t,r)},i.prototype.removeCompletedTaskData=function(t,r){e.prototype.removeCompletedTaskData.call(this,t,r)},i.prototype.getTasksData=function(t){e.prototype.getTasksData.call(this,t)},i.prototype.iter=function(e){var t;return r.__generator(this,(function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<e.size()?[4,e.get(t)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}}))},i.prototype.iterFilter=function(e){var t;return r.__generator(this,(function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<e.size()?[4,e.get(t)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}}))},i.prototype.iterSummaries=function(e){var t;return r.__generator(this,(function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<e.size()?[4,e.get(t)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}}))},i.prototype.processCompletedTask=function(e,t,r,o){var n,s=this,a=null,u=-1,p=e.task;try{if(p.hasErrors)return void this.retryIndex(r,t);r==i.schemaRequestIndex?u=(a=p.result)["@odata.count"]:a=p.result}catch(e){return void this.retryIndex(r,t)}if(this.actualCount=u>=0?u:a["@odata.count"],null!=(n=this.actualSchema))this.finishProcessingCompletedTask(p,r,n,a);else{var l=0;this.resolveSchema((function(e){s.actualSchema=e,!s._isAggregationSupported||0===s._groupDescriptions.size()&&0===s._summaryDescriptions.size()?s.finishProcessingCompletedTask(p,r,e,a):(s._groupDescriptions.size()>0&&(l++,s.resolveGroupInformation((function(t){0===--l&&s.finishProcessingCompletedTask(p,r,e,a)}),(function(){s.retryIndex(r,t)}))),s._summaryDescriptions.size()>0&&(l++,s.resolveSummaryInformation((function(t){0===--l&&s.finishProcessingCompletedTask(p,r,e,a)}),(function(){s.retryIndex(r,t)}))))}),(function(){s.retryIndex(r,t)}))}},i.prototype.finishProcessingCompletedTask=function(e,t,r,i){var o,n,s,a,u=this;this.actualSchema=r,o=this.executionContext,s=this._groupInformation,a=this._summaryInformation,n=this.pageLoaded;var p=null;if(null!=i?(p=new l(i,r,s,a,t),!this.isLastPage(t)&&p.count()>0&&!this.populatedActualPageSize&&(this.populatedActualPageSize=!0,this.actualPageSize=p.count())):p=new l(null,r,s,a,t),null!=this.pageLoaded)if(null!=this.executionContext){if(null==o||null==n)return void this.shutdown();o.execute((function(){return n(p,u.actualCount,u.actualPageSize)}))}else{if(null==n)return void this.shutdown();n(p,this.actualCount,this.actualPageSize)}},i.prototype.resolveGroupInformation=function(e,i){var o,n,s=this;if(null==this._groupInformation){var a,u="",p="",l="";if(null!=this._groupDescriptions&&0!=this._groupDescriptions.size()){if(a=this._filterString,this.updateFilterString(),null!=this._groupDescriptions){var c=!0;try{for(var h=r.__values(this.iter(this._groupDescriptions)),d=h.next();!d.done;d=h.next()){var f=d.value;c?c=!1:(u+=", ",p+=", "),p+=f.propertyName,f.direction===t.ListSortDirection.Descending?u+=f.propertyName+" desc":u+=f.propertyName+" asc"}}catch(e){o={error:e}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(o)throw o.error}}}if(this._summaryScope===t.DataSourceSummaryScope.Both||this._summaryScope===t.DataSourceSummaryScope.Groups){var m=this.getSummaryQueryParameters(!0);t.stringIsNullOrEmpty(m)||(l=", "+m)}var y=this._entitySet+"?$orderby="+u+"&$apply=";t.stringIsNullOrEmpty(a)||(y+="filter("+a+")/"),y+="groupby(("+p+"), aggregate($count as $__count"+l+"))";try{var g=[],_=function(t,r){return s.groupSuccess(t,r,e,i,g)},v=function(t){return s.groupError(t,e,i,g)},b={requestUri:this._baseUri+"/"+y,enableJsonpCallback:this._enableJsonp,method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},data:null};(function(){odatajs.oData.request(b,_,v)})()}catch(e){i()}}else e(null)}else e(this._groupInformation)},i.prototype.groupError=function(e,t,r,i){this._groupInformation=null},i.prototype.groupSuccess=function(e,t,i,o,n){var s,a,u=[];try{for(var p=r.__values(this.iter(this._groupDescriptions)),l=p.next();!l.done;l=p.next()){var c=l.value;u.push(c.propertyName)}}catch(e){s={error:e}}finally{try{l&&!l.done&&(a=p.return)&&a.call(p)}finally{if(s)throw s.error}}if(e&&e.value&&e.value.length>0)for(var h=0;h<e.value.length;h++)this.addGroup(n,u,u,0,e.value[h]);this._groupInformation=n,i(this._groupInformation)},i.prototype.addGroup=function(e,i,o,n,s){var a,u,p=[];try{for(var l=r.__values(i),c=l.next();!c.done;c=l.next()){var h=c.value;s[h]&&p.push(s[h])}}catch(e){a={error:e}}finally{try{c&&!c.done&&(u=l.return)&&u.call(l)}finally{if(a)throw a.error}}var d=0;s.$__count&&(d=t.Convert.toInt321(s.$__count));var f=null;this._summaryScope!=t.DataSourceSummaryScope.Both&&this._summaryScope!=t.DataSourceSummaryScope.Groups||(f=this.createSummaryResults(s));var m=new t.DefaultSectionInformation(n,n+(d-1),o,p,f);e.push(m)},i.prototype.resolveSummaryInformation=function(e,r){var i=this;if(null==this._summaryInformation){var o,n;if(null!=this._summaryDescriptions&&0!=this._summaryDescriptions.size()&&this._summaryScope!=t.DataSourceSummaryScope.Groups&&this._summaryScope!=t.DataSourceSummaryScope.None){o=this._filterString,this.updateFilterString(),n=this.getSummaryQueryParameters(!1);var s=this._entitySet+"?$apply=";t.stringIsNullOrEmpty(o)||(s+="filter("+o+")/"),s+="aggregate("+n+")";try{var a=[],u=function(t,o){return i.summarySuccess(t,o,e,r,a)},p=function(t){return i.summaryError(t,e,r,a)},l={requestUri:this._baseUri+"/"+s,enableJsonpCallback:this._enableJsonp,method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},data:null};(function(){odatajs.oData.request(l,u,p)})()}catch(e){r()}}else e(null)}else e(this._summaryInformation)},i.prototype.summarySuccess=function(e,t,r,i,o){e&&e.value&&e.value.length>0&&(o=this.createSummaryResults(e.value[0])),this._summaryInformation=o,r(this._summaryInformation)},i.prototype.summaryError=function(e,t,r,i){this._summaryInformation=null},i.prototype.getSummaryQueryParameters=function(e){var i,o,n="";if(null!=this._summaryDescriptions){var s=!0,a=!1;try{for(var u=r.__values(this.iterSummaries(this._summaryDescriptions)),p=u.next();!p.done;p=u.next()){var l=p.value;if(l.operand!=t.DataSourceSummaryOperand.Count||!e&&!a){switch(s||(n+=", "),l.operand){case t.DataSourceSummaryOperand.Average:n+=l.propertyName+" with average as "+l.propertyName+"Average";break;case t.DataSourceSummaryOperand.Min:n+=l.propertyName+" with min as "+l.propertyName+"Min";break;case t.DataSourceSummaryOperand.Max:n+=l.propertyName+" with max as "+l.propertyName+"Max";break;case t.DataSourceSummaryOperand.Sum:n+=l.propertyName+" with sum as "+l.propertyName+"Sum";break;case t.DataSourceSummaryOperand.Count:n+="$count as $__count",a=!0}s=!1}}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}}return n},i.prototype.createSummaryResults=function(e){var i,o,n=[];try{for(var s=r.__values(this.iterSummaries(this._summaryDescriptions)),a=s.next();!a.done;a=s.next()){var u=a.value,p=u.propertyName;switch(u.operand){case t.DataSourceSummaryOperand.Average:p+="Average";break;case t.DataSourceSummaryOperand.Min:p+="Min";break;case t.DataSourceSummaryOperand.Max:p+="Max";break;case t.DataSourceSummaryOperand.Sum:p+="Sum";break;case t.DataSourceSummaryOperand.Count:p="$__count"}var l=null;e&&e[p]&&(l=e[p]);var c=new t.DefaultSummaryResult(u.propertyName,u.operand,l);n.push(c)}}catch(e){i={error:e}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return n},i.prototype.resolveSchema=function(e,r){var i=this,o=this._baseUri,n=new XMLHttpRequest;n.onreadystatechange=function(){4===n.readyState&&(200===n.status?function(r){var o=new h(r).getODataDataSourceSchema(i._entitySet);if(null!=i._schemaIncludedProperties){for(var n=[],s=[],a=0;a<o.propertyNames.length;a++)i._schemaIncludedProperties.has(o.propertyNames[a])&&(n.push(o.propertyNames[a]),s.push(o.propertyTypes[a]));o=new t.ODataDataSourceSchema(n,s,o.primaryKey)}e(o)}(n.responseText):r())},n.open("Get",o+"/$metadata"),n.send()},i.prototype.makeTaskForRequest=function(e,o){var n,s,a;a=this.actualPageSize,this.sortDescriptions;var u=this._baseUri;u+="/"+this._entitySet;var p=!1;if(this.updateFilterString(),null!=this._filterString&&(p?u+="&":(p=!0,u+="?"),u+="$filter="+this._filterString),null!=this.sortDescriptions){var l=null;try{for(var c=r.__values(this.iter(this.sortDescriptions)),h=c.next();!h.done;h=c.next()){var d=h.value;null==l?l="":l+=", ",d.direction==t.ListSortDirection.Descending?l+=d.propertyName+" desc":l+=d.propertyName}}catch(e){n={error:e}}finally{try{h&&!h.done&&(s=c.return)&&s.call(c)}finally{if(n)throw n.error}}null!=l&&(p?u+="&":(p=!0,u+="?"),u+="$orderby="+l)}if(null!=this.desiredProperties&&this.desiredProperties.length>0){for(var f="",m=!0,y=this.desiredProperties,g=0;g<y.length;g++){m?m=!1:f+=", ",f+=y[g]}p?u+="&":(p=!0,u+="?"),u+="$select="+f}var _=new t.AsyncVirtualDataTask;e.index==i.schemaRequestIndex?this.executeRequest(u,p,0,a,_):this.executeRequest(u,p,e.index*a,a,_),e.taskHolder=new t.AsyncDataSourcePageTaskHolder,e.taskHolder.task=_,this.tasks.add(e)},i.prototype.updateFilterString=function(){var e,i;if(null!=this.filterExpressions&&this.filterExpressions.size()>0&&null==this._filterString){var o="",n=!0;try{for(var s=r.__values(this.iterFilter(this.filterExpressions)),a=s.next();!a.done;a=s.next()){var u=a.value;n?n=!1:o+=" AND ";var p=new t.ODataDataSourceFilterExpressionVisitor(0);p.visit(u);var l=p.toString();this.filterExpressions.size()>1&&(l="("+l+")"),o+=l}}catch(t){e={error:t}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}this._filterString=o}},i.prototype.executeRequest=function(e,t,r,i,o){var n=this;t?e+="&":(t=!0,e+="?");var s,a=function(e,t){return n.success(o,e,t)},u=function(e){return n.error(o,e)},p={requestUri:e+="$skip="+r+"&$top="+i+"&$count=true",enableJsonpCallback:this._enableJsonp,method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},data:null};s=function(){odatajs.oData.request(p,a,u)},o.run=s},i.prototype.success=function(e,t,r){e.result=t,e.isCompleted=!0},i.prototype.error=function(e,t){e.isCompleted=!0,e.hasErrors=!0},i.prototype.createBatchRequest=function(e){for(var r=[],i=0;i<e.length;i++){var o=e[i],n={"Content-Type":"application/json","odata-version":"4.0"};o.transactionType===t.TransactionType.Add?r.push({method:"POST",id:"r".concat(i),atomicityGroup:"g1",url:"".concat(this._baseUri,"/").concat(this._entitySet),headers:n,body:o.value}):o.transactionType===t.TransactionType.Update?(o.version&&(n["If-Match"]=o.version),r.push({method:"PATCH",id:"r".concat(i),atomicityGroup:"g1",url:"".concat(this._baseUri,"/").concat(this.getRequestUriWithKey(o.id)),headers:n,body:o.value})):o.transactionType===t.TransactionType.Delete&&(o.version&&(n["If-Match"]=o.version),r.push({method:"DELETE",id:"r".concat(i),atomicityGroup:"g1",url:"".concat(this._baseUri,"/").concat(this.getRequestUriWithKey(o.id)),headers:n}))}var s={requestUri:"".concat(this._baseUri,"/$batch"),method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requests:r})},a=this;odatajs.oData.request(s,(function(e){if(e&&e.responses)if(e.responses.length>0){for(var t=!0,i=[],o=function(o){if(200!==e.responses[o].status&&204!==e.responses[o].status){t=!1;var n=r.filter((function(t){return t.id==e.responses[o].id}))[0];if(n){var s="".concat(n.method," request failed with code ").concat(e.responses[o].status);i.push(s),console.error(s)}return"break"}},n=0;n<e.responses.length;n++){if("break"===o(n))break}t?a.batchCompleted(!0,!0,null):a.batchCompleted(!1,!0,i)}else a.batchCompleted(!1,!0,null)}),(function(e){var t=[];e&&e.message&&t.push(e.message),a.batchCompleted(!1,!0,t)}))},i.prototype.getRequestUriWithKey=function(e){for(var t="",r=Object.keys(e),i=0;i<r.length;i++)i>0&&(t+=","),t+="".concat(r[i],"=").concat(e[r[i]]);return"".concat(this._entitySet,"(").concat(t,")")},i.schemaRequestIndex=-1,i}(t.AsyncVirtualDataSourceProviderWorker),m=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._baseUri=null,t._entitySet=null,t._sortDescriptions=null,t._filterExpressions=null,t._propertiesRequested=null,t._schemaIncludedProperties=null,t._groupDescriptions=null,t._summaryDescriptions=null,t}return r.__extends(i,e),Object.defineProperty(i.prototype,"baseUri",{get:function(){return this._baseUri},set:function(e){this._baseUri=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"entitySet",{get:function(){return this._entitySet},set:function(e){this._entitySet=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"sortDescriptions",{get:function(){return this._sortDescriptions},set:function(e){this._sortDescriptions=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"filterExpressions",{get:function(){return this._filterExpressions},set:function(e){this._filterExpressions=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"propertiesRequested",{get:function(){return this._propertiesRequested},set:function(e){this._propertiesRequested=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"schemaIncludedProperties",{get:function(){return this._schemaIncludedProperties},set:function(e){this._schemaIncludedProperties=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"groupDescriptions",{get:function(){return this._groupDescriptions},set:function(e){this._groupDescriptions=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"summaryDescriptions",{get:function(){return this._summaryDescriptions},set:function(e){this._summaryDescriptions=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"summaryScope",{get:function(){return this._summaryscope},set:function(e){this._summaryscope=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"enableJsonp",{get:function(){return this._enableJsonp},set:function(e){this._enableJsonp=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isAggregationSupported",{get:function(){return this._isAggregationSupported},set:function(e){this._isAggregationSupported=e},enumerable:!1,configurable:!0}),i.$t=t.markType(i,"ODataVirtualDataSourceDataProviderWorkerSettings",t.AsyncVirtualDataSourceDataProviderWorkerSettings.$type),i}(t.AsyncVirtualDataSourceDataProviderWorkerSettings),y=function(e){function i(){var r=e.call(this)||this;return r._worker=null,r._requests=new s,r._callback=null,r._pageLoaded=null,r._pageSizeRequested=50,r._baseUri=null,r._entitySet=null,r._timeoutMilliseconds=1e4,r.schemaChanged=null,r._currentFullCount=0,r._currentSchema=null,r._executionContext=null,r._updateNotifier=null,r._deferAutoRefresh=!1,r._sortDescriptions=null,r._groupDescriptions=null,r._propertiesRequested=null,r._schemaIncludedProperties=null,r._filterExpressions=null,r._summaryDescriptions=null,r._enableJsonp=!0,r._schemaFetchQueued=!1,r._autoRefreshQueued=!1,r._batchCompleted=null,r._sortDescriptions=new t.SortDescriptionCollection,r._sortDescriptions.onChanged=function(){return r.sortDescriptions_CollectionChanged(null,null)},r._groupDescriptions=new t.SortDescriptionCollection,r._groupDescriptions.onChanged=function(){return r.groupDescriptions_CollectionChanged(null,null)},r._filterExpressions=new t.FilterExpressionCollection,r._filterExpressions.onChanged=function(){return r.filterExpressions_CollectionChanged(null,null)},r._summaryDescriptions=new t.SummaryDescriptionCollection,r._summaryDescriptions.onChanged=function(){return r.summaryDescriptions_CollectionChanged(null,null)},r}return r.__extends(i,e),i.prototype.filterExpressions_CollectionChanged=function(e,t){this.queueAutoRefresh()},i.prototype.sortDescriptions_CollectionChanged=function(e,t){this.queueAutoRefresh()},i.prototype.groupDescriptions_CollectionChanged=function(e,t){this.queueAutoRefresh()},i.prototype.summaryDescriptions_CollectionChanged=function(e,t){this.queueAutoRefresh()},i.prototype.addPageRequest=function(e,r){this.deferAutoRefresh||(null!=this._worker&&this._worker.isShutdown&&(this._worker=null,this._callback=null),null==this._worker&&this.createWorker(),r==t.DataSourcePageRequestPriority.High?this._requests.addFirst(e):this._requests.addLast(e),this._worker.addPageRequest(e,r)||(this._worker=null,this._callback=null,this.addPageRequest(e,r)))},i.prototype.createWorker=function(){if(this.valid()){this._callback=t.runOn(this,this.raisePageLoaded);var e=this.getWorkerSettings();this._worker=new f(e)}},i.prototype.valid=function(){return null!=this.entitySet&&null!=this.baseUri},i.prototype.getWorkerSettings=function(){var e,t=this;return(e=new m).baseUri=t._baseUri,e.entitySet=t._entitySet,e.pageSizeRequested=t._pageSizeRequested,e.timeoutMilliseconds=t._timeoutMilliseconds,e.pageLoaded=t._callback,e.batchCompleted=t._batchCompleted,e.executionContext=t._executionContext,e.sortDescriptions=t._sortDescriptions,e.groupDescriptions=t._groupDescriptions,e.filterExpressions=t._filterExpressions,e.propertiesRequested=t._propertiesRequested,e.schemaIncludedProperties=t._schemaIncludedProperties,e.summaryDescriptions=t._summaryDescriptions,e.summaryScope=t._summaryScope,e.enableJsonp=t._enableJsonp,e.isAggregationSupported=t.isAggregationSupported,e},i.prototype.removePageRequest=function(e){for(var t=this._requests.first;null!=t;)t.value==e&&this._requests.remove(t),t=t.next;null!=this._worker&&this._worker.removePageRequest(e)},i.prototype.removeAllPageRequests=function(){this._requests.clear(),null!=this._worker&&this._worker.removeAllPageRequests()},i.prototype.close=function(){null!=this._worker&&(this._worker.shutdown(),this._worker=null,this._callback=null)},Object.defineProperty(i.prototype,"pageLoaded",{get:function(){return this._pageLoaded},set:function(e){this._pageLoaded=e,this.queueAutoRefresh()},enumerable:!1,configurable:!0}),i.prototype.raisePageLoaded=function(e,r,i){if(null!=this._pageLoaded){if(this._currentFullCount=r,null==this._currentSchema){var o=null;null!=e&&(o=e.schema()),this._currentSchema=o,null!=this.schemaChanged&&this.schemaChanged(this,new t.DataSourceDataProviderSchemaChangedEventArgs(this._currentSchema,this._currentFullCount))}e.pageIndex()!=f.schemaRequestIndex&&this._pageLoaded(e,r,i)}},i.prototype.killWorker=function(){null!=this._worker&&(this._worker.shutdown(),this._worker=null,this._callback=null)},Object.defineProperty(i.prototype,"pageSizeRequested",{get:function(){return this._pageSizeRequested},set:function(e){this._pageSizeRequested=e,this.queueAutoRefresh()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"baseUri",{get:function(){return this._baseUri},set:function(e){var t=this._baseUri;this._baseUri=e,t!=this._baseUri&&(this.queueAutoRefresh(),this.valid()&&this.deferAutoRefresh&&this.queueSchemaFetch())},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"entitySet",{get:function(){return this._entitySet},set:function(e){var t=this._entitySet;this._entitySet=e,t!=this._entitySet&&(this.queueAutoRefresh(),this.valid()&&this.deferAutoRefresh&&this.queueSchemaFetch())},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"timeoutMilliseconds",{get:function(){return this._timeoutMilliseconds},set:function(e){this._timeoutMilliseconds=e,this.queueAutoRefresh()},enumerable:!1,configurable:!0}),i.prototype.getItemValue=function(e,t){var r=e;return r.has(t)?r.get(t):null},i.prototype.setItemValue=function(e,t,r){},i.prototype.removeItem=function(e){},i.prototype.addItem=function(e){},Object.defineProperty(i.prototype,"actualCount",{get:function(){return this._currentFullCount},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"actualSchema",{get:function(){return this._currentSchema},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"executionContext",{get:function(){return this._executionContext},set:function(e){this._executionContext=e,this.queueAutoRefresh()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"updateNotifier",{get:function(){return this._updateNotifier},set:function(e){this._updateNotifier=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"deferAutoRefresh",{get:function(){return this._deferAutoRefresh},set:function(e){this._deferAutoRefresh=e,this._deferAutoRefresh||this.queueAutoRefresh(),this._deferAutoRefresh&&this.valid()&&null==this._currentSchema&&this.queueSchemaFetch()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isSortingSupported",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isGroupingSupported",{get:function(){return this.isAggregationSupported},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isFilteringSupported",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isAggregationSupported",{get:function(){return this._isAggregationSupported},set:function(e){this._isAggregationSupported=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"sortDescriptions",{get:function(){return this._sortDescriptions},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"groupDescriptions",{get:function(){return this._groupDescriptions},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"propertiesRequested",{get:function(){return this._propertiesRequested},set:function(e){this._propertiesRequested=e,this.queueAutoRefresh()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"schemaIncludedProperties",{get:function(){return this._schemaIncludedProperties},set:function(e){this._schemaIncludedProperties=e,this.queueAutoRefresh()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"filterExpressions",{get:function(){return this._filterExpressions},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"summaryDescriptions",{get:function(){return this._summaryDescriptions},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"summaryScope",{get:function(){return this._summaryScope},set:function(e){this._summaryScope=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"enableJsonp",{get:function(){return this._enableJsonp},set:function(e){this._enableJsonp=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"notifyUsingSourceIndexes",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isItemIndexLookupSupported",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isKeyIndexLookupSupported",{get:function(){return!1},enumerable:!1,configurable:!0}),i.prototype.notifySetItem=function(e,t,r){null!=this.updateNotifier&&this.updateNotifier.notifySetItem(e,t,r)},i.prototype.notifyClearItems=function(){null!=this.updateNotifier&&this.updateNotifier.notifyClearItems()},i.prototype.notifyInsertItem=function(e,t){null!=this.updateNotifier&&this.updateNotifier.notifyInsertItem(e,t)},i.prototype.notifyRemoveItem=function(e,t){null!=this.updateNotifier&&this.updateNotifier.notifyRemoveItem(e,t)},i.prototype.queueSchemaFetch=function(){this._schemaFetchQueued||null!=this.executionContext&&(this._schemaFetchQueued=!0,this.executionContext.enqueueAction(t.runOn(this,this.doSchemaFetchInternal)))},i.prototype.doSchemaFetchInternal=function(){this._schemaFetchQueued&&(this._schemaFetchQueued=!1,this.schemaFetchInternal())},i.prototype.schemaFetchInternal=function(){this.schemaFetchInternalOverride()},i.prototype.schemaFetchInternalOverride=function(){this.deferAutoRefresh&&(this.removeAllPageRequests(),this.killWorker(),this.createWorker(),this.addSchemaRequest())},i.prototype.addSchemaRequest=function(){this._worker.addPageRequest(f.schemaRequestIndex,t.DataSourcePageRequestPriority.High)},i.prototype.queueAutoRefresh=function(){this.deferAutoRefresh||this._autoRefreshQueued||null!=this.executionContext&&(this._autoRefreshQueued=!0,this.executionContext.enqueueAction(t.runOn(this,this.doRefreshInternal)))},i.prototype.doRefreshInternal=function(){this.deferAutoRefresh?this._autoRefreshQueued=!1:this._autoRefreshQueued&&(this._autoRefreshQueued=!1,this.refreshInternal())},i.prototype.refreshInternal=function(){this.refreshInternalOverride()},i.prototype.refreshInternalOverride=function(){this.removeAllPageRequests(),this.killWorker(),this.createWorker(),this._worker.addPageRequest(0,t.DataSourcePageRequestPriority.Normal)},i.prototype.flushAutoRefresh=function(){this.doRefreshInternal()},i.prototype.refresh=function(){this.refreshInternal()},i.prototype.indexOfItem=function(e){return-1},i.prototype.indexOfKey=function(e){return-1},i.prototype.resolveSchemaPropertyType=function(e){if(null==this.actualSchema)return t.DataSourceSchemaPropertyType.ObjectValue;if(t.stringContains(e,"."))return t.DataSourceSchemaPropertyType.ObjectValue;for(var r=0;r<this.actualSchema.propertyNames.length;r++){if(this.actualSchema.propertyNames[r]==e)return this.actualSchema.propertyTypes[r]}return t.DataSourceSchemaPropertyType.ObjectValue},i.prototype.createBatchRequest=function(e){this._worker&&this._worker.createBatchRequest(e)},Object.defineProperty(i.prototype,"batchCompleted",{get:function(){return this._batchCompleted},set:function(e){this._batchCompleted=e},enumerable:!1,configurable:!0}),i.$t=t.markType(i,"ODataVirtualDataSourceDataProvider",t.Base.$type,[t.IDataSourceVirtualDataProvider_$type]),i}(t.Base),g=function(e){function i(){var t,r=e.call(this)||this;return r._baseUri=null,r._entitySet=null,r._timeoutMilliseconds=1e4,r._isAggregationSupportedByServer=!1,r._enableJsonp=!0,r.dataProvider=((t=new y).executionContext=r.executionContext,t.enableJsonp=r.enableJsonp,t.isAggregationSupported=r.isGroupingSupported,t),r.externalDataSource=r,r}return r.__extends(i,e),i.prototype.onBaseUriChanged=function(e,r){null!==t.typeCast(y.$type,this.actualDataProvider)&&(this.actualDataProvider.baseUri=this.baseUri),this.queueAutoRefresh()},Object.defineProperty(i.prototype,"baseUri",{get:function(){return this._baseUri},set:function(e){var t=this._baseUri;this._baseUri=e,t!=this._baseUri&&this.onBaseUriChanged(t,this._baseUri)},enumerable:!1,configurable:!0}),i.prototype.onEntitySetChanged=function(e,r){null!==t.typeCast(y.$type,this.actualDataProvider)&&(this.actualDataProvider.entitySet=this.entitySet),this.queueAutoRefresh()},Object.defineProperty(i.prototype,"entitySet",{get:function(){return this._entitySet},set:function(e){var t=this._entitySet;this._entitySet=e,this._entitySet!=t&&this.onEntitySetChanged(t,this._entitySet)},enumerable:!1,configurable:!0}),i.prototype.onTimeoutMillisecondsChanged=function(e,r){null!==t.typeCast(y.$type,this.actualDataProvider)&&(this.actualDataProvider.timeoutMilliseconds=this.timeoutMilliseconds)},Object.defineProperty(i.prototype,"timeoutMilliseconds",{get:function(){return this._timeoutMilliseconds},set:function(e){var t=this._timeoutMilliseconds;this._timeoutMilliseconds=e,t!=this._timeoutMilliseconds&&this.onTimeoutMillisecondsChanged(t,this._timeoutMilliseconds)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isSortingSupportedOverride",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isFilteringSupportedOverride",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isGroupingSupportedOverride",{get:function(){return this.isAggregationSupportedByServer},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isAggregationSupportedByServer",{get:function(){return this._isAggregationSupportedByServer},set:function(e){this._isAggregationSupportedByServer=e,null!==t.typeCast(y.$type,this.actualDataProvider)&&(this.actualDataProvider.isAggregationSupported=e)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"enableJsonp",{get:function(){return this._enableJsonp},set:function(e){this._enableJsonp=e,null!==t.typeCast(y.$type,this.actualDataProvider)&&(this.actualDataProvider.enableJsonp=e)},enumerable:!1,configurable:!0}),i.prototype.clone=function(){var e=new i;e.executionContext=this.executionContext,e.includeSummaryRowsInSection=this.includeSummaryRowsInSection,e.isSectionCollapsable=this.isSectionCollapsable,e.isSectionExpandedDefault=this.isSectionExpandedDefault,e.isSectionSummaryRowsAtBottom=this.isSectionSummaryRowsAtBottom,e.primaryKey=this.primaryKey,e.propertiesRequested=this.propertiesRequested,e.sectionHeaderDisplayMode=this.sectionHeaderDisplayMode,e.shouldEmitSectionFooters=this.shouldEmitSectionFooters,e.shouldEmitSectionHeaders=this.shouldEmitSectionHeaders,e.shouldEmitShiftedRows=this.shouldEmitShiftedRows,e.summaryScope=this.summaryScope;for(var t=0;t<this.groupDescriptions.size();t++)e.groupDescriptions.add(this.groupDescriptions.get(t));for(t=0;t<this.sortDescriptions.size();t++)e.sortDescriptions.add(this.sortDescriptions.get(t));for(t=0;t<this.filterExpressions.size();t++)e.filterExpressions.add(this.filterExpressions.get(t));for(t=0;t<this.summaryDescriptions.size();t++)e.summaryDescriptions.add(this.summaryDescriptions.get(t));return e.pageSizeRequested=this.pageSizeRequested,e.maxCachedPages=this.maxCachedPages,e.baseUri=this.baseUri,e.entitySet=this.entitySet,e.timeoutMilliseconds=this.timeoutMilliseconds,e.isAggregationSupportedByServer=this.isAggregationSupportedByServer,e.enableJsonp=this.enableJsonp,e},i}(t.VirtualDataSource),_=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(i,e),i.$t=t.markType(i,"ODataVirtualDataSourceProviderTaskDataHolder",t.AsyncVirtualDataSourceProviderTaskDataHolder.$type),i}(t.AsyncVirtualDataSourceProviderTaskDataHolder),v=function(){function e(e,r,i,o,n){if(this._actualData=null,this._schema=null,this._pageIndex=0,this._groupInformation=null,this._summaryInformation=null,null==e)this._actualData=null;else{var s=e.items.length;this._actualData=[];for(var a=new Set,u=0;u<r.propertyNames.length;u++)r.propertyTypes[u]!=t.DataSourceSchemaPropertyType.DateTimeValue&&r.propertyTypes[u]!=t.DataSourceSchemaPropertyType.DateTimeOffsetValue||a.add(r.propertyNames[u]);for(var p=void 0,l=function(t){for(var r=e.items[t],i=new Map,o=Array.from(Object.keys(r)),n=o.map((function(e){return r[e]})),s=0;s<o.length;s++)p=n[s],a.has(o[s])&&(p=new Date(p)),i.set(o[s],p);c._actualData[t]=i},c=this,h=0;h<s;h++)l(h)}this._schema=r,this._groupInformation=i,this._summaryInformation=o,this._pageIndex=n}return e.prototype.count=function(){return this._actualData.length},e.prototype.getItemAtIndex=function(e){return this._actualData[e]},e.prototype.getItemValueAtIndex=function(e,t){var r=this._actualData[e];return r.has(t)?r.get(t):null},e.prototype.pageIndex=function(){return this._pageIndex},e.prototype.schema=function(){return this._schema},e.prototype.getGroupInformation=function(){return this._groupInformation},e.prototype.getSummaryInformation=function(){return this._summaryInformation},e}(),b=function(e){function i(i){var o,n,s=e.call(this,i)||this;if(s._baseUri=null,s._entitySet=null,s._sortDescriptions=null,s._groupDescriptions=null,s._filterExpressions=null,s._summaryDescriptions=null,s._desiredPropeties=null,s._schemaIncludedProperties=null,s._enableJsonp=!0,s._isAggregationSupported=!1,s._provideFullCount=null,s._provideOrderByParameter=null,s._provideFilterParameter=null,s._provideAggregationParameter=null,s._provideAggregatedCount=null,s._providePagingParameter=null,s._provideDesiredPropertiesParameter=null,s._provideUri=null,s._performFetch=null,s._fixedFullCount=-1,s._groupInformation=null,s._summaryInformation=null,s._filterString=null,s._selectedString=null,s.doWork=s.doWork.bind(s),s._baseUri=i.baseUri,s._entitySet=i.entitySet,s._sortDescriptions=i.sortDescriptions,s._groupDescriptions=i.groupDescriptions,null!=s._groupDescriptions&&s._groupDescriptions.size()>0){s._sortDescriptions=new t.SortDescriptionCollection;try{for(var a=r.__values(s.iter(i.sortDescriptions)),u=a.next();!u.done;u=a.next()){var p=u.value;s._sortDescriptions.add(p)}}catch(e){o={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}for(var l=0;l<s._groupDescriptions.size();l++)s._sortDescriptions.insert(l,s._groupDescriptions.get(l))}if(s._filterExpressions=i.filterExpressions,s._desiredPropeties=i.propertiesRequested,null!=i.schemaIncludedProperties){s._schemaIncludedProperties=new Set;for(l=0;l<i.schemaIncludedProperties.length;l++)s._schemaIncludedProperties.add(i.schemaIncludedProperties[l])}return s._summaryDescriptions=i.summaryDescriptions,s._fixedFullCount=i.fixedFullCount,s._summaryScope=i.summaryScope,s._enableJsonp=i.enableJsonp,s._provideFullCount=i.provideFullCount,s._performFetch=i.performFetch,s._provideAggregationParameter=i.provideAggregationParameter,s._provideFilterParameter=i.provideFilterParameter,s._provideOrderByParameter=i.provideOrderByParameter,s._provideUri=i.provideUri,s._providePagingParameter=i.providePagingParameter,s._provideDesiredPropertiesParameter=i.provideDesiredPropertiesParameter,s._provideItems=i.provideItems,s._provideAggregatedCount=i.provideAggregatedCount,s._provideItems||(s._provideItems=function(e){return e?e.items:null}),s._provideFullCount||(s._provideFullCount=function(e){return e.fullCount?e.fullCount:s._fixedFullCount>=0?s._fixedFullCount:0}),s._provideOrderByParameter||(s._provideOrderByParameter=function(e,t,r){e.push({name:"orderBy",value:encodeURIComponent(t)})}),s._providePagingParameter||(s._providePagingParameter=function(e,t,r){e.push({name:"skip",value:t}),e.push({name:"take",value:r})}),s._provideAggregationParameter||(s._provideAggregationParameter=function(e,t,r,i,o,n){e.push({name:"groupBy",value:r}),e.push({name:"aggregate",value:"count"})}),s._provideUri||(s._provideUri=function(e,t,r){var i=e;i+="/"+t,r.length>0&&(i+="?");for(var o="",n=0;n<r.length;n++)n>0&&(o+="&"),o+=r[n].name+"="+r[n].value;return i+o}),s._isAggregationSupported=i.isAggregationSupported,window.setTimeout(s.doWork,100),s}return r.__extends(i,e),Object.defineProperty(i.prototype,"sortDescriptions",{get:function(){return this._sortDescriptions},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"filterExpressions",{get:function(){return this._filterExpressions},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"desiredProperties",{get:function(){return this._desiredPropeties},enumerable:!1,configurable:!0}),i.prototype.initialize=function(){e.prototype.initialize.call(this)},i.prototype.getTaskDataHolder=function(){return new _},i.prototype.getCompletedTaskData=function(t,r){e.prototype.getCompletedTaskData.call(this,t,r)},i.prototype.removeCompletedTaskData=function(t,r){e.prototype.removeCompletedTaskData.call(this,t,r)},i.prototype.getTasksData=function(t){e.prototype.getTasksData.call(this,t)},i.prototype.iter=function(e){var t;return r.__generator(this,(function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<e.size()?[4,e.get(t)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}}))},i.prototype.iterFilter=function(e){var t;return r.__generator(this,(function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<e.size()?[4,e.get(t)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}}))},i.prototype.iterSummaries=function(e){var t;return r.__generator(this,(function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<e.size()?[4,e.get(t)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}}))},i.prototype.processCompletedTask=function(e,t,r,o){var n,s=this,a=null,u=-1,p=e.task;try{if(p.hasErrors)return void this.retryIndex(r,t);r==i.schemaRequestIndex?(a=p.result,u=this._provideFullCount(a)):a=p.result}catch(e){return void this.retryIndex(r,t)}if(this.actualCount=u>=0?u:this._provideFullCount(a),null!=(n=this.actualSchema))this.finishProcessingCompletedTask(p,r,n,a);else{var l=0;this.resolveSchema((function(e){s.actualSchema=e,!s._isAggregationSupported||0===s._groupDescriptions.size()&&0===s._summaryDescriptions.size()?s.finishProcessingCompletedTask(p,r,e,a):(s._groupDescriptions.size()>0&&(l++,s.resolveGroupInformation((function(t){0===--l&&s.finishProcessingCompletedTask(p,r,e,a)}),(function(){s.retryIndex(r,t)}))),s._summaryDescriptions.size()>0&&(l++,s.resolveSummaryInformation((function(t){0===--l&&s.finishProcessingCompletedTask(p,r,e,a)}),(function(){s.retryIndex(r,t)}))))}),(function(){s.retryIndex(r,t)}))}},i.prototype.finishProcessingCompletedTask=function(e,t,r,i){var o,n,s,a,u=this;this.actualSchema=r,o=this.executionContext,s=this._groupInformation,a=this._summaryInformation,n=this.pageLoaded;var p=null;if(null!=i?(p=new v(i,r,s,a,t),!this.isLastPage(t)&&p.count()>0&&!this.populatedActualPageSize&&(this.populatedActualPageSize=!0,this.actualPageSize=p.count())):p=new v(null,r,s,a,t),null!=this.pageLoaded)if(null!=this.executionContext){if(null==o||null==n)return void this.shutdown();o.execute((function(){return n(p,u.actualCount,u.actualPag