From acedf18b40c840ab96194452eb7d100705a1d925 Mon Sep 17 00:00:00 2001 From: Marshall Thompson Date: Mon, 29 Aug 2016 10:07:38 -0600 Subject: [PATCH] 0.6.9 --- dist/amd/can-connect-feathers.js | 212 ++++++++++++++++++ dist/amd/utils.js | 25 +++ dist/cjs/can-connect-feathers.js | 191 +++++++++++++++++ dist/cjs/utils.js | 27 +++ dist/global/can-connect-feathers.js | 319 ++++++++++++++++++++++++++++ 5 files changed, 774 insertions(+) create mode 100644 dist/amd/can-connect-feathers.js create mode 100644 dist/amd/utils.js create mode 100644 dist/cjs/can-connect-feathers.js create mode 100644 dist/cjs/utils.js create mode 100644 dist/global/can-connect-feathers.js diff --git a/dist/amd/can-connect-feathers.js b/dist/amd/can-connect-feathers.js new file mode 100644 index 0000000..339e45a --- /dev/null +++ b/dist/amd/can-connect-feathers.js @@ -0,0 +1,212 @@ +/*[traceur-runtime]*/ +this._System=this.System,function(t){"use strict";function e(t,e,r){for(var n=[e],u=0;u0;)u.unshift("..");0===u.length&&u.push(".")}return e+u.join("/")+r}function n(e){var n=e[a.PATH]||"";return n=r(n),e[a.PATH]=n,t(e[a.SCHEME],e[a.USER_INFO],e[a.DOMAIN],e[a.PORT],e[a.PATH],e[a.QUERY_DATA],e[a.FRAGMENT])}function u(t){var r=e(t);return n(r)}function i(t,r){var u=e(r),i=e(t);if(u[a.SCHEME])return n(u);u[a.SCHEME]=i[a.SCHEME];for(var o=a.SCHEME;o<=a.PORT;o++)u[o]||(u[o]=i[o]);if("/"==u[a.PATH][0])return n(u);var c=i[a.PATH],s=c.lastIndexOf("/");return c=c.slice(0,s+1)+u[a.PATH],u[a.PATH]=c,n(u)}function o(t){if(!t)return!1;if("/"===t[0])return!0;var r=e(t);return r[a.SCHEME]?!0:!1}var c=new RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$"),a={SCHEME:1,USER_INFO:2,DOMAIN:3,PORT:4,PATH:5,QUERY_DATA:6,FRAGMENT:7};$traceurRuntime.canonicalizeUrl=u,$traceurRuntime.isAbsolute=o,$traceurRuntime.removeDotSegments=r,$traceurRuntime.resolveUrl=i}(),function(t){"use strict";function e(t,e){this.url=t,this.value_=e}function r(t,e){this.message=this.constructor.name+": "+this.stripCause(e)+" in "+t,e instanceof r||!e.stack?this.stack="":this.stack=this.stripStack(e.stack)}function n(t,e){var r=[],n=e-3;0>n&&(n=0);for(var u=n;e>u;u++)r.push(t[u]);return r}function u(t,e){var r=e+1;r>t.length-1&&(r=t.length-1);for(var n=[],u=e;r>=u;u++)n.push(t[u]);return n}function i(t){for(var e="",r=0;t-1>r;r++)e+="-";return e}function o(t,r){e.call(this,t,null),this.func=r}function c(t){if(t){var e=v.normalize(t);return p[e]}}function a(t){var e=arguments[1],r=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(n){var u,i;if(e===y){var o=Object.getOwnPropertyDescriptor(t,n);o.get&&(u=o.get)}u||(i=t[n],u=function(){return i}),Object.defineProperty(r,n,{get:u,enumerable:!0})}),Object.preventExtensions(r),r}var s,l=$traceurRuntime,f=l.canonicalizeUrl,h=l.resolveUrl,m=l.isAbsolute,p=Object.create(null);s=t.location&&t.location.href?h(t.location.href,"./"):"",r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.stripError=function(t){return t.replace(/.*Error:/,this.constructor.name+":")},r.prototype.stripCause=function(t){return t?t.message?this.stripError(t.message):t+"":""},r.prototype.loadedBy=function(t){this.stack+="\n loaded by "+t},r.prototype.stripStack=function(t){var e=[];return t.split("\n").some(function(t){return/UncoatedModuleInstantiator/.test(t)?!0:void e.push(t)}),e[0]=this.stripError(e[0]),e.join("\n")},o.prototype=Object.create(e.prototype),o.prototype.getUncoatedModule=function(){var e=this;if(this.value_)return this.value_;try{var o;return void 0!==typeof $traceurRuntime&&$traceurRuntime.require&&(o=$traceurRuntime.require.bind(null,this.url)),this.value_=this.func.call(t,o)}catch(c){if(c instanceof r)throw c.loadedBy(this.url),c;if(c.stack){var a=this.func.toString().split("\n"),s=[];c.stack.split("\n").some(function(t,r){if(t.indexOf("UncoatedModuleInstantiator.getUncoatedModule")>0)return!0;var o=/(at\s[^\s]*\s).*>:(\d*):(\d*)\)/.exec(t);if(o){var c=parseInt(o[2],10);s=s.concat(n(a,c)),1===r?s.push(i(o[3])+"^ "+e.url):s.push(i(o[3])+"^"),s=s.concat(u(a,c)),s.push("= = = = = = = = =")}else s.push(t)}),c.stack=s.join("\n")}throw new r(this.url,c)}};var b=Object.create(null),y={},v={normalize:function(t,e,r){if("string"!=typeof t)throw new TypeError("module name must be a string, not "+typeof t);if(m(t))return f(t);if(/[^\.]\/\.\.\//.test(t))throw new Error("module name embeds /../: "+t);return"."===t[0]&&e?h(e,t):f(t)},get:function(t){var e=c(t);if(!e)return void 0;var r=b[e.url];return r?r:(r=a(e.getUncoatedModule(),y),b[e.url]=r)},set:function(t,e){t=String(t),p[t]=new o(t,function(){return e}),b[t]=e},get baseURL(){return s},set baseURL(t){s=String(t)},registerModule:function(t,e,r){var n=v.normalize(t);if(p[n])throw new Error("duplicate module named "+n);p[n]=new o(n,r)},bundleStore:Object.create(null),register:function(t,e,r){e&&(e.length||r.length)?this.bundleStore[t]={deps:e,execute:function(){var t=arguments,n={};e.forEach(function(e,r){return n[e]=t[r]});var u=r.call(this,n);return u.execute.call(this),u.exports}}:this.registerModule(t,e,r)},getAnonymousModule:function(e){return new a(e.call(t),y)}},g=new a({ModuleStore:v});v.set("@traceur/src/runtime/ModuleStore.js",g);var d=$traceurRuntime.setupGlobals;$traceurRuntime.setupGlobals=function(t){d(t)},$traceurRuntime.ModuleStore=v,t.System={register:v.register.bind(v),registerModule:v.registerModule.bind(v),get:v.get,set:v.set,normalize:v.normalize}}("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this),System.registerModule("traceur-runtime@0.0.91/src/runtime/async.js",[],function(){"use strict";function t(){}function e(){}function r(t){return t.prototype=s(e.prototype),t.__proto__=e,t}function n(t,e){for(var r=[],n=2;n3?("function"==typeof n&&(t.__proto__=n),t.prototype=f(a(n),i(e))):(o(e),t.prototype=e),m(t,"prototype",{configurable:!1,writable:!1}),h(t,i(r))}function a(t){if("function"==typeof t){var e=t.prototype;if(s(e)===e||null===e)return t.prototype;throw new l("super prototype must be an Object or null")}if(null===t)return null;throw new l("Super expression must either be null or a function, not "+typeof t+".")}var s=Object,l=TypeError,f=s.create,h=$traceurRuntime.defineProperties,m=$traceurRuntime.defineProperty,p=$traceurRuntime.getOwnPropertyDescriptor,b=($traceurRuntime.getOwnPropertyNames,Object.getPrototypeOf),y=Object,v=y.getOwnPropertyNames,g=y.getOwnPropertySymbols,d={enumerable:!1};return $traceurRuntime.createClass=c,$traceurRuntime.superConstructor=e,$traceurRuntime.superGet=r,$traceurRuntime.superSet=n,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/destructuring.js",[],function(){"use strict";function t(t){for(var e,r=[],n=0;!(e=t.next()).done;)r[n++]=e.value;return r}return $traceurRuntime.iteratorToArray=t,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/generators.js",[],function(){"use strict";function t(t){return{configurable:!0,enumerable:!1,value:t,writable:!0}}function e(t){return new Error("Traceur compiler bug: invalid state in state machine: "+t)}function r(){this.state=0,this.GState=v,this.storedException=void 0,this.finallyFallThrough=void 0,this.sent_=void 0,this.returnValue=void 0,this.oldReturnValue=void 0,this.tryStack_=[]}function n(t,e,r,n){switch(t.GState){case g:throw new Error('"'+r+'" on executing generator');case j:if("next"==r)return{value:void 0,done:!0};if(n===S)return{value:t.returnValue,done:!0};throw n;case v:if("throw"===r){if(t.GState=j,n===S)return{value:t.returnValue,done:!0};throw n}if(void 0!==n)throw y("Sent value to newborn generator");case d:t.GState=g,t.action=r,t.sent=n;var u;try{u=e(t)}catch(i){if(i!==S)throw i;u=t}var o=u===t;return o&&(u=t.returnValue),t.GState=o?j:d,{value:u,done:o}}}function u(){}function i(){}function o(t,e,n){var u=l(t,n),i=new r,o=b(e.prototype);return o[R]=i,o[_]=u,o}function c(t){return t.prototype=b(i.prototype),t.__proto__=i,t}function a(){r.call(this),this.err=void 0;var t=this;t.result=new Promise(function(e,r){t.resolve=e,t.reject=r})}function s(t,e){var r=l(t,e),n=new a;return n.createCallback=function(t){return function(e){n.state=t,n.value=e,r(n)}},n.errback=function(t){f(n,t),r(n)},r(n),n.result}function l(t,e){return function(r){for(;;)try{return t.call(e,r)}catch(n){f(r,n)}}}function f(t,e){t.storedException=e;var r=t.tryStack_[t.tryStack_.length-1];return r?(t.state=void 0!==r["catch"]?r["catch"]:r["finally"],void(void 0!==r.finallyFallThrough&&(t.finallyFallThrough=r.finallyFallThrough))):void t.handleException(e)}if("object"!=typeof $traceurRuntime)throw new Error("traceur runtime not found.");var h=$traceurRuntime.createPrivateName,m=$traceurRuntime.defineProperties,p=$traceurRuntime.defineProperty,b=Object.create,y=TypeError,v=0,g=1,d=2,j=3,w=-2,O=-3,S={};r.prototype={pushTry:function(t,e){if(null!==e){for(var r=null,n=this.tryStack_.length-1;n>=0;n--)if(void 0!==this.tryStack_[n]["catch"]){r=this.tryStack_[n]["catch"];break}null===r&&(r=O),this.tryStack_.push({"finally":e,finallyFallThrough:r})}null!==t&&this.tryStack_.push({"catch":t})},popTry:function(){this.tryStack_.pop()},maybeUncatchable:function(){if(this.storedException===S)throw S},get sent(){return this.maybeThrow(),this.sent_},set sent(t){this.sent_=t},get sentIgnoreThrow(){return this.sent_},maybeThrow:function(){if("throw"===this.action)throw this.action="next",this.sent_},end:function(){switch(this.state){case w:return this;case O:throw this.storedException;default:throw e(this.state)}},handleException:function(t){throw this.GState=j,this.state=w,t},wrapYieldStar:function(t){var e=this;return{next:function(e){return t.next(e)},"throw":function(r){var n;if(r===S){if(t["return"]){if(n=t["return"](e.returnValue),!n.done)return e.returnValue=e.oldReturnValue,n;e.returnValue=n.value}throw r}if(t["throw"])return t["throw"](r);throw t["return"]&&t["return"](),y("Inner iterator does not have a throw method")}}}};var R=h(),_=h();return u.prototype=i,p(i,"constructor",t(u)),i.prototype={constructor:i,next:function(t){return n(this[R],this[_],"next",t)},"throw":function(t){return n(this[R],this[_],"throw",t)},"return":function(t){return this[R].oldReturnValue=this[R].returnValue,this[R].returnValue=t,n(this[R],this[_],"throw",S)}},m(i.prototype,{constructor:{enumerable:!1},next:{enumerable:!1},"throw":{enumerable:!1},"return":{enumerable:!1}}),Object.defineProperty(i.prototype,Symbol.iterator,t(function(){return this})),a.prototype=b(r.prototype),a.prototype.end=function(){switch(this.state){case w:this.resolve(this.returnValue);break;case O:this.reject(this.storedException);break;default:this.reject(e(this.state))}},a.prototype.handleException=function(){this.state=O},$traceurRuntime.asyncWrap=s,$traceurRuntime.initGeneratorFunction=c,$traceurRuntime.createGeneratorInstance=o,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/relativeRequire.js",[],function(){"use strict";function t(t,r){function n(t){return"/"===t.slice(-1)}function u(t){return"/"===t[0]}function i(t){return"."===t[0]}return e=e||"undefined"!=typeof require&&require("path"),n(r)||u(r)?void 0:i(r)?require(e.resolve(e.dirname(t),r)):require(r)}var e;return $traceurRuntime.require=t,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/spread.js",[],function(){"use strict";function t(){for(var t,e=[],r=0,n=0;n>>0}function e(t){return t&&("object"==typeof t||"function"==typeof t)}function r(t){return"function"==typeof t}function n(t){return"number"==typeof t}function u(t){return t=+t,j(t)?0:0!==t&&d(t)?t>0?g(t):v(t):t}function i(t){var e=u(t);return 0>e?0:O(e,R)}function o(t){return e(t)?t[Symbol.iterator]:void 0}function c(t){return r(t)}function a(t,e){return{value:t,done:e}}function s(t,e,r){e in t||Object.defineProperty(t,e,r)}function l(t,e,r){s(t,e,{value:r,configurable:!0,enumerable:!1,writable:!0})}function f(t,e,r){s(t,e,{value:r,configurable:!1,enumerable:!1,writable:!1})}function h(t,e){for(var r=0;rt;t+=2){var e=v[t],r=v[t+1];e(r),v[t]=void 0,v[t+1]=void 0}l=0}function c(){try{var t=require,e=t("vertx");return a=e.runOnLoop||e.runOnContext,r()}catch(n){return i()}}var a,s,l=0,f=({}.toString,t),h="undefined"!=typeof window?window:void 0,m=h||{},p=m.MutationObserver||m.WebKitMutationObserver,b="undefined"!=typeof process&&"[object process]"==={}.toString.call(process),y="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,v=new Array(1e3);return s=b?e():p?n():y?u():void 0===h&&"function"==typeof require?c():i(),{get default(){return f}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Promise.js",[],function(){"use strict";function t(t){return t&&"object"==typeof t&&void 0!==t.status_}function e(t){return t}function r(t){throw t}function n(t){var n=void 0!==arguments[1]?arguments[1]:e,i=void 0!==arguments[2]?arguments[2]:r,o=u(t.constructor);switch(t.status_){case void 0:throw TypeError;case 0:t.onResolve_.push(n,o),t.onReject_.push(i,o);break;case 1:l(t.value_,[n,o]);break;case-1:l(t.value_,[i,o])}return o.promise}function u(t){if(this===d){var e=o(new d(v));return{promise:e,resolve:function(t){c(e,t)},reject:function(t){a(e,t)}}}var r={};return r.promise=new t(function(t,e){r.resolve=t,r.reject=e}),r}function i(t,e,r,n,u){return t.status_=e,t.value_=r,t.onResolve_=n,t.onReject_=u,t}function o(t){return i(t,0,void 0,[],[])}function c(t,e){s(t,1,e,t.onResolve_)}function a(t,e){s(t,-1,e,t.onReject_)}function s(t,e,r,n){0===t.status_&&(l(r,n),i(t,e,r))}function l(t,e){b(function(){for(var r=0;r=s)return t[u(o)]=void 0,r(void 0,!0);var l,f=e.charCodeAt(a);if(55296>f||f>56319||a+1===s)l=String.fromCharCode(f);else{var h=e.charCodeAt(a+1);l=56320>h||h>57343?String.fromCharCode(f):String.fromCharCode(f)+String.fromCharCode(h)}return t[u(c)]=a+l.length,r(l,!1)},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(e,Symbol.iterator,{value:function(){return this},configurable:!0,enumerable:!0,writable:!0}),e),{})}();return{get createStringIterator(){return t}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/String.js",[],function(){"use strict";function t(t){var e=String(this);if(null==this||"[object RegExp]"==p.call(t))throw TypeError();var r=e.length,n=String(t),u=(n.length,arguments.length>1?arguments[1]:void 0),i=u?Number(u):0;isNaN(i)&&(i=0);var o=Math.min(Math.max(i,0),r);return b.call(e,n,i)==o}function e(t){var e=String(this);if(null==this||"[object RegExp]"==p.call(t))throw TypeError();var r=e.length,n=String(t),u=n.length,i=r;if(arguments.length>1){var o=arguments[1];void 0!==o&&(i=o?Number(o):0,isNaN(i)&&(i=0))}var c=Math.min(Math.max(i,0),r),a=c-u;return 0>a?!1:y.call(e,n,a)==a}function r(t){if(null==this)throw TypeError();var e=String(this);if(t&&"[object RegExp]"==p.call(t))throw TypeError();var r=e.length,n=String(t),u=n.length,i=arguments.length>1?arguments[1]:void 0,o=i?Number(i):0;o!=o&&(o=0);var c=Math.min(Math.max(o,0),r);return u+c>r?!1:-1!=b.call(e,n,o)}function n(t){if(null==this)throw TypeError();var e=String(this),r=t?Number(t):0;if(isNaN(r)&&(r=0),0>r||r==1/0)throw RangeError();if(0==r)return"";for(var n="";r--;)n+=e;return n}function u(t){if(null==this)throw TypeError();var e=String(this),r=e.length,n=t?Number(t):0;if(isNaN(n)&&(n=0),0>n||n>=r)return void 0;var u,i=e.charCodeAt(n);return i>=55296&&56319>=i&&r>n+1&&(u=e.charCodeAt(n+1),u>=56320&&57343>=u)?1024*(i-55296)+u-56320+65536:i}function i(t){var e=t.raw,r=e.length>>>0;if(0===r)return"";for(var n="",u=0;;){if(n+=e[u],u+1===r)return n;n+=arguments[++u]}}function o(t){var e,r,n=[],u=Math.floor,i=-1,o=arguments.length;if(!o)return"";for(;++ic||c>1114111||u(c)!=c)throw RangeError("Invalid code point: "+c);65535>=c?n.push(c):(c-=65536,e=(c>>10)+55296,r=c%1024+56320,n.push(e,r))}return String.fromCharCode.apply(null,n)}function c(){var t=$traceurRuntime.checkObjectCoercible(this),e=String(t);return s(e)}function a(a){var s=a.String;f(s.prototype,["codePointAt",u,"endsWith",e,"includes",r,"repeat",n,"startsWith",t]),f(s,["fromCodePoint",o,"raw",i]),h(s.prototype,c,Symbol)}var s=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/StringIterator.js").createStringIterator,l=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),f=l.maybeAddFunctions,h=l.maybeAddIterator,m=l.registerPolyfill,p=Object.prototype.toString,b=String.prototype.indexOf,y=String.prototype.lastIndexOf;return m(a),{get startsWith(){return t},get endsWith(){return e},get includes(){return r},get repeat(){return n},get codePointAt(){return u},get raw(){return i},get fromCodePoint(){return o},get stringPrototypeIterator(){return c},get polyfillString(){return a}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/String.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/ArrayIterator.js",[],function(){"use strict";function t(t,e){var r=i(t),n=new f;return n.iteratorObject_=r,n.arrayIteratorNextIndex_=0,n.arrayIterationKind_=e,n}function e(){return t(this,l)}function r(){return t(this,a)}function n(){return t(this,s)}var u=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),i=u.toObject,o=u.toUint32,c=u.createIteratorResultObject,a=1,s=2,l=3,f=function(){function t(){}var e;return $traceurRuntime.createClass(t,(e={},Object.defineProperty(e,"next",{value:function(){var t=i(this),e=t.iteratorObject_;if(!e)throw new TypeError("Object is not an ArrayIterator");var r=t.arrayIteratorNextIndex_,n=t.arrayIterationKind_,u=o(e.length);return r>=u?(t.arrayIteratorNextIndex_=1/0,c(void 0,!0)):(t.arrayIteratorNextIndex_=r+1,n==s?c(e[r],!1):n==l?c([r,e[r]],!1):c(r,!1))},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(e,Symbol.iterator,{value:function(){return this},configurable:!0,enumerable:!0,writable:!0}),e),{})}();return{get entries(){return e},get keys(){return r},get values(){return n}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Array.js",[],function(){"use strict";function t(t){var e,r,n=arguments[1],u=arguments[2],i=this,o=j(t),c=void 0!==n,a=0;if(c&&!m(n))throw TypeError();if(h(o)){e=p(i)?new i:[];var s=!0,l=!1,f=void 0;try{for(var b=void 0,y=o[$traceurRuntime.toProperty(Symbol.iterator)]();!(s=(b=y.next()).done);s=!0){var v=b.value;c?e[a]=n.call(u,v,a):e[a]=v,a++}}catch(g){l=!0,f=g}finally{try{s||null==y["return"]||y["return"]()}finally{if(l)throw f}}return e.length=a,e}for(r=d(o.length),e=p(i)?new i(r):new Array(r);r>a;a++)c?e[a]="undefined"==typeof u?n(o[a],a):n.call(u,o[a],a):e[a]=o[a];return e.length=r,e}function e(){for(var t=[],e=0;ei;i++)u[i]=t[i];return u.length=n,u}function r(t){var e=void 0!==arguments[1]?arguments[1]:0,r=arguments[2],n=j(this),u=d(n.length),i=g(e),o=void 0!==r?g(r):u;for(i=0>i?Math.max(u+i,0):Math.min(i,u),o=0>o?Math.max(u+o,0):Math.min(o,u);o>i;)n[i]=t,i++;return n}function n(t){var e=arguments[1];return i(this,t,e)}function u(t){var e=arguments[1];return i(this,t,e,!0)}function i(t,e){var r=arguments[2],n=void 0!==arguments[3]?arguments[3]:!1,u=j(t),i=d(u.length);if(!m(e))throw TypeError();for(var o=0;i>o;o++){var c=u[o];if(e.call(r,c,o,u))return n?o:c}return n?-1:void 0}function o(i){var o=i,c=o.Array,f=o.Object,h=o.Symbol,m=l;h&&h.iterator&&c.prototype[h.iterator]&&(m=c.prototype[h.iterator]),b(c.prototype,["entries",a,"keys",s,"values",m,"fill",r,"find",n,"findIndex",u]),b(c,["from",t,"of",e]),y(c.prototype,m,h),y(f.getPrototypeOf([].values()),function(){return this},h)}var c=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/ArrayIterator.js"),a=c.entries,s=c.keys,l=c.values,f=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),h=f.checkIterable,m=f.isCallable,p=f.isConstructor,b=f.maybeAddFunctions,y=f.maybeAddIterator,v=f.registerPolyfill,g=f.toInteger,d=f.toLength,j=f.toObject;return v(o),{get from(){return t},get of(){return e},get fill(){return r},get find(){return n},get findIndex(){return u},get polyfillArray(){return o}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Array.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Object.js",[],function(){"use strict";function t(t,e){return t===e?0!==t||1/t===1/e:t!==t&&e!==e}function e(t){for(var e=1;eu;u++){var o=n[u];f(o)||(t[o]=r[o])}}return t}function r(t,e){var r,n,u=l(e),i=u.length;for(r=0;i>r;r++){var o=u[r];f(o)||(n=s(e,u[r]),a(t,u[r],n))}return t}function n(n){var u=n.Object;i(u,["assign",e,"is",t,"mixin",r])}var u=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),i=u.maybeAddFunctions,o=u.registerPolyfill,c=$traceurRuntime,a=c.defineProperty,s=c.getOwnPropertyDescriptor,l=c.getOwnPropertyNames,f=c.isPrivateName,h=c.keys;return o(n),{get is(){return t},get assign(){return e},get mixin(){return r},get polyfillObject(){return n}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Object.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Number.js",[],function(){"use strict";function t(t){return o(t)&&h(t)}function e(e){return t(e)&&l(e)===e}function r(t){return o(t)&&m(t)}function n(e){if(t(e)){var r=l(e);if(r===e)return f(r)<=p}return!1}function u(u){var i=u.Number;c(i,["MAX_SAFE_INTEGER",p,"MIN_SAFE_INTEGER",b,"EPSILON",y]),a(i,["isFinite",t,"isInteger",e,"isNaN",r,"isSafeInteger",n])}var i=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),o=i.isNumber,c=i.maybeAddConsts,a=i.maybeAddFunctions,s=i.registerPolyfill,l=i.toInteger,f=Math.abs,h=isFinite,m=isNaN,p=Math.pow(2,53)-1,b=-Math.pow(2,53)+1,y=Math.pow(2,-52);return s(u),{get MAX_SAFE_INTEGER(){return p},get MIN_SAFE_INTEGER(){return b},get EPSILON(){return y},get isFinite(){return t},get isInteger(){return e},get isNaN(){return r},get isSafeInteger(){return n},get polyfillNumber(){return u}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Number.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/fround.js",[],function(){"use strict";function t(t,e,r){function n(t){var e=l(t),r=t-e;return.5>r?e:r>.5?e+1:e%2?e+1:e}var u,i,o,c,p,b,y,v=(1<t?1:0):0===t?(i=0,o=0,u=1/t===-(1/0)?1:0):(u=0>t,t=s(t),t>=m(2,1-v)?(i=h(l(f(t)/a),1023),o=n(t/m(2,i)*m(2,r)),o/m(2,r)>=2&&(i+=1,o=1),i>v?(i=(1<>=1;return f.reverse(),o=f.join(""),c=(1<0?a*m(2,s-c)*(1+l/m(2,r)):0!==l?a*m(2,-(c-1))*(l/m(2,r)):0>a?-0:0}function r(t){return e(t,8,23)}function n(e){return t(e,8,23)}function u(t){return 0===t||!i(t)||o(t)?t:r(n(Number(t)))}var i=isFinite,o=isNaN,c=Math,a=c.LN2,s=c.abs,l=c.floor,f=c.log,h=c.min,m=c.pow;return{get fround(){return u}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Math.js",[],function(){"use strict";function t(t){if(t=S(+t),0==t)return 32;var e=0;return 0===(4294901760&t)&&(t<<=16,e+=16),0===(4278190080&t)&&(t<<=8,e+=8),0===(4026531840&t)&&(t<<=4,e+=4),0===(3221225472&t)&&(t<<=2,e+=2),0===(2147483648&t)&&(t<<=1,e+=1),e}function e(t,e){t=S(+t),e=S(+e);var r=t>>>16&65535,n=65535&t,u=e>>>16&65535,i=65535&e;return n*i+(r*i+n*u<<16>>>0)|0}function r(t){return t=+t,t>0?1:0>t?-1:t}function n(t){return.4342944819032518*I(t)}function u(t){return 1.4426950408889634*I(t)}function i(t){if(t=+t,-1>t||_(t))return NaN;if(0===t||t===1/0)return t;if(-1===t)return-(1/0);var e=0,r=50;if(0>t||t>1)return I(1+t);for(var n=1;r>n;n++)n%2===0?e-=N(t,n)/n:e+=N(t,n)/n;return e}function o(t){return t=+t,t===-(1/0)?-1:R(t)&&0!==t?x(t)-1:t}function c(t){return t=+t,0===t?1:_(t)?NaN:R(t)?(0>t&&(t=-t),t>21?x(t)/2:(x(t)+x(-t))/2):1/0}function a(t){return t=+t,R(t)&&0!==t?(x(t)-x(-t))/2:t}function s(t){if(t=+t,0===t)return t;if(!R(t))return r(t);var e=x(t),n=x(-t);return(e-n)/(e+n)}function l(t){return t=+t,1>t?NaN:R(t)?I(t+k(t+1)*k(t-1)):t}function f(t){return t=+t,0!==t&&R(t)?t>0?I(t+k(t*t+1)):-I(-t+k(t*t+1)):t}function h(t){return t=+t,-1===t?-(1/0):1===t?1/0:0===t?t:_(t)||-1>t||t>1?NaN:.5*I((1+t)/(1-t))}function m(t,e){for(var r=arguments.length,n=new Array(r),u=0,i=0;r>i;i++){var o=arguments[i];if(o=+o,o===1/0||o===-(1/0))return 1/0;o=P(o),o>u&&(u=o),n[i]=o}0===u&&(u=1);for(var c=0,a=0,i=0;r>i;i++){var o=n[i]/u,s=o*o-a,l=c+s;a=l-c-s,c=l}return k(c)*u}function p(t){return t=+t,t>0?M(t):0>t?E(t):t}function b(t){if(t=+t,0===t)return t;var e=0>t;e&&(t=-t);var r=N(t,1/3);return e?-r:r}function y(y){var g=y.Math;w(g,["acosh",l,"asinh",f,"atanh",h,"cbrt",b,"clz32",t,"cosh",c,"expm1",o,"fround",v,"hypot",m,"imul",e,"log10",n,"log1p",i,"log2",u,"sign",r,"sinh",a,"tanh",s,"trunc",p])}var v,g,d=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/fround.js").fround,j=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),w=j.maybeAddFunctions,O=j.registerPolyfill,S=j.toUint32,R=isFinite,_=isNaN,$=Math,P=$.abs,E=$.ceil,x=$.exp,M=$.floor,I=$.log,N=$.pow,k=$.sqrt;return"function"==typeof Float32Array?(g=new Float32Array(1),v=function(t){return g[0]=Number(t),g[0]}):v=d,O(y),{get clz32(){return t},get imul(){return e},get sign(){return r},get log10(){return n},get log2(){return u},get log1p(){return i},get expm1(){return o},get cosh(){return c},get sinh(){return a},get tanh(){return s},get acosh(){return l},get asinh(){return f},get atanh(){return h},get hypot(){return m},get trunc(){return p},get fround(){return v},get cbrt(){return b},get polyfillMath(){return y}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Math.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/polyfills.js",[],function(){"use strict";var t=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js").polyfillAll;t(Reflect.global);var e=$traceurRuntime.setupGlobals;return $traceurRuntime.setupGlobals=function(r){e(r),t(r)},{}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/polyfills.js"),this.System=this._System,delete this._System; +/*can-connect-feathers@0.6.8#can-connect-feathers*/ +define([ + 'steal-socket.io', + 'jquery', + 'cookie-storage', + 'jwt-decode', + './utils', + './utils', + 'feathers-errors' +], function ($__0, $__2, $__4, $__6, $__8, $__10, $__12) { + 'use strict'; + if (!$__0 || !$__0.__esModule) + $__0 = { default: $__0 }; + if (!$__2 || !$__2.__esModule) + $__2 = { default: $__2 }; + if (!$__4 || !$__4.__esModule) + $__4 = { default: $__4 }; + if (!$__6 || !$__6.__esModule) + $__6 = { default: $__6 }; + if (!$__8 || !$__8.__esModule) + $__8 = { default: $__8 }; + if (!$__10 || !$__10.__esModule) + $__10 = { default: $__10 }; + if (!$__12 || !$__12.__esModule) + $__12 = { default: $__12 }; + var io = $__0.default; + var $ = $__2.default; + var CookieStorage = $__4.CookieStorage; + var decode = $__6.default; + var stripSlashes = $__8.stripSlashes; + var addAliases = $__10.addAliases; + var errors = $__12.default; + var cookieStorage = new CookieStorage(); + var Feathers = function () { + function Feathers(config) { + var defaults = { + url: '', + storeToken: true, + storage: cookieStorage, + tokenLocation: 'feathers-jwt', + idProp: 'id', + tokenEndpoint: 'auth/token', + localEndpoint: 'auth/local', + ssr: true + }; + $.extend(this, defaults, config); + if (this.socketio !== false) { + this.io = io(this.url, this.socketio || {}); + } + } + return $traceurRuntime.createClass(Feathers, { + rest: function (location, idProp) { + var self = this; + idProp = idProp || this.idProp; + var service = { + getListData: function (params) { + return self.makeXhr(null, params, location); + }, + getData: function (params) { + var id = null; + if (typeof params === 'string' || typeof params === 'number') { + id = params; + params = {}; + } + return self.makeXhr(id, params, location); + }, + createData: function (data) { + return self.makeXhr(null, data, location, 'POST'); + }, + updateData: function (data) { + return self.makeXhr(data[idProp], data, location, 'PUT'); + }, + patchData: function (data) { + return self.makeXhr(data[idProp], data, location, 'PATCH'); + }, + destroyData: function (data) { + return self.makeXhr(data[idProp], data, location, 'DELETE'); + } + }; + service = addAliases(service); + return service; + }, + makeXhr: function (id, params, location) { + var type = arguments[3] !== void 0 ? arguments[3] : 'GET'; + location = stripSlashes(location); + var url = this.url + '/' + location + '/'; + if (id !== null && id !== undefined) { + url += '' + id; + } else if (params[this.idProp]) { + url += '' + params[this.idProp]; + delete params[this.idProp]; + } + var contentType = 'application/x-www-form-urlencoded'; + if (type !== 'GET') { + contentType = 'application/json'; + } + var ajaxConfig = { + url: url, + type: type, + contentType: contentType, + dataType: 'json' + }; + if (type !== 'DELETE') { + $.extend(ajaxConfig, { data: params }); + } + var token = this.getToken(); + if (token) { + $.extend(ajaxConfig, { headers: { 'Authorization': 'Bearer ' + token } }); + } + return new Promise(function (resolve, reject) { + $.ajax(ajaxConfig).then(resolve).fail(function (err) { + if (!err.responseText) { + return reject(err); + } + try { + reject(errors.convert(JSON.parse(err.responseText))); + } catch (e) { + reject(e); + } + }); + }); + }, + getToken: function () { + var token; + if (this.storage) { + token = this.storage.getItem(this.tokenLocation); + if (!token) { + token = cookieStorage.getItem(this.tokenLocation); + } + } + return token; + }, + getSession: function () { + var session, token; + if (window.localStorage) { + token = this.getToken(); + if (token) { + var tokenData = decode(token); + if (tokenData.exp * 1000 > new Date().getTime()) { + session = $.extend({}, tokenData); + delete session.exp; + delete session.iat; + delete session.iss; + } + } + } + return session; + }, + authenticate: function (params) { + var $__16 = this; + var data = { type: 'token' }; + $.extend(data, params); + var token = this.getToken(); + if (token && data.type === 'token') { + data.token = token; + } + if (token) { + var authenticateSocket = function (data) { + this.io.once('unauthorized', function (res) { + return console.log(res); + }); + this.io.emit('authenticate', data); + }; + if (this.io.connected) { + authenticateSocket.call(this, data); + } else { + this.io.once('connect', function () { + return authenticateSocket.call($__16, data); + }); + } + } + var location = data.type === 'token' ? this.tokenEndpoint : this.localEndpoint; + return this.makeXhr(null, data, location, 'POST').then(function (data) { + return $__16.persistToken(data); + }).then(function (data) { + return $__16.makeSSRCookie(data); + }); + }, + persistToken: function (data) { + if (this.storeToken && this.storage) { + this.storage.setItem(this.tokenLocation, data.token); + } + return data; + }, + makeSSRCookie: function (data) { + if (this.ssr) { + var tokenExp = decode(data.token).exp, options = { expires: new Date(tokenExp * 1000) }; + cookieStorage.setItem(this.tokenLocation, data.token, options); + } + return data; + }, + logout: function (data) { + var $__16 = this; + return new Promise(function (resolve) { + $__16.storage.removeItem($__16.tokenLocation); + cookieStorage.removeItem($__16.tokenLocation); + resolve(data); + }); + } + }, {}); + }(); + var $__default = Feathers; + return { + get default() { + return $__default; + }, + __esModule: true + }; +}); \ No newline at end of file diff --git a/dist/amd/utils.js b/dist/amd/utils.js new file mode 100644 index 0000000..f83b52f --- /dev/null +++ b/dist/amd/utils.js @@ -0,0 +1,25 @@ +/*can-connect-feathers@0.6.8#utils*/ +define([], function () { + 'use strict'; + function stripSlashes(location) { + return location.replace(/^(\/*)|(\/*)$/g, ''); + } + function addAliases(service) { + service.find = service.getListData; + service.get = service.getData; + service.create = service.createData; + service.update = service.updateData; + service.patch = service.patchData; + service.remove = service.destroyData; + return service; + } + return { + get stripSlashes() { + return stripSlashes; + }, + get addAliases() { + return addAliases; + }, + __esModule: true + }; +}); \ No newline at end of file diff --git a/dist/cjs/can-connect-feathers.js b/dist/cjs/can-connect-feathers.js new file mode 100644 index 0000000..ff8ec48 --- /dev/null +++ b/dist/cjs/can-connect-feathers.js @@ -0,0 +1,191 @@ +/*[traceur-runtime]*/ +this._System=this.System,function(t){"use strict";function e(t,e,r){for(var n=[e],u=0;u0;)u.unshift("..");0===u.length&&u.push(".")}return e+u.join("/")+r}function n(e){var n=e[a.PATH]||"";return n=r(n),e[a.PATH]=n,t(e[a.SCHEME],e[a.USER_INFO],e[a.DOMAIN],e[a.PORT],e[a.PATH],e[a.QUERY_DATA],e[a.FRAGMENT])}function u(t){var r=e(t);return n(r)}function i(t,r){var u=e(r),i=e(t);if(u[a.SCHEME])return n(u);u[a.SCHEME]=i[a.SCHEME];for(var o=a.SCHEME;o<=a.PORT;o++)u[o]||(u[o]=i[o]);if("/"==u[a.PATH][0])return n(u);var c=i[a.PATH],s=c.lastIndexOf("/");return c=c.slice(0,s+1)+u[a.PATH],u[a.PATH]=c,n(u)}function o(t){if(!t)return!1;if("/"===t[0])return!0;var r=e(t);return r[a.SCHEME]?!0:!1}var c=new RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$"),a={SCHEME:1,USER_INFO:2,DOMAIN:3,PORT:4,PATH:5,QUERY_DATA:6,FRAGMENT:7};$traceurRuntime.canonicalizeUrl=u,$traceurRuntime.isAbsolute=o,$traceurRuntime.removeDotSegments=r,$traceurRuntime.resolveUrl=i}(),function(t){"use strict";function e(t,e){this.url=t,this.value_=e}function r(t,e){this.message=this.constructor.name+": "+this.stripCause(e)+" in "+t,e instanceof r||!e.stack?this.stack="":this.stack=this.stripStack(e.stack)}function n(t,e){var r=[],n=e-3;0>n&&(n=0);for(var u=n;e>u;u++)r.push(t[u]);return r}function u(t,e){var r=e+1;r>t.length-1&&(r=t.length-1);for(var n=[],u=e;r>=u;u++)n.push(t[u]);return n}function i(t){for(var e="",r=0;t-1>r;r++)e+="-";return e}function o(t,r){e.call(this,t,null),this.func=r}function c(t){if(t){var e=v.normalize(t);return p[e]}}function a(t){var e=arguments[1],r=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(n){var u,i;if(e===y){var o=Object.getOwnPropertyDescriptor(t,n);o.get&&(u=o.get)}u||(i=t[n],u=function(){return i}),Object.defineProperty(r,n,{get:u,enumerable:!0})}),Object.preventExtensions(r),r}var s,l=$traceurRuntime,f=l.canonicalizeUrl,h=l.resolveUrl,m=l.isAbsolute,p=Object.create(null);s=t.location&&t.location.href?h(t.location.href,"./"):"",r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.stripError=function(t){return t.replace(/.*Error:/,this.constructor.name+":")},r.prototype.stripCause=function(t){return t?t.message?this.stripError(t.message):t+"":""},r.prototype.loadedBy=function(t){this.stack+="\n loaded by "+t},r.prototype.stripStack=function(t){var e=[];return t.split("\n").some(function(t){return/UncoatedModuleInstantiator/.test(t)?!0:void e.push(t)}),e[0]=this.stripError(e[0]),e.join("\n")},o.prototype=Object.create(e.prototype),o.prototype.getUncoatedModule=function(){var e=this;if(this.value_)return this.value_;try{var o;return void 0!==typeof $traceurRuntime&&$traceurRuntime.require&&(o=$traceurRuntime.require.bind(null,this.url)),this.value_=this.func.call(t,o)}catch(c){if(c instanceof r)throw c.loadedBy(this.url),c;if(c.stack){var a=this.func.toString().split("\n"),s=[];c.stack.split("\n").some(function(t,r){if(t.indexOf("UncoatedModuleInstantiator.getUncoatedModule")>0)return!0;var o=/(at\s[^\s]*\s).*>:(\d*):(\d*)\)/.exec(t);if(o){var c=parseInt(o[2],10);s=s.concat(n(a,c)),1===r?s.push(i(o[3])+"^ "+e.url):s.push(i(o[3])+"^"),s=s.concat(u(a,c)),s.push("= = = = = = = = =")}else s.push(t)}),c.stack=s.join("\n")}throw new r(this.url,c)}};var b=Object.create(null),y={},v={normalize:function(t,e,r){if("string"!=typeof t)throw new TypeError("module name must be a string, not "+typeof t);if(m(t))return f(t);if(/[^\.]\/\.\.\//.test(t))throw new Error("module name embeds /../: "+t);return"."===t[0]&&e?h(e,t):f(t)},get:function(t){var e=c(t);if(!e)return void 0;var r=b[e.url];return r?r:(r=a(e.getUncoatedModule(),y),b[e.url]=r)},set:function(t,e){t=String(t),p[t]=new o(t,function(){return e}),b[t]=e},get baseURL(){return s},set baseURL(t){s=String(t)},registerModule:function(t,e,r){var n=v.normalize(t);if(p[n])throw new Error("duplicate module named "+n);p[n]=new o(n,r)},bundleStore:Object.create(null),register:function(t,e,r){e&&(e.length||r.length)?this.bundleStore[t]={deps:e,execute:function(){var t=arguments,n={};e.forEach(function(e,r){return n[e]=t[r]});var u=r.call(this,n);return u.execute.call(this),u.exports}}:this.registerModule(t,e,r)},getAnonymousModule:function(e){return new a(e.call(t),y)}},g=new a({ModuleStore:v});v.set("@traceur/src/runtime/ModuleStore.js",g);var d=$traceurRuntime.setupGlobals;$traceurRuntime.setupGlobals=function(t){d(t)},$traceurRuntime.ModuleStore=v,t.System={register:v.register.bind(v),registerModule:v.registerModule.bind(v),get:v.get,set:v.set,normalize:v.normalize}}("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this),System.registerModule("traceur-runtime@0.0.91/src/runtime/async.js",[],function(){"use strict";function t(){}function e(){}function r(t){return t.prototype=s(e.prototype),t.__proto__=e,t}function n(t,e){for(var r=[],n=2;n3?("function"==typeof n&&(t.__proto__=n),t.prototype=f(a(n),i(e))):(o(e),t.prototype=e),m(t,"prototype",{configurable:!1,writable:!1}),h(t,i(r))}function a(t){if("function"==typeof t){var e=t.prototype;if(s(e)===e||null===e)return t.prototype;throw new l("super prototype must be an Object or null")}if(null===t)return null;throw new l("Super expression must either be null or a function, not "+typeof t+".")}var s=Object,l=TypeError,f=s.create,h=$traceurRuntime.defineProperties,m=$traceurRuntime.defineProperty,p=$traceurRuntime.getOwnPropertyDescriptor,b=($traceurRuntime.getOwnPropertyNames,Object.getPrototypeOf),y=Object,v=y.getOwnPropertyNames,g=y.getOwnPropertySymbols,d={enumerable:!1};return $traceurRuntime.createClass=c,$traceurRuntime.superConstructor=e,$traceurRuntime.superGet=r,$traceurRuntime.superSet=n,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/destructuring.js",[],function(){"use strict";function t(t){for(var e,r=[],n=0;!(e=t.next()).done;)r[n++]=e.value;return r}return $traceurRuntime.iteratorToArray=t,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/generators.js",[],function(){"use strict";function t(t){return{configurable:!0,enumerable:!1,value:t,writable:!0}}function e(t){return new Error("Traceur compiler bug: invalid state in state machine: "+t)}function r(){this.state=0,this.GState=v,this.storedException=void 0,this.finallyFallThrough=void 0,this.sent_=void 0,this.returnValue=void 0,this.oldReturnValue=void 0,this.tryStack_=[]}function n(t,e,r,n){switch(t.GState){case g:throw new Error('"'+r+'" on executing generator');case j:if("next"==r)return{value:void 0,done:!0};if(n===S)return{value:t.returnValue,done:!0};throw n;case v:if("throw"===r){if(t.GState=j,n===S)return{value:t.returnValue,done:!0};throw n}if(void 0!==n)throw y("Sent value to newborn generator");case d:t.GState=g,t.action=r,t.sent=n;var u;try{u=e(t)}catch(i){if(i!==S)throw i;u=t}var o=u===t;return o&&(u=t.returnValue),t.GState=o?j:d,{value:u,done:o}}}function u(){}function i(){}function o(t,e,n){var u=l(t,n),i=new r,o=b(e.prototype);return o[R]=i,o[_]=u,o}function c(t){return t.prototype=b(i.prototype),t.__proto__=i,t}function a(){r.call(this),this.err=void 0;var t=this;t.result=new Promise(function(e,r){t.resolve=e,t.reject=r})}function s(t,e){var r=l(t,e),n=new a;return n.createCallback=function(t){return function(e){n.state=t,n.value=e,r(n)}},n.errback=function(t){f(n,t),r(n)},r(n),n.result}function l(t,e){return function(r){for(;;)try{return t.call(e,r)}catch(n){f(r,n)}}}function f(t,e){t.storedException=e;var r=t.tryStack_[t.tryStack_.length-1];return r?(t.state=void 0!==r["catch"]?r["catch"]:r["finally"],void(void 0!==r.finallyFallThrough&&(t.finallyFallThrough=r.finallyFallThrough))):void t.handleException(e)}if("object"!=typeof $traceurRuntime)throw new Error("traceur runtime not found.");var h=$traceurRuntime.createPrivateName,m=$traceurRuntime.defineProperties,p=$traceurRuntime.defineProperty,b=Object.create,y=TypeError,v=0,g=1,d=2,j=3,w=-2,O=-3,S={};r.prototype={pushTry:function(t,e){if(null!==e){for(var r=null,n=this.tryStack_.length-1;n>=0;n--)if(void 0!==this.tryStack_[n]["catch"]){r=this.tryStack_[n]["catch"];break}null===r&&(r=O),this.tryStack_.push({"finally":e,finallyFallThrough:r})}null!==t&&this.tryStack_.push({"catch":t})},popTry:function(){this.tryStack_.pop()},maybeUncatchable:function(){if(this.storedException===S)throw S},get sent(){return this.maybeThrow(),this.sent_},set sent(t){this.sent_=t},get sentIgnoreThrow(){return this.sent_},maybeThrow:function(){if("throw"===this.action)throw this.action="next",this.sent_},end:function(){switch(this.state){case w:return this;case O:throw this.storedException;default:throw e(this.state)}},handleException:function(t){throw this.GState=j,this.state=w,t},wrapYieldStar:function(t){var e=this;return{next:function(e){return t.next(e)},"throw":function(r){var n;if(r===S){if(t["return"]){if(n=t["return"](e.returnValue),!n.done)return e.returnValue=e.oldReturnValue,n;e.returnValue=n.value}throw r}if(t["throw"])return t["throw"](r);throw t["return"]&&t["return"](),y("Inner iterator does not have a throw method")}}}};var R=h(),_=h();return u.prototype=i,p(i,"constructor",t(u)),i.prototype={constructor:i,next:function(t){return n(this[R],this[_],"next",t)},"throw":function(t){return n(this[R],this[_],"throw",t)},"return":function(t){return this[R].oldReturnValue=this[R].returnValue,this[R].returnValue=t,n(this[R],this[_],"throw",S)}},m(i.prototype,{constructor:{enumerable:!1},next:{enumerable:!1},"throw":{enumerable:!1},"return":{enumerable:!1}}),Object.defineProperty(i.prototype,Symbol.iterator,t(function(){return this})),a.prototype=b(r.prototype),a.prototype.end=function(){switch(this.state){case w:this.resolve(this.returnValue);break;case O:this.reject(this.storedException);break;default:this.reject(e(this.state))}},a.prototype.handleException=function(){this.state=O},$traceurRuntime.asyncWrap=s,$traceurRuntime.initGeneratorFunction=c,$traceurRuntime.createGeneratorInstance=o,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/relativeRequire.js",[],function(){"use strict";function t(t,r){function n(t){return"/"===t.slice(-1)}function u(t){return"/"===t[0]}function i(t){return"."===t[0]}return e=e||"undefined"!=typeof require&&require("path"),n(r)||u(r)?void 0:i(r)?require(e.resolve(e.dirname(t),r)):require(r)}var e;return $traceurRuntime.require=t,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/spread.js",[],function(){"use strict";function t(){for(var t,e=[],r=0,n=0;n>>0}function e(t){return t&&("object"==typeof t||"function"==typeof t)}function r(t){return"function"==typeof t}function n(t){return"number"==typeof t}function u(t){return t=+t,j(t)?0:0!==t&&d(t)?t>0?g(t):v(t):t}function i(t){var e=u(t);return 0>e?0:O(e,R)}function o(t){return e(t)?t[Symbol.iterator]:void 0}function c(t){return r(t)}function a(t,e){return{value:t,done:e}}function s(t,e,r){e in t||Object.defineProperty(t,e,r)}function l(t,e,r){s(t,e,{value:r,configurable:!0,enumerable:!1,writable:!0})}function f(t,e,r){s(t,e,{value:r,configurable:!1,enumerable:!1,writable:!1})}function h(t,e){for(var r=0;rt;t+=2){var e=v[t],r=v[t+1];e(r),v[t]=void 0,v[t+1]=void 0}l=0}function c(){try{var t=require,e=t("vertx");return a=e.runOnLoop||e.runOnContext,r()}catch(n){return i()}}var a,s,l=0,f=({}.toString,t),h="undefined"!=typeof window?window:void 0,m=h||{},p=m.MutationObserver||m.WebKitMutationObserver,b="undefined"!=typeof process&&"[object process]"==={}.toString.call(process),y="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,v=new Array(1e3);return s=b?e():p?n():y?u():void 0===h&&"function"==typeof require?c():i(),{get default(){return f}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Promise.js",[],function(){"use strict";function t(t){return t&&"object"==typeof t&&void 0!==t.status_}function e(t){return t}function r(t){throw t}function n(t){var n=void 0!==arguments[1]?arguments[1]:e,i=void 0!==arguments[2]?arguments[2]:r,o=u(t.constructor);switch(t.status_){case void 0:throw TypeError;case 0:t.onResolve_.push(n,o),t.onReject_.push(i,o);break;case 1:l(t.value_,[n,o]);break;case-1:l(t.value_,[i,o])}return o.promise}function u(t){if(this===d){var e=o(new d(v));return{promise:e,resolve:function(t){c(e,t)},reject:function(t){a(e,t)}}}var r={};return r.promise=new t(function(t,e){r.resolve=t,r.reject=e}),r}function i(t,e,r,n,u){return t.status_=e,t.value_=r,t.onResolve_=n,t.onReject_=u,t}function o(t){return i(t,0,void 0,[],[])}function c(t,e){s(t,1,e,t.onResolve_)}function a(t,e){s(t,-1,e,t.onReject_)}function s(t,e,r,n){0===t.status_&&(l(r,n),i(t,e,r))}function l(t,e){b(function(){for(var r=0;r=s)return t[u(o)]=void 0,r(void 0,!0);var l,f=e.charCodeAt(a);if(55296>f||f>56319||a+1===s)l=String.fromCharCode(f);else{var h=e.charCodeAt(a+1);l=56320>h||h>57343?String.fromCharCode(f):String.fromCharCode(f)+String.fromCharCode(h)}return t[u(c)]=a+l.length,r(l,!1)},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(e,Symbol.iterator,{value:function(){return this},configurable:!0,enumerable:!0,writable:!0}),e),{})}();return{get createStringIterator(){return t}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/String.js",[],function(){"use strict";function t(t){var e=String(this);if(null==this||"[object RegExp]"==p.call(t))throw TypeError();var r=e.length,n=String(t),u=(n.length,arguments.length>1?arguments[1]:void 0),i=u?Number(u):0;isNaN(i)&&(i=0);var o=Math.min(Math.max(i,0),r);return b.call(e,n,i)==o}function e(t){var e=String(this);if(null==this||"[object RegExp]"==p.call(t))throw TypeError();var r=e.length,n=String(t),u=n.length,i=r;if(arguments.length>1){var o=arguments[1];void 0!==o&&(i=o?Number(o):0,isNaN(i)&&(i=0))}var c=Math.min(Math.max(i,0),r),a=c-u;return 0>a?!1:y.call(e,n,a)==a}function r(t){if(null==this)throw TypeError();var e=String(this);if(t&&"[object RegExp]"==p.call(t))throw TypeError();var r=e.length,n=String(t),u=n.length,i=arguments.length>1?arguments[1]:void 0,o=i?Number(i):0;o!=o&&(o=0);var c=Math.min(Math.max(o,0),r);return u+c>r?!1:-1!=b.call(e,n,o)}function n(t){if(null==this)throw TypeError();var e=String(this),r=t?Number(t):0;if(isNaN(r)&&(r=0),0>r||r==1/0)throw RangeError();if(0==r)return"";for(var n="";r--;)n+=e;return n}function u(t){if(null==this)throw TypeError();var e=String(this),r=e.length,n=t?Number(t):0;if(isNaN(n)&&(n=0),0>n||n>=r)return void 0;var u,i=e.charCodeAt(n);return i>=55296&&56319>=i&&r>n+1&&(u=e.charCodeAt(n+1),u>=56320&&57343>=u)?1024*(i-55296)+u-56320+65536:i}function i(t){var e=t.raw,r=e.length>>>0;if(0===r)return"";for(var n="",u=0;;){if(n+=e[u],u+1===r)return n;n+=arguments[++u]}}function o(t){var e,r,n=[],u=Math.floor,i=-1,o=arguments.length;if(!o)return"";for(;++ic||c>1114111||u(c)!=c)throw RangeError("Invalid code point: "+c);65535>=c?n.push(c):(c-=65536,e=(c>>10)+55296,r=c%1024+56320,n.push(e,r))}return String.fromCharCode.apply(null,n)}function c(){var t=$traceurRuntime.checkObjectCoercible(this),e=String(t);return s(e)}function a(a){var s=a.String;f(s.prototype,["codePointAt",u,"endsWith",e,"includes",r,"repeat",n,"startsWith",t]),f(s,["fromCodePoint",o,"raw",i]),h(s.prototype,c,Symbol)}var s=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/StringIterator.js").createStringIterator,l=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),f=l.maybeAddFunctions,h=l.maybeAddIterator,m=l.registerPolyfill,p=Object.prototype.toString,b=String.prototype.indexOf,y=String.prototype.lastIndexOf;return m(a),{get startsWith(){return t},get endsWith(){return e},get includes(){return r},get repeat(){return n},get codePointAt(){return u},get raw(){return i},get fromCodePoint(){return o},get stringPrototypeIterator(){return c},get polyfillString(){return a}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/String.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/ArrayIterator.js",[],function(){"use strict";function t(t,e){var r=i(t),n=new f;return n.iteratorObject_=r,n.arrayIteratorNextIndex_=0,n.arrayIterationKind_=e,n}function e(){return t(this,l)}function r(){return t(this,a)}function n(){return t(this,s)}var u=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),i=u.toObject,o=u.toUint32,c=u.createIteratorResultObject,a=1,s=2,l=3,f=function(){function t(){}var e;return $traceurRuntime.createClass(t,(e={},Object.defineProperty(e,"next",{value:function(){var t=i(this),e=t.iteratorObject_;if(!e)throw new TypeError("Object is not an ArrayIterator");var r=t.arrayIteratorNextIndex_,n=t.arrayIterationKind_,u=o(e.length);return r>=u?(t.arrayIteratorNextIndex_=1/0,c(void 0,!0)):(t.arrayIteratorNextIndex_=r+1,n==s?c(e[r],!1):n==l?c([r,e[r]],!1):c(r,!1))},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(e,Symbol.iterator,{value:function(){return this},configurable:!0,enumerable:!0,writable:!0}),e),{})}();return{get entries(){return e},get keys(){return r},get values(){return n}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Array.js",[],function(){"use strict";function t(t){var e,r,n=arguments[1],u=arguments[2],i=this,o=j(t),c=void 0!==n,a=0;if(c&&!m(n))throw TypeError();if(h(o)){e=p(i)?new i:[];var s=!0,l=!1,f=void 0;try{for(var b=void 0,y=o[$traceurRuntime.toProperty(Symbol.iterator)]();!(s=(b=y.next()).done);s=!0){var v=b.value;c?e[a]=n.call(u,v,a):e[a]=v,a++}}catch(g){l=!0,f=g}finally{try{s||null==y["return"]||y["return"]()}finally{if(l)throw f}}return e.length=a,e}for(r=d(o.length),e=p(i)?new i(r):new Array(r);r>a;a++)c?e[a]="undefined"==typeof u?n(o[a],a):n.call(u,o[a],a):e[a]=o[a];return e.length=r,e}function e(){for(var t=[],e=0;ei;i++)u[i]=t[i];return u.length=n,u}function r(t){var e=void 0!==arguments[1]?arguments[1]:0,r=arguments[2],n=j(this),u=d(n.length),i=g(e),o=void 0!==r?g(r):u;for(i=0>i?Math.max(u+i,0):Math.min(i,u),o=0>o?Math.max(u+o,0):Math.min(o,u);o>i;)n[i]=t,i++;return n}function n(t){var e=arguments[1];return i(this,t,e)}function u(t){var e=arguments[1];return i(this,t,e,!0)}function i(t,e){var r=arguments[2],n=void 0!==arguments[3]?arguments[3]:!1,u=j(t),i=d(u.length);if(!m(e))throw TypeError();for(var o=0;i>o;o++){var c=u[o];if(e.call(r,c,o,u))return n?o:c}return n?-1:void 0}function o(i){var o=i,c=o.Array,f=o.Object,h=o.Symbol,m=l;h&&h.iterator&&c.prototype[h.iterator]&&(m=c.prototype[h.iterator]),b(c.prototype,["entries",a,"keys",s,"values",m,"fill",r,"find",n,"findIndex",u]),b(c,["from",t,"of",e]),y(c.prototype,m,h),y(f.getPrototypeOf([].values()),function(){return this},h)}var c=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/ArrayIterator.js"),a=c.entries,s=c.keys,l=c.values,f=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),h=f.checkIterable,m=f.isCallable,p=f.isConstructor,b=f.maybeAddFunctions,y=f.maybeAddIterator,v=f.registerPolyfill,g=f.toInteger,d=f.toLength,j=f.toObject;return v(o),{get from(){return t},get of(){return e},get fill(){return r},get find(){return n},get findIndex(){return u},get polyfillArray(){return o}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Array.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Object.js",[],function(){"use strict";function t(t,e){return t===e?0!==t||1/t===1/e:t!==t&&e!==e}function e(t){for(var e=1;eu;u++){var o=n[u];f(o)||(t[o]=r[o])}}return t}function r(t,e){var r,n,u=l(e),i=u.length;for(r=0;i>r;r++){var o=u[r];f(o)||(n=s(e,u[r]),a(t,u[r],n))}return t}function n(n){var u=n.Object;i(u,["assign",e,"is",t,"mixin",r])}var u=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),i=u.maybeAddFunctions,o=u.registerPolyfill,c=$traceurRuntime,a=c.defineProperty,s=c.getOwnPropertyDescriptor,l=c.getOwnPropertyNames,f=c.isPrivateName,h=c.keys;return o(n),{get is(){return t},get assign(){return e},get mixin(){return r},get polyfillObject(){return n}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Object.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Number.js",[],function(){"use strict";function t(t){return o(t)&&h(t)}function e(e){return t(e)&&l(e)===e}function r(t){return o(t)&&m(t)}function n(e){if(t(e)){var r=l(e);if(r===e)return f(r)<=p}return!1}function u(u){var i=u.Number;c(i,["MAX_SAFE_INTEGER",p,"MIN_SAFE_INTEGER",b,"EPSILON",y]),a(i,["isFinite",t,"isInteger",e,"isNaN",r,"isSafeInteger",n])}var i=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),o=i.isNumber,c=i.maybeAddConsts,a=i.maybeAddFunctions,s=i.registerPolyfill,l=i.toInteger,f=Math.abs,h=isFinite,m=isNaN,p=Math.pow(2,53)-1,b=-Math.pow(2,53)+1,y=Math.pow(2,-52);return s(u),{get MAX_SAFE_INTEGER(){return p},get MIN_SAFE_INTEGER(){return b},get EPSILON(){return y},get isFinite(){return t},get isInteger(){return e},get isNaN(){return r},get isSafeInteger(){return n},get polyfillNumber(){return u}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Number.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/fround.js",[],function(){"use strict";function t(t,e,r){function n(t){var e=l(t),r=t-e;return.5>r?e:r>.5?e+1:e%2?e+1:e}var u,i,o,c,p,b,y,v=(1<t?1:0):0===t?(i=0,o=0,u=1/t===-(1/0)?1:0):(u=0>t,t=s(t),t>=m(2,1-v)?(i=h(l(f(t)/a),1023),o=n(t/m(2,i)*m(2,r)),o/m(2,r)>=2&&(i+=1,o=1),i>v?(i=(1<>=1;return f.reverse(),o=f.join(""),c=(1<0?a*m(2,s-c)*(1+l/m(2,r)):0!==l?a*m(2,-(c-1))*(l/m(2,r)):0>a?-0:0}function r(t){return e(t,8,23)}function n(e){return t(e,8,23)}function u(t){return 0===t||!i(t)||o(t)?t:r(n(Number(t)))}var i=isFinite,o=isNaN,c=Math,a=c.LN2,s=c.abs,l=c.floor,f=c.log,h=c.min,m=c.pow;return{get fround(){return u}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Math.js",[],function(){"use strict";function t(t){if(t=S(+t),0==t)return 32;var e=0;return 0===(4294901760&t)&&(t<<=16,e+=16),0===(4278190080&t)&&(t<<=8,e+=8),0===(4026531840&t)&&(t<<=4,e+=4),0===(3221225472&t)&&(t<<=2,e+=2),0===(2147483648&t)&&(t<<=1,e+=1),e}function e(t,e){t=S(+t),e=S(+e);var r=t>>>16&65535,n=65535&t,u=e>>>16&65535,i=65535&e;return n*i+(r*i+n*u<<16>>>0)|0}function r(t){return t=+t,t>0?1:0>t?-1:t}function n(t){return.4342944819032518*I(t)}function u(t){return 1.4426950408889634*I(t)}function i(t){if(t=+t,-1>t||_(t))return NaN;if(0===t||t===1/0)return t;if(-1===t)return-(1/0);var e=0,r=50;if(0>t||t>1)return I(1+t);for(var n=1;r>n;n++)n%2===0?e-=N(t,n)/n:e+=N(t,n)/n;return e}function o(t){return t=+t,t===-(1/0)?-1:R(t)&&0!==t?x(t)-1:t}function c(t){return t=+t,0===t?1:_(t)?NaN:R(t)?(0>t&&(t=-t),t>21?x(t)/2:(x(t)+x(-t))/2):1/0}function a(t){return t=+t,R(t)&&0!==t?(x(t)-x(-t))/2:t}function s(t){if(t=+t,0===t)return t;if(!R(t))return r(t);var e=x(t),n=x(-t);return(e-n)/(e+n)}function l(t){return t=+t,1>t?NaN:R(t)?I(t+k(t+1)*k(t-1)):t}function f(t){return t=+t,0!==t&&R(t)?t>0?I(t+k(t*t+1)):-I(-t+k(t*t+1)):t}function h(t){return t=+t,-1===t?-(1/0):1===t?1/0:0===t?t:_(t)||-1>t||t>1?NaN:.5*I((1+t)/(1-t))}function m(t,e){for(var r=arguments.length,n=new Array(r),u=0,i=0;r>i;i++){var o=arguments[i];if(o=+o,o===1/0||o===-(1/0))return 1/0;o=P(o),o>u&&(u=o),n[i]=o}0===u&&(u=1);for(var c=0,a=0,i=0;r>i;i++){var o=n[i]/u,s=o*o-a,l=c+s;a=l-c-s,c=l}return k(c)*u}function p(t){return t=+t,t>0?M(t):0>t?E(t):t}function b(t){if(t=+t,0===t)return t;var e=0>t;e&&(t=-t);var r=N(t,1/3);return e?-r:r}function y(y){var g=y.Math;w(g,["acosh",l,"asinh",f,"atanh",h,"cbrt",b,"clz32",t,"cosh",c,"expm1",o,"fround",v,"hypot",m,"imul",e,"log10",n,"log1p",i,"log2",u,"sign",r,"sinh",a,"tanh",s,"trunc",p])}var v,g,d=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/fround.js").fround,j=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),w=j.maybeAddFunctions,O=j.registerPolyfill,S=j.toUint32,R=isFinite,_=isNaN,$=Math,P=$.abs,E=$.ceil,x=$.exp,M=$.floor,I=$.log,N=$.pow,k=$.sqrt;return"function"==typeof Float32Array?(g=new Float32Array(1),v=function(t){return g[0]=Number(t),g[0]}):v=d,O(y),{get clz32(){return t},get imul(){return e},get sign(){return r},get log10(){return n},get log2(){return u},get log1p(){return i},get expm1(){return o},get cosh(){return c},get sinh(){return a},get tanh(){return s},get acosh(){return l},get asinh(){return f},get atanh(){return h},get hypot(){return m},get trunc(){return p},get fround(){return v},get cbrt(){return b},get polyfillMath(){return y}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Math.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/polyfills.js",[],function(){"use strict";var t=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js").polyfillAll;t(Reflect.global);var e=$traceurRuntime.setupGlobals;return $traceurRuntime.setupGlobals=function(r){e(r),t(r)},{}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/polyfills.js"),this.System=this._System,delete this._System; +/*can-connect-feathers@0.6.8#can-connect-feathers*/ +'use strict'; +var $__steal_45_socket_46_io__, $__jquery__, $__cookie_45_storage__, $__jwt_45_decode__, $__utils__, $__utils__, $__feathers_45_errors__; +var io = ($__steal_45_socket_46_io__ = require('steal-socket.io'), $__steal_45_socket_46_io__ && $__steal_45_socket_46_io__.__esModule && $__steal_45_socket_46_io__ || { default: $__steal_45_socket_46_io__ }).default; +var $ = ($__jquery__ = require('jquery'), $__jquery__ && $__jquery__.__esModule && $__jquery__ || { default: $__jquery__ }).default; +var CookieStorage = ($__cookie_45_storage__ = require('cookie-storage'), $__cookie_45_storage__ && $__cookie_45_storage__.__esModule && $__cookie_45_storage__ || { default: $__cookie_45_storage__ }).CookieStorage; +var decode = ($__jwt_45_decode__ = require('jwt-decode'), $__jwt_45_decode__ && $__jwt_45_decode__.__esModule && $__jwt_45_decode__ || { default: $__jwt_45_decode__ }).default; +var stripSlashes = ($__utils__ = require('./utils.js'), $__utils__ && $__utils__.__esModule && $__utils__ || { default: $__utils__ }).stripSlashes; +var addAliases = ($__utils__ = require('./utils.js'), $__utils__ && $__utils__.__esModule && $__utils__ || { default: $__utils__ }).addAliases; +var errors = ($__feathers_45_errors__ = require('feathers-errors'), $__feathers_45_errors__ && $__feathers_45_errors__.__esModule && $__feathers_45_errors__ || { default: $__feathers_45_errors__ }).default; +var cookieStorage = new CookieStorage(); +var Feathers = function () { + function Feathers(config) { + var defaults = { + url: '', + storeToken: true, + storage: cookieStorage, + tokenLocation: 'feathers-jwt', + idProp: 'id', + tokenEndpoint: 'auth/token', + localEndpoint: 'auth/local', + ssr: true + }; + $.extend(this, defaults, config); + if (this.socketio !== false) { + this.io = io(this.url, this.socketio || {}); + } + } + return $traceurRuntime.createClass(Feathers, { + rest: function (location, idProp) { + var self = this; + idProp = idProp || this.idProp; + var service = { + getListData: function (params) { + return self.makeXhr(null, params, location); + }, + getData: function (params) { + var id = null; + if (typeof params === 'string' || typeof params === 'number') { + id = params; + params = {}; + } + return self.makeXhr(id, params, location); + }, + createData: function (data) { + return self.makeXhr(null, data, location, 'POST'); + }, + updateData: function (data) { + return self.makeXhr(data[idProp], data, location, 'PUT'); + }, + patchData: function (data) { + return self.makeXhr(data[idProp], data, location, 'PATCH'); + }, + destroyData: function (data) { + return self.makeXhr(data[idProp], data, location, 'DELETE'); + } + }; + service = addAliases(service); + return service; + }, + makeXhr: function (id, params, location) { + var type = arguments[3] !== void 0 ? arguments[3] : 'GET'; + location = stripSlashes(location); + var url = this.url + '/' + location + '/'; + if (id !== null && id !== undefined) { + url += '' + id; + } else if (params[this.idProp]) { + url += '' + params[this.idProp]; + delete params[this.idProp]; + } + var contentType = 'application/x-www-form-urlencoded'; + if (type !== 'GET') { + contentType = 'application/json'; + } + var ajaxConfig = { + url: url, + type: type, + contentType: contentType, + dataType: 'json' + }; + if (type !== 'DELETE') { + $.extend(ajaxConfig, { data: params }); + } + var token = this.getToken(); + if (token) { + $.extend(ajaxConfig, { headers: { 'Authorization': 'Bearer ' + token } }); + } + return new Promise(function (resolve, reject) { + $.ajax(ajaxConfig).then(resolve).fail(function (err) { + if (!err.responseText) { + return reject(err); + } + try { + reject(errors.convert(JSON.parse(err.responseText))); + } catch (e) { + reject(e); + } + }); + }); + }, + getToken: function () { + var token; + if (this.storage) { + token = this.storage.getItem(this.tokenLocation); + if (!token) { + token = cookieStorage.getItem(this.tokenLocation); + } + } + return token; + }, + getSession: function () { + var session, token; + if (window.localStorage) { + token = this.getToken(); + if (token) { + var tokenData = decode(token); + if (tokenData.exp * 1000 > new Date().getTime()) { + session = $.extend({}, tokenData); + delete session.exp; + delete session.iat; + delete session.iss; + } + } + } + return session; + }, + authenticate: function (params) { + var $__9 = this; + var data = { type: 'token' }; + $.extend(data, params); + var token = this.getToken(); + if (token && data.type === 'token') { + data.token = token; + } + if (token) { + var authenticateSocket = function (data) { + this.io.once('unauthorized', function (res) { + return console.log(res); + }); + this.io.emit('authenticate', data); + }; + if (this.io.connected) { + authenticateSocket.call(this, data); + } else { + this.io.once('connect', function () { + return authenticateSocket.call($__9, data); + }); + } + } + var location = data.type === 'token' ? this.tokenEndpoint : this.localEndpoint; + return this.makeXhr(null, data, location, 'POST').then(function (data) { + return $__9.persistToken(data); + }).then(function (data) { + return $__9.makeSSRCookie(data); + }); + }, + persistToken: function (data) { + if (this.storeToken && this.storage) { + this.storage.setItem(this.tokenLocation, data.token); + } + return data; + }, + makeSSRCookie: function (data) { + if (this.ssr) { + var tokenExp = decode(data.token).exp, options = { expires: new Date(tokenExp * 1000) }; + cookieStorage.setItem(this.tokenLocation, data.token, options); + } + return data; + }, + logout: function (data) { + var $__9 = this; + return new Promise(function (resolve) { + $__9.storage.removeItem($__9.tokenLocation); + cookieStorage.removeItem($__9.tokenLocation); + resolve(data); + }); + } + }, {}); +}(); +var $__default = Feathers; +Object.defineProperties(module.exports, { + default: { + get: function () { + return $__default; + } + }, + __esModule: { value: true } +}); \ No newline at end of file diff --git a/dist/cjs/utils.js b/dist/cjs/utils.js new file mode 100644 index 0000000..9250a4f --- /dev/null +++ b/dist/cjs/utils.js @@ -0,0 +1,27 @@ +/*can-connect-feathers@0.6.8#utils*/ +'use strict'; +function stripSlashes(location) { + return location.replace(/^(\/*)|(\/*)$/g, ''); +} +function addAliases(service) { + service.find = service.getListData; + service.get = service.getData; + service.create = service.createData; + service.update = service.updateData; + service.patch = service.patchData; + service.remove = service.destroyData; + return service; +} +Object.defineProperties(module.exports, { + stripSlashes: { + get: function () { + return stripSlashes; + } + }, + addAliases: { + get: function () { + return addAliases; + } + }, + __esModule: { value: true } +}); \ No newline at end of file diff --git a/dist/global/can-connect-feathers.js b/dist/global/can-connect-feathers.js new file mode 100644 index 0000000..45b9564 --- /dev/null +++ b/dist/global/can-connect-feathers.js @@ -0,0 +1,319 @@ +/*[traceur-runtime]*/ +this._System=this.System,function(t){"use strict";function e(t,e,r){for(var n=[e],u=0;u0;)u.unshift("..");0===u.length&&u.push(".")}return e+u.join("/")+r}function n(e){var n=e[a.PATH]||"";return n=r(n),e[a.PATH]=n,t(e[a.SCHEME],e[a.USER_INFO],e[a.DOMAIN],e[a.PORT],e[a.PATH],e[a.QUERY_DATA],e[a.FRAGMENT])}function u(t){var r=e(t);return n(r)}function i(t,r){var u=e(r),i=e(t);if(u[a.SCHEME])return n(u);u[a.SCHEME]=i[a.SCHEME];for(var o=a.SCHEME;o<=a.PORT;o++)u[o]||(u[o]=i[o]);if("/"==u[a.PATH][0])return n(u);var c=i[a.PATH],s=c.lastIndexOf("/");return c=c.slice(0,s+1)+u[a.PATH],u[a.PATH]=c,n(u)}function o(t){if(!t)return!1;if("/"===t[0])return!0;var r=e(t);return r[a.SCHEME]?!0:!1}var c=new RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$"),a={SCHEME:1,USER_INFO:2,DOMAIN:3,PORT:4,PATH:5,QUERY_DATA:6,FRAGMENT:7};$traceurRuntime.canonicalizeUrl=u,$traceurRuntime.isAbsolute=o,$traceurRuntime.removeDotSegments=r,$traceurRuntime.resolveUrl=i}(),function(t){"use strict";function e(t,e){this.url=t,this.value_=e}function r(t,e){this.message=this.constructor.name+": "+this.stripCause(e)+" in "+t,e instanceof r||!e.stack?this.stack="":this.stack=this.stripStack(e.stack)}function n(t,e){var r=[],n=e-3;0>n&&(n=0);for(var u=n;e>u;u++)r.push(t[u]);return r}function u(t,e){var r=e+1;r>t.length-1&&(r=t.length-1);for(var n=[],u=e;r>=u;u++)n.push(t[u]);return n}function i(t){for(var e="",r=0;t-1>r;r++)e+="-";return e}function o(t,r){e.call(this,t,null),this.func=r}function c(t){if(t){var e=v.normalize(t);return p[e]}}function a(t){var e=arguments[1],r=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(n){var u,i;if(e===y){var o=Object.getOwnPropertyDescriptor(t,n);o.get&&(u=o.get)}u||(i=t[n],u=function(){return i}),Object.defineProperty(r,n,{get:u,enumerable:!0})}),Object.preventExtensions(r),r}var s,l=$traceurRuntime,f=l.canonicalizeUrl,h=l.resolveUrl,m=l.isAbsolute,p=Object.create(null);s=t.location&&t.location.href?h(t.location.href,"./"):"",r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.stripError=function(t){return t.replace(/.*Error:/,this.constructor.name+":")},r.prototype.stripCause=function(t){return t?t.message?this.stripError(t.message):t+"":""},r.prototype.loadedBy=function(t){this.stack+="\n loaded by "+t},r.prototype.stripStack=function(t){var e=[];return t.split("\n").some(function(t){return/UncoatedModuleInstantiator/.test(t)?!0:void e.push(t)}),e[0]=this.stripError(e[0]),e.join("\n")},o.prototype=Object.create(e.prototype),o.prototype.getUncoatedModule=function(){var e=this;if(this.value_)return this.value_;try{var o;return void 0!==typeof $traceurRuntime&&$traceurRuntime.require&&(o=$traceurRuntime.require.bind(null,this.url)),this.value_=this.func.call(t,o)}catch(c){if(c instanceof r)throw c.loadedBy(this.url),c;if(c.stack){var a=this.func.toString().split("\n"),s=[];c.stack.split("\n").some(function(t,r){if(t.indexOf("UncoatedModuleInstantiator.getUncoatedModule")>0)return!0;var o=/(at\s[^\s]*\s).*>:(\d*):(\d*)\)/.exec(t);if(o){var c=parseInt(o[2],10);s=s.concat(n(a,c)),1===r?s.push(i(o[3])+"^ "+e.url):s.push(i(o[3])+"^"),s=s.concat(u(a,c)),s.push("= = = = = = = = =")}else s.push(t)}),c.stack=s.join("\n")}throw new r(this.url,c)}};var b=Object.create(null),y={},v={normalize:function(t,e,r){if("string"!=typeof t)throw new TypeError("module name must be a string, not "+typeof t);if(m(t))return f(t);if(/[^\.]\/\.\.\//.test(t))throw new Error("module name embeds /../: "+t);return"."===t[0]&&e?h(e,t):f(t)},get:function(t){var e=c(t);if(!e)return void 0;var r=b[e.url];return r?r:(r=a(e.getUncoatedModule(),y),b[e.url]=r)},set:function(t,e){t=String(t),p[t]=new o(t,function(){return e}),b[t]=e},get baseURL(){return s},set baseURL(t){s=String(t)},registerModule:function(t,e,r){var n=v.normalize(t);if(p[n])throw new Error("duplicate module named "+n);p[n]=new o(n,r)},bundleStore:Object.create(null),register:function(t,e,r){e&&(e.length||r.length)?this.bundleStore[t]={deps:e,execute:function(){var t=arguments,n={};e.forEach(function(e,r){return n[e]=t[r]});var u=r.call(this,n);return u.execute.call(this),u.exports}}:this.registerModule(t,e,r)},getAnonymousModule:function(e){return new a(e.call(t),y)}},g=new a({ModuleStore:v});v.set("@traceur/src/runtime/ModuleStore.js",g);var d=$traceurRuntime.setupGlobals;$traceurRuntime.setupGlobals=function(t){d(t)},$traceurRuntime.ModuleStore=v,t.System={register:v.register.bind(v),registerModule:v.registerModule.bind(v),get:v.get,set:v.set,normalize:v.normalize}}("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this),System.registerModule("traceur-runtime@0.0.91/src/runtime/async.js",[],function(){"use strict";function t(){}function e(){}function r(t){return t.prototype=s(e.prototype),t.__proto__=e,t}function n(t,e){for(var r=[],n=2;n3?("function"==typeof n&&(t.__proto__=n),t.prototype=f(a(n),i(e))):(o(e),t.prototype=e),m(t,"prototype",{configurable:!1,writable:!1}),h(t,i(r))}function a(t){if("function"==typeof t){var e=t.prototype;if(s(e)===e||null===e)return t.prototype;throw new l("super prototype must be an Object or null")}if(null===t)return null;throw new l("Super expression must either be null or a function, not "+typeof t+".")}var s=Object,l=TypeError,f=s.create,h=$traceurRuntime.defineProperties,m=$traceurRuntime.defineProperty,p=$traceurRuntime.getOwnPropertyDescriptor,b=($traceurRuntime.getOwnPropertyNames,Object.getPrototypeOf),y=Object,v=y.getOwnPropertyNames,g=y.getOwnPropertySymbols,d={enumerable:!1};return $traceurRuntime.createClass=c,$traceurRuntime.superConstructor=e,$traceurRuntime.superGet=r,$traceurRuntime.superSet=n,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/destructuring.js",[],function(){"use strict";function t(t){for(var e,r=[],n=0;!(e=t.next()).done;)r[n++]=e.value;return r}return $traceurRuntime.iteratorToArray=t,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/generators.js",[],function(){"use strict";function t(t){return{configurable:!0,enumerable:!1,value:t,writable:!0}}function e(t){return new Error("Traceur compiler bug: invalid state in state machine: "+t)}function r(){this.state=0,this.GState=v,this.storedException=void 0,this.finallyFallThrough=void 0,this.sent_=void 0,this.returnValue=void 0,this.oldReturnValue=void 0,this.tryStack_=[]}function n(t,e,r,n){switch(t.GState){case g:throw new Error('"'+r+'" on executing generator');case j:if("next"==r)return{value:void 0,done:!0};if(n===S)return{value:t.returnValue,done:!0};throw n;case v:if("throw"===r){if(t.GState=j,n===S)return{value:t.returnValue,done:!0};throw n}if(void 0!==n)throw y("Sent value to newborn generator");case d:t.GState=g,t.action=r,t.sent=n;var u;try{u=e(t)}catch(i){if(i!==S)throw i;u=t}var o=u===t;return o&&(u=t.returnValue),t.GState=o?j:d,{value:u,done:o}}}function u(){}function i(){}function o(t,e,n){var u=l(t,n),i=new r,o=b(e.prototype);return o[R]=i,o[_]=u,o}function c(t){return t.prototype=b(i.prototype),t.__proto__=i,t}function a(){r.call(this),this.err=void 0;var t=this;t.result=new Promise(function(e,r){t.resolve=e,t.reject=r})}function s(t,e){var r=l(t,e),n=new a;return n.createCallback=function(t){return function(e){n.state=t,n.value=e,r(n)}},n.errback=function(t){f(n,t),r(n)},r(n),n.result}function l(t,e){return function(r){for(;;)try{return t.call(e,r)}catch(n){f(r,n)}}}function f(t,e){t.storedException=e;var r=t.tryStack_[t.tryStack_.length-1];return r?(t.state=void 0!==r["catch"]?r["catch"]:r["finally"],void(void 0!==r.finallyFallThrough&&(t.finallyFallThrough=r.finallyFallThrough))):void t.handleException(e)}if("object"!=typeof $traceurRuntime)throw new Error("traceur runtime not found.");var h=$traceurRuntime.createPrivateName,m=$traceurRuntime.defineProperties,p=$traceurRuntime.defineProperty,b=Object.create,y=TypeError,v=0,g=1,d=2,j=3,w=-2,O=-3,S={};r.prototype={pushTry:function(t,e){if(null!==e){for(var r=null,n=this.tryStack_.length-1;n>=0;n--)if(void 0!==this.tryStack_[n]["catch"]){r=this.tryStack_[n]["catch"];break}null===r&&(r=O),this.tryStack_.push({"finally":e,finallyFallThrough:r})}null!==t&&this.tryStack_.push({"catch":t})},popTry:function(){this.tryStack_.pop()},maybeUncatchable:function(){if(this.storedException===S)throw S},get sent(){return this.maybeThrow(),this.sent_},set sent(t){this.sent_=t},get sentIgnoreThrow(){return this.sent_},maybeThrow:function(){if("throw"===this.action)throw this.action="next",this.sent_},end:function(){switch(this.state){case w:return this;case O:throw this.storedException;default:throw e(this.state)}},handleException:function(t){throw this.GState=j,this.state=w,t},wrapYieldStar:function(t){var e=this;return{next:function(e){return t.next(e)},"throw":function(r){var n;if(r===S){if(t["return"]){if(n=t["return"](e.returnValue),!n.done)return e.returnValue=e.oldReturnValue,n;e.returnValue=n.value}throw r}if(t["throw"])return t["throw"](r);throw t["return"]&&t["return"](),y("Inner iterator does not have a throw method")}}}};var R=h(),_=h();return u.prototype=i,p(i,"constructor",t(u)),i.prototype={constructor:i,next:function(t){return n(this[R],this[_],"next",t)},"throw":function(t){return n(this[R],this[_],"throw",t)},"return":function(t){return this[R].oldReturnValue=this[R].returnValue,this[R].returnValue=t,n(this[R],this[_],"throw",S)}},m(i.prototype,{constructor:{enumerable:!1},next:{enumerable:!1},"throw":{enumerable:!1},"return":{enumerable:!1}}),Object.defineProperty(i.prototype,Symbol.iterator,t(function(){return this})),a.prototype=b(r.prototype),a.prototype.end=function(){switch(this.state){case w:this.resolve(this.returnValue);break;case O:this.reject(this.storedException);break;default:this.reject(e(this.state))}},a.prototype.handleException=function(){this.state=O},$traceurRuntime.asyncWrap=s,$traceurRuntime.initGeneratorFunction=c,$traceurRuntime.createGeneratorInstance=o,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/relativeRequire.js",[],function(){"use strict";function t(t,r){function n(t){return"/"===t.slice(-1)}function u(t){return"/"===t[0]}function i(t){return"."===t[0]}return e=e||"undefined"!=typeof require&&require("path"),n(r)||u(r)?void 0:i(r)?require(e.resolve(e.dirname(t),r)):require(r)}var e;return $traceurRuntime.require=t,{}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/spread.js",[],function(){"use strict";function t(){for(var t,e=[],r=0,n=0;n>>0}function e(t){return t&&("object"==typeof t||"function"==typeof t)}function r(t){return"function"==typeof t}function n(t){return"number"==typeof t}function u(t){return t=+t,j(t)?0:0!==t&&d(t)?t>0?g(t):v(t):t}function i(t){var e=u(t);return 0>e?0:O(e,R)}function o(t){return e(t)?t[Symbol.iterator]:void 0}function c(t){return r(t)}function a(t,e){return{value:t,done:e}}function s(t,e,r){e in t||Object.defineProperty(t,e,r)}function l(t,e,r){s(t,e,{value:r,configurable:!0,enumerable:!1,writable:!0})}function f(t,e,r){s(t,e,{value:r,configurable:!1,enumerable:!1,writable:!1})}function h(t,e){for(var r=0;rt;t+=2){var e=v[t],r=v[t+1];e(r),v[t]=void 0,v[t+1]=void 0}l=0}function c(){try{var t=require,e=t("vertx");return a=e.runOnLoop||e.runOnContext,r()}catch(n){return i()}}var a,s,l=0,f=({}.toString,t),h="undefined"!=typeof window?window:void 0,m=h||{},p=m.MutationObserver||m.WebKitMutationObserver,b="undefined"!=typeof process&&"[object process]"==={}.toString.call(process),y="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,v=new Array(1e3);return s=b?e():p?n():y?u():void 0===h&&"function"==typeof require?c():i(),{get default(){return f}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Promise.js",[],function(){"use strict";function t(t){return t&&"object"==typeof t&&void 0!==t.status_}function e(t){return t}function r(t){throw t}function n(t){var n=void 0!==arguments[1]?arguments[1]:e,i=void 0!==arguments[2]?arguments[2]:r,o=u(t.constructor);switch(t.status_){case void 0:throw TypeError;case 0:t.onResolve_.push(n,o),t.onReject_.push(i,o);break;case 1:l(t.value_,[n,o]);break;case-1:l(t.value_,[i,o])}return o.promise}function u(t){if(this===d){var e=o(new d(v));return{promise:e,resolve:function(t){c(e,t)},reject:function(t){a(e,t)}}}var r={};return r.promise=new t(function(t,e){r.resolve=t,r.reject=e}),r}function i(t,e,r,n,u){return t.status_=e,t.value_=r,t.onResolve_=n,t.onReject_=u,t}function o(t){return i(t,0,void 0,[],[])}function c(t,e){s(t,1,e,t.onResolve_)}function a(t,e){s(t,-1,e,t.onReject_)}function s(t,e,r,n){0===t.status_&&(l(r,n),i(t,e,r))}function l(t,e){b(function(){for(var r=0;r=s)return t[u(o)]=void 0,r(void 0,!0);var l,f=e.charCodeAt(a);if(55296>f||f>56319||a+1===s)l=String.fromCharCode(f);else{var h=e.charCodeAt(a+1);l=56320>h||h>57343?String.fromCharCode(f):String.fromCharCode(f)+String.fromCharCode(h)}return t[u(c)]=a+l.length,r(l,!1)},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(e,Symbol.iterator,{value:function(){return this},configurable:!0,enumerable:!0,writable:!0}),e),{})}();return{get createStringIterator(){return t}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/String.js",[],function(){"use strict";function t(t){var e=String(this);if(null==this||"[object RegExp]"==p.call(t))throw TypeError();var r=e.length,n=String(t),u=(n.length,arguments.length>1?arguments[1]:void 0),i=u?Number(u):0;isNaN(i)&&(i=0);var o=Math.min(Math.max(i,0),r);return b.call(e,n,i)==o}function e(t){var e=String(this);if(null==this||"[object RegExp]"==p.call(t))throw TypeError();var r=e.length,n=String(t),u=n.length,i=r;if(arguments.length>1){var o=arguments[1];void 0!==o&&(i=o?Number(o):0,isNaN(i)&&(i=0))}var c=Math.min(Math.max(i,0),r),a=c-u;return 0>a?!1:y.call(e,n,a)==a}function r(t){if(null==this)throw TypeError();var e=String(this);if(t&&"[object RegExp]"==p.call(t))throw TypeError();var r=e.length,n=String(t),u=n.length,i=arguments.length>1?arguments[1]:void 0,o=i?Number(i):0;o!=o&&(o=0);var c=Math.min(Math.max(o,0),r);return u+c>r?!1:-1!=b.call(e,n,o)}function n(t){if(null==this)throw TypeError();var e=String(this),r=t?Number(t):0;if(isNaN(r)&&(r=0),0>r||r==1/0)throw RangeError();if(0==r)return"";for(var n="";r--;)n+=e;return n}function u(t){if(null==this)throw TypeError();var e=String(this),r=e.length,n=t?Number(t):0;if(isNaN(n)&&(n=0),0>n||n>=r)return void 0;var u,i=e.charCodeAt(n);return i>=55296&&56319>=i&&r>n+1&&(u=e.charCodeAt(n+1),u>=56320&&57343>=u)?1024*(i-55296)+u-56320+65536:i}function i(t){var e=t.raw,r=e.length>>>0;if(0===r)return"";for(var n="",u=0;;){if(n+=e[u],u+1===r)return n;n+=arguments[++u]}}function o(t){var e,r,n=[],u=Math.floor,i=-1,o=arguments.length;if(!o)return"";for(;++ic||c>1114111||u(c)!=c)throw RangeError("Invalid code point: "+c);65535>=c?n.push(c):(c-=65536,e=(c>>10)+55296,r=c%1024+56320,n.push(e,r))}return String.fromCharCode.apply(null,n)}function c(){var t=$traceurRuntime.checkObjectCoercible(this),e=String(t);return s(e)}function a(a){var s=a.String;f(s.prototype,["codePointAt",u,"endsWith",e,"includes",r,"repeat",n,"startsWith",t]),f(s,["fromCodePoint",o,"raw",i]),h(s.prototype,c,Symbol)}var s=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/StringIterator.js").createStringIterator,l=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),f=l.maybeAddFunctions,h=l.maybeAddIterator,m=l.registerPolyfill,p=Object.prototype.toString,b=String.prototype.indexOf,y=String.prototype.lastIndexOf;return m(a),{get startsWith(){return t},get endsWith(){return e},get includes(){return r},get repeat(){return n},get codePointAt(){return u},get raw(){return i},get fromCodePoint(){return o},get stringPrototypeIterator(){return c},get polyfillString(){return a}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/String.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/ArrayIterator.js",[],function(){"use strict";function t(t,e){var r=i(t),n=new f;return n.iteratorObject_=r,n.arrayIteratorNextIndex_=0,n.arrayIterationKind_=e,n}function e(){return t(this,l)}function r(){return t(this,a)}function n(){return t(this,s)}var u=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),i=u.toObject,o=u.toUint32,c=u.createIteratorResultObject,a=1,s=2,l=3,f=function(){function t(){}var e;return $traceurRuntime.createClass(t,(e={},Object.defineProperty(e,"next",{value:function(){var t=i(this),e=t.iteratorObject_;if(!e)throw new TypeError("Object is not an ArrayIterator");var r=t.arrayIteratorNextIndex_,n=t.arrayIterationKind_,u=o(e.length);return r>=u?(t.arrayIteratorNextIndex_=1/0,c(void 0,!0)):(t.arrayIteratorNextIndex_=r+1,n==s?c(e[r],!1):n==l?c([r,e[r]],!1):c(r,!1))},configurable:!0,enumerable:!0,writable:!0}),Object.defineProperty(e,Symbol.iterator,{value:function(){return this},configurable:!0,enumerable:!0,writable:!0}),e),{})}();return{get entries(){return e},get keys(){return r},get values(){return n}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Array.js",[],function(){"use strict";function t(t){var e,r,n=arguments[1],u=arguments[2],i=this,o=j(t),c=void 0!==n,a=0;if(c&&!m(n))throw TypeError();if(h(o)){e=p(i)?new i:[];var s=!0,l=!1,f=void 0;try{for(var b=void 0,y=o[$traceurRuntime.toProperty(Symbol.iterator)]();!(s=(b=y.next()).done);s=!0){var v=b.value;c?e[a]=n.call(u,v,a):e[a]=v,a++}}catch(g){l=!0,f=g}finally{try{s||null==y["return"]||y["return"]()}finally{if(l)throw f}}return e.length=a,e}for(r=d(o.length),e=p(i)?new i(r):new Array(r);r>a;a++)c?e[a]="undefined"==typeof u?n(o[a],a):n.call(u,o[a],a):e[a]=o[a];return e.length=r,e}function e(){for(var t=[],e=0;ei;i++)u[i]=t[i];return u.length=n,u}function r(t){var e=void 0!==arguments[1]?arguments[1]:0,r=arguments[2],n=j(this),u=d(n.length),i=g(e),o=void 0!==r?g(r):u;for(i=0>i?Math.max(u+i,0):Math.min(i,u),o=0>o?Math.max(u+o,0):Math.min(o,u);o>i;)n[i]=t,i++;return n}function n(t){var e=arguments[1];return i(this,t,e)}function u(t){var e=arguments[1];return i(this,t,e,!0)}function i(t,e){var r=arguments[2],n=void 0!==arguments[3]?arguments[3]:!1,u=j(t),i=d(u.length);if(!m(e))throw TypeError();for(var o=0;i>o;o++){var c=u[o];if(e.call(r,c,o,u))return n?o:c}return n?-1:void 0}function o(i){var o=i,c=o.Array,f=o.Object,h=o.Symbol,m=l;h&&h.iterator&&c.prototype[h.iterator]&&(m=c.prototype[h.iterator]),b(c.prototype,["entries",a,"keys",s,"values",m,"fill",r,"find",n,"findIndex",u]),b(c,["from",t,"of",e]),y(c.prototype,m,h),y(f.getPrototypeOf([].values()),function(){return this},h)}var c=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/ArrayIterator.js"),a=c.entries,s=c.keys,l=c.values,f=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),h=f.checkIterable,m=f.isCallable,p=f.isConstructor,b=f.maybeAddFunctions,y=f.maybeAddIterator,v=f.registerPolyfill,g=f.toInteger,d=f.toLength,j=f.toObject;return v(o),{get from(){return t},get of(){return e},get fill(){return r},get find(){return n},get findIndex(){return u},get polyfillArray(){return o}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Array.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Object.js",[],function(){"use strict";function t(t,e){return t===e?0!==t||1/t===1/e:t!==t&&e!==e}function e(t){for(var e=1;eu;u++){var o=n[u];f(o)||(t[o]=r[o])}}return t}function r(t,e){var r,n,u=l(e),i=u.length;for(r=0;i>r;r++){var o=u[r];f(o)||(n=s(e,u[r]),a(t,u[r],n))}return t}function n(n){var u=n.Object;i(u,["assign",e,"is",t,"mixin",r])}var u=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),i=u.maybeAddFunctions,o=u.registerPolyfill,c=$traceurRuntime,a=c.defineProperty,s=c.getOwnPropertyDescriptor,l=c.getOwnPropertyNames,f=c.isPrivateName,h=c.keys;return o(n),{get is(){return t},get assign(){return e},get mixin(){return r},get polyfillObject(){return n}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Object.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Number.js",[],function(){"use strict";function t(t){return o(t)&&h(t)}function e(e){return t(e)&&l(e)===e}function r(t){return o(t)&&m(t)}function n(e){if(t(e)){var r=l(e);if(r===e)return f(r)<=p}return!1}function u(u){var i=u.Number;c(i,["MAX_SAFE_INTEGER",p,"MIN_SAFE_INTEGER",b,"EPSILON",y]),a(i,["isFinite",t,"isInteger",e,"isNaN",r,"isSafeInteger",n])}var i=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),o=i.isNumber,c=i.maybeAddConsts,a=i.maybeAddFunctions,s=i.registerPolyfill,l=i.toInteger,f=Math.abs,h=isFinite,m=isNaN,p=Math.pow(2,53)-1,b=-Math.pow(2,53)+1,y=Math.pow(2,-52);return s(u),{get MAX_SAFE_INTEGER(){return p},get MIN_SAFE_INTEGER(){return b},get EPSILON(){return y},get isFinite(){return t},get isInteger(){return e},get isNaN(){return r},get isSafeInteger(){return n},get polyfillNumber(){return u}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Number.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/fround.js",[],function(){"use strict";function t(t,e,r){function n(t){var e=l(t),r=t-e;return.5>r?e:r>.5?e+1:e%2?e+1:e}var u,i,o,c,p,b,y,v=(1<t?1:0):0===t?(i=0,o=0,u=1/t===-(1/0)?1:0):(u=0>t,t=s(t),t>=m(2,1-v)?(i=h(l(f(t)/a),1023),o=n(t/m(2,i)*m(2,r)),o/m(2,r)>=2&&(i+=1,o=1),i>v?(i=(1<>=1;return f.reverse(),o=f.join(""),c=(1<0?a*m(2,s-c)*(1+l/m(2,r)):0!==l?a*m(2,-(c-1))*(l/m(2,r)):0>a?-0:0}function r(t){return e(t,8,23)}function n(e){return t(e,8,23)}function u(t){return 0===t||!i(t)||o(t)?t:r(n(Number(t)))}var i=isFinite,o=isNaN,c=Math,a=c.LN2,s=c.abs,l=c.floor,f=c.log,h=c.min,m=c.pow;return{get fround(){return u}}}),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/Math.js",[],function(){"use strict";function t(t){if(t=S(+t),0==t)return 32;var e=0;return 0===(4294901760&t)&&(t<<=16,e+=16),0===(4278190080&t)&&(t<<=8,e+=8),0===(4026531840&t)&&(t<<=4,e+=4),0===(3221225472&t)&&(t<<=2,e+=2),0===(2147483648&t)&&(t<<=1,e+=1),e}function e(t,e){t=S(+t),e=S(+e);var r=t>>>16&65535,n=65535&t,u=e>>>16&65535,i=65535&e;return n*i+(r*i+n*u<<16>>>0)|0}function r(t){return t=+t,t>0?1:0>t?-1:t}function n(t){return.4342944819032518*I(t)}function u(t){return 1.4426950408889634*I(t)}function i(t){if(t=+t,-1>t||_(t))return NaN;if(0===t||t===1/0)return t;if(-1===t)return-(1/0);var e=0,r=50;if(0>t||t>1)return I(1+t);for(var n=1;r>n;n++)n%2===0?e-=N(t,n)/n:e+=N(t,n)/n;return e}function o(t){return t=+t,t===-(1/0)?-1:R(t)&&0!==t?x(t)-1:t}function c(t){return t=+t,0===t?1:_(t)?NaN:R(t)?(0>t&&(t=-t),t>21?x(t)/2:(x(t)+x(-t))/2):1/0}function a(t){return t=+t,R(t)&&0!==t?(x(t)-x(-t))/2:t}function s(t){if(t=+t,0===t)return t;if(!R(t))return r(t);var e=x(t),n=x(-t);return(e-n)/(e+n)}function l(t){return t=+t,1>t?NaN:R(t)?I(t+k(t+1)*k(t-1)):t}function f(t){return t=+t,0!==t&&R(t)?t>0?I(t+k(t*t+1)):-I(-t+k(t*t+1)):t}function h(t){return t=+t,-1===t?-(1/0):1===t?1/0:0===t?t:_(t)||-1>t||t>1?NaN:.5*I((1+t)/(1-t))}function m(t,e){for(var r=arguments.length,n=new Array(r),u=0,i=0;r>i;i++){var o=arguments[i];if(o=+o,o===1/0||o===-(1/0))return 1/0;o=P(o),o>u&&(u=o),n[i]=o}0===u&&(u=1);for(var c=0,a=0,i=0;r>i;i++){var o=n[i]/u,s=o*o-a,l=c+s;a=l-c-s,c=l}return k(c)*u}function p(t){return t=+t,t>0?M(t):0>t?E(t):t}function b(t){if(t=+t,0===t)return t;var e=0>t;e&&(t=-t);var r=N(t,1/3);return e?-r:r}function y(y){var g=y.Math;w(g,["acosh",l,"asinh",f,"atanh",h,"cbrt",b,"clz32",t,"cosh",c,"expm1",o,"fround",v,"hypot",m,"imul",e,"log10",n,"log1p",i,"log2",u,"sign",r,"sinh",a,"tanh",s,"trunc",p])}var v,g,d=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/fround.js").fround,j=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js"),w=j.maybeAddFunctions,O=j.registerPolyfill,S=j.toUint32,R=isFinite,_=isNaN,$=Math,P=$.abs,E=$.ceil,x=$.exp,M=$.floor,I=$.log,N=$.pow,k=$.sqrt;return"function"==typeof Float32Array?(g=new Float32Array(1),v=function(t){return g[0]=Number(t),g[0]}):v=d,O(y),{get clz32(){return t},get imul(){return e},get sign(){return r},get log10(){return n},get log2(){return u},get log1p(){return i},get expm1(){return o},get cosh(){return c},get sinh(){return a},get tanh(){return s},get acosh(){return l},get asinh(){return f},get atanh(){return h},get hypot(){return m},get trunc(){return p},get fround(){return v},get cbrt(){return b},get polyfillMath(){return y}}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/Math.js"),System.registerModule("traceur-runtime@0.0.91/src/runtime/polyfills/polyfills.js",[],function(){"use strict";var t=System.get("traceur-runtime@0.0.91/src/runtime/polyfills/utils.js").polyfillAll;t(Reflect.global);var e=$traceurRuntime.setupGlobals;return $traceurRuntime.setupGlobals=function(r){e(r),t(r)},{}}),System.get("traceur-runtime@0.0.91/src/runtime/polyfills/polyfills.js"),this.System=this._System,delete this._System; +/*[global-shim-start]*/ +(function(exports, global, doEval){ // jshint ignore:line + var origDefine = global.define; + + var get = function(name){ + var parts = name.split("."), + cur = global, + i; + for(i = 0 ; i < parts.length; i++){ + if(!cur) { + break; + } + cur = cur[parts[i]]; + } + return cur; + }; + var modules = (global.define && global.define.modules) || + (global._define && global._define.modules) || {}; + var ourDefine = global.define = function(moduleName, deps, callback){ + var module; + if(typeof deps === "function") { + callback = deps; + deps = []; + } + var args = [], + i; + for(i =0; i < deps.length; i++) { + args.push( exports[deps[i]] ? get(exports[deps[i]]) : ( modules[deps[i]] || get(deps[i]) ) ); + } + // CJS has no dependencies but 3 callback arguments + if(!deps.length && callback.length) { + module = { exports: {} }; + var require = function(name) { + return exports[name] ? get(exports[name]) : modules[name]; + }; + args.push(require, module.exports, module); + } + // Babel uses the exports and module object. + else if(!args[0] && deps[0] === "exports") { + module = { exports: {} }; + args[0] = module.exports; + if(deps[1] === "module") { + args[1] = module; + } + } else if(!args[0] && deps[0] === "module") { + args[0] = { id: moduleName }; + } + + global.define = origDefine; + var result = callback ? callback.apply(null, args) : undefined; + global.define = ourDefine; + + // Favor CJS module.exports over the return value + modules[moduleName] = module && module.exports ? module.exports : result; + }; + global.define.orig = origDefine; + global.define.modules = modules; + global.define.amd = true; + ourDefine("@loader", [], function(){ + // shim for @@global-helpers + var noop = function(){}; + return { + get: function(){ + return { prepareGlobal: noop, retrieveGlobal: noop }; + }, + global: global, + __exec: function(__load){ + doEval(__load.source, global); + } + }; + }); +} +)({},window,function(__$source__, __$global__) { // jshint ignore:line + eval("(function() { " + __$source__ + " \n }).call(__$global__);"); +} +) +/*can-connect-feathers@0.6.8#utils*/ +define('can-connect-feathers/utils', [], function () { + 'use strict'; + function stripSlashes(location) { + return location.replace(/^(\/*)|(\/*)$/g, ''); + } + function addAliases(service) { + service.find = service.getListData; + service.get = service.getData; + service.create = service.createData; + service.update = service.updateData; + service.patch = service.patchData; + service.remove = service.destroyData; + return service; + } + return { + get stripSlashes() { + return stripSlashes; + }, + get addAliases() { + return addAliases; + }, + __esModule: true + }; +}); +/*can-connect-feathers@0.6.8#can-connect-feathers*/ +define('can-connect-feathers', [ + 'steal-socket.io', + 'jquery', + 'cookie-storage', + 'jwt-decode', + 'can-connect-feathers/utils', + 'can-connect-feathers/utils', + 'feathers-errors' +], function ($__0, $__2, $__4, $__6, $__8, $__10, $__12) { + 'use strict'; + if (!$__0 || !$__0.__esModule) + $__0 = { default: $__0 }; + if (!$__2 || !$__2.__esModule) + $__2 = { default: $__2 }; + if (!$__4 || !$__4.__esModule) + $__4 = { default: $__4 }; + if (!$__6 || !$__6.__esModule) + $__6 = { default: $__6 }; + if (!$__8 || !$__8.__esModule) + $__8 = { default: $__8 }; + if (!$__10 || !$__10.__esModule) + $__10 = { default: $__10 }; + if (!$__12 || !$__12.__esModule) + $__12 = { default: $__12 }; + var io = $__0.default; + var $ = $__2.default; + var CookieStorage = $__4.CookieStorage; + var decode = $__6.default; + var stripSlashes = $__8.stripSlashes; + var addAliases = $__10.addAliases; + var errors = $__12.default; + var cookieStorage = new CookieStorage(); + var Feathers = function () { + function Feathers(config) { + var defaults = { + url: '', + storeToken: true, + storage: cookieStorage, + tokenLocation: 'feathers-jwt', + idProp: 'id', + tokenEndpoint: 'auth/token', + localEndpoint: 'auth/local', + ssr: true + }; + $.extend(this, defaults, config); + if (this.socketio !== false) { + this.io = io(this.url, this.socketio || {}); + } + } + return $traceurRuntime.createClass(Feathers, { + rest: function (location, idProp) { + var self = this; + idProp = idProp || this.idProp; + var service = { + getListData: function (params) { + return self.makeXhr(null, params, location); + }, + getData: function (params) { + var id = null; + if (typeof params === 'string' || typeof params === 'number') { + id = params; + params = {}; + } + return self.makeXhr(id, params, location); + }, + createData: function (data) { + return self.makeXhr(null, data, location, 'POST'); + }, + updateData: function (data) { + return self.makeXhr(data[idProp], data, location, 'PUT'); + }, + patchData: function (data) { + return self.makeXhr(data[idProp], data, location, 'PATCH'); + }, + destroyData: function (data) { + return self.makeXhr(data[idProp], data, location, 'DELETE'); + } + }; + service = addAliases(service); + return service; + }, + makeXhr: function (id, params, location) { + var type = arguments[3] !== void 0 ? arguments[3] : 'GET'; + location = stripSlashes(location); + var url = this.url + '/' + location + '/'; + if (id !== null && id !== undefined) { + url += '' + id; + } else if (params[this.idProp]) { + url += '' + params[this.idProp]; + delete params[this.idProp]; + } + var contentType = 'application/x-www-form-urlencoded'; + if (type !== 'GET') { + contentType = 'application/json'; + } + var ajaxConfig = { + url: url, + type: type, + contentType: contentType, + dataType: 'json' + }; + if (type !== 'DELETE') { + $.extend(ajaxConfig, { data: params }); + } + var token = this.getToken(); + if (token) { + $.extend(ajaxConfig, { headers: { 'Authorization': 'Bearer ' + token } }); + } + return new Promise(function (resolve, reject) { + $.ajax(ajaxConfig).then(resolve).fail(function (err) { + if (!err.responseText) { + return reject(err); + } + try { + reject(errors.convert(JSON.parse(err.responseText))); + } catch (e) { + reject(e); + } + }); + }); + }, + getToken: function () { + var token; + if (this.storage) { + token = this.storage.getItem(this.tokenLocation); + if (!token) { + token = cookieStorage.getItem(this.tokenLocation); + } + } + return token; + }, + getSession: function () { + var session, token; + if (window.localStorage) { + token = this.getToken(); + if (token) { + var tokenData = decode(token); + if (tokenData.exp * 1000 > new Date().getTime()) { + session = $.extend({}, tokenData); + delete session.exp; + delete session.iat; + delete session.iss; + } + } + } + return session; + }, + authenticate: function (params) { + var $__16 = this; + var data = { type: 'token' }; + $.extend(data, params); + var token = this.getToken(); + if (token && data.type === 'token') { + data.token = token; + } + if (token) { + var authenticateSocket = function (data) { + this.io.once('unauthorized', function (res) { + return console.log(res); + }); + this.io.emit('authenticate', data); + }; + if (this.io.connected) { + authenticateSocket.call(this, data); + } else { + this.io.once('connect', function () { + return authenticateSocket.call($__16, data); + }); + } + } + var location = data.type === 'token' ? this.tokenEndpoint : this.localEndpoint; + return this.makeXhr(null, data, location, 'POST').then(function (data) { + return $__16.persistToken(data); + }).then(function (data) { + return $__16.makeSSRCookie(data); + }); + }, + persistToken: function (data) { + if (this.storeToken && this.storage) { + this.storage.setItem(this.tokenLocation, data.token); + } + return data; + }, + makeSSRCookie: function (data) { + if (this.ssr) { + var tokenExp = decode(data.token).exp, options = { expires: new Date(tokenExp * 1000) }; + cookieStorage.setItem(this.tokenLocation, data.token, options); + } + return data; + }, + logout: function (data) { + var $__16 = this; + return new Promise(function (resolve) { + $__16.storage.removeItem($__16.tokenLocation); + cookieStorage.removeItem($__16.tokenLocation); + resolve(data); + }); + } + }, {}); + }(); + var $__default = Feathers; + return { + get default() { + return $__default; + }, + __esModule: true + }; +}); +/*[global-shim-end]*/ +(function(){ // jshint ignore:line + window._define = window.define; + window.define = window.define.orig; +} +)(); \ No newline at end of file