Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update dist to latest

  • Loading branch information...
commit f78b7cbd174d77798354efc76d5351bb8bb1932f 1 parent cc3f88b
Lucas Holmquist lholmquist authored
Showing with 13 additions and 13 deletions.
  1. +11 −11 dist/aerogear.js
  2. +2 −2 dist/aerogear.min.js
22 dist/aerogear.js
View
@@ -1,4 +1,4 @@
-/*! AeroGear JavaScript Library - v1.0.0.M2 - 2013-01-02
+/*! AeroGear JavaScript Library - v1.0.0.M2 - 2013-01-04
* https://github.com/aerogear/aerogear-js
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat, Inc., and individual contributors
@@ -101,6 +101,16 @@ AeroGear.Core = function() {
};
};
+/**
+ Utility function to test if an object is an Array
+ @private
+ @method
+ @param {Object} obj - This can be any object to test
+*/
+AeroGear.isArray = function( obj ) {
+ return ({}).toString.call( obj ) === "[object Array]";
+};
+
(function( AeroGear, $, undefined ) {
/**
Wrapper utility around jQuery.ajax to preform some custom actions
@@ -159,16 +169,6 @@ AeroGear.Core = function() {
return promise;
};
-
- /**
- Utility function to test if an object is an Array
- @private
- @method
- @param {Object} obj - This can be any object to test
- */
- AeroGear.isArray = function( obj ) {
- return ({}).toString.call( obj ) === "[object Array]";
- };
})( AeroGear, jQuery );
// node-uuid/uuid.js
4 dist/aerogear.min.js
View
@@ -1,4 +1,4 @@
-/*! AeroGear JavaScript Library - v1.0.0.M2 - 2013-01-02
+/*! AeroGear JavaScript Library - v1.0.0.M2 - 2013-01-04
* https://github.com/aerogear/aerogear-js
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat, Inc., and individual contributors
@@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-var AeroGear={};AeroGear.Core=function(){if(this instanceof AeroGear.Core)throw"Invalid instantiation of base class AeroGear.Core";this.add=function(e){var t,n,r=this[this.collectionName]||{};if(!e)return this;if(typeof e=="string")r[e]=AeroGear[this.lib].adapters[this.type](e);else if(AeroGear.isArray(e))for(t=0;t<e.length;t++)n=e[t],typeof n=="string"?r[n]=AeroGear[this.lib].adapters[this.type](n):r[n.name]=AeroGear[this.lib].adapters[n.type||this.type](n.name,n.settings||{});else r[e.name]=AeroGear[this.lib].adapters[e.type||this.type](e.name,e.settings||{});return this[this.collectionName]=r,this},this.remove=function(e){var t,n,r=this[this.collectionName]||{};if(typeof e=="string")delete r[e];else if(AeroGear.isArray(e))for(t=0;t<e.length;t++)n=e[t],typeof n=="string"?delete r[n]:delete r[n.name];else e&&delete r[e.name];return this[this.collectionName]=r,this}},function(e,t,n){e.ajax=function(n,r){var i=t.Deferred(function(){var i=this,s=t.extend({},{contentType:"application/json",dataType:"json"},r);this.done(s.success),this.fail(s.error),this.always(s.complete);var o=t.extend({},s,{success:function(e,t,n){i.resolve(typeof e=="string"&&o.dataType==="json"?JSON.parse(e):e,t,n)},error:function(e,t,n){if(o.dataType==="json")try{e.responseJSON=JSON.parse(e.responseText)}catch(r){}i.reject(e,t,n)},complete:function(e,t){i.resolve(e,t)}});o.contentType==="application/json"&&o.data&&(o.type==="POST"||o.type==="PUT")&&(o.data=JSON.stringify(o.data)),e.Auth&&!n.isAuthenticated()?this.reject("auth","Error: Authentication Required"):n.addAuthIdentifier?t.ajax(n.addAuthIdentifier(o)):t.ajax(o)}),s=i.promise();return s.success=i.done,s.error=i.fail,s.complete=i.always,s},e.isArray=function(e){return{}.toString.call(e)==="[object Array]"}}(AeroGear,jQuery),function(){function p(e,t,n){var r=t&&n||0,i=0;t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){i<16&&(t[r+i++]=c[e])});while(i<16)t[r+i++]=0;return t}function d(e,t){var n=t||0,r=l;return r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]}function w(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var s=e.clockseq!=null?e.clockseq:g,o=e.msecs!=null?e.msecs:(new Date).getTime(),u=e.nsecs!=null?e.nsecs:b+1,a=o-y+(u-b)/1e4;a<0&&e.clockseq==null&&(s=s+1&16383),(a<0||o>y)&&e.nsecs==null&&(u=0);if(u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");y=o,b=u,g=s,o+=122192928e5;var f=((o&268435455)*1e4+u)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=f&255;var l=o/4294967296*1e4&268435455;i[r++]=l>>>8&255,i[r++]=l&255,i[r++]=l>>>24&15|16,i[r++]=l>>>16&255,i[r++]=s>>>8|128,i[r++]=s&255;var c=e.node||m;for(var h=0;h<6;h++)i[r+h]=c[h];return t?t:d(i)}function E(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e=="binary"?new f(16):null,e=null),e=e||{};var i=e.random||(e.rng||a)();i[6]=i[6]&15|64,i[8]=i[8]&63|128;if(t)for(var s=0;s<16;s++)t[r+s]=i[s];return t||d(i)}var e=this,t,n,r,i=new Array(16);t=function(){var e,t=i,n=0;for(var n=0,e;n<16;n++)(n&3)==0&&(e=Math.random()*4294967296),t[n]=e>>>((n&3)<<3)&255;return t};if(e.crypto&&crypto.getRandomValues){var s=new Uint32Array(4);r=function(){crypto.getRandomValues(s);for(var e=0;e<16;e++)i[e]=s[e>>2]>>>(e&3)*8&255;return i}}try{var o=require("crypto").randomBytes;n=o&&function(){return o(16)}}catch(u){}var a=n||r||t,f=typeof Buffer=="function"?Buffer:Array,l=[],c={};for(var h=0;h<256;h++)l[h]=(h+256).toString(16).substr(1),c[l[h]]=h;var v=a(),m=[v[0]|1,v[1],v[2],v[3],v[4],v[5]],g=(v[6]<<8|v[7])&16383,y=0,b=0,S=E;S.v1=w,S.v4=E,S.parse=p,S.unparse=d,S.BufferClass=f,S.mathRNG=t,S.nodeRNG=n,S.whatwgRNG=r;if(typeof module!="undefined")module.exports=S;else{var x=e.uuid;S.noConflict=function(){return e.uuid=x,S},e.uuid=S}}(),function(e,t,n){e.Pipeline=function(t){if(!(this instanceof e.Pipeline))return new e.Pipeline(t);e.Core.call(this),this.lib="Pipeline",this.type=t?t.type||"Rest":"Rest",this.collectionName="pipes",this.add(t)},e.Pipeline.prototype=e.Core,e.Pipeline.constructor=e.Pipeline,e.Pipeline.adapters={}}(AeroGear,jQuery),function(e,t,n,r){e.Pipeline.adapters.Rest=function(t,n){if(!(this instanceof e.Pipeline.adapters.Rest))return new e.Pipeline.adapters.Rest(t,n);n=n||{};var r=n.endpoint||t,i={url:n.baseURL?n.baseURL+r:r},s=n.recordId||"id",o=n.authenticator||null,u="Rest";this.isAuthenticated=function(){return o?o.isAuthenticated():!0},this.addAuthIdentifier=function(e){return o?o.addAuthIdentifier(e):e},this.deauthorize=function(){o&&o.deauthorize()},this.getAjaxSettings=function(){return i},this.getRecordId=function(){return s}},e.Pipeline.adapters.Rest.prototype.read=function(n){var r=this,i=this.getRecordId(),s=this.getAjaxSettings(),o,u,a,f;return n=n||{},n[i]?o=s.url+"/"+n[i]:o=s.url,u=function(t){var r=n.stores?e.isArray(n.stores)?n.stores:[n.stores]:[],i;if(r.length)for(i in r)r[i].save(t,!0);n.success&&n.success.apply(this,arguments)},a=function(t,r){var i=n.stores?e.isArray(n.stores)?n.stores:[n.stores]:[],s;if(t==="auth"&&i.length)for(s in i)i[s].remove();n.error&&n.error.apply(this,arguments)},f={type:"GET",data:n.query,success:u,error:a,url:o,statusCode:n.statusCode,complete:n.complete},n.jsonp&&(f.dataType="jsonp",f.jsonp=n.jsonp.callback?n.jsonp.callback:"callback",n.jsonp.customCallback&&(f.jsonpCallback=n.jsonp.customCallback)),e.ajax(this,t.extend({},this.getAjaxSettings(),f))},e.Pipeline.adapters.Rest.prototype.save=function(n,r){var i=this,s=this.getRecordId(),o=this.getAjaxSettings(),u,a,f,l,c;return n=n||{},r=r||{},u=n[s]?"PUT":"POST",n[s]?a=o.url+"/"+n[s]:a=o.url,f=function(t){var n=e.isArray(r.stores)?r.stores:[r.stores],i;if(r.stores)for(i in n)n[i].save(t);r.success&&r.success.apply(this,arguments)},l=function(t,n){var i=r.stores?e.isArray(r.stores)?r.stores:[r.stores]:[],s;if(t==="auth"&&i.length)for(s in i)i[s].remove();r.error&&r.error.apply(this,arguments)},c={data:n,type:u,url:a,success:f,error:l,statusCode:r.statusCode,complete:r.complete},e.ajax(this,t.extend({},o,c))},e.Pipeline.adapters.Rest.prototype.remove=function(n,r){var i=this,s=this.getRecordId(),o=this.getAjaxSettings(),u="",a,f,l,c,h;return typeof n=="string"||typeof n=="number"?a=n:n&&n[s]?a=n[s]:n&&!r&&(r=n),r=r||{},u=a?"/"+a:"",f=o.url+u,l=function(t){var n,i;if(r.stores){n=e.isArray(r.stores)?r.stores:[r.stores];for(i in n)n[i].remove(a)}r.success&&r.success.apply(this,arguments)},c=function(t,n){var i=r.stores?e.isArray(r.stores)?r.stores:[r.stores]:[],s;if(t==="auth"&&i.length)for(s in i)i[s].remove();r.error&&r.error.apply(this,arguments)},h={type:"DELETE",url:f,success:l,error:c,statusCode:r.statusCode,complete:r.complete},e.ajax(this,t.extend({},o,h))}}(AeroGear,jQuery,uuid),function(e,t,n){e.DataManager=function(t){if(!(this instanceof e.DataManager))return new e.DataManager(t);e.Core.call(this),this.lib="DataManager",this.type=t?t.type||"Memory":"Memory",this.collectionName="stores",this.add(t)},e.DataManager.prototype=e.Core,e.DataManager.constructor=e.DataManager,e.DataManager.adapters={},e.DataManager.STATUS_NEW=1,e.DataManager.STATUS_MODIFIED=2,e.DataManager.STATUS_REMOVED=0}(AeroGear,jQuery),function(e,t,n,r){e.DataManager.adapters.Memory=function(t,r){if(!(this instanceof e.DataManager.adapters.Memory))return new e.DataManager.adapters.Memory(t,r);r=r||{};var i=r.recordId?r.recordId:"id",s="Memory",o=null,u=!!r.dataSync;this.getRecordId=function(){return i},this.getData=function(t){var n=[],r,i;if(u&&!t){for(r in o)i=o[r]["ag-sync-status"],i!==e.DataManager.STATUS_REMOVED&&n.push(o[r]);return n}return o},this.setData=function(t){if(u)for(var n in t)t[n]["ag-sync-status"]=e.DataManager.STATUS_NEW;o=t},this.emptyData=function(){if(u)for(var t in o)o[t]["ag-sync-status"]=e.DataManager.STATUS_REMOVED;else o=null},this.addDataRecord=function(t){o=o||[],u&&(t["ag-sync-status"]=e.DataManager.STATUS_NEW,t.id=t.id||n()),o.push(t)},this.updateDataRecord=function(t,n){u&&(n["ag-sync-status"]=e.DataManager.STATUS_MODIFIED),o[t]=n},this.removeDataRecord=function(t){u?o[t]["ag-sync-status"]=e.DataManager.STATUS_REMOVED:o.splice(t,1)},this.getDataSync=function(){return u},this.traverseObjects=function(e,t,n){while(typeof t=="object"){if(!n)break;e=Object.keys(t)[0],t=t[e],n=n[e]}return t===n?!0:!1}},e.DataManager.adapters.Memory.prototype.read=function(e){var t={};return t[this.getRecordId()]=e,e?this.filter(t):this.getData()},e.DataManager.adapters.Memory.prototype.save=function(t,n){var r=!1;t=e.isArray(t)?t:[t];if(n)this.setData(t);else if(this.getData())for(var i=0;i<t.length;i++){for(var s in this.getData())if(this.getData()[s][this.getRecordId()]===t[i][this.getRecordId()]){this.updateDataRecord(s,t[i]),r=!0;break}r||this.addDataRecord(t[i]),r=!1}else this.setData(t);return this.getData()},e.DataManager.adapters.Memory.prototype.remove=function(t){if(!t)return this.emptyData(),this.getData();t=e.isArray(t)?t:[t];var n,r,i;for(var s=0;s<t.length;s++){if(typeof t[s]=="string"||typeof t[s]=="number")n=t[s];else{if(!t)continue;n=t[s][this.getRecordId()]}r=this.getData(!0);for(i in r)r[i][this.getRecordId()]===n&&this.removeDataRecord(i)}return this.getData()},e.DataManager.adapters.Memory.prototype.filter=function(n,r){var i,s,o,u,a,f,l,c,h=this;return n?(i=this.getData().filter(function(i,f,l){var c=r?!1:!0,p=Object.keys(n),d,v,m;for(s=0;s<p.length;s++){if(n[p[s]].data){d=n[p[s]],m=d.matchAny?!1:!0;for(o=0;o<d.data.length;o++)if(e.isArray(i[p[s]]))if(i[p[s]].length){if(t(i[p]).not(d.data).length===0&&t(d.data).not(i[p]).length===0){m=!0;break}for(u=0;u<i[p[s]].length;u++){if(d.matchAny&&d.data[o]===i[p[s]][u]){m=!0;if(r)break;for(a=0;a<i[p[s]].length;a++)if(!r&&d.data[o]!==i[p[s]][a]){m=!1;break}}if(!d.matchAny&&d.data[o]!==i[p[s]][u]){m=!1;break}}}else m=!1;else if(typeof d.data[o]=="object"){if(d.matchAny&&h.traverseObjects(p[s],d.data[o],i[p[s]])){m=!0;break}if(!d.matchAny&&!h.traverseObjects(p[s],d.data[o],i[p[s]])){m=!1;break}}else{if(d.matchAny&&d.data[o]===i[p[s]]){m=!0;break}if(!d.matchAny&&d.data[o]!==i[p[s]]){m=!1;break}}}else if(e.isArray(i[p[s]])){m=r?!1:!0;if(i[p[s]].length)for(o=0;o<i[p[s]].length;o++){if(r&&n[p[s]]===i[p[s]][o]){m=!0;break}if(!r&&n[p[s]]!==i[p[s]][o]){m=!1;break}}else m=!1}else typeof n[p[s]]=="object"?m=h.traverseObjects(p[s],n[p[s]],i[p[s]]):m=n[p[s]]===i[p[s]]?!0:!1;if(r&&m){c=!0;break}if(!r&&!m){c=!1;break}}return c}),i):(i=this.getData()||[],i)}}(AeroGear,jQuery,uuid),function(e,t,n,r){e.DataManager.adapters.SessionLocal=function(t,n){if(!(this instanceof e.DataManager.adapters.SessionLocal))return new e.DataManager.adapters.SessionLocal(t,n);e.DataManager.adapters.Memory.apply(this,arguments);var r=null,i="SessionLocal",s=n.storageType||"sessionStorage",o=t,u=n.dataSync,a=document.location.pathname.replace(/[\/\.]/g,"-"),f=o+a,l=JSON.parse(window[s].getItem(f));l&&e.DataManager.adapters.Memory.prototype.save.call(this,l,!0),this.getStoreType=function(){return s},this.getStoreKey=function(){return f}},e.DataManager.adapters.SessionLocal.prototype=Object.create(new e.DataManager.adapters.Memory,{save:{value:function(t,n){e.DataManager.adapters.Memory.prototype.save.apply(this,arguments);try{window[this.getStoreType()].setItem(this.getStoreKey(),JSON.stringify(this.getData())),n&&n.storageSuccess&&n.storageSuccess(t)}catch(r){if(!n||!n.storageError)throw r;n.storageError(r,t)}},enumerable:!0,configurable:!0,writable:!0},remove:{value:function(t,n){e.DataManager.adapters.Memory.prototype.remove.apply(this,arguments),window[this.getStoreType()].setItem(this.getStoreKey(),JSON.stringify(this.getData()))},enumerable:!0,configurable:!0,writable:!0}})}(AeroGear,jQuery,uuid),function(e,t,n){e.Auth=function(t){if(!(this instanceof e.Auth))return new e.Auth(t);e.Core.call(this),this.lib="Auth",this.type=t?t.type||"Rest":"Rest",this.collectionName="modules",this.add(t)},e.Auth.prototype=e.Core,e.Auth.constructor=e.Auth,e.Auth.adapters={}}(AeroGear,jQuery),function(e,t,n){e.Auth.adapters.Rest=function(n,r){if(!(this instanceof e.Auth.adapters.Rest))return new e.Auth.adapters.Rest(n,r);r=r||{};var i=r.endpoints||{},s="Rest",o=n,u=!!r.agAuth,a=r.baseURL,f=r.tokenName||"Auth-Token";this.isAuthenticated=function(){return u?!!sessionStorage.getItem("ag-auth-"+o):!0},this.addAuthIdentifier=function(e){return e.headers={},e.headers[f]=sessionStorage.getItem("ag-auth-"+o),t.extend({},e)},this.deauthorize=function(){sessionStorage.removeItem("ag-auth-"+o)},this.getSettings=function(){return r},this.getEndpoints=function(){return i},this.getName=function(){return o},this.getAGAuth=function(){return u},this.getBaseURL=function(){return a},this.getTokenName=function(){return f}},e.Auth.adapters.Rest.prototype.enroll=function(e,n){n=n||{};var r=this,i=this.getName(),s=this.getTokenName(),o=this.getBaseURL(),u=this.getEndpoints(),a=this.getAGAuth(),f=function(e,t,o){sessionStorage.setItem("ag-auth-"+i,r.getAGAuth()?o.getResponseHeader(s):"true"),n.success&&n.success.apply(this,arguments)},l=function(e,t,r){var i;try{e.responseJSON=JSON.parse(e.responseText),i=[e,t,r]}catch(s){i=arguments}n.error&&n.error.apply(this,i)},c={success:f,error:l,data:e},h="";return n.contentType?c.contentType=n.contentType:a&&(c.contentType="application/json"),n.dataType?c.dataType=n.dataType:a&&(c.dataType="json"),n.baseURL?h=n.baseURL:o&&(h=o),u.enroll?h+=u.enroll:h+="auth/enroll",h.length&&(c.url=h),t.ajax(t.extend({},this.getSettings(),{type:"POST"},c))},e.Auth.adapters.Rest.prototype.login=function(e,n){n=n||{};var r=this,i=this.getName(),s=this.getTokenName(),o=this.getBaseURL(),u=this.getEndpoints(),a=this.getAGAuth(),f=function(e,t,o){sessionStorage.setItem("ag-auth-"+i,r.getAGAuth()?o.getResponseHeader(s):"true"),n.success&&n.success.apply(this,arguments)},l=function(e,t,r){var i;try{e.responseJSON=JSON.parse(e.responseText),i=[e,t,r]}catch(s){i=arguments}n.error&&n.error.apply(this,i)},c={success:f,error:l,data:e},h="";return n.contentType?c.contentType=n.contentType:a&&(c.contentType="application/json"),n.dataType?c.dataType=n.dataType:a&&(c.dataType="json"),n.baseURL?h=n.baseURL:o&&(h=o),u.login?h+=u.login:h+="auth/login",h.length&&(c.url=h),t.ajax(t.extend({},this.getSettings(),{type:"POST"},c))},e.Auth.adapters.Rest.prototype.logout=function(e){e=e||{};var n=this,r=this.getName(),i=this.getTokenName(),s=this.getBaseURL(),o=this.getEndpoints(),u=function(t,r,i){n.deauthorize(),e.success&&e.success.apply(this,arguments)},a=function(t,n,r){var i;try{t.responseJSON=JSON.parse(t.responseText),i=[t,n,r]}catch(s){i=arguments}e.error&&e.error.apply(this,i)},f={success:u,error:a},l="";return e.baseURL?l=e.baseURL:s&&(l=s),o.logout?l+=o.logout:l+="auth/logout",l.length&&(f.url=l),this.isAuthenticated()&&(f.headers={},f.headers[i]=sessionStorage.getItem("ag-auth-"+r)),t.ajax(t.extend({},this.getSettings(),{type:"POST"},f))}}(AeroGear,jQuery);
+var AeroGear={};AeroGear.Core=function(){if(this instanceof AeroGear.Core)throw"Invalid instantiation of base class AeroGear.Core";this.add=function(e){var t,n,r=this[this.collectionName]||{};if(!e)return this;if(typeof e=="string")r[e]=AeroGear[this.lib].adapters[this.type](e);else if(AeroGear.isArray(e))for(t=0;t<e.length;t++)n=e[t],typeof n=="string"?r[n]=AeroGear[this.lib].adapters[this.type](n):r[n.name]=AeroGear[this.lib].adapters[n.type||this.type](n.name,n.settings||{});else r[e.name]=AeroGear[this.lib].adapters[e.type||this.type](e.name,e.settings||{});return this[this.collectionName]=r,this},this.remove=function(e){var t,n,r=this[this.collectionName]||{};if(typeof e=="string")delete r[e];else if(AeroGear.isArray(e))for(t=0;t<e.length;t++)n=e[t],typeof n=="string"?delete r[n]:delete r[n.name];else e&&delete r[e.name];return this[this.collectionName]=r,this}},AeroGear.isArray=function(e){return{}.toString.call(e)==="[object Array]"},function(e,t,n){e.ajax=function(n,r){var i=t.Deferred(function(){var i=this,s=t.extend({},{contentType:"application/json",dataType:"json"},r);this.done(s.success),this.fail(s.error),this.always(s.complete);var o=t.extend({},s,{success:function(e,t,n){i.resolve(typeof e=="string"&&o.dataType==="json"?JSON.parse(e):e,t,n)},error:function(e,t,n){if(o.dataType==="json")try{e.responseJSON=JSON.parse(e.responseText)}catch(r){}i.reject(e,t,n)},complete:function(e,t){i.resolve(e,t)}});o.contentType==="application/json"&&o.data&&(o.type==="POST"||o.type==="PUT")&&(o.data=JSON.stringify(o.data)),e.Auth&&!n.isAuthenticated()?this.reject("auth","Error: Authentication Required"):n.addAuthIdentifier?t.ajax(n.addAuthIdentifier(o)):t.ajax(o)}),s=i.promise();return s.success=i.done,s.error=i.fail,s.complete=i.always,s}}(AeroGear,jQuery),function(){function p(e,t,n){var r=t&&n||0,i=0;t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){i<16&&(t[r+i++]=c[e])});while(i<16)t[r+i++]=0;return t}function d(e,t){var n=t||0,r=l;return r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+"-"+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]+r[e[n++]]}function w(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var s=e.clockseq!=null?e.clockseq:g,o=e.msecs!=null?e.msecs:(new Date).getTime(),u=e.nsecs!=null?e.nsecs:b+1,a=o-y+(u-b)/1e4;a<0&&e.clockseq==null&&(s=s+1&16383),(a<0||o>y)&&e.nsecs==null&&(u=0);if(u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");y=o,b=u,g=s,o+=122192928e5;var f=((o&268435455)*1e4+u)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=f&255;var l=o/4294967296*1e4&268435455;i[r++]=l>>>8&255,i[r++]=l&255,i[r++]=l>>>24&15|16,i[r++]=l>>>16&255,i[r++]=s>>>8|128,i[r++]=s&255;var c=e.node||m;for(var h=0;h<6;h++)i[r+h]=c[h];return t?t:d(i)}function E(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e=="binary"?new f(16):null,e=null),e=e||{};var i=e.random||(e.rng||a)();i[6]=i[6]&15|64,i[8]=i[8]&63|128;if(t)for(var s=0;s<16;s++)t[r+s]=i[s];return t||d(i)}var e=this,t,n,r,i=new Array(16);t=function(){var e,t=i,n=0;for(var n=0,e;n<16;n++)(n&3)==0&&(e=Math.random()*4294967296),t[n]=e>>>((n&3)<<3)&255;return t};if(e.crypto&&crypto.getRandomValues){var s=new Uint32Array(4);r=function(){crypto.getRandomValues(s);for(var e=0;e<16;e++)i[e]=s[e>>2]>>>(e&3)*8&255;return i}}try{var o=require("crypto").randomBytes;n=o&&function(){return o(16)}}catch(u){}var a=n||r||t,f=typeof Buffer=="function"?Buffer:Array,l=[],c={};for(var h=0;h<256;h++)l[h]=(h+256).toString(16).substr(1),c[l[h]]=h;var v=a(),m=[v[0]|1,v[1],v[2],v[3],v[4],v[5]],g=(v[6]<<8|v[7])&16383,y=0,b=0,S=E;S.v1=w,S.v4=E,S.parse=p,S.unparse=d,S.BufferClass=f,S.mathRNG=t,S.nodeRNG=n,S.whatwgRNG=r;if(typeof module!="undefined")module.exports=S;else{var x=e.uuid;S.noConflict=function(){return e.uuid=x,S},e.uuid=S}}(),function(e,t,n){e.Pipeline=function(t){if(!(this instanceof e.Pipeline))return new e.Pipeline(t);e.Core.call(this),this.lib="Pipeline",this.type=t?t.type||"Rest":"Rest",this.collectionName="pipes",this.add(t)},e.Pipeline.prototype=e.Core,e.Pipeline.constructor=e.Pipeline,e.Pipeline.adapters={}}(AeroGear,jQuery),function(e,t,n,r){e.Pipeline.adapters.Rest=function(t,n){if(!(this instanceof e.Pipeline.adapters.Rest))return new e.Pipeline.adapters.Rest(t,n);n=n||{};var r=n.endpoint||t,i={url:n.baseURL?n.baseURL+r:r},s=n.recordId||"id",o=n.authenticator||null,u="Rest";this.isAuthenticated=function(){return o?o.isAuthenticated():!0},this.addAuthIdentifier=function(e){return o?o.addAuthIdentifier(e):e},this.deauthorize=function(){o&&o.deauthorize()},this.getAjaxSettings=function(){return i},this.getRecordId=function(){return s}},e.Pipeline.adapters.Rest.prototype.read=function(n){var r=this,i=this.getRecordId(),s=this.getAjaxSettings(),o,u,a,f;return n=n||{},n[i]?o=s.url+"/"+n[i]:o=s.url,u=function(t){var r=n.stores?e.isArray(n.stores)?n.stores:[n.stores]:[],i;if(r.length)for(i in r)r[i].save(t,!0);n.success&&n.success.apply(this,arguments)},a=function(t,r){var i=n.stores?e.isArray(n.stores)?n.stores:[n.stores]:[],s;if(t==="auth"&&i.length)for(s in i)i[s].remove();n.error&&n.error.apply(this,arguments)},f={type:"GET",data:n.query,success:u,error:a,url:o,statusCode:n.statusCode,complete:n.complete},n.jsonp&&(f.dataType="jsonp",f.jsonp=n.jsonp.callback?n.jsonp.callback:"callback",n.jsonp.customCallback&&(f.jsonpCallback=n.jsonp.customCallback)),e.ajax(this,t.extend({},this.getAjaxSettings(),f))},e.Pipeline.adapters.Rest.prototype.save=function(n,r){var i=this,s=this.getRecordId(),o=this.getAjaxSettings(),u,a,f,l,c;return n=n||{},r=r||{},u=n[s]?"PUT":"POST",n[s]?a=o.url+"/"+n[s]:a=o.url,f=function(t){var n=e.isArray(r.stores)?r.stores:[r.stores],i;if(r.stores)for(i in n)n[i].save(t);r.success&&r.success.apply(this,arguments)},l=function(t,n){var i=r.stores?e.isArray(r.stores)?r.stores:[r.stores]:[],s;if(t==="auth"&&i.length)for(s in i)i[s].remove();r.error&&r.error.apply(this,arguments)},c={data:n,type:u,url:a,success:f,error:l,statusCode:r.statusCode,complete:r.complete},e.ajax(this,t.extend({},o,c))},e.Pipeline.adapters.Rest.prototype.remove=function(n,r){var i=this,s=this.getRecordId(),o=this.getAjaxSettings(),u="",a,f,l,c,h;return typeof n=="string"||typeof n=="number"?a=n:n&&n[s]?a=n[s]:n&&!r&&(r=n),r=r||{},u=a?"/"+a:"",f=o.url+u,l=function(t){var n,i;if(r.stores){n=e.isArray(r.stores)?r.stores:[r.stores];for(i in n)n[i].remove(a)}r.success&&r.success.apply(this,arguments)},c=function(t,n){var i=r.stores?e.isArray(r.stores)?r.stores:[r.stores]:[],s;if(t==="auth"&&i.length)for(s in i)i[s].remove();r.error&&r.error.apply(this,arguments)},h={type:"DELETE",url:f,success:l,error:c,statusCode:r.statusCode,complete:r.complete},e.ajax(this,t.extend({},o,h))}}(AeroGear,jQuery,uuid),function(e,t,n){e.DataManager=function(t){if(!(this instanceof e.DataManager))return new e.DataManager(t);e.Core.call(this),this.lib="DataManager",this.type=t?t.type||"Memory":"Memory",this.collectionName="stores",this.add(t)},e.DataManager.prototype=e.Core,e.DataManager.constructor=e.DataManager,e.DataManager.adapters={},e.DataManager.STATUS_NEW=1,e.DataManager.STATUS_MODIFIED=2,e.DataManager.STATUS_REMOVED=0}(AeroGear,jQuery),function(e,t,n,r){e.DataManager.adapters.Memory=function(t,r){if(!(this instanceof e.DataManager.adapters.Memory))return new e.DataManager.adapters.Memory(t,r);r=r||{};var i=r.recordId?r.recordId:"id",s="Memory",o=null,u=!!r.dataSync;this.getRecordId=function(){return i},this.getData=function(t){var n=[],r,i;if(u&&!t){for(r in o)i=o[r]["ag-sync-status"],i!==e.DataManager.STATUS_REMOVED&&n.push(o[r]);return n}return o},this.setData=function(t){if(u)for(var n in t)t[n]["ag-sync-status"]=e.DataManager.STATUS_NEW;o=t},this.emptyData=function(){if(u)for(var t in o)o[t]["ag-sync-status"]=e.DataManager.STATUS_REMOVED;else o=null},this.addDataRecord=function(t){o=o||[],u&&(t["ag-sync-status"]=e.DataManager.STATUS_NEW,t.id=t.id||n()),o.push(t)},this.updateDataRecord=function(t,n){u&&(n["ag-sync-status"]=e.DataManager.STATUS_MODIFIED),o[t]=n},this.removeDataRecord=function(t){u?o[t]["ag-sync-status"]=e.DataManager.STATUS_REMOVED:o.splice(t,1)},this.getDataSync=function(){return u},this.traverseObjects=function(e,t,n){while(typeof t=="object"){if(!n)break;e=Object.keys(t)[0],t=t[e],n=n[e]}return t===n?!0:!1}},e.DataManager.adapters.Memory.prototype.read=function(e){var t={};return t[this.getRecordId()]=e,e?this.filter(t):this.getData()},e.DataManager.adapters.Memory.prototype.save=function(t,n){var r=!1;t=e.isArray(t)?t:[t];if(n)this.setData(t);else if(this.getData())for(var i=0;i<t.length;i++){for(var s in this.getData())if(this.getData()[s][this.getRecordId()]===t[i][this.getRecordId()]){this.updateDataRecord(s,t[i]),r=!0;break}r||this.addDataRecord(t[i]),r=!1}else this.setData(t);return this.getData()},e.DataManager.adapters.Memory.prototype.remove=function(t){if(!t)return this.emptyData(),this.getData();t=e.isArray(t)?t:[t];var n,r,i;for(var s=0;s<t.length;s++){if(typeof t[s]=="string"||typeof t[s]=="number")n=t[s];else{if(!t)continue;n=t[s][this.getRecordId()]}r=this.getData(!0);for(i in r)r[i][this.getRecordId()]===n&&this.removeDataRecord(i)}return this.getData()},e.DataManager.adapters.Memory.prototype.filter=function(n,r){var i,s,o,u,a,f,l,c,h=this;return n?(i=this.getData().filter(function(i,f,l){var c=r?!1:!0,p=Object.keys(n),d,v,m;for(s=0;s<p.length;s++){if(n[p[s]].data){d=n[p[s]],m=d.matchAny?!1:!0;for(o=0;o<d.data.length;o++)if(e.isArray(i[p[s]]))if(i[p[s]].length){if(t(i[p]).not(d.data).length===0&&t(d.data).not(i[p]).length===0){m=!0;break}for(u=0;u<i[p[s]].length;u++){if(d.matchAny&&d.data[o]===i[p[s]][u]){m=!0;if(r)break;for(a=0;a<i[p[s]].length;a++)if(!r&&d.data[o]!==i[p[s]][a]){m=!1;break}}if(!d.matchAny&&d.data[o]!==i[p[s]][u]){m=!1;break}}}else m=!1;else if(typeof d.data[o]=="object"){if(d.matchAny&&h.traverseObjects(p[s],d.data[o],i[p[s]])){m=!0;break}if(!d.matchAny&&!h.traverseObjects(p[s],d.data[o],i[p[s]])){m=!1;break}}else{if(d.matchAny&&d.data[o]===i[p[s]]){m=!0;break}if(!d.matchAny&&d.data[o]!==i[p[s]]){m=!1;break}}}else if(e.isArray(i[p[s]])){m=r?!1:!0;if(i[p[s]].length)for(o=0;o<i[p[s]].length;o++){if(r&&n[p[s]]===i[p[s]][o]){m=!0;break}if(!r&&n[p[s]]!==i[p[s]][o]){m=!1;break}}else m=!1}else typeof n[p[s]]=="object"?m=h.traverseObjects(p[s],n[p[s]],i[p[s]]):m=n[p[s]]===i[p[s]]?!0:!1;if(r&&m){c=!0;break}if(!r&&!m){c=!1;break}}return c}),i):(i=this.getData()||[],i)}}(AeroGear,jQuery,uuid),function(e,t,n,r){e.DataManager.adapters.SessionLocal=function(t,n){if(!(this instanceof e.DataManager.adapters.SessionLocal))return new e.DataManager.adapters.SessionLocal(t,n);e.DataManager.adapters.Memory.apply(this,arguments);var r=null,i="SessionLocal",s=n.storageType||"sessionStorage",o=t,u=n.dataSync,a=document.location.pathname.replace(/[\/\.]/g,"-"),f=o+a,l=JSON.parse(window[s].getItem(f));l&&e.DataManager.adapters.Memory.prototype.save.call(this,l,!0),this.getStoreType=function(){return s},this.getStoreKey=function(){return f}},e.DataManager.adapters.SessionLocal.prototype=Object.create(new e.DataManager.adapters.Memory,{save:{value:function(t,n){e.DataManager.adapters.Memory.prototype.save.apply(this,arguments);try{window[this.getStoreType()].setItem(this.getStoreKey(),JSON.stringify(this.getData())),n&&n.storageSuccess&&n.storageSuccess(t)}catch(r){if(!n||!n.storageError)throw r;n.storageError(r,t)}},enumerable:!0,configurable:!0,writable:!0},remove:{value:function(t,n){e.DataManager.adapters.Memory.prototype.remove.apply(this,arguments),window[this.getStoreType()].setItem(this.getStoreKey(),JSON.stringify(this.getData()))},enumerable:!0,configurable:!0,writable:!0}})}(AeroGear,jQuery,uuid),function(e,t,n){e.Auth=function(t){if(!(this instanceof e.Auth))return new e.Auth(t);e.Core.call(this),this.lib="Auth",this.type=t?t.type||"Rest":"Rest",this.collectionName="modules",this.add(t)},e.Auth.prototype=e.Core,e.Auth.constructor=e.Auth,e.Auth.adapters={}}(AeroGear,jQuery),function(e,t,n){e.Auth.adapters.Rest=function(n,r){if(!(this instanceof e.Auth.adapters.Rest))return new e.Auth.adapters.Rest(n,r);r=r||{};var i=r.endpoints||{},s="Rest",o=n,u=!!r.agAuth,a=r.baseURL,f=r.tokenName||"Auth-Token";this.isAuthenticated=function(){return u?!!sessionStorage.getItem("ag-auth-"+o):!0},this.addAuthIdentifier=function(e){return e.headers={},e.headers[f]=sessionStorage.getItem("ag-auth-"+o),t.extend({},e)},this.deauthorize=function(){sessionStorage.removeItem("ag-auth-"+o)},this.getSettings=function(){return r},this.getEndpoints=function(){return i},this.getName=function(){return o},this.getAGAuth=function(){return u},this.getBaseURL=function(){return a},this.getTokenName=function(){return f}},e.Auth.adapters.Rest.prototype.enroll=function(e,n){n=n||{};var r=this,i=this.getName(),s=this.getTokenName(),o=this.getBaseURL(),u=this.getEndpoints(),a=this.getAGAuth(),f=function(e,t,o){sessionStorage.setItem("ag-auth-"+i,r.getAGAuth()?o.getResponseHeader(s):"true"),n.success&&n.success.apply(this,arguments)},l=function(e,t,r){var i;try{e.responseJSON=JSON.parse(e.responseText),i=[e,t,r]}catch(s){i=arguments}n.error&&n.error.apply(this,i)},c={success:f,error:l,data:e},h="";return n.contentType?c.contentType=n.contentType:a&&(c.contentType="application/json"),n.dataType?c.dataType=n.dataType:a&&(c.dataType="json"),n.baseURL?h=n.baseURL:o&&(h=o),u.enroll?h+=u.enroll:h+="auth/enroll",h.length&&(c.url=h),t.ajax(t.extend({},this.getSettings(),{type:"POST"},c))},e.Auth.adapters.Rest.prototype.login=function(e,n){n=n||{};var r=this,i=this.getName(),s=this.getTokenName(),o=this.getBaseURL(),u=this.getEndpoints(),a=this.getAGAuth(),f=function(e,t,o){sessionStorage.setItem("ag-auth-"+i,r.getAGAuth()?o.getResponseHeader(s):"true"),n.success&&n.success.apply(this,arguments)},l=function(e,t,r){var i;try{e.responseJSON=JSON.parse(e.responseText),i=[e,t,r]}catch(s){i=arguments}n.error&&n.error.apply(this,i)},c={success:f,error:l,data:e},h="";return n.contentType?c.contentType=n.contentType:a&&(c.contentType="application/json"),n.dataType?c.dataType=n.dataType:a&&(c.dataType="json"),n.baseURL?h=n.baseURL:o&&(h=o),u.login?h+=u.login:h+="auth/login",h.length&&(c.url=h),t.ajax(t.extend({},this.getSettings(),{type:"POST"},c))},e.Auth.adapters.Rest.prototype.logout=function(e){e=e||{};var n=this,r=this.getName(),i=this.getTokenName(),s=this.getBaseURL(),o=this.getEndpoints(),u=function(t,r,i){n.deauthorize(),e.success&&e.success.apply(this,arguments)},a=function(t,n,r){var i;try{t.responseJSON=JSON.parse(t.responseText),i=[t,n,r]}catch(s){i=arguments}e.error&&e.error.apply(this,i)},f={success:u,error:a},l="";return e.baseURL?l=e.baseURL:s&&(l=s),o.logout?l+=o.logout:l+="auth/logout",l.length&&(f.url=l),this.isAuthenticated()&&(f.headers={},f.headers[i]=sessionStorage.getItem("ag-auth-"+r)),t.ajax(t.extend({},this.getSettings(),{type:"POST"},f))}}(AeroGear,jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.