UNPKG

1.78 kBJavaScriptView Raw
1"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var EncodeAction,mutable_1=require("./mutable");!function(t){t[t.INSERT=0]="INSERT",t[t.UPDATE=1]="UPDATE",t[t.DELETE=2]="DELETE"}(EncodeAction=exports.EncodeAction||(exports.EncodeAction={}));var CodecHelper=function(){function t(){}return t.prototype.coerceInt64=function(t){return t.toNumber?t.toNumber():t},t.prototype.populatePKIntoMetaInfo=function(t,e){return t[mutable_1.Const.AGGREGATE_KEY]=e.toString(),t},t.prototype.round=function(t){return Math.round(1e3*t)/1e3},t}();exports.CodecHelper=CodecHelper;var FilterRequest=function(){function t(t,e){this._requestId=t,this._ruleCombination=e}return t.prototype.getRequestId=function(){return this._requestId},t.prototype.getFilterData=function(){return this._ruleCombination},t.prototype.toJSON=function(){return{requestId:this.getRequestId(),namespace:this._ruleCombination.namespace,filterRules:this._ruleCombination.filterRules}},t.IGNORED_REQUEST_ID=-1,t}();exports.FilterRequest=FilterRequest;var Util=function(){function l(){}return l.addKey=function(t,e){if(-1!=e.search(l.SEPARATOR))throw new TypeError("Incoming String cannot contain Separator: "+l.SEPARATOR+" Incoming: "+e);return 0==t.length?e:-1===t.indexOf(e)?t+l.SEPARATOR+e:t},l.removeKey=function(t,e){var n=t.split(l.SEPARATOR),r=e.split(l.SEPARATOR);n.sort();for(var o=0,i=r;o<i.length;o++){var u=i[o],c=n.indexOf(u);if(!(c<0)&&(n.splice(c,1),0==n.length))return""}for(var a=n[0],s=1;s<n.length;s++)a=l.addKey(a,n[s]);return a},l.containsKey=function(t,e){if(null==t)return!1;if(-1!=e.search(l.SEPARATOR))throw new TypeError("Incoming String cannot contain Separator: "+l.SEPARATOR+" Incoming: "+e);return!(t.split(l.SEPARATOR).indexOf(e)<0)},l.SEPARATOR=",",l}();exports.Util=Util;
\No newline at end of file