mvcct-odata
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -841,2 +841,3 @@ var __extends = (this && this.__extends) || (function () { | ||
this.verb = y.verb; | ||
this.ajaxId = y.ajaxId; | ||
} | ||
@@ -843,0 +844,0 @@ } |
@@ -845,2 +845,3 @@ var __extends = (this && this.__extends) || (function () { | ||
this.verb = y.verb; | ||
this.ajaxId = y.ajaxId; | ||
} | ||
@@ -847,0 +848,0 @@ } |
@@ -1,2 +0,2 @@ | ||
var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mvcct;!function(t){!function(t){function e(t,e){t+="",e.set[t]||(e.counters[0]=e.counters[0]+1,e.set[t]=!0)}function r(t){return function(e){for(var r=0,n=t;r<n.length;r++){e=(0,n[r])(e)}return e}}function n(t){return function(e,r){for(var n=0,i=t;n<i.length;n++){var o=i[n],u=o(e,r);if(0!=u)return u}return 0}}var i="first argument must have a not null value",o=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,u=function(){function t(){this.value=[],this.child={}}return t.prototype.add=function(t,e){this.addInternal(t.map(function(t){return e[t]+""}),0,e)},t.prototype.addInternal=function(e,r,n){if(r==e.length)this.value.push(n);else{var i=this.child[e[r]];i||(this.child[e[r]]=i=new t),i.addInternal(e,r+1,n)}},t.prototype.aggregate=function(t,e,r){var n=this;if(t>0){var i=[];for(var o in this.child)Array.prototype.push.apply(i,this.child[o].aggregate(t-1,e,r));return i}if(!this.value.length)return[];r.forEach(function(t){t.initialize(t)});var u={};e.forEach(function(t){u[t]=n.value[0][t]});for(var s=function(t){r.forEach(function(e){e.update(t[e.property],e)})},a=0,l=this.value;a<l.length;a++){s(l[a])}return r.forEach(function(t){u[t.alias]=t.result(t)}),[u]},t}(),s=function(){function t(){}return t.prototype.encodeProperty=function(t){return null==t?null:t.replace(/\./g,"/")},t.prototype.decodeProperty=function(t){return null==t?null:t.replace(/\//g,".")},t.prototype.getProperty=function(e,r){return t.getProperty(e,r)},t.getProperty=function(t,e){for(var r=e.split("."),n=0;"object"==typeof t&&n<r.length;)t=t[r[n++]];return t&&"function"==typeof t.getMonth&&(t=t.getTime()),t},t}();t.QueryNode=s;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(s);t.QueryFilterClause=a;var l=function(t){function e(r,n,o){void 0===n&&(n=null),void 0===o&&(o=null);var u=t.call(this)||this;if("number"==typeof r){if(!n)throw"first operand must have a not null value";u.operator=r,void 0===n.dateTimeType?(u.child1=n,u.argument1=null):(u.child1=null,u.argument1=n),o?void 0===o.dateTimeType?(u.child2=o,u.argument2=null):(u.child2=null,u.argument2=o):(u.child2=null,u.argument2=null)}else{if(!r)throw i;u.argument1=r.argument1?void 0!==r.argument1.operator?new p(r.argument1):new h(r.argument1):null,u.argument2=r.argument2?void 0!==r.argument2.operator?new p(r.argument2):new h(r.argument2):null,u.child1=r.child1?new e(r.child1):null,u.child2=r.child2?new e(r.child2):null,u.operator=r.operator||e.and}return u}return __extends(e,t),e.prototype.toString=function(){var t=this.argument1||this.child1,r=this.argument2||this.child2;if(!t&&!r)return null;if(this.operator==e.not)return"(not "+(t||r).toString()+")";if(this.operator==e.NOT)return"(NOT "+(t||r).toString()+")";if(!t)return r.toString();if(!r)return t.toString();var n=t.toString(),i=r.toString();return n?i?this.operator==e.and?"("+n+" and "+i+")":this.operator==e.AND?"("+n+" AND "+i+")":this.operator==e.OR?"("+n+" OR "+i+")":"("+n+" or "+i+")":n||null:i||null},e.prototype.toQuery=function(){var t=this.argument1||this.child1,r=this.argument2||this.child2;if(!t&&!r)return null;if(this.operator==e.not||this.operator==e.NOT)return function(e){return!(t||r).toQuery()(e)};if(!t)return r.toQuery();if(!r)return t.toQuery();var n=t.toQuery(),i=r.toQuery();return n?i?this.operator==e.and||this.operator==e.AND?function(e){return t.toQuery()(e)&&r.toQuery()(e)}:function(e){return t.toQuery()(e)||r.toQuery()(e)}:n||null:i||null},e}(a);l.and=0,l.or=1,l.not=2,l.AND=3,l.OR=4,l.NOT=5,t.QueryFilterBooleanOperator=l;var h=function(t){function e(r){void 0===r&&(r=null);var n=t.call(this)||this;return r?(n.value=r.value,n.dateTimeType=r.dateTimeType||e.IsNotDateTime):(n.value=null,n.dateTimeType=p.IsNotDateTime),n}return __extends(e,t),e.prototype.formatInt=function(t,e){var r=t+"";return r.length<e?new Array(e-r.length+1).join("0")+r:r},e.prototype.normalizeTime=function(t,e,r){var n=t.split(":"),i=n[0].indexOf(".");return e&&i<0?t="00."+t:e&&0==i?t="00"+t:e&&1==i&&(t="0"+t),1==n.length?t+=":00:00.000":2==n.length?t+=":00.000":n[2].indexOf(".")<0?t+=".000":r&&n[2].length>6?t=t.substr(0,t.length-n[2].length+6):n[2].length<6&&(t+=new Array(7-n[2].length).join("0")),t},e.prototype.isGuid=function(){return"string"==typeof this.value&&o.test(this.value.toLowerCase())},e.prototype.setDate=function(t){this.dateTimeType=e.IsDate,t||(this.value=null),this.value=this.formatInt(t.getFullYear(),4)+"-"+this.formatInt(t.getMonth()+1,2)+"-"+this.formatInt(t.getDate(),2)+"T00:00:00.000"},e.prototype.setTime=function(t){this.dateTimeType=e.IsTime,t||(this.value=null),this.value=this.formatInt(t.getHours(),2)+":"+this.formatInt(t.getMinutes(),2)+":"+this.formatInt(t.getSeconds(),2)+"."+this.formatInt(t.getMilliseconds(),3)},e.prototype.setDuration=function(t,r,n,i,o){void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=0),this.dateTimeType=e.IsDuration,this.value=this.formatInt(t||0,2)+"."+this.formatInt(r||0,2)+":"+this.formatInt(n||0,2)+":"+this.formatInt(i||0,2)+"."+this.formatInt(o||0,3)},e.prototype.setDateTimeLocal=function(t){this.dateTimeType=e.IsDateTime,t||(this.value=null),this.value=t.toISOString()},e.prototype.setDateTimeInvariant=function(t){this.dateTimeType=e.IsDateTime,t||(this.value=null),this.value=this.formatInt(t.getFullYear(),4)+"-"+this.formatInt(t.getMonth()+1,2)+"-"+this.formatInt(t.getDate(),2)+"T"+this.formatInt(t.getHours(),2)+":"+this.formatInt(t.getMinutes(),2)+":"+this.formatInt(t.getSeconds(),2)+"."+this.formatInt(t.getMilliseconds(),3)},e.prototype.setBoolean=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setNumber=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setString=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setNotDateTime=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.getValue=function(){if(null===this.value||void 0===this.value)return null;if(this.dateTimeType==e.IsNotDateTime)return this.value;var t=this.value;switch(this.dateTimeType){case e.IsDateTime:var r=t.match(/\d+/g);return"Z"==t.charAt(t.length-1).toUpperCase()?new Date(Date.UTC(parseInt(r[0]),parseInt(r[1])-1,parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5]),parseInt(r[6]))).getTime():new Date(parseInt(r[0]),parseInt(r[1])-1,parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5]),parseInt(r[6])).getTime();case e.IsDate:var n=t.split("T")[0].split("-");return new Date(parseInt(n[0]),parseInt(n[1])-1,parseInt(n[2])).getTime();case e.IsTime:t=this.normalizeTime(t,!1,!0);var i=t.match(/\d+/g);return new Date(1970,0,1,parseInt(i[0]),parseInt(i[1]),parseInt(i[2]),parseInt(i[3])).getTime();case e.IsDuration:t=this.normalizeTime(t,!0,!1);var o=t.match(/\d+/g);return 1e3*(60*(60*(24*parseInt(o[0])+parseInt(o[1]))+parseInt(o[2]))+parseInt(o[3]))+parseInt(o[4]);default:return null}},e.prototype.toString=function(){if(null===this.value||void 0===this.value)return"null";if(this.dateTimeType==e.IsNotDateTime)return this.value+"";var t=this.value;switch(this.dateTimeType){case e.IsDateTime:return"Z"!=t.charAt(t.length-1).toUpperCase()?t+"Z":t;case e.IsDate:return t.split("T")[0];case e.IsTime:return t=this.normalizeTime(t,!1,!0);case e.IsDuration:t=this.normalizeTime(t,!0,!1);var r=t.match(/\d+/g);return"'P"+r[0]+"DT"+r[1]+"H"+r[2]+"M"+r[3]+"."+r[4]+new Array(13-r[4].length).join("0")+"S'";default:return null}},e.prototype.toQuery=function(){return null},e}(a);h.IsNotDateTime=0,h.IsDate=1,h.IsTime=2,h.IsDateTime=3,h.IsDuration=4,t.QueryValue=h;var p=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this,e)||this;return e?(r.operator=e.operator||null,r.inv=e.inv||!1,r.property=e.property||null):(r.operator=null,r.inv=!1,r.property=null),r}return __extends(e,t),e.fromModelAndName=function(t,r,n,i,o){if(void 0===i&&(i="eq"),void 0===o&&(o=!1),!n)return null;var u=s.getProperty(n,r),a=new e;switch(a.inv=o,a.property=r,a.operator=i,t){case h.IsDate:a.setDate(u);break;case h.IsTime:a.setTime(u);break;case h.IsDateTime:a.setDateTimeLocal(u);default:a.setNotDateTime(u)}return a},e.prototype.toQuery=function(){var t=this.getValue();if(!this.property){return function(e){if("object"!=typeof e)return!1;for(var r in e){var n=e[r];if("string"==typeof n&&n.indexOf(t)>=0)return!0}return!1}}if(!this.operator)return null;var r=e.dict[this.operator];if(!r)return null;var n=this,i=this.property;switch(this.operator){case e.startswith:case e.endswith:case e.contains:return this.inv?function(e){return r(t,n.getProperty(e,i))}:function(e){return r(n.getProperty(e,i),t)};default:return function(e){return r(n.getProperty(e,i),t)}}},e.prototype.toString=function(){var r=t.prototype.toString.call(this);if(null===r)return null;if(!this.property)return r;switch(this.dateTimeType!=h.IsNotDateTime||"string"!=typeof this.value||this.isGuid()||(r="'"+r.replace(/'/g,"''")+"'"),this.operator){case e.startswith:case e.endswith:case e.contains:return this.inv?this.operator+"("+r+","+this.encodeProperty(this.property)+")":this.operator+"("+this.encodeProperty(this.property)+","+r+")";default:return"("+this.encodeProperty(this.property)+" "+this.operator+" "+r+")"}},e}(h);p.eq="eq",p.ne="ne",p.gt="gt",p.lt="lt",p.ge="ge",p.le="le",p.startswith="startswith",p.endswith="endswith",p.contains="contains",p.dict={eq:function(t,e){return t==e},ne:function(t,e){return t!=e},gt:function(t,e){return t>e},lt:function(t,e){return t<e},ge:function(t,e){return t>=e},le:function(t,e){return t<=e},startswith:function(t,e){return 0==((t||"")+"").indexOf((e||"")+"")},endswith:function(t,e){var r=(t||"")+"",n=(e||"")+"";return r.indexOf(n,r.length-n.length)>=0},contains:function(t,e){return((t||"")+"").indexOf((e||"")+"")>=0}},t.QueryFilterCondition=p;var c=function(t){function e(e){var r=t.call(this)||this;if(!e)throw i;return void 0!==e.dateTimeType?r.value=new l(l.AND,new p(e)):void 0!==e.operator?r.value=new l(e):r.value=e.value?new l(e.value):null,r}return __extends(e,t),e.prototype.toString=function(){return this.value?this.value.toString():null},e.prototype.toQuery=function(){return this.value?this.value.toQuery():null},e}(s);t.QuerySearch=c;var f=function(t){function e(e,r){void 0===r&&(r=!1);var n=t.call(this)||this;if("string"==typeof e)n.property=e,n.down=r;else{if(!e)throw i;n.property=e.property,n.down=e.down}return n}return __extends(e,t),e.prototype.toString=function(){return this.property?this.down?this.encodeProperty(this.property)+" desc":this.encodeProperty(this.property)+" asc":null},e.prototype.toCompare=function(){if(!this.property)return null;var t=this.property,e=this;return this.down?function(r,n){var i=e.getProperty(r,t),o=e.getProperty(n,t);return i>o?-1:i<o?1:0}:function(r,n){var i=e.getProperty(r,t),o=e.getProperty(n,t);return i<o?-1:i>o?1:0}},e}(s);t.QuerySortingCondition=f;var g=function(t){function r(e,n,o){void 0===n&&(n=null),void 0===o&&(o=null);var u=t.call(this)||this;if("string"==typeof e){if(!e||!n||!o)throw"all arguments must have a not null value";u.operator=e,u.isCount=e==r.count,u.property=n,u.alias=o}else{if(!e)throw i;u.isCount=e.operator==r.count,u.operator=e.operator,u.alias=e.alias,u.property=e.property}return u}return __extends(r,t),r.prototype.getCount=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.set={},t.counters[0]=0},result:function(t){return t.counters[0]},update:e}},r.prototype.getSum=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=0},result:function(t){return t.counters[0]},update:function(t,e){e.counters[0]=e.counters[0]+t}}},r.prototype.getAverage=function(){return{counters:[0,0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=0,t.counters[1]=0},result:function(t){return t.counters[0]/t.counters[1]},update:function(t,e){e.counters[0]=e.counters[0]+t,e.counters[1]=e.counters[1]+1}}},r.prototype.getMin=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=void 0},result:function(t){return t.counters[0]},update:function(t,e){(void 0===e.counters[0]||t<e.counters[0])&&(e.counters[0]=t)}}},r.prototype.getMax=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=void 0},result:function(t){return t.counters[0]},update:function(t,e){(void 0===e.counters[0]||t>e.counters[0])&&(e.counters[0]=t)}}},r.prototype.toString=function(){return this.property&&this.operator&&this.alias?this.encodeProperty(this.property)+" with "+this.operator+" as "+this.alias:null},r.prototype.toQuery=function(){switch(this.operator){case r.count:return this.getCount();case r.min:return this.getMin();case r.max:return this.getMax();case r.sum:return this.getSum();case r.average:return this.getAverage()}},r}(s);g.count="countdistinct",g.sum="sum",g.average="average",g.min="min",g.max="max",t.QueryAggregation=g;var y=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this)||this;return e?(e.keys?r.keys=e.keys.map(function(t){return t}):r.keys=new Array,e.dateTimeTypes?r.dateTimeTypes=e.dateTimeTypes.map(function(t){return t}):r.dateTimeTypes=new Array,e.aggregations?r.aggregations=e.aggregations.map(function(t){return new g(t)}):r.aggregations=new Array):(r.keys=new Array,r.dateTimeTypes=new Array,r.aggregations=new Array),r}return __extends(e,t),e.prototype.encodeGroups=function(){var t=this;return null!=!this.keys&&this.keys.length?1==this.keys.length?this.encodeProperty(this.keys[0]):this.keys.filter(function(t){return t}).map(function(e){return t.encodeProperty(e)}).join(","):null},e.prototype.encodeAggrgates=function(){return this.aggregations&&this.aggregations.length?1==this.aggregations.length?this.aggregations[0].toString():this.aggregations.map(function(t){return t.toString()}).filter(function(t){return t}).join(","):null},e.prototype.toString=function(){var t=this.encodeGroups();if(!t)return null;var e=this.encodeAggrgates();return e?"groupby(("+t+"),aggregate("+e+"))":"groupby(("+t+"))"},e.prototype.toQuery=function(){if(!this.keys||!this.keys.length)return null;var t=this.keys.map(function(t){return t}),e=this.aggregations&&this.aggregations.length?this.aggregations.map(function(t){return t.toQuery()}):[];return function(r){if(!r||!r.length)return[];var n=new u;return r.forEach(function(e){n.add(t,e)}),n.aggregate(t.length,t,e)}},e}(s);t.QueryGrouping=y;var d=function(){function t(t,e,r,n,o,u){if(void 0===e&&(e=null),void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===o&&(o=null),void 0===u&&(u=null),"string"==typeof t)this.baseUrl=t,this.bearerToken=o,this.accpetsJson=r,this.returnsJson=n,this.verb=e,this.ajaxId=u;else{if(!t)throw i;this.baseUrl=t.baseUrl,this.bearerToken=t.bearerToken,this.accpetsJson=t.accpetsJson,this.returnsJson=t.returnsJson,this.verb=t.verb}}return t}();d.Get="GET",d.Post="POST",d.Put="PUT",d.Delete="DELETE",d.Patch="PATCH",t.Endpoint=d;var v=function(){function t(t){this.urlEncode=encodeURIComponent,t?(this.skip=t.skip,this.take=t.take,this.page=t.page,this.search=t.search?new c(t.search):null,this.filter=t.filter?new l(t.filter):null,this.grouping=t.grouping?new y(t.grouping):null,this.sorting=t.sorting?t.sorting.map(function(t){return new f(t)}):null,this.attachedTo=t.attachedTo?new d(t.attachedTo):null):(this.skip=null,this.take=0,this.page=0,this.search=null,this.filter=null,this.grouping=null,this.sorting=new Array,this.attachedTo=null)}return t.prototype.customUrlEncode=function(t){this.urlEncode=t||this.urlEncode},t.fromJson=function(e){return e?new t(JSON.parse(e)):null},t.prototype.addFilterCondition=function(t,e){if(void 0===e&&(e=!1),t){if(!this.filter)return void(this.filter=void 0===t.dateTimeType?t:new l(l.and,t,null));var r;r=this.filter.operator!=l.not?this.filter.child1||this.filter.argument1?this.filter.child2||this.filter.argument2?this.filter:this.filter.argument1||this.filter.child1:this.filter.argument2||this.filter.child2:this.filter,this.filter=new l(e?l.or:l.and,r,t)}},t.prototype.getGroupDetailQuery=function(e){if(!(e&&this.grouping&&this.grouping.keys&&this.grouping.keys.length))return null;var r=new t(this);r.grouping=null,r.take=null,r.page=1,r.skip=0;for(var n=0;n<this.grouping.keys.length;n++){var i=p.fromModelAndName(this.grouping.dateTimeTypes[n],this.grouping.keys[n],e);i&&r.addFilterCondition(i)}return r},t.prototype.queryString=function(){var e=new Array,r=this.search?this.search.toString():null,n=null;r?(e.push(t.searchName),e.push("="),e.push(this.urlEncode(r))):(n=this.filter?this.filter.toString():null,n&&(e.push(t.filterName),e.push("="),e.push(this.urlEncode(n))));var i=this.grouping?this.grouping.toString():null;i&&(e.length&&e.push("&"),e.push(t.applyName),e.push("="),e.push(this.urlEncode(i)));var o=this.sorting?this.sorting.map(function(t){return t.toString()}).filter(function(t){return t}).join(","):null;return o&&(e.length&&e.push("&"),e.push(t.sortingName),e.push("="),e.push(this.urlEncode(o))),this.skip>0&&(e.length&&e.push("&"),e.push(t.skipName),e.push("="),e.push(this.skip+"")),this.take&&this.take>0&&(e.length&&e.push("&"),e.push(t.topName),e.push("="),e.push(this.take+"")),e.length?e.join(""):null},t.prototype.addToUrl=function(t){t||(t="");var e=this.queryString();return e&&e.trim()?t.indexOf("?")>=0?t+"&"+e:t+"?"+e:t},t.prototype.toString=function(){return this.addToUrl(this.attachedTo?this.attachedTo.baseUrl:null)},t.prototype.toQuery=function(){var t=[],e=this.search?this.search.toQuery():null;if(e)t.push(function(t){return t.filter(e)});else{var i=this.filter?this.filter.toQuery():null;i&&t.push(function(t){return t.filter(i)})}var o=this.grouping?this.grouping.toQuery():null;o&&t.push(o);var u=this.sorting?n(this.sorting.map(function(t){return t.toCompare()})):null;if(u&&t.push(function(t){var e=t.map(function(t){return t});return e.sort(u),e}),this.skip>0||this.take&&this.take>0){var s=this.skip>0?this.skip:0,a=this.take&&this.take>0?this.take+s:void 0;t.push(function(t){return t.length&&s<t.length?t.slice(s,a?Math.min(a,t.length):void 0):[]})}return t.length?r(t):function(t){return t}},t}();v.filterName="$filter",v.applyName="$apply",v.sortingName="$orderby",v.searchName="$search",v.topName="$top",v.skipName="$skip",t.QueryDescription=v}(t.odata||(t.odata={}))}(mvcct||(mvcct={})); | ||
var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mvcct;!function(t){!function(t){function e(t,e){t+="",e.set[t]||(e.counters[0]=e.counters[0]+1,e.set[t]=!0)}function r(t){return function(e){for(var r=0,n=t;r<n.length;r++){e=(0,n[r])(e)}return e}}function n(t){return function(e,r){for(var n=0,i=t;n<i.length;n++){var o=i[n],u=o(e,r);if(0!=u)return u}return 0}}var i="first argument must have a not null value",o=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,u=function(){function t(){this.value=[],this.child={}}return t.prototype.add=function(t,e){this.addInternal(t.map(function(t){return e[t]+""}),0,e)},t.prototype.addInternal=function(e,r,n){if(r==e.length)this.value.push(n);else{var i=this.child[e[r]];i||(this.child[e[r]]=i=new t),i.addInternal(e,r+1,n)}},t.prototype.aggregate=function(t,e,r){var n=this;if(t>0){var i=[];for(var o in this.child)Array.prototype.push.apply(i,this.child[o].aggregate(t-1,e,r));return i}if(!this.value.length)return[];r.forEach(function(t){t.initialize(t)});var u={};e.forEach(function(t){u[t]=n.value[0][t]});for(var s=function(t){r.forEach(function(e){e.update(t[e.property],e)})},a=0,l=this.value;a<l.length;a++){s(l[a])}return r.forEach(function(t){u[t.alias]=t.result(t)}),[u]},t}(),s=function(){function t(){}return t.prototype.encodeProperty=function(t){return null==t?null:t.replace(/\./g,"/")},t.prototype.decodeProperty=function(t){return null==t?null:t.replace(/\//g,".")},t.prototype.getProperty=function(e,r){return t.getProperty(e,r)},t.getProperty=function(t,e){for(var r=e.split("."),n=0;"object"==typeof t&&n<r.length;)t=t[r[n++]];return t&&"function"==typeof t.getMonth&&(t=t.getTime()),t},t}();t.QueryNode=s;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(s);t.QueryFilterClause=a;var l=function(t){function e(r,n,o){void 0===n&&(n=null),void 0===o&&(o=null);var u=t.call(this)||this;if("number"==typeof r){if(!n)throw"first operand must have a not null value";u.operator=r,void 0===n.dateTimeType?(u.child1=n,u.argument1=null):(u.child1=null,u.argument1=n),o?void 0===o.dateTimeType?(u.child2=o,u.argument2=null):(u.child2=null,u.argument2=o):(u.child2=null,u.argument2=null)}else{if(!r)throw i;u.argument1=r.argument1?void 0!==r.argument1.operator?new p(r.argument1):new h(r.argument1):null,u.argument2=r.argument2?void 0!==r.argument2.operator?new p(r.argument2):new h(r.argument2):null,u.child1=r.child1?new e(r.child1):null,u.child2=r.child2?new e(r.child2):null,u.operator=r.operator||e.and}return u}return __extends(e,t),e.prototype.toString=function(){var t=this.argument1||this.child1,r=this.argument2||this.child2;if(!t&&!r)return null;if(this.operator==e.not)return"(not "+(t||r).toString()+")";if(this.operator==e.NOT)return"(NOT "+(t||r).toString()+")";if(!t)return r.toString();if(!r)return t.toString();var n=t.toString(),i=r.toString();return n?i?this.operator==e.and?"("+n+" and "+i+")":this.operator==e.AND?"("+n+" AND "+i+")":this.operator==e.OR?"("+n+" OR "+i+")":"("+n+" or "+i+")":n||null:i||null},e.prototype.toQuery=function(){var t=this.argument1||this.child1,r=this.argument2||this.child2;if(!t&&!r)return null;if(this.operator==e.not||this.operator==e.NOT)return function(e){return!(t||r).toQuery()(e)};if(!t)return r.toQuery();if(!r)return t.toQuery();var n=t.toQuery(),i=r.toQuery();return n?i?this.operator==e.and||this.operator==e.AND?function(e){return t.toQuery()(e)&&r.toQuery()(e)}:function(e){return t.toQuery()(e)||r.toQuery()(e)}:n||null:i||null},e}(a);l.and=0,l.or=1,l.not=2,l.AND=3,l.OR=4,l.NOT=5,t.QueryFilterBooleanOperator=l;var h=function(t){function e(r){void 0===r&&(r=null);var n=t.call(this)||this;return r?(n.value=r.value,n.dateTimeType=r.dateTimeType||e.IsNotDateTime):(n.value=null,n.dateTimeType=p.IsNotDateTime),n}return __extends(e,t),e.prototype.formatInt=function(t,e){var r=t+"";return r.length<e?new Array(e-r.length+1).join("0")+r:r},e.prototype.normalizeTime=function(t,e,r){var n=t.split(":"),i=n[0].indexOf(".");return e&&i<0?t="00."+t:e&&0==i?t="00"+t:e&&1==i&&(t="0"+t),1==n.length?t+=":00:00.000":2==n.length?t+=":00.000":n[2].indexOf(".")<0?t+=".000":r&&n[2].length>6?t=t.substr(0,t.length-n[2].length+6):n[2].length<6&&(t+=new Array(7-n[2].length).join("0")),t},e.prototype.isGuid=function(){return"string"==typeof this.value&&o.test(this.value.toLowerCase())},e.prototype.setDate=function(t){this.dateTimeType=e.IsDate,t||(this.value=null),this.value=this.formatInt(t.getFullYear(),4)+"-"+this.formatInt(t.getMonth()+1,2)+"-"+this.formatInt(t.getDate(),2)+"T00:00:00.000"},e.prototype.setTime=function(t){this.dateTimeType=e.IsTime,t||(this.value=null),this.value=this.formatInt(t.getHours(),2)+":"+this.formatInt(t.getMinutes(),2)+":"+this.formatInt(t.getSeconds(),2)+"."+this.formatInt(t.getMilliseconds(),3)},e.prototype.setDuration=function(t,r,n,i,o){void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=0),this.dateTimeType=e.IsDuration,this.value=this.formatInt(t||0,2)+"."+this.formatInt(r||0,2)+":"+this.formatInt(n||0,2)+":"+this.formatInt(i||0,2)+"."+this.formatInt(o||0,3)},e.prototype.setDateTimeLocal=function(t){this.dateTimeType=e.IsDateTime,t||(this.value=null),this.value=t.toISOString()},e.prototype.setDateTimeInvariant=function(t){this.dateTimeType=e.IsDateTime,t||(this.value=null),this.value=this.formatInt(t.getFullYear(),4)+"-"+this.formatInt(t.getMonth()+1,2)+"-"+this.formatInt(t.getDate(),2)+"T"+this.formatInt(t.getHours(),2)+":"+this.formatInt(t.getMinutes(),2)+":"+this.formatInt(t.getSeconds(),2)+"."+this.formatInt(t.getMilliseconds(),3)},e.prototype.setBoolean=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setNumber=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setString=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setNotDateTime=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.getValue=function(){if(null===this.value||void 0===this.value)return null;if(this.dateTimeType==e.IsNotDateTime)return this.value;var t=this.value;switch(this.dateTimeType){case e.IsDateTime:var r=t.match(/\d+/g);return"Z"==t.charAt(t.length-1).toUpperCase()?new Date(Date.UTC(parseInt(r[0]),parseInt(r[1])-1,parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5]),parseInt(r[6]))).getTime():new Date(parseInt(r[0]),parseInt(r[1])-1,parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5]),parseInt(r[6])).getTime();case e.IsDate:var n=t.split("T")[0].split("-");return new Date(parseInt(n[0]),parseInt(n[1])-1,parseInt(n[2])).getTime();case e.IsTime:t=this.normalizeTime(t,!1,!0);var i=t.match(/\d+/g);return new Date(1970,0,1,parseInt(i[0]),parseInt(i[1]),parseInt(i[2]),parseInt(i[3])).getTime();case e.IsDuration:t=this.normalizeTime(t,!0,!1);var o=t.match(/\d+/g);return 1e3*(60*(60*(24*parseInt(o[0])+parseInt(o[1]))+parseInt(o[2]))+parseInt(o[3]))+parseInt(o[4]);default:return null}},e.prototype.toString=function(){if(null===this.value||void 0===this.value)return"null";if(this.dateTimeType==e.IsNotDateTime)return this.value+"";var t=this.value;switch(this.dateTimeType){case e.IsDateTime:return"Z"!=t.charAt(t.length-1).toUpperCase()?t+"Z":t;case e.IsDate:return t.split("T")[0];case e.IsTime:return t=this.normalizeTime(t,!1,!0);case e.IsDuration:t=this.normalizeTime(t,!0,!1);var r=t.match(/\d+/g);return"'P"+r[0]+"DT"+r[1]+"H"+r[2]+"M"+r[3]+"."+r[4]+new Array(13-r[4].length).join("0")+"S'";default:return null}},e.prototype.toQuery=function(){return null},e}(a);h.IsNotDateTime=0,h.IsDate=1,h.IsTime=2,h.IsDateTime=3,h.IsDuration=4,t.QueryValue=h;var p=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this,e)||this;return e?(r.operator=e.operator||null,r.inv=e.inv||!1,r.property=e.property||null):(r.operator=null,r.inv=!1,r.property=null),r}return __extends(e,t),e.fromModelAndName=function(t,r,n,i,o){if(void 0===i&&(i="eq"),void 0===o&&(o=!1),!n)return null;var u=s.getProperty(n,r),a=new e;switch(a.inv=o,a.property=r,a.operator=i,t){case h.IsDate:a.setDate(u);break;case h.IsTime:a.setTime(u);break;case h.IsDateTime:a.setDateTimeLocal(u);default:a.setNotDateTime(u)}return a},e.prototype.toQuery=function(){var t=this.getValue();if(!this.property){return function(e){if("object"!=typeof e)return!1;for(var r in e){var n=e[r];if("string"==typeof n&&n.indexOf(t)>=0)return!0}return!1}}if(!this.operator)return null;var r=e.dict[this.operator];if(!r)return null;var n=this,i=this.property;switch(this.operator){case e.startswith:case e.endswith:case e.contains:return this.inv?function(e){return r(t,n.getProperty(e,i))}:function(e){return r(n.getProperty(e,i),t)};default:return function(e){return r(n.getProperty(e,i),t)}}},e.prototype.toString=function(){var r=t.prototype.toString.call(this);if(null===r)return null;if(!this.property)return r;switch(this.dateTimeType!=h.IsNotDateTime||"string"!=typeof this.value||this.isGuid()||(r="'"+r.replace(/'/g,"''")+"'"),this.operator){case e.startswith:case e.endswith:case e.contains:return this.inv?this.operator+"("+r+","+this.encodeProperty(this.property)+")":this.operator+"("+this.encodeProperty(this.property)+","+r+")";default:return"("+this.encodeProperty(this.property)+" "+this.operator+" "+r+")"}},e}(h);p.eq="eq",p.ne="ne",p.gt="gt",p.lt="lt",p.ge="ge",p.le="le",p.startswith="startswith",p.endswith="endswith",p.contains="contains",p.dict={eq:function(t,e){return t==e},ne:function(t,e){return t!=e},gt:function(t,e){return t>e},lt:function(t,e){return t<e},ge:function(t,e){return t>=e},le:function(t,e){return t<=e},startswith:function(t,e){return 0==((t||"")+"").indexOf((e||"")+"")},endswith:function(t,e){var r=(t||"")+"",n=(e||"")+"";return r.indexOf(n,r.length-n.length)>=0},contains:function(t,e){return((t||"")+"").indexOf((e||"")+"")>=0}},t.QueryFilterCondition=p;var c=function(t){function e(e){var r=t.call(this)||this;if(!e)throw i;return void 0!==e.dateTimeType?r.value=new l(l.AND,new p(e)):void 0!==e.operator?r.value=new l(e):r.value=e.value?new l(e.value):null,r}return __extends(e,t),e.prototype.toString=function(){return this.value?this.value.toString():null},e.prototype.toQuery=function(){return this.value?this.value.toQuery():null},e}(s);t.QuerySearch=c;var f=function(t){function e(e,r){void 0===r&&(r=!1);var n=t.call(this)||this;if("string"==typeof e)n.property=e,n.down=r;else{if(!e)throw i;n.property=e.property,n.down=e.down}return n}return __extends(e,t),e.prototype.toString=function(){return this.property?this.down?this.encodeProperty(this.property)+" desc":this.encodeProperty(this.property)+" asc":null},e.prototype.toCompare=function(){if(!this.property)return null;var t=this.property,e=this;return this.down?function(r,n){var i=e.getProperty(r,t),o=e.getProperty(n,t);return i>o?-1:i<o?1:0}:function(r,n){var i=e.getProperty(r,t),o=e.getProperty(n,t);return i<o?-1:i>o?1:0}},e}(s);t.QuerySortingCondition=f;var g=function(t){function r(e,n,o){void 0===n&&(n=null),void 0===o&&(o=null);var u=t.call(this)||this;if("string"==typeof e){if(!e||!n||!o)throw"all arguments must have a not null value";u.operator=e,u.isCount=e==r.count,u.property=n,u.alias=o}else{if(!e)throw i;u.isCount=e.operator==r.count,u.operator=e.operator,u.alias=e.alias,u.property=e.property}return u}return __extends(r,t),r.prototype.getCount=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.set={},t.counters[0]=0},result:function(t){return t.counters[0]},update:e}},r.prototype.getSum=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=0},result:function(t){return t.counters[0]},update:function(t,e){e.counters[0]=e.counters[0]+t}}},r.prototype.getAverage=function(){return{counters:[0,0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=0,t.counters[1]=0},result:function(t){return t.counters[0]/t.counters[1]},update:function(t,e){e.counters[0]=e.counters[0]+t,e.counters[1]=e.counters[1]+1}}},r.prototype.getMin=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=void 0},result:function(t){return t.counters[0]},update:function(t,e){(void 0===e.counters[0]||t<e.counters[0])&&(e.counters[0]=t)}}},r.prototype.getMax=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=void 0},result:function(t){return t.counters[0]},update:function(t,e){(void 0===e.counters[0]||t>e.counters[0])&&(e.counters[0]=t)}}},r.prototype.toString=function(){return this.property&&this.operator&&this.alias?this.encodeProperty(this.property)+" with "+this.operator+" as "+this.alias:null},r.prototype.toQuery=function(){switch(this.operator){case r.count:return this.getCount();case r.min:return this.getMin();case r.max:return this.getMax();case r.sum:return this.getSum();case r.average:return this.getAverage()}},r}(s);g.count="countdistinct",g.sum="sum",g.average="average",g.min="min",g.max="max",t.QueryAggregation=g;var y=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this)||this;return e?(e.keys?r.keys=e.keys.map(function(t){return t}):r.keys=new Array,e.dateTimeTypes?r.dateTimeTypes=e.dateTimeTypes.map(function(t){return t}):r.dateTimeTypes=new Array,e.aggregations?r.aggregations=e.aggregations.map(function(t){return new g(t)}):r.aggregations=new Array):(r.keys=new Array,r.dateTimeTypes=new Array,r.aggregations=new Array),r}return __extends(e,t),e.prototype.encodeGroups=function(){var t=this;return null!=!this.keys&&this.keys.length?1==this.keys.length?this.encodeProperty(this.keys[0]):this.keys.filter(function(t){return t}).map(function(e){return t.encodeProperty(e)}).join(","):null},e.prototype.encodeAggrgates=function(){return this.aggregations&&this.aggregations.length?1==this.aggregations.length?this.aggregations[0].toString():this.aggregations.map(function(t){return t.toString()}).filter(function(t){return t}).join(","):null},e.prototype.toString=function(){var t=this.encodeGroups();if(!t)return null;var e=this.encodeAggrgates();return e?"groupby(("+t+"),aggregate("+e+"))":"groupby(("+t+"))"},e.prototype.toQuery=function(){if(!this.keys||!this.keys.length)return null;var t=this.keys.map(function(t){return t}),e=this.aggregations&&this.aggregations.length?this.aggregations.map(function(t){return t.toQuery()}):[];return function(r){if(!r||!r.length)return[];var n=new u;return r.forEach(function(e){n.add(t,e)}),n.aggregate(t.length,t,e)}},e}(s);t.QueryGrouping=y;var d=function(){function t(t,e,r,n,o,u){if(void 0===e&&(e=null),void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===o&&(o=null),void 0===u&&(u=null),"string"==typeof t)this.baseUrl=t,this.bearerToken=o,this.accpetsJson=r,this.returnsJson=n,this.verb=e,this.ajaxId=u;else{if(!t)throw i;this.baseUrl=t.baseUrl,this.bearerToken=t.bearerToken,this.accpetsJson=t.accpetsJson,this.returnsJson=t.returnsJson,this.verb=t.verb,this.ajaxId=t.ajaxId}}return t}();d.Get="GET",d.Post="POST",d.Put="PUT",d.Delete="DELETE",d.Patch="PATCH",t.Endpoint=d;var v=function(){function t(t){this.urlEncode=encodeURIComponent,t?(this.skip=t.skip,this.take=t.take,this.page=t.page,this.search=t.search?new c(t.search):null,this.filter=t.filter?new l(t.filter):null,this.grouping=t.grouping?new y(t.grouping):null,this.sorting=t.sorting?t.sorting.map(function(t){return new f(t)}):null,this.attachedTo=t.attachedTo?new d(t.attachedTo):null):(this.skip=null,this.take=0,this.page=0,this.search=null,this.filter=null,this.grouping=null,this.sorting=new Array,this.attachedTo=null)}return t.prototype.customUrlEncode=function(t){this.urlEncode=t||this.urlEncode},t.fromJson=function(e){return e?new t(JSON.parse(e)):null},t.prototype.addFilterCondition=function(t,e){if(void 0===e&&(e=!1),t){if(!this.filter)return void(this.filter=void 0===t.dateTimeType?t:new l(l.and,t,null));var r;r=this.filter.operator!=l.not?this.filter.child1||this.filter.argument1?this.filter.child2||this.filter.argument2?this.filter:this.filter.argument1||this.filter.child1:this.filter.argument2||this.filter.child2:this.filter,this.filter=new l(e?l.or:l.and,r,t)}},t.prototype.getGroupDetailQuery=function(e){if(!(e&&this.grouping&&this.grouping.keys&&this.grouping.keys.length))return null;var r=new t(this);r.grouping=null,r.take=null,r.page=1,r.skip=0;for(var n=0;n<this.grouping.keys.length;n++){var i=p.fromModelAndName(this.grouping.dateTimeTypes[n],this.grouping.keys[n],e);i&&r.addFilterCondition(i)}return r},t.prototype.queryString=function(){var e=new Array,r=this.search?this.search.toString():null,n=null;r?(e.push(t.searchName),e.push("="),e.push(this.urlEncode(r))):(n=this.filter?this.filter.toString():null,n&&(e.push(t.filterName),e.push("="),e.push(this.urlEncode(n))));var i=this.grouping?this.grouping.toString():null;i&&(e.length&&e.push("&"),e.push(t.applyName),e.push("="),e.push(this.urlEncode(i)));var o=this.sorting?this.sorting.map(function(t){return t.toString()}).filter(function(t){return t}).join(","):null;return o&&(e.length&&e.push("&"),e.push(t.sortingName),e.push("="),e.push(this.urlEncode(o))),this.skip>0&&(e.length&&e.push("&"),e.push(t.skipName),e.push("="),e.push(this.skip+"")),this.take&&this.take>0&&(e.length&&e.push("&"),e.push(t.topName),e.push("="),e.push(this.take+"")),e.length?e.join(""):null},t.prototype.addToUrl=function(t){t||(t="");var e=this.queryString();return e&&e.trim()?t.indexOf("?")>=0?t+"&"+e:t+"?"+e:t},t.prototype.toString=function(){return this.addToUrl(this.attachedTo?this.attachedTo.baseUrl:null)},t.prototype.toQuery=function(){var t=[],e=this.search?this.search.toQuery():null;if(e)t.push(function(t){return t.filter(e)});else{var i=this.filter?this.filter.toQuery():null;i&&t.push(function(t){return t.filter(i)})}var o=this.grouping?this.grouping.toQuery():null;o&&t.push(o);var u=this.sorting?n(this.sorting.map(function(t){return t.toCompare()})):null;if(u&&t.push(function(t){var e=t.map(function(t){return t});return e.sort(u),e}),this.skip>0||this.take&&this.take>0){var s=this.skip>0?this.skip:0,a=this.take&&this.take>0?this.take+s:void 0;t.push(function(t){return t.length&&s<t.length?t.slice(s,a?Math.min(a,t.length):void 0):[]})}return t.length?r(t):function(t){return t}},t}();v.filterName="$filter",v.applyName="$apply",v.sortingName="$orderby",v.searchName="$search",v.topName="$top",v.skipName="$skip",t.QueryDescription=v}(t.odata||(t.odata={}))}(mvcct||(mvcct={})); | ||
//# sourceMappingURL=mvcct.odata.min.js.map |
@@ -852,2 +852,3 @@ var __extends = (this && this.__extends) || (function () { | ||
this.verb = y.verb; | ||
this.ajaxId = y.ajaxId; | ||
} | ||
@@ -854,0 +855,0 @@ } |
@@ -1,2 +0,2 @@ | ||
var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();!function(t){if("object"==typeof module&&"object"==typeof module.exports){var e=t(require,exports);void 0!==e&&(module.exports=e)}else"function"==typeof define&&define.amd&&define(["require","exports"],t)}(function(t,e){"use strict";function r(t,e){t+="",e.set[t]||(e.counters[0]=e.counters[0]+1,e.set[t]=!0)}function n(t){return function(e){for(var r=0,n=t;r<n.length;r++){e=(0,n[r])(e)}return e}}function i(t){return function(e,r){for(var n=0,i=t;n<i.length;n++){var o=i[n],u=o(e,r);if(0!=u)return u}return 0}}e.__esModule=!0;var o="first argument must have a not null value",u=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,s=function(){function t(){this.value=[],this.child={}}return t.prototype.add=function(t,e){this.addInternal(t.map(function(t){return e[t]+""}),0,e)},t.prototype.addInternal=function(e,r,n){if(r==e.length)this.value.push(n);else{var i=this.child[e[r]];i||(this.child[e[r]]=i=new t),i.addInternal(e,r+1,n)}},t.prototype.aggregate=function(t,e,r){var n=this;if(t>0){var i=[];for(var o in this.child)Array.prototype.push.apply(i,this.child[o].aggregate(t-1,e,r));return i}if(!this.value.length)return[];r.forEach(function(t){t.initialize(t)});var u={};e.forEach(function(t){u[t]=n.value[0][t]});for(var s=function(t){r.forEach(function(e){e.update(t[e.property],e)})},a=0,l=this.value;a<l.length;a++){s(l[a])}return r.forEach(function(t){u[t.alias]=t.result(t)}),[u]},t}(),a=function(){function t(){}return t.prototype.encodeProperty=function(t){return null==t?null:t.replace(/\./g,"/")},t.prototype.decodeProperty=function(t){return null==t?null:t.replace(/\//g,".")},t.prototype.getProperty=function(e,r){return t.getProperty(e,r)},t.getProperty=function(t,e){for(var r=e.split("."),n=0;"object"==typeof t&&n<r.length;)t=t[r[n++]];return t&&"function"==typeof t.getMonth&&(t=t.getTime()),t},t}();e.QueryNode=a;var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(a);e.QueryFilterClause=l;var h=function(t){function e(r,n,i){void 0===n&&(n=null),void 0===i&&(i=null);var u=t.call(this)||this;if("number"==typeof r){if(!n)throw"first operand must have a not null value";u.operator=r,void 0===n.dateTimeType?(u.child1=n,u.argument1=null):(u.child1=null,u.argument1=n),i?void 0===i.dateTimeType?(u.child2=i,u.argument2=null):(u.child2=null,u.argument2=i):(u.child2=null,u.argument2=null)}else{if(!r)throw o;u.argument1=r.argument1?void 0!==r.argument1.operator?new c(r.argument1):new p(r.argument1):null,u.argument2=r.argument2?void 0!==r.argument2.operator?new c(r.argument2):new p(r.argument2):null,u.child1=r.child1?new e(r.child1):null,u.child2=r.child2?new e(r.child2):null,u.operator=r.operator||e.and}return u}return __extends(e,t),e.prototype.toString=function(){var t=this.argument1||this.child1,r=this.argument2||this.child2;if(!t&&!r)return null;if(this.operator==e.not)return"(not "+(t||r).toString()+")";if(this.operator==e.NOT)return"(NOT "+(t||r).toString()+")";if(!t)return r.toString();if(!r)return t.toString();var n=t.toString(),i=r.toString();return n?i?this.operator==e.and?"("+n+" and "+i+")":this.operator==e.AND?"("+n+" AND "+i+")":this.operator==e.OR?"("+n+" OR "+i+")":"("+n+" or "+i+")":n||null:i||null},e.prototype.toQuery=function(){var t=this.argument1||this.child1,r=this.argument2||this.child2;if(!t&&!r)return null;if(this.operator==e.not||this.operator==e.NOT)return function(e){return!(t||r).toQuery()(e)};if(!t)return r.toQuery();if(!r)return t.toQuery();var n=t.toQuery(),i=r.toQuery();return n?i?this.operator==e.and||this.operator==e.AND?function(e){return t.toQuery()(e)&&r.toQuery()(e)}:function(e){return t.toQuery()(e)||r.toQuery()(e)}:n||null:i||null},e}(l);h.and=0,h.or=1,h.not=2,h.AND=3,h.OR=4,h.NOT=5,e.QueryFilterBooleanOperator=h;var p=function(t){function e(r){void 0===r&&(r=null);var n=t.call(this)||this;return r?(n.value=r.value,n.dateTimeType=r.dateTimeType||e.IsNotDateTime):(n.value=null,n.dateTimeType=c.IsNotDateTime),n}return __extends(e,t),e.prototype.formatInt=function(t,e){var r=t+"";return r.length<e?new Array(e-r.length+1).join("0")+r:r},e.prototype.normalizeTime=function(t,e,r){var n=t.split(":"),i=n[0].indexOf(".");return e&&i<0?t="00."+t:e&&0==i?t="00"+t:e&&1==i&&(t="0"+t),1==n.length?t+=":00:00.000":2==n.length?t+=":00.000":n[2].indexOf(".")<0?t+=".000":r&&n[2].length>6?t=t.substr(0,t.length-n[2].length+6):n[2].length<6&&(t+=new Array(7-n[2].length).join("0")),t},e.prototype.isGuid=function(){return"string"==typeof this.value&&u.test(this.value.toLowerCase())},e.prototype.setDate=function(t){this.dateTimeType=e.IsDate,t||(this.value=null),this.value=this.formatInt(t.getFullYear(),4)+"-"+this.formatInt(t.getMonth()+1,2)+"-"+this.formatInt(t.getDate(),2)+"T00:00:00.000"},e.prototype.setTime=function(t){this.dateTimeType=e.IsTime,t||(this.value=null),this.value=this.formatInt(t.getHours(),2)+":"+this.formatInt(t.getMinutes(),2)+":"+this.formatInt(t.getSeconds(),2)+"."+this.formatInt(t.getMilliseconds(),3)},e.prototype.setDuration=function(t,r,n,i,o){void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=0),this.dateTimeType=e.IsDuration,this.value=this.formatInt(t||0,2)+"."+this.formatInt(r||0,2)+":"+this.formatInt(n||0,2)+":"+this.formatInt(i||0,2)+"."+this.formatInt(o||0,3)},e.prototype.setDateTimeLocal=function(t){this.dateTimeType=e.IsDateTime,t||(this.value=null),this.value=t.toISOString()},e.prototype.setDateTimeInvariant=function(t){this.dateTimeType=e.IsDateTime,t||(this.value=null),this.value=this.formatInt(t.getFullYear(),4)+"-"+this.formatInt(t.getMonth()+1,2)+"-"+this.formatInt(t.getDate(),2)+"T"+this.formatInt(t.getHours(),2)+":"+this.formatInt(t.getMinutes(),2)+":"+this.formatInt(t.getSeconds(),2)+"."+this.formatInt(t.getMilliseconds(),3)},e.prototype.setBoolean=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setNumber=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setString=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setNotDateTime=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.getValue=function(){if(null===this.value||void 0===this.value)return null;if(this.dateTimeType==e.IsNotDateTime)return this.value;var t=this.value;switch(this.dateTimeType){case e.IsDateTime:var r=t.match(/\d+/g);return"Z"==t.charAt(t.length-1).toUpperCase()?new Date(Date.UTC(parseInt(r[0]),parseInt(r[1])-1,parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5]),parseInt(r[6]))).getTime():new Date(parseInt(r[0]),parseInt(r[1])-1,parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5]),parseInt(r[6])).getTime();case e.IsDate:var n=t.split("T")[0].split("-");return new Date(parseInt(n[0]),parseInt(n[1])-1,parseInt(n[2])).getTime();case e.IsTime:t=this.normalizeTime(t,!1,!0);var i=t.match(/\d+/g);return new Date(1970,0,1,parseInt(i[0]),parseInt(i[1]),parseInt(i[2]),parseInt(i[3])).getTime();case e.IsDuration:t=this.normalizeTime(t,!0,!1);var o=t.match(/\d+/g);return 1e3*(60*(60*(24*parseInt(o[0])+parseInt(o[1]))+parseInt(o[2]))+parseInt(o[3]))+parseInt(o[4]);default:return null}},e.prototype.toString=function(){if(null===this.value||void 0===this.value)return"null";if(this.dateTimeType==e.IsNotDateTime)return this.value+"";var t=this.value;switch(this.dateTimeType){case e.IsDateTime:return"Z"!=t.charAt(t.length-1).toUpperCase()?t+"Z":t;case e.IsDate:return t.split("T")[0];case e.IsTime:return t=this.normalizeTime(t,!1,!0);case e.IsDuration:t=this.normalizeTime(t,!0,!1);var r=t.match(/\d+/g);return"'P"+r[0]+"DT"+r[1]+"H"+r[2]+"M"+r[3]+"."+r[4]+new Array(13-r[4].length).join("0")+"S'";default:return null}},e.prototype.toQuery=function(){return null},e}(l);p.IsNotDateTime=0,p.IsDate=1,p.IsTime=2,p.IsDateTime=3,p.IsDuration=4,e.QueryValue=p;var c=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this,e)||this;return e?(r.operator=e.operator||null,r.inv=e.inv||!1,r.property=e.property||null):(r.operator=null,r.inv=!1,r.property=null),r}return __extends(e,t),e.fromModelAndName=function(t,r,n,i,o){if(void 0===i&&(i="eq"),void 0===o&&(o=!1),!n)return null;var u=a.getProperty(n,r),s=new e;switch(s.inv=o,s.property=r,s.operator=i,t){case p.IsDate:s.setDate(u);break;case p.IsTime:s.setTime(u);break;case p.IsDateTime:s.setDateTimeLocal(u);default:s.setNotDateTime(u)}return s},e.prototype.toQuery=function(){var t=this.getValue();if(!this.property){return function(e){if("object"!=typeof e)return!1;for(var r in e){var n=e[r];if("string"==typeof n&&n.indexOf(t)>=0)return!0}return!1}}if(!this.operator)return null;var r=e.dict[this.operator];if(!r)return null;var n=this,i=this.property;switch(this.operator){case e.startswith:case e.endswith:case e.contains:return this.inv?function(e){return r(t,n.getProperty(e,i))}:function(e){return r(n.getProperty(e,i),t)};default:return function(e){return r(n.getProperty(e,i),t)}}},e.prototype.toString=function(){var r=t.prototype.toString.call(this);if(null===r)return null;if(!this.property)return r;switch(this.dateTimeType!=p.IsNotDateTime||"string"!=typeof this.value||this.isGuid()||(r="'"+r.replace(/'/g,"''")+"'"),this.operator){case e.startswith:case e.endswith:case e.contains:return this.inv?this.operator+"("+r+","+this.encodeProperty(this.property)+")":this.operator+"("+this.encodeProperty(this.property)+","+r+")";default:return"("+this.encodeProperty(this.property)+" "+this.operator+" "+r+")"}},e}(p);c.eq="eq",c.ne="ne",c.gt="gt",c.lt="lt",c.ge="ge",c.le="le",c.startswith="startswith",c.endswith="endswith",c.contains="contains",c.dict={eq:function(t,e){return t==e},ne:function(t,e){return t!=e},gt:function(t,e){return t>e},lt:function(t,e){return t<e},ge:function(t,e){return t>=e},le:function(t,e){return t<=e},startswith:function(t,e){return 0==((t||"")+"").indexOf((e||"")+"")},endswith:function(t,e){var r=(t||"")+"",n=(e||"")+"";return r.indexOf(n,r.length-n.length)>=0},contains:function(t,e){return((t||"")+"").indexOf((e||"")+"")>=0}},e.QueryFilterCondition=c;var f=function(t){function e(e){var r=t.call(this)||this;if(!e)throw o;return void 0!==e.dateTimeType?r.value=new h(h.AND,new c(e)):void 0!==e.operator?r.value=new h(e):r.value=e.value?new h(e.value):null,r}return __extends(e,t),e.prototype.toString=function(){return this.value?this.value.toString():null},e.prototype.toQuery=function(){return this.value?this.value.toQuery():null},e}(a);e.QuerySearch=f;var g=function(t){function e(e,r){void 0===r&&(r=!1);var n=t.call(this)||this;if("string"==typeof e)n.property=e,n.down=r;else{if(!e)throw o;n.property=e.property,n.down=e.down}return n}return __extends(e,t),e.prototype.toString=function(){return this.property?this.down?this.encodeProperty(this.property)+" desc":this.encodeProperty(this.property)+" asc":null},e.prototype.toCompare=function(){if(!this.property)return null;var t=this.property,e=this;return this.down?function(r,n){var i=e.getProperty(r,t),o=e.getProperty(n,t);return i>o?-1:i<o?1:0}:function(r,n){var i=e.getProperty(r,t),o=e.getProperty(n,t);return i<o?-1:i>o?1:0}},e}(a);e.QuerySortingCondition=g;var y=function(t){function e(r,n,i){void 0===n&&(n=null),void 0===i&&(i=null);var u=t.call(this)||this;if("string"==typeof r){if(!r||!n||!i)throw"all arguments must have a not null value";u.operator=r,u.isCount=r==e.count,u.property=n,u.alias=i}else{if(!r)throw o;u.isCount=r.operator==e.count,u.operator=r.operator,u.alias=r.alias,u.property=r.property}return u}return __extends(e,t),e.prototype.getCount=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.set={},t.counters[0]=0},result:function(t){return t.counters[0]},update:r}},e.prototype.getSum=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=0},result:function(t){return t.counters[0]},update:function(t,e){e.counters[0]=e.counters[0]+t}}},e.prototype.getAverage=function(){return{counters:[0,0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=0,t.counters[1]=0},result:function(t){return t.counters[0]/t.counters[1]},update:function(t,e){e.counters[0]=e.counters[0]+t,e.counters[1]=e.counters[1]+1}}},e.prototype.getMin=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=void 0},result:function(t){return t.counters[0]},update:function(t,e){(void 0===e.counters[0]||t<e.counters[0])&&(e.counters[0]=t)}}},e.prototype.getMax=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=void 0},result:function(t){return t.counters[0]},update:function(t,e){(void 0===e.counters[0]||t>e.counters[0])&&(e.counters[0]=t)}}},e.prototype.toString=function(){return this.property&&this.operator&&this.alias?this.encodeProperty(this.property)+" with "+this.operator+" as "+this.alias:null},e.prototype.toQuery=function(){switch(this.operator){case e.count:return this.getCount();case e.min:return this.getMin();case e.max:return this.getMax();case e.sum:return this.getSum();case e.average:return this.getAverage()}},e}(a);y.count="countdistinct",y.sum="sum",y.average="average",y.min="min",y.max="max",e.QueryAggregation=y;var d=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this)||this;return e?(e.keys?r.keys=e.keys.map(function(t){return t}):r.keys=new Array,e.dateTimeTypes?r.dateTimeTypes=e.dateTimeTypes.map(function(t){return t}):r.dateTimeTypes=new Array,e.aggregations?r.aggregations=e.aggregations.map(function(t){return new y(t)}):r.aggregations=new Array):(r.keys=new Array,r.dateTimeTypes=new Array,r.aggregations=new Array),r}return __extends(e,t),e.prototype.encodeGroups=function(){var t=this;return null!=!this.keys&&this.keys.length?1==this.keys.length?this.encodeProperty(this.keys[0]):this.keys.filter(function(t){return t}).map(function(e){return t.encodeProperty(e)}).join(","):null},e.prototype.encodeAggrgates=function(){return this.aggregations&&this.aggregations.length?1==this.aggregations.length?this.aggregations[0].toString():this.aggregations.map(function(t){return t.toString()}).filter(function(t){return t}).join(","):null},e.prototype.toString=function(){var t=this.encodeGroups();if(!t)return null;var e=this.encodeAggrgates();return e?"groupby(("+t+"),aggregate("+e+"))":"groupby(("+t+"))"},e.prototype.toQuery=function(){if(!this.keys||!this.keys.length)return null;var t=this.keys.map(function(t){return t}),e=this.aggregations&&this.aggregations.length?this.aggregations.map(function(t){return t.toQuery()}):[];return function(r){if(!r||!r.length)return[];var n=new s;return r.forEach(function(e){n.add(t,e)}),n.aggregate(t.length,t,e)}},e}(a);e.QueryGrouping=d;var m=function(){function t(t,e,r,n,i,u){if(void 0===e&&(e=null),void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i=null),void 0===u&&(u=null),"string"==typeof t)this.baseUrl=t,this.bearerToken=i,this.accpetsJson=r,this.returnsJson=n,this.verb=e,this.ajaxId=u;else{if(!t)throw o;this.baseUrl=t.baseUrl,this.bearerToken=t.bearerToken,this.accpetsJson=t.accpetsJson,this.returnsJson=t.returnsJson,this.verb=t.verb}}return t}();m.Get="GET",m.Post="POST",m.Put="PUT",m.Delete="DELETE",m.Patch="PATCH",e.Endpoint=m;var v=function(){function t(t){this.urlEncode=encodeURIComponent,t?(this.skip=t.skip,this.take=t.take,this.page=t.page,this.search=t.search?new f(t.search):null,this.filter=t.filter?new h(t.filter):null,this.grouping=t.grouping?new d(t.grouping):null,this.sorting=t.sorting?t.sorting.map(function(t){return new g(t)}):null,this.attachedTo=t.attachedTo?new m(t.attachedTo):null):(this.skip=null,this.take=0,this.page=0,this.search=null,this.filter=null,this.grouping=null,this.sorting=new Array,this.attachedTo=null)}return t.prototype.customUrlEncode=function(t){this.urlEncode=t||this.urlEncode},t.fromJson=function(e){return e?new t(JSON.parse(e)):null},t.prototype.addFilterCondition=function(t,e){if(void 0===e&&(e=!1),t){if(!this.filter)return void(this.filter=void 0===t.dateTimeType?t:new h(h.and,t,null));var r;r=this.filter.operator!=h.not?this.filter.child1||this.filter.argument1?this.filter.child2||this.filter.argument2?this.filter:this.filter.argument1||this.filter.child1:this.filter.argument2||this.filter.child2:this.filter,this.filter=new h(e?h.or:h.and,r,t)}},t.prototype.getGroupDetailQuery=function(e){if(!(e&&this.grouping&&this.grouping.keys&&this.grouping.keys.length))return null;var r=new t(this);r.grouping=null,r.take=null,r.page=1,r.skip=0;for(var n=0;n<this.grouping.keys.length;n++){var i=c.fromModelAndName(this.grouping.dateTimeTypes[n],this.grouping.keys[n],e);i&&r.addFilterCondition(i)}return r},t.prototype.queryString=function(){var e=new Array,r=this.search?this.search.toString():null,n=null;r?(e.push(t.searchName),e.push("="),e.push(this.urlEncode(r))):(n=this.filter?this.filter.toString():null,n&&(e.push(t.filterName),e.push("="),e.push(this.urlEncode(n))));var i=this.grouping?this.grouping.toString():null;i&&(e.length&&e.push("&"),e.push(t.applyName),e.push("="),e.push(this.urlEncode(i)));var o=this.sorting?this.sorting.map(function(t){return t.toString()}).filter(function(t){return t}).join(","):null;return o&&(e.length&&e.push("&"),e.push(t.sortingName),e.push("="),e.push(this.urlEncode(o))),this.skip>0&&(e.length&&e.push("&"),e.push(t.skipName),e.push("="),e.push(this.skip+"")),this.take&&this.take>0&&(e.length&&e.push("&"),e.push(t.topName),e.push("="),e.push(this.take+"")),e.length?e.join(""):null},t.prototype.addToUrl=function(t){t||(t="");var e=this.queryString();return e&&e.trim()?t.indexOf("?")>=0?t+"&"+e:t+"?"+e:t},t.prototype.toString=function(){return this.addToUrl(this.attachedTo?this.attachedTo.baseUrl:null)},t.prototype.toQuery=function(){var t=[],e=this.search?this.search.toQuery():null;if(e)t.push(function(t){return t.filter(e)});else{var r=this.filter?this.filter.toQuery():null;r&&t.push(function(t){return t.filter(r)})}var o=this.grouping?this.grouping.toQuery():null;o&&t.push(o);var u=this.sorting?i(this.sorting.map(function(t){return t.toCompare()})):null;if(u&&t.push(function(t){var e=t.map(function(t){return t});return e.sort(u),e}),this.skip>0||this.take&&this.take>0){var s=this.skip>0?this.skip:0,a=this.take&&this.take>0?this.take+s:void 0;t.push(function(t){return t.length&&s<t.length?t.slice(s,a?Math.min(a,t.length):void 0):[]})}return t.length?n(t):function(t){return t}},t}();v.filterName="$filter",v.applyName="$apply",v.sortingName="$orderby",v.searchName="$search",v.topName="$top",v.skipName="$skip",e.QueryDescription=v}); | ||
var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();!function(t){if("object"==typeof module&&"object"==typeof module.exports){var e=t(require,exports);void 0!==e&&(module.exports=e)}else"function"==typeof define&&define.amd&&define(["require","exports"],t)}(function(t,e){"use strict";function r(t,e){t+="",e.set[t]||(e.counters[0]=e.counters[0]+1,e.set[t]=!0)}function n(t){return function(e){for(var r=0,n=t;r<n.length;r++){e=(0,n[r])(e)}return e}}function i(t){return function(e,r){for(var n=0,i=t;n<i.length;n++){var o=i[n],u=o(e,r);if(0!=u)return u}return 0}}e.__esModule=!0;var o="first argument must have a not null value",u=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,s=function(){function t(){this.value=[],this.child={}}return t.prototype.add=function(t,e){this.addInternal(t.map(function(t){return e[t]+""}),0,e)},t.prototype.addInternal=function(e,r,n){if(r==e.length)this.value.push(n);else{var i=this.child[e[r]];i||(this.child[e[r]]=i=new t),i.addInternal(e,r+1,n)}},t.prototype.aggregate=function(t,e,r){var n=this;if(t>0){var i=[];for(var o in this.child)Array.prototype.push.apply(i,this.child[o].aggregate(t-1,e,r));return i}if(!this.value.length)return[];r.forEach(function(t){t.initialize(t)});var u={};e.forEach(function(t){u[t]=n.value[0][t]});for(var s=function(t){r.forEach(function(e){e.update(t[e.property],e)})},a=0,l=this.value;a<l.length;a++){s(l[a])}return r.forEach(function(t){u[t.alias]=t.result(t)}),[u]},t}(),a=function(){function t(){}return t.prototype.encodeProperty=function(t){return null==t?null:t.replace(/\./g,"/")},t.prototype.decodeProperty=function(t){return null==t?null:t.replace(/\//g,".")},t.prototype.getProperty=function(e,r){return t.getProperty(e,r)},t.getProperty=function(t,e){for(var r=e.split("."),n=0;"object"==typeof t&&n<r.length;)t=t[r[n++]];return t&&"function"==typeof t.getMonth&&(t=t.getTime()),t},t}();e.QueryNode=a;var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e}(a);e.QueryFilterClause=l;var h=function(t){function e(r,n,i){void 0===n&&(n=null),void 0===i&&(i=null);var u=t.call(this)||this;if("number"==typeof r){if(!n)throw"first operand must have a not null value";u.operator=r,void 0===n.dateTimeType?(u.child1=n,u.argument1=null):(u.child1=null,u.argument1=n),i?void 0===i.dateTimeType?(u.child2=i,u.argument2=null):(u.child2=null,u.argument2=i):(u.child2=null,u.argument2=null)}else{if(!r)throw o;u.argument1=r.argument1?void 0!==r.argument1.operator?new c(r.argument1):new p(r.argument1):null,u.argument2=r.argument2?void 0!==r.argument2.operator?new c(r.argument2):new p(r.argument2):null,u.child1=r.child1?new e(r.child1):null,u.child2=r.child2?new e(r.child2):null,u.operator=r.operator||e.and}return u}return __extends(e,t),e.prototype.toString=function(){var t=this.argument1||this.child1,r=this.argument2||this.child2;if(!t&&!r)return null;if(this.operator==e.not)return"(not "+(t||r).toString()+")";if(this.operator==e.NOT)return"(NOT "+(t||r).toString()+")";if(!t)return r.toString();if(!r)return t.toString();var n=t.toString(),i=r.toString();return n?i?this.operator==e.and?"("+n+" and "+i+")":this.operator==e.AND?"("+n+" AND "+i+")":this.operator==e.OR?"("+n+" OR "+i+")":"("+n+" or "+i+")":n||null:i||null},e.prototype.toQuery=function(){var t=this.argument1||this.child1,r=this.argument2||this.child2;if(!t&&!r)return null;if(this.operator==e.not||this.operator==e.NOT)return function(e){return!(t||r).toQuery()(e)};if(!t)return r.toQuery();if(!r)return t.toQuery();var n=t.toQuery(),i=r.toQuery();return n?i?this.operator==e.and||this.operator==e.AND?function(e){return t.toQuery()(e)&&r.toQuery()(e)}:function(e){return t.toQuery()(e)||r.toQuery()(e)}:n||null:i||null},e}(l);h.and=0,h.or=1,h.not=2,h.AND=3,h.OR=4,h.NOT=5,e.QueryFilterBooleanOperator=h;var p=function(t){function e(r){void 0===r&&(r=null);var n=t.call(this)||this;return r?(n.value=r.value,n.dateTimeType=r.dateTimeType||e.IsNotDateTime):(n.value=null,n.dateTimeType=c.IsNotDateTime),n}return __extends(e,t),e.prototype.formatInt=function(t,e){var r=t+"";return r.length<e?new Array(e-r.length+1).join("0")+r:r},e.prototype.normalizeTime=function(t,e,r){var n=t.split(":"),i=n[0].indexOf(".");return e&&i<0?t="00."+t:e&&0==i?t="00"+t:e&&1==i&&(t="0"+t),1==n.length?t+=":00:00.000":2==n.length?t+=":00.000":n[2].indexOf(".")<0?t+=".000":r&&n[2].length>6?t=t.substr(0,t.length-n[2].length+6):n[2].length<6&&(t+=new Array(7-n[2].length).join("0")),t},e.prototype.isGuid=function(){return"string"==typeof this.value&&u.test(this.value.toLowerCase())},e.prototype.setDate=function(t){this.dateTimeType=e.IsDate,t||(this.value=null),this.value=this.formatInt(t.getFullYear(),4)+"-"+this.formatInt(t.getMonth()+1,2)+"-"+this.formatInt(t.getDate(),2)+"T00:00:00.000"},e.prototype.setTime=function(t){this.dateTimeType=e.IsTime,t||(this.value=null),this.value=this.formatInt(t.getHours(),2)+":"+this.formatInt(t.getMinutes(),2)+":"+this.formatInt(t.getSeconds(),2)+"."+this.formatInt(t.getMilliseconds(),3)},e.prototype.setDuration=function(t,r,n,i,o){void 0===n&&(n=0),void 0===i&&(i=0),void 0===o&&(o=0),this.dateTimeType=e.IsDuration,this.value=this.formatInt(t||0,2)+"."+this.formatInt(r||0,2)+":"+this.formatInt(n||0,2)+":"+this.formatInt(i||0,2)+"."+this.formatInt(o||0,3)},e.prototype.setDateTimeLocal=function(t){this.dateTimeType=e.IsDateTime,t||(this.value=null),this.value=t.toISOString()},e.prototype.setDateTimeInvariant=function(t){this.dateTimeType=e.IsDateTime,t||(this.value=null),this.value=this.formatInt(t.getFullYear(),4)+"-"+this.formatInt(t.getMonth()+1,2)+"-"+this.formatInt(t.getDate(),2)+"T"+this.formatInt(t.getHours(),2)+":"+this.formatInt(t.getMinutes(),2)+":"+this.formatInt(t.getSeconds(),2)+"."+this.formatInt(t.getMilliseconds(),3)},e.prototype.setBoolean=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setNumber=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setString=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.setNotDateTime=function(t){this.dateTimeType=e.IsNotDateTime,this.value=t},e.prototype.getValue=function(){if(null===this.value||void 0===this.value)return null;if(this.dateTimeType==e.IsNotDateTime)return this.value;var t=this.value;switch(this.dateTimeType){case e.IsDateTime:var r=t.match(/\d+/g);return"Z"==t.charAt(t.length-1).toUpperCase()?new Date(Date.UTC(parseInt(r[0]),parseInt(r[1])-1,parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5]),parseInt(r[6]))).getTime():new Date(parseInt(r[0]),parseInt(r[1])-1,parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5]),parseInt(r[6])).getTime();case e.IsDate:var n=t.split("T")[0].split("-");return new Date(parseInt(n[0]),parseInt(n[1])-1,parseInt(n[2])).getTime();case e.IsTime:t=this.normalizeTime(t,!1,!0);var i=t.match(/\d+/g);return new Date(1970,0,1,parseInt(i[0]),parseInt(i[1]),parseInt(i[2]),parseInt(i[3])).getTime();case e.IsDuration:t=this.normalizeTime(t,!0,!1);var o=t.match(/\d+/g);return 1e3*(60*(60*(24*parseInt(o[0])+parseInt(o[1]))+parseInt(o[2]))+parseInt(o[3]))+parseInt(o[4]);default:return null}},e.prototype.toString=function(){if(null===this.value||void 0===this.value)return"null";if(this.dateTimeType==e.IsNotDateTime)return this.value+"";var t=this.value;switch(this.dateTimeType){case e.IsDateTime:return"Z"!=t.charAt(t.length-1).toUpperCase()?t+"Z":t;case e.IsDate:return t.split("T")[0];case e.IsTime:return t=this.normalizeTime(t,!1,!0);case e.IsDuration:t=this.normalizeTime(t,!0,!1);var r=t.match(/\d+/g);return"'P"+r[0]+"DT"+r[1]+"H"+r[2]+"M"+r[3]+"."+r[4]+new Array(13-r[4].length).join("0")+"S'";default:return null}},e.prototype.toQuery=function(){return null},e}(l);p.IsNotDateTime=0,p.IsDate=1,p.IsTime=2,p.IsDateTime=3,p.IsDuration=4,e.QueryValue=p;var c=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this,e)||this;return e?(r.operator=e.operator||null,r.inv=e.inv||!1,r.property=e.property||null):(r.operator=null,r.inv=!1,r.property=null),r}return __extends(e,t),e.fromModelAndName=function(t,r,n,i,o){if(void 0===i&&(i="eq"),void 0===o&&(o=!1),!n)return null;var u=a.getProperty(n,r),s=new e;switch(s.inv=o,s.property=r,s.operator=i,t){case p.IsDate:s.setDate(u);break;case p.IsTime:s.setTime(u);break;case p.IsDateTime:s.setDateTimeLocal(u);default:s.setNotDateTime(u)}return s},e.prototype.toQuery=function(){var t=this.getValue();if(!this.property){return function(e){if("object"!=typeof e)return!1;for(var r in e){var n=e[r];if("string"==typeof n&&n.indexOf(t)>=0)return!0}return!1}}if(!this.operator)return null;var r=e.dict[this.operator];if(!r)return null;var n=this,i=this.property;switch(this.operator){case e.startswith:case e.endswith:case e.contains:return this.inv?function(e){return r(t,n.getProperty(e,i))}:function(e){return r(n.getProperty(e,i),t)};default:return function(e){return r(n.getProperty(e,i),t)}}},e.prototype.toString=function(){var r=t.prototype.toString.call(this);if(null===r)return null;if(!this.property)return r;switch(this.dateTimeType!=p.IsNotDateTime||"string"!=typeof this.value||this.isGuid()||(r="'"+r.replace(/'/g,"''")+"'"),this.operator){case e.startswith:case e.endswith:case e.contains:return this.inv?this.operator+"("+r+","+this.encodeProperty(this.property)+")":this.operator+"("+this.encodeProperty(this.property)+","+r+")";default:return"("+this.encodeProperty(this.property)+" "+this.operator+" "+r+")"}},e}(p);c.eq="eq",c.ne="ne",c.gt="gt",c.lt="lt",c.ge="ge",c.le="le",c.startswith="startswith",c.endswith="endswith",c.contains="contains",c.dict={eq:function(t,e){return t==e},ne:function(t,e){return t!=e},gt:function(t,e){return t>e},lt:function(t,e){return t<e},ge:function(t,e){return t>=e},le:function(t,e){return t<=e},startswith:function(t,e){return 0==((t||"")+"").indexOf((e||"")+"")},endswith:function(t,e){var r=(t||"")+"",n=(e||"")+"";return r.indexOf(n,r.length-n.length)>=0},contains:function(t,e){return((t||"")+"").indexOf((e||"")+"")>=0}},e.QueryFilterCondition=c;var f=function(t){function e(e){var r=t.call(this)||this;if(!e)throw o;return void 0!==e.dateTimeType?r.value=new h(h.AND,new c(e)):void 0!==e.operator?r.value=new h(e):r.value=e.value?new h(e.value):null,r}return __extends(e,t),e.prototype.toString=function(){return this.value?this.value.toString():null},e.prototype.toQuery=function(){return this.value?this.value.toQuery():null},e}(a);e.QuerySearch=f;var g=function(t){function e(e,r){void 0===r&&(r=!1);var n=t.call(this)||this;if("string"==typeof e)n.property=e,n.down=r;else{if(!e)throw o;n.property=e.property,n.down=e.down}return n}return __extends(e,t),e.prototype.toString=function(){return this.property?this.down?this.encodeProperty(this.property)+" desc":this.encodeProperty(this.property)+" asc":null},e.prototype.toCompare=function(){if(!this.property)return null;var t=this.property,e=this;return this.down?function(r,n){var i=e.getProperty(r,t),o=e.getProperty(n,t);return i>o?-1:i<o?1:0}:function(r,n){var i=e.getProperty(r,t),o=e.getProperty(n,t);return i<o?-1:i>o?1:0}},e}(a);e.QuerySortingCondition=g;var y=function(t){function e(r,n,i){void 0===n&&(n=null),void 0===i&&(i=null);var u=t.call(this)||this;if("string"==typeof r){if(!r||!n||!i)throw"all arguments must have a not null value";u.operator=r,u.isCount=r==e.count,u.property=n,u.alias=i}else{if(!r)throw o;u.isCount=r.operator==e.count,u.operator=r.operator,u.alias=r.alias,u.property=r.property}return u}return __extends(e,t),e.prototype.getCount=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.set={},t.counters[0]=0},result:function(t){return t.counters[0]},update:r}},e.prototype.getSum=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=0},result:function(t){return t.counters[0]},update:function(t,e){e.counters[0]=e.counters[0]+t}}},e.prototype.getAverage=function(){return{counters:[0,0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=0,t.counters[1]=0},result:function(t){return t.counters[0]/t.counters[1]},update:function(t,e){e.counters[0]=e.counters[0]+t,e.counters[1]=e.counters[1]+1}}},e.prototype.getMin=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=void 0},result:function(t){return t.counters[0]},update:function(t,e){(void 0===e.counters[0]||t<e.counters[0])&&(e.counters[0]=t)}}},e.prototype.getMax=function(){return{counters:[0],alias:this.alias,property:this.property,initialize:function(t){t.counters[0]=void 0},result:function(t){return t.counters[0]},update:function(t,e){(void 0===e.counters[0]||t>e.counters[0])&&(e.counters[0]=t)}}},e.prototype.toString=function(){return this.property&&this.operator&&this.alias?this.encodeProperty(this.property)+" with "+this.operator+" as "+this.alias:null},e.prototype.toQuery=function(){switch(this.operator){case e.count:return this.getCount();case e.min:return this.getMin();case e.max:return this.getMax();case e.sum:return this.getSum();case e.average:return this.getAverage()}},e}(a);y.count="countdistinct",y.sum="sum",y.average="average",y.min="min",y.max="max",e.QueryAggregation=y;var d=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this)||this;return e?(e.keys?r.keys=e.keys.map(function(t){return t}):r.keys=new Array,e.dateTimeTypes?r.dateTimeTypes=e.dateTimeTypes.map(function(t){return t}):r.dateTimeTypes=new Array,e.aggregations?r.aggregations=e.aggregations.map(function(t){return new y(t)}):r.aggregations=new Array):(r.keys=new Array,r.dateTimeTypes=new Array,r.aggregations=new Array),r}return __extends(e,t),e.prototype.encodeGroups=function(){var t=this;return null!=!this.keys&&this.keys.length?1==this.keys.length?this.encodeProperty(this.keys[0]):this.keys.filter(function(t){return t}).map(function(e){return t.encodeProperty(e)}).join(","):null},e.prototype.encodeAggrgates=function(){return this.aggregations&&this.aggregations.length?1==this.aggregations.length?this.aggregations[0].toString():this.aggregations.map(function(t){return t.toString()}).filter(function(t){return t}).join(","):null},e.prototype.toString=function(){var t=this.encodeGroups();if(!t)return null;var e=this.encodeAggrgates();return e?"groupby(("+t+"),aggregate("+e+"))":"groupby(("+t+"))"},e.prototype.toQuery=function(){if(!this.keys||!this.keys.length)return null;var t=this.keys.map(function(t){return t}),e=this.aggregations&&this.aggregations.length?this.aggregations.map(function(t){return t.toQuery()}):[];return function(r){if(!r||!r.length)return[];var n=new s;return r.forEach(function(e){n.add(t,e)}),n.aggregate(t.length,t,e)}},e}(a);e.QueryGrouping=d;var m=function(){function t(t,e,r,n,i,u){if(void 0===e&&(e=null),void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i=null),void 0===u&&(u=null),"string"==typeof t)this.baseUrl=t,this.bearerToken=i,this.accpetsJson=r,this.returnsJson=n,this.verb=e,this.ajaxId=u;else{if(!t)throw o;this.baseUrl=t.baseUrl,this.bearerToken=t.bearerToken,this.accpetsJson=t.accpetsJson,this.returnsJson=t.returnsJson,this.verb=t.verb,this.ajaxId=t.ajaxId}}return t}();m.Get="GET",m.Post="POST",m.Put="PUT",m.Delete="DELETE",m.Patch="PATCH",e.Endpoint=m;var v=function(){function t(t){this.urlEncode=encodeURIComponent,t?(this.skip=t.skip,this.take=t.take,this.page=t.page,this.search=t.search?new f(t.search):null,this.filter=t.filter?new h(t.filter):null,this.grouping=t.grouping?new d(t.grouping):null,this.sorting=t.sorting?t.sorting.map(function(t){return new g(t)}):null,this.attachedTo=t.attachedTo?new m(t.attachedTo):null):(this.skip=null,this.take=0,this.page=0,this.search=null,this.filter=null,this.grouping=null,this.sorting=new Array,this.attachedTo=null)}return t.prototype.customUrlEncode=function(t){this.urlEncode=t||this.urlEncode},t.fromJson=function(e){return e?new t(JSON.parse(e)):null},t.prototype.addFilterCondition=function(t,e){if(void 0===e&&(e=!1),t){if(!this.filter)return void(this.filter=void 0===t.dateTimeType?t:new h(h.and,t,null));var r;r=this.filter.operator!=h.not?this.filter.child1||this.filter.argument1?this.filter.child2||this.filter.argument2?this.filter:this.filter.argument1||this.filter.child1:this.filter.argument2||this.filter.child2:this.filter,this.filter=new h(e?h.or:h.and,r,t)}},t.prototype.getGroupDetailQuery=function(e){if(!(e&&this.grouping&&this.grouping.keys&&this.grouping.keys.length))return null;var r=new t(this);r.grouping=null,r.take=null,r.page=1,r.skip=0;for(var n=0;n<this.grouping.keys.length;n++){var i=c.fromModelAndName(this.grouping.dateTimeTypes[n],this.grouping.keys[n],e);i&&r.addFilterCondition(i)}return r},t.prototype.queryString=function(){var e=new Array,r=this.search?this.search.toString():null,n=null;r?(e.push(t.searchName),e.push("="),e.push(this.urlEncode(r))):(n=this.filter?this.filter.toString():null,n&&(e.push(t.filterName),e.push("="),e.push(this.urlEncode(n))));var i=this.grouping?this.grouping.toString():null;i&&(e.length&&e.push("&"),e.push(t.applyName),e.push("="),e.push(this.urlEncode(i)));var o=this.sorting?this.sorting.map(function(t){return t.toString()}).filter(function(t){return t}).join(","):null;return o&&(e.length&&e.push("&"),e.push(t.sortingName),e.push("="),e.push(this.urlEncode(o))),this.skip>0&&(e.length&&e.push("&"),e.push(t.skipName),e.push("="),e.push(this.skip+"")),this.take&&this.take>0&&(e.length&&e.push("&"),e.push(t.topName),e.push("="),e.push(this.take+"")),e.length?e.join(""):null},t.prototype.addToUrl=function(t){t||(t="");var e=this.queryString();return e&&e.trim()?t.indexOf("?")>=0?t+"&"+e:t+"?"+e:t},t.prototype.toString=function(){return this.addToUrl(this.attachedTo?this.attachedTo.baseUrl:null)},t.prototype.toQuery=function(){var t=[],e=this.search?this.search.toQuery():null;if(e)t.push(function(t){return t.filter(e)});else{var r=this.filter?this.filter.toQuery():null;r&&t.push(function(t){return t.filter(r)})}var o=this.grouping?this.grouping.toQuery():null;o&&t.push(o);var u=this.sorting?i(this.sorting.map(function(t){return t.toCompare()})):null;if(u&&t.push(function(t){var e=t.map(function(t){return t});return e.sort(u),e}),this.skip>0||this.take&&this.take>0){var s=this.skip>0?this.skip:0,a=this.take&&this.take>0?this.take+s:void 0;t.push(function(t){return t.length&&s<t.length?t.slice(s,a?Math.min(a,t.length):void 0):[]})}return t.length?n(t):function(t){return t}},t}();v.filterName="$filter",v.applyName="$apply",v.sortingName="$orderby",v.searchName="$search",v.topName="$top",v.skipName="$skip",e.QueryDescription=v}); | ||
//# sourceMappingURL=mvcct.odata.min.js.map |
{ | ||
"name": "mvcct-odata", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "JavaScript OData client", | ||
@@ -5,0 +5,0 @@ "main": "dest/umd/mvcct.odata.min.js", |
@@ -910,2 +910,3 @@ | ||
this.verb = y.verb; | ||
this.ajaxId = y.ajaxId; | ||
} | ||
@@ -912,0 +913,0 @@ } |
@@ -912,2 +912,3 @@ namespace mvcct{ | ||
this.verb = y.verb; | ||
this.ajaxId = y.ajaxId; | ||
} | ||
@@ -914,0 +915,0 @@ } |
@@ -910,2 +910,3 @@ | ||
this.verb = y.verb; | ||
this.ajaxId = y.ajaxId; | ||
} | ||
@@ -912,0 +913,0 @@ } |
@@ -53,12 +53,5 @@ # What is mvcct-odata? | ||
## QueryDescription class | ||
*Under construction* | ||
## Building filters | ||
*Under construction* | ||
## building free search | ||
*Under construction* | ||
## building sorting | ||
*Under construction* | ||
## Grouping and aggregations | ||
*Under construction* | ||
## Classes documentation | ||
[See the Core Mvc Controls Toolkit official documentation.](http://documentation.aspnetcore.mvc-controls.com/JavaScript/OData) | ||
@@ -70,2 +63,2 @@ | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
507869
7202
63