From d6721c3abbb94686e8c0646c3333e4f912d722b7 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Mon, 27 Sep 2021 17:20:18 +0800 Subject: [PATCH] include dist output --- .gitignore | 2 +- dist/@fleetbase/sdk.min.js | 2 ++ dist/@fleetbase/sdk.min.js.map | 1 + dist/cjs/fleetbase.js | 2 ++ dist/cjs/fleetbase.js.map | 1 + dist/esm/fleetbase.js | 2 ++ dist/esm/fleetbase.js.map | 1 + 7 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 dist/@fleetbase/sdk.min.js create mode 100644 dist/@fleetbase/sdk.min.js.map create mode 100644 dist/cjs/fleetbase.js create mode 100644 dist/cjs/fleetbase.js.map create mode 100644 dist/esm/fleetbase.js create mode 100644 dist/esm/fleetbase.js.map diff --git a/.gitignore b/.gitignore index 391bf13..76d0ee8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # compiled output -/dist/ +# /dist/ /tmp/ # dependencies diff --git a/dist/@fleetbase/sdk.min.js b/dist/@fleetbase/sdk.min.js new file mode 100644 index 0000000..891e2a4 --- /dev/null +++ b/dist/@fleetbase/sdk.min.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("core-js/stable"),require("regenerator-runtime/runtime"),require("axios")):"function"==typeof define&&define.amd?define(["exports","core-js/stable","regenerator-runtime/runtime","axios"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@fleetbase/sdk"]={},null,null,t.axios)}(this,(function(t,e,n,r){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=i(r);function s(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n3&&void 0!==arguments[3]?arguments[3]:[];if(C(t))if(r.length<=T)t.splice.apply(t,[e,n].concat(E(r)));else{t.splice(e,n);for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:q,n=[],r=new Set,i="function"==typeof e?e:function(t){return get(t,e)};return t.forEach((function(t){var e=i(t);r.has(e)||(r.add(e),n.push(t))})),n},U=function(t){return t instanceof Q},I=function(t,e){return C(t)?t[e]:U(t)?t.objectAt(e):null},J=function(t,e){return 2===D.length?function(n){return e===n[t]}:function(e){return Boolean(e[t])}},W=function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.length,i=n;i2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0,i=t.length;n<0&&(n+=i);var o=r&&e!=e?function(t){return t!=t}:function(t){return t===e};return W(t,o,n)},V=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return N(t,e,n,[]),t},Z=function(t,e,n){return N(t,e,0,[n]),n},Q=function(t){g(n,t);var e=R(n);function n(){for(var t=arguments.length,r=new Array(t),i=0;i0}},{key:"empty",get:function(){return 0===this.length}},{key:"first",get:function(){return I(this,0)}},{key:"last",get:function(){return I(this,this.length-1)}},{key:"replace",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return N(this,t,e,n),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return I(e,t)}))}},{key:"objectAt",value:function(t){return I(this,t)}},{key:"indexOf",value:function(t,e){return H(this,t,e,!1)}},{key:"lastIndexOf",value:function(t,e){var n=this.length;(void 0===e||e>=n)&&(e=n-1),e<0&&(e+=n);for(var r=e;r>=0;r--)if(I(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==H(this,t,e,!0)}},{key:"findBy",value:function(){return K(this,J.apply(void 0,arguments))}},{key:"findIndexBy",value:function(){return W(this,J.apply(void 0,arguments))}},{key:"isEvery",value:function(){return G(this,J.apply(void 0,arguments))}},{key:"isAny",value:function(){return M(this,J.apply(void 0,arguments))}},{key:"invoke",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r=0;){I(this,e)===t&&this.removeAt(e)}return this}},{key:"removeObjects",value:function(t){for(var e=t.length-1;e>=0;e--)this.removeObject(t[e]);return this}},{key:"addObject",value:function(t){return this.includes(t)||this.pushObject(t),this}},{key:"addObjects",value:function(t){var e=this;return t.forEach((function(t){return e.addObject(t)})),this}}]),n}(w(Array)),Y=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=a(t);if("object"===n){var r=t.size;if("number"==typeof r)return!r}if("number"==typeof t.length&&"function"!==n)return!t.length;if("object"===n){var i=t.length;if("number"==typeof i)return!i}return!1},X=function(t){return Y(t)||"string"==typeof t&&!1===/\S/.test(t)};function tt(t){return isFinite(t)&&Math.abs(t)<=90}function et(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90}function nt(t){return t instanceof vt}var rt=function(){var t,e,n,r,i;return!("undefined"==typeof process||"object"!==a(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(n=e.name)||void 0===n?void 0:n.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(r=window)||void 0===r||null===(i=r.navigator)||void 0===i?void 0:i.product))},it=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return rt()?It("adapter","NodeAdapter",t):It("adapter","BrowserAdapter",t)},ot=Array.isArray,st=function(){function t(e){l(this,t),this.place=e,this.geometry=null==e?void 0:e.geometry,this.components=this.parseComponents(),this.attributes=this.parseProperties()}return v(t,[{key:"parse",value:function(){this.parseComponents(),this.parseProperties()}},{key:"parseComponents",value:function(){var t;return((null===(t=this.place)||void 0===t?void 0:t.address_components)||[]).reduce((function(t,e){return e.types.forEach((function(n){t[n]=e})),t}),{})}},{key:"parseProperties",value:function(){var t,e={streetNumber:this.get("street_number"),streetName:this.get("route"),coordinates:null!==(t=this.geometry)&&void 0!==t&&t.location?Object.values(this.geometry.location):[0,0],city:this.or(["locality","sublocality","sublocality_level_1","neighborhood","administrative_area_level_3","administrative_area_level_2"]),county:this.get("administrative_area_level_2"),stateShort:this.get("administrative_area_level_1",!0),stateLong:this.get("administrative_area_level_1"),countryShort:this.get("country",!0),country:this.get("country",!0),countryLong:this.get("country"),postalCode:this.get("postal_code")};return e.address=[e.streetNumber,e.streetName].filter(Boolean).join(" "),e}},{key:"all",value:function(){return this.attributes}},{key:"or",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e1&&void 0!==arguments[1]&&arguments[1];return t in this.components?e?this.components[t].short_name:this.components[t].long_name:null}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.attributes=u(u({},this.attributes),t),this}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"getAttribute",value:function(t){return this.attributes[t]||null}}]),t}(),ut=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;l(this,t),this.type="Point",this.coordinates=[n,e]}return v(t,[{key:"latitude",get:function(){return this.coordinates[1]}},{key:"longitude",get:function(){return this.coordinates[0]}},{key:"lat",value:function(){return this.latitude}},{key:"lng",value:function(){return this.longitude}},{key:"serialize",value:function(){return{type:"Point",coorindates:[this.lat(),this.lng()]}}},{key:"toJson",value:function(){return this.serialize()}},{key:"toString",value:function(){return"(".concat(this.latitude,", ").concat(this.longitude,")")}}],[{key:"fromGeoJson",value:function(e){var n=$(e.coordinates,2);return longitude=n[0],latitude=n[1],new t(latitude,longitude)}}]),t}(),at=function(t){return"object"===a(t)&&!Y(null==t?void 0:t.attributes)&&"object"===a(null==t?void 0:t.attributes)},ct=function(t,e){var n=t();return Array.isArray(n)||"object"===a(n)?ht(n,e):null},ht=function t(e,n){var r=e,i=a(e),o="object"===i,s="function"===i,u=Array.isArray(e),c="string"===a(n)&&n.includes(".")?n.split("."):[n];if(u||o){for(var h=0;h0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;l(this,t),this.actions=e,this.bind=n}return v(t,[{key:"extend",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=t||this.bind;if(!e)return this;if(null!=this&&this.actions&&"object"===a(this.actions))for(var n in this.actions){var r=this.actions[n];"function"==typeof r?lt(e,n,r.bind(e)):lt(e,n,r)}return this}}]),t}(),vt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};l(this,t),this.attributes=e,this.dirtyAttributes={},this.changes={},this.isLoading=!1,this.isSaving=!1,this.isDestroying=!1,this.isReloading=!1,this.resource=r,this.options=i,this.version=i.version||"v1",this.setAdapter(n)}return v(t,[{key:"setAdapter",value:function(t){var e;return this.adapter=t,this.store=new Kt(this.resource,t,{onAfterFetch:this.syncAttributes.bind(this),actions:null===(e=this.options)||void 0===e?void 0:e.actions}),this}},{key:"id",get:function(){return this.getAttribute("id")}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.mergeAttributes(e);return this.setFlags(["isLoading","isSaving"]),this.store.create(n).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setFlags(["isLoading","isSaving"]),this.store.update(this.attributes.id,e).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"destroy",value:function(){var t=this;return this.setFlags(["isLoading","isDestroying"]),this.store.destroy(this.attributes.id).then((function(e){return t.setFlags(["isLoading","isDestroying"],!1),e}))}},{key:"reload",value:function(){var t=this;return this.setFlags(["isLoading","isReloading"]),this.store.findRecord(this.attributes.id).then((function(e){return t.reset(),e}))}},{key:"setFlags",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=["isLoading","isSaving","isReloading","isDestroying"],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAttributes();return Y(this.id)?this.create(e):!0===t.onlyDirty?this.savedirty():this.update(e)}},{key:"saveDirty",value:function(){for(var t=Object.keys(this.dirtyAttributes),e={},n=0;n0}},{key:"mutate",value:function(t,e){this.attributes[t]=e}},{key:"setAttribute",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null===e&&"object"===a(t))return this.setAttributes(t);var n=this.attributes[t]||null;return lt(this.attributes,t,e),lt(this.dirtyAttributes,t,n),C(this.changes[t])||(this.changes[t]=[]),this.changes[t].push({property:t,previousValue:n,value:e,changedAt:new Date}),this}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in t)this.setAttribute(e,t[e]);return this}},{key:"getAttribute",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=ht(this.attributes,t);return void 0===n?e:n}},{key:"hasAttribute",value:function(t){if(C(t)){var e,n=t,r=Object.keys(null!==(e=this.attributes)&&void 0!==e?e:{});return n.every((function(t){return r.includes(t)}))}return!!this.attributes&&t in this.attributes}},{key:"hasAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.hasAttribute(t)}},{key:"isAttributeFilled",value:function(t){var e=this;return C(t)?this.hasAttribute(t)&&t.every((function(t){return!Y(e.getAttribute(t))})):this.hasAttribute(t)&&!Y(this.getAttribute(t))}},{key:"getAttributes",value:function(t){var e={};if(null==t)return this.attributes;if("string"==typeof t)return this.getAttribute(Array.prototype.slice.call(arguments));if(!C(t))throw new Error("No attribute properties provided!");for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},e=this.attributes||{};return this.attributes=u(u({},e),t),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),dt=new ft({getDistanceAndTime:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/distance-and-time"),{},e)}}),gt=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"order",u({actions:dt},i))}return v(n,[{key:"getDistanceAndTime",value:function(){return this.store.getDistanceAndTime(this.id)}}]),n}(vt),pt=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"payload",i)}return v(n,[{key:"attach",value:function(t){}},{key:"entities",get:function(){}},{key:"dropoff",get:function(){}},{key:"pickup",get:function(){}},{key:"waypoints",get:function(){return new Q(this.waypoints)}}]),n}(vt),yt=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"entity",i)}return n}(vt),bt=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"place",i)}return v(n,[{key:"latitude",get:function(){return this.getAttribute("location",new ut).coordinates[1]}},{key:"longitude",get:function(){return this.getAttribute("location",new ut).coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return nt(t)&&this.setAttribute("owner",t.id),"string"==typeof t&&this.setAttribute("owner",t),this}}],[{key:"fromGoogleAddress",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.getAttribute("coordinates"),o=$(i,2),s=o[0],u=o[1],a={name:null,address:t.getAttribute("address"),location:new ut(s,u),street1:t.getAttribute("streetName"),street2:null,city:t.getAttribute("city"),province:t.getAttribute("stateLong"),postal_code:t.getAttribute("postalCode"),neighborhood:t.get("neighborhood"),district:t.getAttribute("county"),building:t.get("building"),country:t.getAttribute("countryShort"),phone:null,security_access_code:null};return new n(a,e,r)}}]),n}(vt),mt=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"waypoint",i)}return n}(bt),kt=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"tracking-status",i)}return n}(vt),wt=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"vehicle",i)}return n}(vt),At=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"driver",i)}return n}(vt),xt=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"vendor",i)}return n}(vt),Rt=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"contact",i)}return n}(vt),$t=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"zone",i)}return n}(vt),Et=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"service-area",i)}return n}(vt),jt=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"service-rate",i)}return n}(vt),Ot=function(t){g(n,t);var e=R(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return l(this,n),e.call(this,t,r,"service-quote",i)}return v(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(vt),St=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};l(this,t),this.version=e.version||"v1",this.host=e.host||null,this.namespace=e.namespace||null,this.headers=e.headers||{}},_t=function(t){g(n,t);var e=R(n);function n(t){var r;return l(this,n),(r=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),r}return v(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=u(u({},this.headers),t),this}},{key:"parseJSON",value:function(t){return new Promise((function(e,n){return t.json().then((function(n){return e({statusText:t.statusText,status:t.status,ok:t.ok,json:n})})).catch((function(){n(new Error("Oops! Something went wrong when handling your request."))}))}))}},{key:"request",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(o,s){return fetch(i.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),u({method:n,mode:i.mode||"cors",headers:new Headers(u(u({},e.headers||{}),i.headers||{}))},r)).then(e.parseJSON).then((function(t){return t.ok?o(t.json):s(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){s(t)}))}))}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=X(e)?"":new URLSearchParams(e).toString();return this.request("".concat(t).concat(r?"?".concat(r):""),"GET",{},n)}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"POST",{body:JSON.stringify(e)},n)}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PUT",{body:JSON.stringify(e)},n)}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request(t,"DELETE",{},e)}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PATCH",{body:JSON.stringify(e)},n)}}]),n}(St),Pt=function(t){g(n,t);var e=R(n);function n(t){var r;return l(this,n),(r=e.call(this,t)).axios=o.default.create({baseURL:"".concat(r.host,"/").concat(r.namespace),headers:{Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;node"}}),r}return v(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.axios.defaults.headers.common;return this.axios.defaults.headers.common=u(u({},e),t),this}},{key:"transform",value:function(t){return t.data}},{key:"handleError",value:function(t){if(t.response){var e=t.response.data;if(C(e.errors))throw new Error(e.errors[0]);if(e.error)throw new Error(e.error)}throw t}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=X(e)?"":new URLSearchParams(e).toString();return this.axios.get("".concat(t).concat(r?"?".concat(r):""),n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.post(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.put(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.axios.delete(t,e).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.patch(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}}]),n}(St),zt=function(t){g(n,t);var e=R(n);function n(){return l(this,n),e.apply(this,arguments)}return n}(St),Lt=function(){function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];l(this,t),d(this,"uncountableWords",["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"]),d(this,"pluralRules",[[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]]),d(this,"singularRules",[[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("s$","gi"),""]]),d(this,"nonTitlecasedWords",["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"]),d(this,"idSuffix",new RegExp("(_ids|_id)$","g")),d(this,"underbar",new RegExp("_","g")),d(this,"spaceOrUnderbar",new RegExp("[ _]","g")),d(this,"uppercase",new RegExp("([A-Z])","g")),d(this,"underbarPrefix",new RegExp("^_")),this.str=e,this.chain=n}return v(t,[{key:"get",value:function(){return this.str}},{key:"applyRules",value:function(t,e,n,r){if(r)t=r;else if(!(n.indexOf(t.toLowerCase())>-1))for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:null;return t=t||this.str,this.applyRules(t,this.pluralRules,this.uncountableWords,e)}},{key:"singularize",value:function(t,e){return t=t||this.str,this.applyRules(t,this.singularRules,this.uncountableWords,e)}},{key:"camelize",value:function(t,e){for(var n=(t=t||this.str).split("/"),r=0;r1&&void 0!==arguments[1]&&arguments[1];return t=t||this.str,t=this.underscore(this.demodulize(t))+(e?"":"_")+"id",this.str=t,!0===this.chain?this:t}},{key:"ordinalize",value:function(t){for(var e=(t=t||this.str).split(" "),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];if(t.actions=C(e)?e:[e],!C(e))return e instanceof ft&&e.extend(t),t;for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};l(this,t),this.resource=e,this.adapter=n||it(),this.namespace=Ft(e),this.storage=new Q,this.options=r,this.extendActions(r.actions)}return v(t,[{key:"extendActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Jt(this,t)}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return It("resource",Nt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return Wt(this,t)}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=h(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.post("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"update",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(){var i=h(regeneratorRuntime.mark((function i(o,s){var u;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,e.adapter.put("".concat(e.namespace,"/").concat(t),n,r).then(e.afterFetch.bind(e)).catch(s);case 2:u=i.sent,o(u);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"findRecord",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=h(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.adapter.get("".concat(e.namespace,"/").concat(t),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"findAll",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(){var n=h(regeneratorRuntime.mark((function n(r,i){var o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.adapter.get("".concat(t.namespace),{},e).then(t.afterFetch.bind(t)).catch(i);case 2:o=n.sent,r(o);case 4:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}())}},{key:"query",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=h(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"queryRecord",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.single=!0,new Promise(function(){var r=h(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"destroy",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=nt(t)?t.getAttribute("id"):t;return new Promise(function(){var t=h(regeneratorRuntime.mark((function t(i,o){var s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.adapter.delete("".concat(e.namespace,"/").concat(r),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=t.sent,i(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),Mt=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(l(this,t),this.version=n.version||"v1",this.options={version:this.version,host:n.host||"https://api.fleetbase.io",namespace:this.version||n.namespace,debug:r,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!rt()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=n.adapter||it(this.options),this.orders=new Kt("order",this.adapter).extendActions(dt),this.entities=new Kt("entity",this.adapter),this.places=new Kt("place",this.adapter),this.drivers=new Kt("driver",this.adapter),this.vehicles=new Kt("vehicle",this.adapter),this.vendors=new Kt("vendor",this.adapter),this.contacts=new Kt("contact",this.adapter)}return v(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return m(t,Array.prototype.slice.call(arguments))}}]),t}();t.Adapter=St,t.BrowserAdapter=_t,t.Collection=Q,t.Contact=Rt,t.Driver=At,t.EmberJsAdapter=zt,t.Entity=yt,t.GoogleAddress=st,t.NodeAdapter=Pt,t.Order=gt,t.Payload=pt,t.Place=bt,t.Point=ut,t.Resource=vt,t.ServiceArea=Et,t.ServiceQuote=Ot,t.ServiceRate=jt,t.Store=Kt,t.StoreActions=ft,t.TrackingStatus=kt,t.Vehicle=wt,t.Vendor=xt,t.Waypoint=mt,t.Zone=$t,t.camelize=Dt,t.classify=Nt,t.dasherize=Tt,t.default=Mt,t.extendStoreActions=Jt,t.isLatitude=tt,t.isLongitude=et,t.isNodeEnvironment=rt,t.isResource=nt,t.pluralize=Ft,t.singularize=Ct})); +//# sourceMappingURL=sdk.min.js.map diff --git a/dist/@fleetbase/sdk.min.js.map b/dist/@fleetbase/sdk.min.js.map new file mode 100644 index 0000000..540654a --- /dev/null +++ b/dist/@fleetbase/sdk.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sdk.min.js","sources":["../../src/utils/array.js","../../src/utils/collection.js","../../src/utils/is-empty.js","../../src/utils/is-blank.js","../../src/utils/is-latitude.js","../../src/utils/is-longitude.js","../../src/utils/is-resource.js","../../src/utils/is-node-environment.js","../../src/utils/detect-adapter.js","../../src/utils/google-address.js","../../src/utils/point.js","../../src/utils/object.js","../../src/utils/store-actions.js","../../src/resource.js","../../src/resources/order.js","../../src/resources/payload.js","../../src/resources/entity.js","../../src/resources/place.js","../../src/resources/waypoint.js","../../src/resources/tracking-status.js","../../src/resources/vehicle.js","../../src/resources/driver.js","../../src/resources/vendor.js","../../src/resources/contact.js","../../src/resources/zone.js","../../src/resources/service-area.js","../../src/resources/service-rate.js","../../src/resources/service-quote.js","../../src/adapter.js","../../src/adapters/browser.js","../../src/adapters/node.js","../../src/adapters/ember.js","../../src/utils/string.js","../../src/resolver.js","../../src/store.js","../../src/fleetbase.js"],"sourcesContent":["const { isArray } = Array;\n\nexport {\n isArray\n};\n","import { isArray } from './array';\n\n/**\n * Collection\n * Extended array inspired by Ember's NativeArray\n **/\n\nconst CHUNK_SIZE = 60000;\n\n// To avoid overflowing the stack, we splice up to CHUNK_SIZE items at a time.\n// See https://code.google.com/p/chromium/issues/detail?id=56588 for more details.\nconst replace = (array, start, deleteCount, items = []) => {\n if (isArray(array)) {\n if (items.length <= CHUNK_SIZE) {\n array.splice(start, deleteCount, ...items);\n } else {\n array.splice(start, deleteCount);\n\n for (let i = 0; i < items.length; i += CHUNK_SIZE) {\n let chunk = items.slice(i, i + CHUNK_SIZE);\n array.splice(start + i, 0, ...chunk);\n }\n }\n } else if (isCollection(arr)) {\n array.replace(start, deleteCount, items);\n }\n};\n\nconst identityFunction = (item) => item;\n\nconst uniqBy = (array, key = identityFunction) => {\n let ret = [];\n let seen = new Set();\n let getter = typeof key === 'function' ? key : (item) => get(item, key);\n\n array.forEach((item) => {\n let val = getter(item);\n if (!seen.has(val)) {\n seen.add(val);\n ret.push(item);\n }\n });\n\n return ret;\n};\n\nconst isCollection = (mixed) => mixed instanceof Collection;\n\nconst objectAt = (array, index) => {\n if (isArray(array)) {\n return array[index];\n } else if (isCollection(array)) {\n return array.objectAt(index);\n }\n\n return null;\n};\n\nconst iter = (key, value) => {\n let valueProvided = arguments.length === 2;\n return valueProvided ? (item) => value === item[key] : (item) => Boolean(item[key]);\n};\n\nconst findIndex = (array, predicate, startAt = 0) => {\n let len = array.length;\n for (let index = startAt; index < len; index++) {\n let item = objectAt(array, index);\n if (predicate(item, index, array)) {\n return index;\n }\n }\n return -1;\n};\n\nconst find = (array, callback, target) => {\n let predicate = callback.bind(target);\n let index = findIndex(array, predicate, 0);\n return index === -1 ? undefined : objectAt(array, index);\n};\n\nconst any = (array, callback, target) => {\n let predicate = callback.bind(target);\n return findIndex(array, predicate, 0) !== -1;\n};\n\nconst every = (array, callback, target) => {\n let cb = callback.bind(target);\n let predicate = (item, index, array) => !cb(item, index, array);\n return findIndex(array, predicate, 0) === -1;\n};\n\nconst indexOf = (array, val, startAt = 0, withNaNCheck) => {\n let len = array.length;\n\n if (startAt < 0) {\n startAt += len;\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = withNaNCheck && val !== val ? (item) => item !== item : (item) => item === val;\n return findIndex(array, predicate, startAt);\n};\n\nconst removeAt = (array, index, len = 1) => {\n replace(array, index, len, []);\n return array;\n};\n\nconst insertAt = (array, index, item) => {\n replace(array, index, 0, [item]);\n return item;\n};\n\nclass Collection extends Array {\n constructor(...items) {\n if (isArray(arguments[0])) {\n super(...arguments[0]);\n } else {\n super(...arguments);\n }\n }\n\n get notEmpty() {\n return this.length > 0;\n }\n\n get empty() {\n return this.length === 0;\n }\n\n get first() {\n return objectAt(this, 0);\n }\n\n get last() {\n return objectAt(this, this.length - 1);\n }\n\n replace(start, deleteCount, items = []) {\n replace(this, start, deleteCount, items);\n\n return this;\n }\n\n objectsAt(indexes) {\n return indexes.map((idx) => objectAt(this, idx));\n }\n\n objectAt(index) {\n return objectAt(this, index);\n }\n\n indexOf(object, startAt) {\n return indexOf(this, object, startAt, false);\n }\n\n lastIndexOf(object, startAt) {\n let len = this.length;\n\n if (startAt === undefined || startAt >= len) {\n startAt = len - 1;\n }\n\n if (startAt < 0) {\n startAt += len;\n }\n\n for (let idx = startAt; idx >= 0; idx--) {\n if (objectAt(this, idx) === object) {\n return idx;\n }\n }\n\n return -1;\n }\n\n includes(object, startAt) {\n return indexOf(this, object, startAt, true) !== -1;\n }\n\n findBy() {\n return find(this, iter(...arguments));\n }\n\n findIndexBy() {\n return findIndex(this, iter(...arguments));\n }\n\n isEvery() {\n return every(this, iter(...arguments));\n }\n\n isAny() {\n return any(this, iter(...arguments));\n }\n\n invoke(methodName, ...args) {\n let ret = [];\n\n this.forEach((item) => ret.push(item[methodName]?.(...args)));\n\n return ret;\n }\n\n toArray() {\n return this.map((item) => item);\n }\n\n compact() {\n return this.filter((value) => value != null);\n }\n\n sortBy() {\n let sortKeys = arguments;\n\n return this.sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n let key = sortKeys[i];\n let propA = a[key];\n let propB = b[key];\n // return 1 or -1 else continue to the next sortKey\n let compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n }\n\n uniqBy(key) {\n return uniqBy(this, key);\n }\n\n without(value) {\n if (!this.includes(value)) {\n return this; // nothing to do\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = value === value ? (item) => item !== value : (item) => item === item;\n return this.filter(predicate);\n }\n\n clear() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n this.replace(0, len, []);\n return this;\n }\n\n insertAt(idx, object) {\n insertAt(this, idx, object);\n return this;\n }\n\n replaceAt(idx, object) {\n return this.replace(idx, 1, [object]);\n }\n\n removeAt(start, len) {\n return removeAt(this, start, len);\n }\n\n pushObject(obj) {\n return this.insertAt(this.length, obj);\n }\n\n pushObjects(objects) {\n this.replace(this.length, 0, objects);\n return this;\n }\n\n popObject() {\n let len = this.length;\n if (len === 0) {\n return null;\n }\n\n let ret = objectAt(this, len - 1);\n this.removeAt(len - 1, 1);\n return ret;\n }\n\n shiftObject() {\n if (this.length === 0) {\n return null;\n }\n\n let ret = objectAt(this, 0);\n this.removeAt(0);\n return ret;\n }\n\n unshiftObject(obj) {\n return insertAt(this, 0, obj);\n }\n\n unshiftObjects(objects) {\n this.replace(0, 0, objects);\n return this;\n }\n\n reverseObjects() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n let objects = this.toArray().reverse();\n this.replace(0, len, objects);\n return this;\n }\n\n setObjects(objects) {\n if (objects.length === 0) {\n return this.clear();\n }\n\n let len = this.length;\n this.replace(0, len, objects);\n return this;\n }\n\n removeObject(obj) {\n let loc = this.length || 0;\n while (--loc >= 0) {\n let curObject = objectAt(this, loc);\n\n if (curObject === obj) {\n this.removeAt(loc);\n }\n }\n return this;\n }\n\n removeObjects(objects) {\n for (let i = objects.length - 1; i >= 0; i--) {\n this.removeObject(objects[i]);\n }\n\n return this;\n }\n\n addObject(obj) {\n let included = this.includes(obj);\n\n if (!included) {\n this.pushObject(obj);\n }\n\n return this;\n }\n\n addObjects(objects) {\n objects.forEach((obj) => this.addObject(obj));\n return this;\n }\n}\n\nexport default Collection;\n\nexport { replace, uniqBy, isCollection, objectAt, iter, findIndex, find, any, every, indexOf, removeAt, insertAt };\n","const isEmpty = (obj) => {\n const none = obj === null || obj === undefined;\n if (none) {\n return none;\n }\n\n if (typeof obj.size === 'number') {\n return !obj.size;\n }\n\n const objectType = typeof obj;\n\n if (objectType === 'object') {\n const { size } = obj;\n if (typeof size === 'number') {\n return !size;\n }\n }\n\n if (typeof obj.length === 'number' && objectType !== 'function') {\n return !obj.length;\n }\n\n if (objectType === 'object') {\n const { length } = obj;\n if (typeof length === 'number') {\n return !length;\n }\n }\n\n return false;\n};\n\nexport default isEmpty;\n","import isEmpty from './is-empty';\n\nconst isBlank = (obj) => isEmpty(obj) || (typeof obj === 'string' && /\\S/.test(obj) === false);\n\nexport default isBlank;\n","export default function isLatitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 90;\n}\n","export default function isLongitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 180 && Math.abs(coordinate) >= 90;\n}\n","import Resource from '../resource';\n\nexport default function isResource(record) {\n return record instanceof Resource;\n}\n","/**\n * Determines if environment SDK is initialized in is Node, additionally checks pass if environment is ReactNative.\n * \n * @returns boolean\n */\nconst isNodeEnvironment = () => {\n return (typeof process !== 'undefined') && (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) && (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative');\n};\n\nexport default isNodeEnvironment;","import { lookup } from '../resolver';\nimport isNodeEnvironment from './is-node-environment';\n\nconst detectAdapter = (options = {}) => {\n if (isNodeEnvironment()) {\n return lookup('adapter', 'NodeAdapter', options);\n }\n\n return lookup('adapter', 'BrowserAdapter', options);\n}\n\nexport default detectAdapter;","const { isArray } = Array;\n\nclass GoogleAddress {\n constructor(place) {\n this.place = place;\n this.geometry = place?.geometry;\n this.components = this.parseComponents();\n this.attributes = this.parseProperties();\n }\n\n parse() {\n this.parseComponents();\n this.parseProperties();\n }\n\n parseComponents() {\n const components = (this.place?.address_components || []).reduce(function (acc, data) {\n data.types.forEach(function (type) {\n acc[type] = data;\n });\n return acc;\n }, {});\n\n return components;\n }\n\n parseProperties() {\n const attributes = {\n streetNumber: this.get('street_number'),\n streetName: this.get('route'),\n coordinates: this.geometry?.location ? Object.values(this.geometry.location) : [0, 0],\n city: this.or(['locality', 'sublocality', 'sublocality_level_1', 'neighborhood', 'administrative_area_level_3', 'administrative_area_level_2']),\n county: this.get('administrative_area_level_2'),\n stateShort: this.get('administrative_area_level_1', true),\n stateLong: this.get('administrative_area_level_1'),\n countryShort: this.get('country', true),\n country: this.get('country', true),\n countryLong: this.get('country'),\n postalCode: this.get('postal_code'),\n };\n\n attributes.address = [attributes.streetNumber, attributes.streetName].filter(Boolean).join(' ');\n\n return attributes;\n }\n\n all() {\n return this.attributes;\n }\n\n or(keys = []) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (isArray(key)) {\n const pkey = key[0];\n const short = key[1];\n\n if (this.has(pkey)) {\n return this.get(pkey, short);\n }\n\n continue;\n }\n\n if (this.has(key)) {\n return this.get(key);\n }\n }\n\n return null;\n }\n\n has(key) {\n return (key in this.components);\n }\n\n get(key, short = false) {\n if (!(key in this.components)) {\n return null;\n }\n\n return short ? this.components[key].short_name : this.components[key].long_name;\n }\n\n setAttributes(attributes = {}) {\n this.attributes = {...this.attributes, ...attributes};\n\n return this;\n }\n\n setAttribute(key, value) {\n this.attributes[key] = value;\n\n return this;\n }\n\n getAttribute(key) {\n return this.attributes[key] || null;\n }\n}\n\nexport default GoogleAddress;\n","export default class Point {\n constructor(latitude = 0, longitude = 0) {\n this.type = 'Point';\n this.coordinates = [longitude, latitude];\n }\n\n get latitude() {\n return this.coordinates[1];\n }\n\n get longitude() {\n return this.coordinates[0];\n }\n\n lat() {\n return this.latitude;\n }\n\n lng() {\n return this.longitude;\n }\n\n static fromGeoJson(json) {\n [ longitude, latitude ] = json.coordinates;\n\n return new Point(latitude, longitude);\n }\n\n serialize() {\n return {\n type: 'Point',\n coorindates: [this.lat(), this.lng()]\n };\n }\n\n toJson() {\n return this.serialize();\n }\n\n toString() {\n return `(${this.latitude}, ${this.longitude})`;\n }\n}","import isEmpty from './is-empty';\n\nconst isResource = (mixed) => typeof mixed === 'object' && !isEmpty(mixed?.attributes) && typeof mixed?.attributes === 'object';\n\nconst isCallable = (object, property) => typeof object[property] === 'function';\n\nconst getResolved = (func, path) => {\n const resolved = func();\n return Array.isArray(resolved) || typeof resolved === 'object' ? get(resolved, path) : null;\n};\n\nconst invoke = (object, method) => {\n if (typeof object[method] === 'function') {\n return object[method].bind(object);\n }\n};\n\nconst get = (object, path) => {\n let current = object;\n\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n\n if (isArray || isObject) {\n for (let i = 0; i < pathArray.length; i++) {\n if (current && current[pathArray[i]] === undefined) {\n return null;\n } else if (current) {\n current = current[pathArray[i]];\n\n // if is resource then return get on it's attributes\n if (isResource(current) && pathArray[i + 1] !== undefined) {\n const newPath = pathArray.slice(i + 1).join('.');\n\n return get(current.attributes, newPath);\n }\n\n // resolve functions and continue\n if (typeof current === 'function') {\n const newPath = pathArray.slice(i + 1).join('.');\n return getResolved(current, newPath);\n }\n }\n }\n return current;\n }\n\n if (isFunction) {\n return getResolved(object, path);\n }\n};\n\nconst getProperties = (object, properties = []) => {\n const selected = {};\n let propertyNames = arguments;\n let i = 1;\n\n if (arguments.length === 2 && Array.isArray(properties)) {\n i = 0;\n propertyNames = arguments[1];\n }\n\n for (; i < propertyNames.length; i++) {\n selected[propertyNames[i]] = get(object, propertyNames[i]);\n }\n\n return selected;\n};\n\nconst set = (object, path, value) => {\n let current = object;\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n // if is function\n if (isFunction) {\n // throw error should be object or array or object like\n }\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n const iterations = pathArray.length;\n\n if (isArray || isObject) {\n for (let i = 0; i < iterations - 1; i++) {\n if (!current[pathArray[i]]) {\n current[pathArray[i]] = {};\n }\n current = current[pathArray[i]];\n }\n\n current[pathArray[iterations - 1]] = value;\n }\n\n return value;\n};\n\nconst setProperties = (object, properties = {}) => {\n for (const property in properties) {\n set(object, property, properties[property]);\n }\n\n return object;\n};\n\nconst extend = (target, classes = []) => {\n if (arguments.length > 1) {\n classes = arguments;\n }\n for (let index = 0; index < classes.length; index++) {\n for (const property in classes[index]) {\n if (Object.prototype.hasOwnProperty.call(classes[index], property)) {\n target[property] = classes[index][property];\n }\n }\n }\n return target;\n};\n\nexport { set, get, getProperties, setProperties, extend, isCallable, invoke };\n","import { set } from './object';\n\nexport default class StoreActions {\n constructor(actions = {}, bind = null) {\n this.actions = actions;\n this.bind = bind;\n }\n\n extend(bindTo = null) {\n const binding = bindTo || this.bind;\n\n if (!binding) {\n return this;\n }\n\n if (this?.actions && typeof this.actions === 'object') {\n for (let action in this.actions) {\n const fn = this.actions[action];\n\n if (typeof fn !== 'function') {\n set(binding, action, fn);\n continue;\n }\n\n set(binding, action, fn.bind(binding));\n }\n }\n\n return this;\n }\n}\n","import Store from './store';\nimport { isEmpty } from './utils';\nimport { isArray } from './utils/array';\nimport { set, get } from './utils/object';\n\nclass Resource {\n /**\n\t * The base resource for all resources\n\n\t * @return {[type]} [description]\n\t */\n constructor(attributes = {}, adapter, resource, options = {}) {\n this.attributes = attributes;\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isDestroying = false;\n this.isReloading = false;\n this.resource = resource;\n this.options = options;\n this.version = options.version || 'v1';\n this.setAdapter(adapter);\n }\n\n /**\n * Set a new adapter to the resource instance, this will update the Store instance\n *\n * @param {Adapter} adapter\n * @return {Resource} this\n */\n setAdapter(adapter) {\n this.adapter = adapter;\n this.store = new Store(this.resource, adapter, {\n onAfterFetch: this.syncAttributes.bind(this),\n actions: this.options?.actions\n });\n\n return this;\n }\n\n /**\n * Getter for id attribute\n *\n * @var {String}\n */\n get id() {\n return this.getAttribute('id');\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n create(attributes = {}) {\n const data = this.mergeAttributes(attributes);\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.create(data).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n update(attributes = {}) {\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.update(this.attributes.id, attributes).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Deletes the resource instance on the server\n *\n * @return {[type]} [description]\n */\n destroy() {\n this.setFlags(['isLoading', 'isDestroying']);\n\n return this.store.destroy(this.attributes.id).then((response) => {\n this.setFlags(['isLoading', 'isDestroying'], false);\n\n return response;\n });\n }\n\n /**\n * Reloads the resource from the server.\n *\n * @return {[type]} [description]\n */\n reload() {\n this.setFlags(['isLoading', 'isReloading']);\n\n return this.store.findRecord(this.attributes.id).then((response) => {\n this.reset();\n\n return response;\n });\n }\n\n /**\n * Sets flag properties.\n *\n * @return this\n */\n setFlags(flags = [], state = true) {\n const validFlags = ['isLoading', 'isSaving', 'isReloading', 'isDestroying'];\n\n for(let i = 0; i < flags.length; i++) {\n const flag = flags[i];\n\n if (typeof flag !== 'string' || !validFlags.includes(flag)) {\n throw new Error(`${flag} is not a valid flag!`);\n }\n\n this[flag] = state;\n }\n\n return this;\n }\n\n /**\n * Resets tracked properties\n *\n * @return this\n */\n reset() {\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isReloading = false;\n\n return this;\n }\n\n /**\n * Emptys resource.\n *\n * @return this\n */\n empty() {\n this.reset();\n this.attribues = {};\n\n return this;\n }\n\n /**\n * Saves the resource instance on the server\n *\n * @return {[type]} [description]\n */\n save(options = {}) {\n const attributes = this.getAttributes();\n\n if (isEmpty(this.id)) {\n return this.create(attributes);\n }\n\n if (options.onlyDirty === true) {\n return this.savedirty();\n }\n\n return this.update(attributes);\n }\n\n /**\n * Saves only dirtied attributes.\n *\n * @return {[type]} [description]\n */\n saveDirty() {\n const dirtyAttributeKeys = Object.keys(this.dirtyAttributes);\n const dirtyAttributes = {};\n\n for (let i = 0; i < dirtyAttributeKeys.length; i++) {\n const key = dirtyAttributeKeys[i];\n dirtyAttributes[key] = this.getAttribute(key);\n }\n\n return this.update(dirtyAttributes);\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get createdAt() {\n return this.hasAttribute('created_at') ? new Date(this.getAttribute('created_at')) : null;\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get updatedAt() {\n return this.hasAttribute('updated_at') ? new Date(this.getAttribute('updated_at')) : null;\n }\n\n /**\n * Checks if resource is loaded from the server.\n *\n * @return {Boolean}\n */\n get isLoaded() {\n return this.hasAttributes(['created_at', 'id']);\n }\n\n /**\n * Checks if resource ihas no attributes\n *\n * @return {Boolean}\n */\n get isEmpty() {\n return Object.values(this.attributes).length === 0;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isNew() {\n return !this.id;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isSaved() {\n return !this.isNew && this.isLoaded;\n }\n\n /**\n * Checks if resource is deleted on server.\n *\n * @return {Boolean}\n */\n get isDeleted() {\n return this.hasAttributes(['deleted', 'time']);\n }\n\n /**\n * Iterates over each attribute value and property executing a user supplied callback.\n *\n * @return {Object}\n */\n eachAttribute(callback) {\n if (typeof callback !== 'function') {\n return this;\n }\n\n Object.keys(this.attributes).forEach((property) => {\n const value = this.getAttribute(property);\n callback.call(this, value, property);\n });\n\n return this;\n }\n\n /**\n * Gets all changes\n *\n * @return {Object}\n */\n changes() {\n return this.changes;\n }\n\n /**\n * Gets all dirty attributes.\n *\n * @return {Object}\n */\n getDirtyAttributes() {\n return this.dirtyAttributes;\n }\n\n /**\n * Checks if property is dirty.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n isDirty(property) {\n return property in this.dirtyAttributes;\n }\n\n /**\n * Checks if any properties is dirty.\n *\n * @return {Boolean}\n */\n hasDirtyAttributes() {\n return Object.keys(this.dirtyAttributes).length > 0;\n }\n\n /**\n * Updates a instance property without tracking changes or dirtying attribute.\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n mutate(property, value) {\n this.attributes[property] = value;\n }\n\n /**\n * Set an instance property locally\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n setAttribute(property, value = null) {\n if (value === null && typeof property === 'object') {\n return this.setAttributes(property);\n }\n\n const previousValue = this.attributes[property] || null;\n\n // use object setter\n set(this.attributes, property, value);\n set(this.dirtyAttributes, property, previousValue);\n \n // this.attributes[property] = value;\n // this.dirtyAttributes[property] = previousValue;\n\n // track changes\n if (!isArray(this.changes[property])) {\n this.changes[property] = [];\n }\n\n this.changes[property].push({\n property,\n previousValue,\n value,\n changedAt: new Date(),\n });\n\n return this;\n }\n\n /**\n * Set multiple instance properties locally\n *\n * @param {Object} properties [description]\n */\n setAttributes(attributes = {}) {\n for (let property in attributes) {\n this.setAttribute(property, attributes[property]);\n }\n\n return this;\n }\n\n /**\n * Get an attribute\n *\n * @param {String} attribute The attribute key to get\n * @param {mixed} defaultValue The default value if no attribute value\n */\n getAttribute(attribute, defaultValue = null) {\n const value = get(this.attributes, attribute);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n }\n\n /**\n * Checks if attribute exists.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n hasAttribute(property) {\n if (isArray(property)) {\n const properties = property;\n const attributeKeys = Object.keys(this.attributes ?? {});\n \n return properties.every((prop) => attributeKeys.includes(prop));\n }\n\n if (!this.attributes) {\n return false;\n }\n\n return property in this.attributes;\n }\n\n /**\n * Alias for checking if has multiple attributes.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n hasAttributes(properties = []) {\n return this.hasAttribute(properties);\n }\n\n\n /**\n * Returns true if attribute has value.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n isAttributeFilled(property) {\n if (isArray(property)) {\n return this.hasAttribute(property) && property.every((prop) => !isEmpty(this.getAttribute(prop)));\n }\n\n return this.hasAttribute(property) && !isEmpty(this.getAttribute(property));\n }\n\n /**\n * Get multiple attributes.\n *\n * @param {Array} properties [description]\n * @param {[type]} value [description]\n */\n getAttributes(properties) {\n const attributes = {};\n\n if (properties === null || properties === undefined) {\n return this.attributes;\n }\n\n if (typeof properties === 'string') {\n return this.getAttribute([...arguments]);\n }\n\n if (!isArray(properties)) {\n throw new Error('No attribute properties provided!');\n }\n\n for (let i = 0; i < properties.length; i++) {\n const property = properties[i];\n\n if (typeof property !== 'string') {\n continue;\n }\n\n attributes[property] = this.getAttribute(property);\n }\n\n return attributes;\n }\n\n /**\n * Serialize resource to a POJO\n *\n * @returns {Object}\n */\n serialize() {\n return this.getAttributes();\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n mergeAttributes(attributes = {}) {\n const modelAttributes = this.attributes || {};\n this.attributes = { ...modelAttributes, ...attributes };\n\n return this.attributes;\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n syncAttributes(json = {}) {\n this.attributes = json;\n }\n}\n\nexport default Resource;\n","import Resource from '../resource';\nimport { StoreActions } from '../utils';\n\nconst orderActions = new StoreActions({\n getDistanceAndTime: function (id, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/distance-and-time`, {}, options);\n },\n});\n\nclass Order extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'order', { actions: orderActions, ...options });\n }\n\n getDistanceAndTime() {\n return this.store.getDistanceAndTime(this.id);\n }\n}\n\nexport default Order;\n\nexport { orderActions };","import Resource from '../resource';\nimport Collection from '../utils/collection';\n\nclass Payload extends Resource {\n\tconstructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\t\n /**\n\t * Attaches an entity to an existing payload and returns\n\t * the payload with the entity attached\n\t *\n\t * @param {[type]} Entity entity [description]\n\t * @return {[type]} [description]\n\t */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n\t * Returns all of the entities attached to this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get entities() {\n\n }\n\n /**\n\t * Returns the dropoff for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get dropoff() {\n\n }\n\n /**\n\t * Returns the pickup for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get pickup() {\n\n }\n\n /**\n\t * Returns all the waypoints for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get waypoints() {\n return new Collection(this.waypoints);\n }\n}\n\nexport default Payload;\n","import Resource from '../resource';\n\nclass Entity extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'entity', options);\n }\n}\n\nexport default Entity;\n","import Resource from '../resource';\nimport { isResource, Point } from '../utils';\n\nclass Place extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'place', options);\n }\n\n static fromGoogleAddress(googleAddress, adapter, options = {}) {\n const [ latitude, longitude ] = googleAddress.getAttribute('coordinates');\n const attributes = {\n name: null,\n address: googleAddress.getAttribute('address'),\n location: new Point(latitude, longitude),\n street1: googleAddress.getAttribute('streetName'),\n street2: null,\n city: googleAddress.getAttribute('city'),\n province: googleAddress.getAttribute('stateLong'),\n postal_code: googleAddress.getAttribute('postalCode'),\n neighborhood: googleAddress.get('neighborhood'),\n district: googleAddress.getAttribute('county'),\n building: googleAddress.get('building'),\n country: googleAddress.getAttribute('countryShort'),\n phone: null,\n security_access_code: null\n };\n\n return new Place(attributes, adapter, options);\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point()).coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point()).coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n * \n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [ latitude, longitude ];\n }\n\n /**\n * Set the owner of the place.\n * \n * @param {Object|String} owner\n * @return {Place}\n */\n setOwner(owner) {\n if (isResource(owner)) {\n this.setAttribute('owner', owner.id);\n }\n\n if (typeof owner === 'string') {\n this.setAttribute('owner', owner);\n }\n\n return this;\n }\n}\n\nexport default Place;\n","import Place from './place';\n\nclass Waypoint extends Place {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'waypoint', options);\n }\n}\n\nexport default Waypoint;\n","import Resource from '../resource';\n\nclass TrackingStatus extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'tracking-status', options);\n }\n}\n\nexport default TrackingStatus;\n","import Resource from '../resource';\n\nclass Vehicle extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vehicle', options);\n }\n}\n\nexport default Vehicle;\n","import Resource from '../resource';\n\nclass Driver extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'driver', options);\n }\n}\n\nexport default Driver;\n","import Resource from '../resource';\n\nclass Vendor extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vendor', options);\n }\n}\n\nexport default Vendor;\n","import Resource from '../resource';\n\nclass Contact extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'contact', options);\n }\n}\n\nexport default Contact;\n","import Resource from '../resource';\n\nclass Zone extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'zone', options);\n }\n}\n\nexport default Zone;\n","import Resource from '../resource';\n\nclass ServiceArea extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-area', options);\n }\n}\n\nexport default ServiceArea;\n","import Resource from '../resource';\n\nclass ServiceRate extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-rate', options);\n }\n}\n\nexport default ServiceRate;\n","import Resource from '../resource';\n\nclass ServiceQuote extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-quote', options);\n }\n\n fromPreliminary() {\n\n }\n\n fromPayload() {\n \n }\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n\t * Creates a configured base adapter for Fleetbase.\n\t *\n\t * @param {Object} config Configuration options for adapter\n\t */\n constructor(config = {}) {\n this.version = config.version || 'v1';\n this.host = config.host || null;\n this.namespace = config.namespace || null;\n this.headers = config.headers || {};\n }\n}\n\nexport default Adapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\n\nclass BrowserAdapter extends Adapter {\n /**\n * Setup browser adapter.\n * @param {Object} config\n */\n constructor(config) {\n super(config);\n\n this.setHeaders({\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;browser'\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n this.headers = { ...this.headers, ...headers };\n\n return this;\n }\n\n /**\n * Parses the JSON returned by a network request\n *\n * @param {Object} response A response from a network request\n * @return {Object} The parsed JSON, status from the response\n *\n * @return {Promise}\n */\n parseJSON(response) {\n return new Promise((resolve, reject) => response\n .json()\n .then((json) => resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n }))\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n }));\n }\n\n /**\n * The base request method\n *\n * @param {String} path\n * @param {String} method\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n request(path, method = 'GET', data = {}, options = {}) {\n return new Promise((resolve, reject) => fetch(options.url || `${this.host}/${this.namespace}/${path}`, {\n method,\n mode: options.mode || 'cors',\n headers: new Headers({\n ...(this.headers || {}),\n ...(options.headers || {}),\n }),\n ...data,\n })\n .then(this.parseJSON)\n .then((response) => {\n if (response.ok) {\n return resolve(response.json);\n }\n\n return reject(new Error(response.json.errors ? response.json.errors[0] : response.statusText));\n })\n .catch((error) => {\n reject(error);\n }));\n }\n\n /**\n * Makes a GET request with fetch\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.request(`${path}${urlParams ? `?${urlParams}` : ''}`, 'GET', {}, options);\n }\n\n /**\n * Makes a POST request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.request(path, 'POST', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a PUT request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.request(path, 'PUT', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a DELETE request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.request(path, 'DELETE', {}, options);\n }\n\n /**\n * Makes a PATCH request with fetch\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.request(path, 'PATCH', { body: JSON.stringify(data) }, options);\n }\n}\n\nexport default BrowserAdapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\nimport { isArray } from '../utils/array';\nimport axios from 'axios';\n\nclass NodeAdapter extends Adapter {\n constructor(config) {\n super(config);\n\n this.axios = axios.create({\n baseURL: `${this.host}/${this.namespace}`,\n headers: {\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;node',\n },\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n const commonHeaders = this.axios.defaults.headers.common;\n this.axios.defaults.headers.common = { ...commonHeaders, ...headers };\n\n return this;\n }\n\n /**\n * Tranform the response, and return the response data from axios.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n transform(response) {\n return response.data;\n }\n\n /**\n * Handles an erroneous request.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n handleError(error) {\n if (error.response) {\n const { data } = error.response;\n\n if (isArray(data.errors)) {\n throw new Error(data.errors[0]);\n }\n\n if (data.error) {\n throw new Error(data.error);\n }\n }\n\n throw error;\n }\n\n /**\n * Makes a GET request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.axios\n .get(`${path}${urlParams ? `?${urlParams}` : ''}`, options)\n .then(this.transform.bind(this))\n .catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a POST request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.axios.post(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PUT request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.axios.put(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a DELETE request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.axios.delete(path, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PATCH request with axios\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.axios.patch(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n}\n\nexport default NodeAdapter;\n","import Adapter from '../adapter';\n\nclass EmberJsAdapter extends Adapter {}\n\nexport default EmberJsAdapter;\n","'use strict';\n\n/**\n * Javascript String\n *\n * instance\n * new String('hello_world').humanize().get() => \"Hello world\"\n *\n * instance\n * const string = new String();\n * string.humanize('hello_world').get() => \"Hello world\"\n * \n * no chain\n * new String('hello_world', false).humanize() => \"Hello world\"\n *\n * static\n * String.invoke('humanize', 'hello_world') => \"Hello world\"\n *\n * exports {}\n * humanize('hello_world') => \"Hello world\"\n */\n\nexport default class String {\n constructor(string, chain = true) {\n this.str = string;\n this.chain = chain;\n }\n\n uncountableWords = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'moose', 'deer', 'news'];\n\n pluralRules = [\n [new RegExp('(m)an$', 'gi'), '$1en'],\n [new RegExp('(pe)rson$', 'gi'), '$1ople'],\n [new RegExp('(child)$', 'gi'), '$1ren'],\n [new RegExp('^(ox)$', 'gi'), '$1en'],\n [new RegExp('(ax|test)is$', 'gi'), '$1es'],\n [new RegExp('(octop|vir)us$', 'gi'), '$1i'],\n [new RegExp('(alias|status)$', 'gi'), '$1es'],\n [new RegExp('(bu)s$', 'gi'), '$1ses'],\n [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'],\n [new RegExp('([ti])um$', 'gi'), '$1a'],\n [new RegExp('sis$', 'gi'), 'ses'],\n [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'],\n [new RegExp('(hive)$', 'gi'), '$1s'],\n [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'],\n [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'],\n [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'],\n [new RegExp('([m|l])ouse$', 'gi'), '$1ice'],\n [new RegExp('(quiz)$', 'gi'), '$1zes'],\n [new RegExp('s$', 'gi'), 's'],\n [new RegExp('$', 'gi'), 's'],\n ];\n\n singularRules = [\n [new RegExp('(m)en$', 'gi'), '$1an'],\n [new RegExp('(pe)ople$', 'gi'), '$1rson'],\n [new RegExp('(child)ren$', 'gi'), '$1'],\n [new RegExp('([ti])a$', 'gi'), '$1um'],\n [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', 'gi'), '$1$2sis'],\n [new RegExp('(hive)s$', 'gi'), '$1'],\n [new RegExp('(tive)s$', 'gi'), '$1'],\n [new RegExp('(curve)s$', 'gi'), '$1'],\n [new RegExp('([lr])ves$', 'gi'), '$1f'],\n [new RegExp('([^fo])ves$', 'gi'), '$1fe'],\n [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'],\n [new RegExp('(s)eries$', 'gi'), '$1eries'],\n [new RegExp('(m)ovies$', 'gi'), '$1ovie'],\n [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'],\n [new RegExp('([m|l])ice$', 'gi'), '$1ouse'],\n [new RegExp('(bus)es$', 'gi'), '$1'],\n [new RegExp('(o)es$', 'gi'), '$1'],\n [new RegExp('(shoe)s$', 'gi'), '$1'],\n [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'],\n [new RegExp('(octop|vir)i$', 'gi'), '$1us'],\n [new RegExp('(alias|status)es$', 'gi'), '$1'],\n [new RegExp('^(ox)en', 'gi'), '$1'],\n [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'],\n [new RegExp('(matr)ices$', 'gi'), '$1ix'],\n [new RegExp('(quiz)zes$', 'gi'), '$1'],\n [new RegExp('s$', 'gi'), ''],\n ];\n\n nonTitlecasedWords = ['and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at', 'by', 'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over', 'with', 'for'];\n\n idSuffix = new RegExp('(_ids|_id)$', 'g');\n underbar = new RegExp('_', 'g');\n spaceOrUnderbar = new RegExp('[ _]', 'g');\n uppercase = new RegExp('([A-Z])', 'g');\n underbarPrefix = new RegExp('^_');\n\n get() {\n return this.str;\n }\n\n applyRules(str, rules, skip, override) {\n if (override) {\n str = override;\n } else {\n var ignore = skip.indexOf(str.toLowerCase()) > -1;\n if (!ignore) {\n for (var x = 0; x < rules.length; x++) {\n if (str.match(rules[x][0])) {\n str = str.replace(rules[x][0], rules[x][1]);\n break;\n }\n }\n }\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.pluralize('person') -> 'people'\n String.pluralize('octopus') -> 'octopi'\n String.pluralize('Hat') -> 'Hats'\n String.pluralize('person', 'guys') -> 'guys' \n */\n pluralize(str, plural = null) {\n str = str || this.str;\n\n return this.applyRules(str, this.pluralRules, this.uncountableWords, plural);\n }\n\n /*\n String.singularize('person') -> 'person'\n String.singularize('octopi') -> 'octopus'\n String.singularize('hats') -> 'hat'\n String.singularize('guys', 'person') -> 'person'\n */\n singularize(str, singular) {\n str = str || this.str;\n\n return this.applyRules(str, this.singularRules, this.uncountableWords, singular);\n }\n\n /*\n String.camelize('message_properties') -> 'MessageProperties'\n String.camelize('message_properties', true) -> 'messageProperties'\n */\n camelize(str, lowFirstLetter) {\n str = str || this.str;\n\n let str_path = str.split('/');\n for (var i = 0; i < str_path.length; i++) {\n let str_arr = str_path[i].split('_');\n let initX = lowFirstLetter && i + 1 === str_path.length ? 1 : 0;\n\n for (let x = initX; x < str_arr.length; x++) {\n str_arr[x] = str_arr[x].charAt(0).toUpperCase() + str_arr[x].substring(1);\n }\n str_path[i] = str_arr.join('');\n }\n str = str_path.join('::');\n\n // fix\n if (lowFirstLetter === true) {\n let first = str.charAt(0).toLowerCase();\n let last = str.slice(1);\n str = first + last;\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.underscore('MessageProperties') -> 'message_properties'\n String.underscore('messageProperties') -> 'message_properties'\n */\n underscore(str) {\n str = str || this.str;\n\n var str_path = str.split('::');\n for (var i = 0; i < str_path.length; i++) {\n str_path[i] = str_path[i].replace(this.uppercase, '_$1');\n str_path[i] = str_path[i].replace(this.underbarPrefix, '');\n }\n str = str_path.join('/').toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.humanize('message_properties') -> 'Message properties'\n String.humanize('message_properties') -> 'message properties'\n */\n humanize(str, lowFirstLetter) {\n str = str || this.str;\n\n var str = str.toLowerCase();\n str = str.replace(this.idSuffix, '');\n str = str.replace(this.underbar, ' ');\n if (!lowFirstLetter) {\n str = this.capitalize(str);\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.capitalize('message_properties') -> 'Message_properties'\n String.capitalize('message properties') -> 'Message properties'\n */\n capitalize(str) {\n str = str || this.str;\n\n str = str.toLowerCase();\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.dasherize('message_properties') -> 'message-properties'\n String.dasherize('message properties') -> 'message-properties'\n */\n dasherize(str) {\n str = str || this.str;\n\n str = str.replace(this.spaceOrUnderbar, '-');\n str = str.toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.normify('message_properties') -> 'Message Properties'\n String.normify('message properties') -> 'Message Properties'\n Inflactor.normify('Message_propertyId', true) -> 'Message Properties Id'\n */\n normify(str, allFirstUpper) {\n str = str || this.str;\n\n //var str = str.toLowerCase();\n if (allFirstUpper === true) {\n str = this.camelize(str);\n str = this.underscore(str);\n } else {\n str = str.toLowerCase();\n }\n\n str = str.replace(this.underbar, ' ');\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var d = str_arr[x].split('-');\n for (var i = 0; i < d.length; i++) {\n if (this.nonTitlecasedWords.indexOf(d[i].toLowerCase()) < 0) {\n d[i] = this.capitalize(d[i]);\n }\n }\n str_arr[x] = d.join('-');\n }\n str = str_arr.join(' ');\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.demodulize('Message::Bus::Properties') -> 'Properties'\n */\n demodulize(str) {\n str = str || this.str;\n\n var str_arr = str.split('::');\n str = str_arr[str_arr.length - 1];\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.tableize('MessageBusProperty') -> 'message_bus_properties'\n */\n tableize(str) {\n str = str || this.str;\n\n str = this.pluralize(this.underscore(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.classify('message_bus_properties') -> 'MessageBusProperty'\n */\n classify(str) {\n str = str || this.str;\n\n str = this.singularize(this.camelize(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.foreignKey('MessageBusProperty') -> 'message_bus_property_id'\n String.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'\n */\n foreignKey(str, dropIdUbar = false) {\n str = str || this.str;\n\n str = this.underscore(this.demodulize(str)) + (dropIdUbar ? '' : '_') + 'id';\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.ordinalize('the 1 pitch') -> 'the 1st pitch'\n */\n ordinalize(str) {\n str = str || this.str;\n\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var i = parseInt(str_arr[x]);\n if (i === NaN) {\n var ltd = str_arr[x].substring(str_arr[x].length - 2);\n var ld = str_arr[x].substring(str_arr[x].length - 1);\n var suf = 'th';\n if (ltd != '11' && ltd != '12' && ltd != '13') {\n if (ld === '1') {\n suf = 'st';\n } else if (ld === '2') {\n suf = 'nd';\n } else if (ld === '3') {\n suf = 'rd';\n }\n }\n str_arr[x] += suf;\n }\n }\n str = str_arr.join(' ');\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /**\n * @method invoke\n **/\n static invoke() {\n const argz = Object.values(arguments);\n const instance = new String(null, false);\n const method = arguments[0];\n argz.shift();\n\n if (typeof instance[method] === 'function') {\n return instance[method](...argz);\n }\n\n return null;\n }\n}\n\nconst pluralize = function() {\n const argz = ['pluralize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst singularize = function() {\n const argz = ['singularize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst humanize = function() {\n const argz = ['humanize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst underscore = function() {\n const argz = ['underscore', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst camelize = function() {\n const argz = ['camelize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst capitalize = function() {\n const argz = ['capitalize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst dasherize = function() {\n const argz = ['dasherize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst normify = function() {\n const argz = ['normify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst demodulize = function() {\n const argz = ['demodulize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst tableize = function() {\n const argz = ['tableize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst classify = function() {\n const argz = ['classify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst foreignKey = function() {\n const argz = ['foreignKey', ...arguments];\n\n return String.invoke(...argz);\n};\n\nexport {\n pluralize,\n singularize,\n humanize,\n underscore,\n camelize,\n capitalize,\n dasherize,\n normify,\n demodulize,\n tableize,\n classify,\n foreignKey\n}","import { Place, Payload, Order } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter } from './adapters';\nimport { pluralize, singularize } from './utils/string';\n\nconst resources = {\n Place,\n Payload,\n Order\n};\n\nconst adapters = {\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter\n};\n\nclass Resolver {\n constructor () {\n this.resources = resources;\n this.adapters = adapters;\n\n return this.lookup(...arguments);\n }\n\n lookup(type, className) {\n const key = pluralize(type);\n const params = [ ...arguments ].slice(2);\n\n if (!this[key]) {\n throw new Error('Attempted to resolve invalid type');\n }\n\n if (!this[key][className]) {\n throw new Error(`No ${singularize(type)} named ${className} to resolve`);\n }\n\n return new this[key][className](...params);\n }\n}\n\nconst lookup = function() {\n return new Resolver(...arguments);\n};\n\nexport {\n Resolver,\n lookup\n};\n","import { lookup } from './resolver';\nimport { pluralize, classify } from './utils/string';\nimport { isArray } from './utils/array';\nimport { Collection, detectAdapter, isResource, StoreActions } from './utils';\nimport { set, isCallable, invoke } from './utils/object';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (let i = 0; i < actions.length; i++) {\n const action = actions[i];\n\n store.extendActions(action);\n }\n return;\n }\n\n if (actions instanceof StoreActions) {\n actions.extend(store);\n }\n\n return store;\n};\n\nconst afterFetch = (store, json) => {\n if (typeof store.options.onAfterFetch === 'function') {\n store.options.onAfterFetch(json);\n }\n\n if (isArray(json)) {\n const serialized = [];\n\n for (let i = 0; i < json.length; i++) {\n serialized.push(store.afterFetch(json[i]));\n }\n\n return new Collection(...serialized);\n }\n\n const resourceInstance = store.serialize(json);\n return store.deposit(resourceInstance);\n};\n\nclass Store {\n constructor(resource, adapter, options = {}) {\n this.resource = resource;\n this.adapter = adapter || detectAdapter();\n this.namespace = pluralize(resource);\n this.storage = new Collection();\n this.options = options;\n this.extendActions(options.actions);\n }\n\n extendActions(actions = []) {\n return extendStoreActions(this, actions);\n }\n\n deposit(resourceInstance) {\n // this.storage[this.namespace].pushObject(resourceInstance);\n\n return resourceInstance;\n }\n\n serialize(json) {\n return lookup('resource', classify(this.resource), json, this.adapter);\n }\n\n afterFetch(json) {\n return afterFetch(this, json);\n }\n\n create(attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.post(`${this.namespace}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n update(id, attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.put(`${this.namespace}/${id}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findRecord(id, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findAll(options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n query(query = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n queryRecord(query = {}, options = {}) {\n query.single = true;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n destroy(record, options = {}) {\n const id = isResource(record) ? record.getAttribute('id') : record;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.delete(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n}\n\nexport default Store;\n\nexport { extendStoreActions, afterFetch };\n","import 'core-js/stable';\nimport 'regenerator-runtime/runtime';\nimport Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter, Adapter } from './adapters';\nimport { isNodeEnvironment, detectAdapter, isLatitude, isLongitude, Point, isResource, GoogleAddress, Collection, StoreActions } from './utils';\nimport { pluralize, singularize, classify, dasherize, camelize } from './utils/string';\nimport { extendStoreActions } from './store';\nimport { orderActions } from './resources/order';\n\n/**\n * // instance\n * const fleetbase = new Fleetbase();\n *\n * const contact = fleetbase.contacts.create({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * constact.update({ name: 'Hollywood Ron' });\n *\n * // export\n * import { Contact } from '@fleetbase/sdk';\n *\n * const contact = new Contact({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * contact.save();\n */\n\nexport default class Fleetbase {\n /**\n * Builds an instance of the Fleetbase SDK\n *\n * @param {String} publicKey The public key issued\n * @param {Object} config The version of resource to access\n * @param {Boolean} debug Debug mode for SDK\n * @return {Fleetbase} Instance\n */\n constructor(publicKey, config = {}, debug = false) {\n this.version = config.version || 'v1';\n this.options = {\n version: this.version,\n host: config.host || 'https://api.fleetbase.io',\n namespace: this.version || config.namespace,\n debug,\n publicKey,\n };\n\n if (typeof publicKey !== 'string' || publicKey.length === 0) {\n throw new Error('⚠️ Invalid public key given to Fleetbase SDK');\n }\n\n if (!isNodeEnvironment() && publicKey.toLowerCase().startsWith('$')) {\n throw new Error('Secret key provided. You must use a public key with Fleetbase Javascript SDK!');\n }\n\n this.adapter = config.adapter || detectAdapter(this.options);\n\n this.orders = new Store('order', this.adapter).extendActions(orderActions);\n this.entities = new Store('entity', this.adapter);\n this.places = new Store('place', this.adapter);\n this.drivers = new Store('driver', this.adapter);\n this.vehicles = new Store('vehicle', this.adapter);\n this.vendors = new Store('vendor', this.adapter);\n this.contacts = new Store('contact', this.adapter);\n }\n\n static newInstance() {\n return new Fleetbase(...arguments);\n }\n\n setAdapter(adapter) {\n this.adapter = adapter;\n }\n\n getAdapter() {\n return this.adapter;\n }\n}\n\nexport {\n Store,\n Resource,\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n Adapter,\n isNodeEnvironment,\n isLatitude,\n isLongitude,\n Point,\n isResource,\n GoogleAddress,\n Collection,\n StoreActions,\n extendStoreActions,\n pluralize,\n singularize,\n classify,\n dasherize,\n camelize,\n};\n"],"names":["isArray","Array","CHUNK_SIZE","replace","array","start","deleteCount","items","length","splice","i","chunk","slice","isCollection","arr","identityFunction","item","uniqBy","key","ret","seen","Set","getter","get","forEach","val","has","add","push","mixed","Collection","objectAt","index","iter","value","arguments","Boolean","findIndex","predicate","startAt","len","find","callback","target","bind","undefined","any","every","cb","indexOf","withNaNCheck","removeAt","insertAt","this","indexes","map","idx","_this2","object","methodName","args","_item$methodName","filter","sortKeys","sort","a","b","propA","propB","compareValue","compare","includes","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","isBlank","test","isLatitude","coordinate","isFinite","Math","abs","isLongitude","isResource","record","Resource","isNodeEnvironment","process","_typeof","_process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","address_components","reduce","acc","data","types","type","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","keys","pkey","short","short_name","long_name","Point","latitude","longitude","coorindates","lat","lng","serialize","json","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","bindTo","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","store","Store","onAfterFetch","syncAttributes","_this$options","getAttribute","mergeAttributes","setFlags","create","then","response","_this","update","id","destroy","findRecord","_this4","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","hasAttribute","Date","hasAttributes","isNew","isLoaded","property","_this5","call","setAttributes","previousValue","changedAt","setAttribute","attribute","defaultValue","properties","attributeKeys","prop","_this6","modelAttributes","orderActions","getDistanceAndTime","namespace","Order","Payload","entity","waypoints","Entity","Place","owner","googleAddress","street1","street2","province","postal_code","neighborhood","district","building","phone","security_access_code","Waypoint","TrackingStatus","Vehicle","Driver","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","setHeaders","Authorization","publicKey","Promise","resolve","reject","statusText","status","ok","method","fetch","url","mode","Headers","parseJSON","errors","error","query","urlParams","URLSearchParams","toString","request","body","JSON","stringify","NodeAdapter","axios","baseURL","commonHeaders","defaults","common","transform","handleError","post","put","patch","EmberJsAdapter","String","string","chain","RegExp","str","rules","skip","override","toLowerCase","x","match","plural","applyRules","pluralRules","uncountableWords","singular","singularRules","lowFirstLetter","str_path","str_arr","charAt","toUpperCase","substring","first","last","uppercase","underbarPrefix","idSuffix","underbar","capitalize","spaceOrUnderbar","allFirstUpper","camelize","underscore","d","nonTitlecasedWords","pluralize","singularize","dropIdUbar","demodulize","NaN","parseInt","ltd","ld","suf","argz","instance","shift","invoke","dasherize","classify","resources","adapters","Resolver","className","params","extendStoreActions","extend","extendActions","afterFetch","serialized","resourceInstance","deposit","storage","single","_this7","Fleetbase","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts"],"mappings":"2iKAAA,IAAQA,EAAYC,MAAZD,8CCOFE,EAAa,IAIbC,EAAU,SAACC,EAAOC,EAAOC,OAAaC,yDAAQ,MAC5CP,EAAQI,MACJG,EAAMC,QAAUN,EAChBE,EAAMK,aAANL,GAAaC,EAAOC,YAAgBC,SACjC,CACHH,EAAMK,OAAOJ,EAAOC,OAEf,IAAII,EAAI,EAAGA,EAAIH,EAAMC,OAAQE,GAAKR,EAAY,KAC3CS,EAAQJ,EAAMK,MAAMF,EAAGA,EAAIR,GAC/BE,EAAMK,aAANL,GAAaC,EAAQK,EAAG,YAAMC,WAG/BE,EAAaC,MACpBV,EAAMD,QAAQE,EAAOC,EAAaC,IAIpCQ,EAAmB,SAACC,UAASA,GAE7BC,EAAS,SAACb,OAAOc,yDAAMH,EACrBI,EAAM,GACNC,EAAO,IAAIC,IACXC,EAAwB,mBAARJ,EAAqBA,EAAM,SAACF,UAASO,IAAIP,EAAME,WAEnEd,EAAMoB,SAAQ,SAACR,OACPS,EAAMH,EAAON,GACZI,EAAKM,IAAID,KACVL,EAAKO,IAAIF,GACTN,EAAIS,KAAKZ,OAIVG,GAGLN,EAAe,SAACgB,UAAUA,aAAiBC,GAE3CC,EAAW,SAAC3B,EAAO4B,UACjBhC,EAAQI,GACDA,EAAM4B,GACNnB,EAAaT,GACbA,EAAM2B,SAASC,GAGnB,MAGLC,EAAO,SAACf,EAAKgB,UAC0B,IAArBC,EAAU3B,OACP,SAACQ,UAASkB,IAAUlB,EAAKE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,GAAUA,EAAO4F,aAAa,MAAQ5F,SAErD,IAAI4K,oDAAQ,WAAOC,EAASC,yGACRiG,EAAKlM,yBAAkBkM,EAAKvI,sBAAapC,GAAM,GAAItF,GAASkF,KAAK+K,EAAKN,WAAW5T,KAAKkU,UAAajG,UAApH7E,SAEN4E,EAAQ5E,gHC/FC+K,yBASLrG,OAAWN,yDAAS,GAAI4G,4EAC3B5L,QAAUgF,EAAOhF,SAAW,UAC5BvE,QAAU,CACXuE,QAAS/H,KAAK+H,QACdiF,KAAMD,EAAOC,MAAQ,2BACrB9B,UAAWlL,KAAK+H,SAAWgF,EAAO7B,UAClCyI,MAAAA,EACAtG,UAAAA,GAGqB,iBAAdA,GAA+C,IAArBA,EAAUlQ,aACrC,IAAIoM,MAAM,oDAGf3G,MAAuByK,EAAU2C,cAAc4D,WAAW,WACrD,IAAIrK,MAAM,sFAGfhC,QAAUwF,EAAOxF,SAAWhE,GAAcvD,KAAKwD,cAE/CqQ,OAAS,IAAI3L,GAAM,QAASlI,KAAKuH,SAAS2L,cAAclI,SACxD8I,SAAW,IAAI5L,GAAM,SAAUlI,KAAKuH,cACpCwM,OAAS,IAAI7L,GAAM,QAASlI,KAAKuH,cACjCyM,QAAU,IAAI9L,GAAM,SAAUlI,KAAKuH,cACnC0M,SAAW,IAAI/L,GAAM,UAAWlI,KAAKuH,cACrC2M,QAAU,IAAIhM,GAAM,SAAUlI,KAAKuH,cACnC4M,SAAW,IAAIjM,GAAM,UAAWlI,KAAKuH,6CAO9C,SAAWA,QACFA,QAAUA,4BAGnB,kBACWvH,KAAKuH,qCAThB,oBACemM,6BAAa5U"} \ No newline at end of file diff --git a/dist/cjs/fleetbase.js b/dist/cjs/fleetbase.js new file mode 100644 index 0000000..e947e63 --- /dev/null +++ b/dist/cjs/fleetbase.js @@ -0,0 +1,2 @@ +"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0}),require("core-js/stable"),require("regenerator-runtime/runtime");var e=t(require("axios"));function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n3&&void 0!==arguments[3]?arguments[3]:[];if(A(t))if(r.length<=6e4)t.splice.apply(t,[e,n].concat(k(r)));else{t.splice(e,n);for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:0,r=t.length,i=n;i2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0,i=t.length;n<0&&(n+=i);var o=r&&e!=e?function(t){return t!=t}:function(t){return t===e};return _(t,o,n)},C=function(t,e,n){return $(t,e,0,[n]),n},D=function(t){l(n,g(Array));var e=b(n);function n(){for(var t=arguments.length,r=new Array(t),i=0;i0}},{key:"empty",get:function(){return 0===this.length}},{key:"first",get:function(){return O(this,0)}},{key:"last",get:function(){return O(this,this.length-1)}},{key:"replace",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return $(this,t,e,n),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return O(e,t)}))}},{key:"objectAt",value:function(t){return O(this,t)}},{key:"indexOf",value:function(t,e){return F(this,t,e,!1)}},{key:"lastIndexOf",value:function(t,e){var n=this.length;(void 0===e||e>=n)&&(e=n-1),e<0&&(e+=n);for(var r=e;r>=0;r--)if(O(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==F(this,t,e,!0)}},{key:"findBy",value:function(){return P(this,S.apply(void 0,arguments))}},{key:"findIndexBy",value:function(){return _(this,S.apply(void 0,arguments))}},{key:"isEvery",value:function(){return L(this,S.apply(void 0,arguments))}},{key:"isAny",value:function(){return z(this,S.apply(void 0,arguments))}},{key:"invoke",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:E,n=[],r=new Set,i="function"==typeof e?e:function(t){return get(t,e)};return t.forEach((function(t){var e=i(t);r.has(e)||(r.add(e),n.push(t))})),n}(this,t)}},{key:"without",value:function(t){if(!this.includes(t))return this;var e=t==t?function(e){return e!==t}:function(t){return t==t};return this.filter(e)}},{key:"clear",value:function(){var t=this.length;return 0===t||this.replace(0,t,[]),this}},{key:"insertAt",value:function(t,e){return C(this,t,e),this}},{key:"replaceAt",value:function(t,e){return this.replace(t,1,[e])}},{key:"removeAt",value:function(t,e){return function(t,e){return $(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,[]),t}(this,t,e)}},{key:"pushObject",value:function(t){return this.insertAt(this.length,t)}},{key:"pushObjects",value:function(t){return this.replace(this.length,0,t),this}},{key:"popObject",value:function(){var t=this.length;if(0===t)return null;var e=O(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=O(this,0);return this.removeAt(0),t}},{key:"unshiftObject",value:function(t){return C(this,0,t)}},{key:"unshiftObjects",value:function(t){return this.replace(0,0,t),this}},{key:"reverseObjects",value:function(){var t=this.length;if(0===t)return this;var e=this.toArray().reverse();return this.replace(0,t,e),this}},{key:"setObjects",value:function(t){if(0===t.length)return this.clear();var e=this.length;return this.replace(0,e,t),this}},{key:"removeObject",value:function(t){for(var e=this.length||0;--e>=0;){O(this,e)===t&&this.removeAt(e)}return this}},{key:"removeObjects",value:function(t){for(var e=t.length-1;e>=0;e--)this.removeObject(t[e]);return this}},{key:"addObject",value:function(t){return this.includes(t)||this.pushObject(t),this}},{key:"addObjects",value:function(t){var e=this;return t.forEach((function(t){return e.addObject(t)})),this}}]),n}(),T=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=i(t);if("object"===n){var r=t.size;if("number"==typeof r)return!r}if("number"==typeof t.length&&"function"!==n)return!t.length;if("object"===n){var o=t.length;if("number"==typeof o)return!o}return!1},N=function(t){return T(t)||"string"==typeof t&&!1===/\S/.test(t)};function q(t){return t instanceof V}var B=function(){var t,e,n,r,o;return!("undefined"==typeof process||"object"!==i(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(n=e.name)||void 0===n?void 0:n.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(r=window)||void 0===r||null===(o=r.navigator)||void 0===o?void 0:o.product))},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return B()?xt("adapter","NodeAdapter",t):xt("adapter","BrowserAdapter",t)},I=Array.isArray,J=function(){function t(e){u(this,t),this.place=e,this.geometry=null==e?void 0:e.geometry,this.components=this.parseComponents(),this.attributes=this.parseProperties()}return c(t,[{key:"parse",value:function(){this.parseComponents(),this.parseProperties()}},{key:"parseComponents",value:function(){var t;return((null===(t=this.place)||void 0===t?void 0:t.address_components)||[]).reduce((function(t,e){return e.types.forEach((function(n){t[n]=e})),t}),{})}},{key:"parseProperties",value:function(){var t,e={streetNumber:this.get("street_number"),streetName:this.get("route"),coordinates:null!==(t=this.geometry)&&void 0!==t&&t.location?Object.values(this.geometry.location):[0,0],city:this.or(["locality","sublocality","sublocality_level_1","neighborhood","administrative_area_level_3","administrative_area_level_2"]),county:this.get("administrative_area_level_2"),stateShort:this.get("administrative_area_level_1",!0),stateLong:this.get("administrative_area_level_1"),countryShort:this.get("country",!0),country:this.get("country",!0),countryLong:this.get("country"),postalCode:this.get("postal_code")};return e.address=[e.streetNumber,e.streetName].filter(Boolean).join(" "),e}},{key:"all",value:function(){return this.attributes}},{key:"or",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e1&&void 0!==arguments[1]&&arguments[1];return t in this.components?e?this.components[t].short_name:this.components[t].long_name:null}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.attributes=r(r({},this.attributes),t),this}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"getAttribute",value:function(t){return this.attributes[t]||null}}]),t}(),M=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;u(this,t),this.type="Point",this.coordinates=[n,e]}return c(t,[{key:"latitude",get:function(){return this.coordinates[1]}},{key:"longitude",get:function(){return this.coordinates[0]}},{key:"lat",value:function(){return this.latitude}},{key:"lng",value:function(){return this.longitude}},{key:"serialize",value:function(){return{type:"Point",coorindates:[this.lat(),this.lng()]}}},{key:"toJson",value:function(){return this.serialize()}},{key:"toString",value:function(){return"(".concat(this.latitude,", ").concat(this.longitude,")")}}],[{key:"fromGeoJson",value:function(e){var n=m(e.coordinates,2);return longitude=n[0],latitude=n[1],new t(latitude,longitude)}}]),t}();"undefined"==typeof arguments||arguments;var W=function(t,e){var n=t();return Array.isArray(n)||"object"===i(n)?K(n,e):null},K=function t(e,n){var r,o=e,s=i(e),u="object"===s,a="function"===s,c=Array.isArray(e),h="string"===i(n)&&n.includes(".")?n.split("."):[n];if(c||u){for(var l=0;l0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;u(this,t),this.actions=e,this.bind=n}return c(t,[{key:"extend",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=t||this.bind;if(!e)return this;if(null!=this&&this.actions&&"object"===i(this.actions))for(var n in this.actions){var r=this.actions[n];"function"==typeof r?G(e,n,r.bind(e)):G(e,n,r)}return this}}]),t}(),V=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};u(this,t),this.attributes=e,this.dirtyAttributes={},this.changes={},this.isLoading=!1,this.isSaving=!1,this.isDestroying=!1,this.isReloading=!1,this.resource=r,this.options=i,this.version=i.version||"v1",this.setAdapter(n)}return c(t,[{key:"setAdapter",value:function(t){var e;return this.adapter=t,this.store=new Rt(this.resource,t,{onAfterFetch:this.syncAttributes.bind(this),actions:null===(e=this.options)||void 0===e?void 0:e.actions}),this}},{key:"id",get:function(){return this.getAttribute("id")}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.mergeAttributes(e);return this.setFlags(["isLoading","isSaving"]),this.store.create(n).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setFlags(["isLoading","isSaving"]),this.store.update(this.attributes.id,e).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"destroy",value:function(){var t=this;return this.setFlags(["isLoading","isDestroying"]),this.store.destroy(this.attributes.id).then((function(e){return t.setFlags(["isLoading","isDestroying"],!1),e}))}},{key:"reload",value:function(){var t=this;return this.setFlags(["isLoading","isReloading"]),this.store.findRecord(this.attributes.id).then((function(e){return t.reset(),e}))}},{key:"setFlags",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=["isLoading","isSaving","isReloading","isDestroying"],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAttributes();return T(this.id)?this.create(e):!0===t.onlyDirty?this.savedirty():this.update(e)}},{key:"saveDirty",value:function(){for(var t=Object.keys(this.dirtyAttributes),e={},n=0;n0}},{key:"mutate",value:function(t,e){this.attributes[t]=e}},{key:"setAttribute",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null===e&&"object"===i(t))return this.setAttributes(t);var n=this.attributes[t]||null;return G(this.attributes,t,e),G(this.dirtyAttributes,t,n),A(this.changes[t])||(this.changes[t]=[]),this.changes[t].push({property:t,previousValue:n,value:e,changedAt:new Date}),this}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in t)this.setAttribute(e,t[e]);return this}},{key:"getAttribute",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=K(this.attributes,t);return void 0===n?e:n}},{key:"hasAttribute",value:function(t){if(A(t)){var e,n=t,r=Object.keys(null!==(e=this.attributes)&&void 0!==e?e:{});return n.every((function(t){return r.includes(t)}))}return!!this.attributes&&t in this.attributes}},{key:"hasAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.hasAttribute(t)}},{key:"isAttributeFilled",value:function(t){var e=this;return A(t)?this.hasAttribute(t)&&t.every((function(t){return!T(e.getAttribute(t))})):this.hasAttribute(t)&&!T(this.getAttribute(t))}},{key:"getAttributes",value:function(t){var e={};if(null==t)return this.attributes;if("string"==typeof t)return this.getAttribute(Array.prototype.slice.call(arguments));if(!A(t))throw new Error("No attribute properties provided!");for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},e=this.attributes||{};return this.attributes=r(r({},e),t),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),Z=new H({getDistanceAndTime:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/distance-and-time"),{},e)}}),Q=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,i,"order",r({actions:Z},o))}return c(n,[{key:"getDistanceAndTime",value:function(){return this.store.getDistanceAndTime(this.id)}}]),n}(),Y=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"payload",i)}return c(n,[{key:"attach",value:function(t){}},{key:"entities",get:function(){}},{key:"dropoff",get:function(){}},{key:"pickup",get:function(){}},{key:"waypoints",get:function(){return new D(this.waypoints)}}]),n}(),X=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"entity",i)}return n}(),tt=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"place",i)}return c(n,[{key:"latitude",get:function(){return this.getAttribute("location",new M).coordinates[1]}},{key:"longitude",get:function(){return this.getAttribute("location",new M).coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return q(t)&&this.setAttribute("owner",t.id),"string"==typeof t&&this.setAttribute("owner",t),this}}],[{key:"fromGoogleAddress",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.getAttribute("coordinates"),o=m(i,2),s=o[0],u=o[1],a={name:null,address:t.getAttribute("address"),location:new M(s,u),street1:t.getAttribute("streetName"),street2:null,city:t.getAttribute("city"),province:t.getAttribute("stateLong"),postal_code:t.getAttribute("postalCode"),neighborhood:t.get("neighborhood"),district:t.getAttribute("county"),building:t.get("building"),country:t.getAttribute("countryShort"),phone:null,security_access_code:null};return new n(a,e,r)}}]),n}(),et=function(t){l(n,tt);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"waypoint",i)}return n}(),nt=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"tracking-status",i)}return n}(),rt=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"vehicle",i)}return n}(),it=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"driver",i)}return n}(),ot=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"vendor",i)}return n}(),st=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"contact",i)}return n}(),ut=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"zone",i)}return n}(),at=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"service-area",i)}return n}(),ct=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"service-rate",i)}return n}(),ht=function(t){l(n,V);var e=b(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u(this,n),e.call(this,t,r,"service-quote",i)}return c(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(),lt=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,t),this.version=e.version||"v1",this.host=e.host||null,this.namespace=e.namespace||null,this.headers=e.headers||{}},ft=function(t){l(n,lt);var e=b(n);function n(t){var r;return u(this,n),(r=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),r}return c(n,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=r(r({},this.headers),t),this}},{key:"parseJSON",value:function(t){return new Promise((function(e,n){return t.json().then((function(n){return e({statusText:t.statusText,status:t.status,ok:t.ok,json:n})})).catch((function(){n(new Error("Oops! Something went wrong when handling your request."))}))}))}},{key:"request",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(s,u){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),r({method:n,mode:o.mode||"cors",headers:new Headers(r(r({},e.headers||{}),o.headers||{}))},i)).then(e.parseJSON).then((function(t){return t.ok?s(t.json):u(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){u(t)}))}))}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=N(e)?"":new URLSearchParams(e).toString();return this.request("".concat(t).concat(r?"?".concat(r):""),"GET",{},n)}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"POST",{body:JSON.stringify(e)},n)}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PUT",{body:JSON.stringify(e)},n)}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request(t,"DELETE",{},e)}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PATCH",{body:JSON.stringify(e)},n)}}]),n}(),vt=function(t){l(i,lt);var n=b(i);function i(t){var r;return u(this,i),(r=n.call(this,t)).axios=e.default.create({baseURL:"".concat(r.host,"/").concat(r.namespace),headers:{Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;node"}}),r}return c(i,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.axios.defaults.headers.common;return this.axios.defaults.headers.common=r(r({},e),t),this}},{key:"transform",value:function(t){return t.data}},{key:"handleError",value:function(t){if(t.response){var e=t.response.data;if(A(e.errors))throw new Error(e.errors[0]);if(e.error)throw new Error(e.error)}throw t}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=N(e)?"":new URLSearchParams(e).toString();return this.axios.get("".concat(t).concat(r?"?".concat(r):""),n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.post(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.put(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.axios.delete(t,e).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.patch(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}}]),i}(),dt=function(t){l(n,lt);var e=b(n);function n(){return u(this,n),e.apply(this,arguments)}return n}(),pt=function(){function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];u(this,t),h(this,"uncountableWords",["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"]),h(this,"pluralRules",[[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]]),h(this,"singularRules",[[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("s$","gi"),""]]),h(this,"nonTitlecasedWords",["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"]),h(this,"idSuffix",new RegExp("(_ids|_id)$","g")),h(this,"underbar",new RegExp("_","g")),h(this,"spaceOrUnderbar",new RegExp("[ _]","g")),h(this,"uppercase",new RegExp("([A-Z])","g")),h(this,"underbarPrefix",new RegExp("^_")),this.str=e,this.chain=n}return c(t,[{key:"get",value:function(){return this.str}},{key:"applyRules",value:function(t,e,n,r){if(r)t=r;else if(!(n.indexOf(t.toLowerCase())>-1))for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:null;return t=t||this.str,this.applyRules(t,this.pluralRules,this.uncountableWords,e)}},{key:"singularize",value:function(t,e){return t=t||this.str,this.applyRules(t,this.singularRules,this.uncountableWords,e)}},{key:"camelize",value:function(t,e){for(var n=(t=t||this.str).split("/"),r=0;r1&&void 0!==arguments[1]&&arguments[1];return t=t||this.str,t=this.underscore(this.demodulize(t))+(e?"":"_")+"id",this.str=t,!0===this.chain?this:t}},{key:"ordinalize",value:function(t){for(var e=(t=t||this.str).split(" "),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];if(t.actions=A(e)?e:[e],!A(e))return e instanceof H&&e.extend(t),t;for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};u(this,t),this.resource=e,this.adapter=n||U(),this.namespace=gt(e),this.storage=new D,this.options=r,this.extendActions(r.actions)}return c(t,[{key:"extendActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return At(this,t)}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return xt("resource",bt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),A(e)){for(var n=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=s(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.post("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"update",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(){var i=s(regeneratorRuntime.mark((function i(o,s){var u;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,e.adapter.put("".concat(e.namespace,"/").concat(t),n,r).then(e.afterFetch.bind(e)).catch(s);case 2:u=i.sent,o(u);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"findRecord",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=s(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.adapter.get("".concat(e.namespace,"/").concat(t),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"findAll",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(){var n=s(regeneratorRuntime.mark((function n(r,i){var o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.adapter.get("".concat(t.namespace),{},e).then(t.afterFetch.bind(t)).catch(i);case 2:o=n.sent,r(o);case 4:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}())}},{key:"query",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=s(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"queryRecord",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.single=!0,new Promise(function(){var r=s(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"destroy",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=q(t)?t.getAttribute("id"):t;return new Promise(function(){var t=s(regeneratorRuntime.mark((function t(i,o){var s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.adapter.delete("".concat(e.namespace,"/").concat(r),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=t.sent,i(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),$t=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(u(this,t),this.version=n.version||"v1",this.options={version:this.version,host:n.host||"https://api.fleetbase.io",namespace:this.version||n.namespace,debug:r,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!B()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=n.adapter||U(this.options),this.orders=new Rt("order",this.adapter).extendActions(Z),this.entities=new Rt("entity",this.adapter),this.places=new Rt("place",this.adapter),this.drivers=new Rt("driver",this.adapter),this.vehicles=new Rt("vehicle",this.adapter),this.vendors=new Rt("vendor",this.adapter),this.contacts=new Rt("contact",this.adapter)}return c(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return p(t,Array.prototype.slice.call(arguments))}}]),t}();exports.Adapter=lt,exports.BrowserAdapter=ft,exports.Collection=D,exports.Contact=st,exports.Driver=it,exports.EmberJsAdapter=dt,exports.Entity=X,exports.GoogleAddress=J,exports.NodeAdapter=vt,exports.Order=Q,exports.Payload=Y,exports.Place=tt,exports.Point=M,exports.Resource=V,exports.ServiceArea=at,exports.ServiceQuote=ht,exports.ServiceRate=ct,exports.Store=Rt,exports.StoreActions=H,exports.TrackingStatus=nt,exports.Vehicle=rt,exports.Vendor=ot,exports.Waypoint=et,exports.Zone=ut,exports.camelize=function(){var t=["camelize"].concat(Array.prototype.slice.call(arguments));return pt.invoke.apply(pt,k(t))},exports.classify=bt,exports.dasherize=function(){var t=["dasherize"].concat(Array.prototype.slice.call(arguments));return pt.invoke.apply(pt,k(t))},exports.default=$t,exports.extendStoreActions=At,exports.isLatitude=function(t){return isFinite(t)&&Math.abs(t)<=90},exports.isLongitude=function(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90},exports.isNodeEnvironment=B,exports.isResource=q,exports.pluralize=gt,exports.singularize=yt; +//# sourceMappingURL=fleetbase.js.map diff --git a/dist/cjs/fleetbase.js.map b/dist/cjs/fleetbase.js.map new file mode 100644 index 0000000..30876b7 --- /dev/null +++ b/dist/cjs/fleetbase.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fleetbase.js","sources":["../../src/utils/array.js","../../src/utils/collection.js","../../src/utils/is-empty.js","../../src/utils/is-blank.js","../../src/utils/is-resource.js","../../src/utils/is-node-environment.js","../../src/utils/detect-adapter.js","../../src/utils/google-address.js","../../src/utils/point.js","../../src/utils/object.js","../../src/utils/store-actions.js","../../src/resource.js","../../src/resources/order.js","../../src/resources/payload.js","../../src/resources/entity.js","../../src/resources/place.js","../../src/resources/waypoint.js","../../src/resources/tracking-status.js","../../src/resources/vehicle.js","../../src/resources/driver.js","../../src/resources/vendor.js","../../src/resources/contact.js","../../src/resources/zone.js","../../src/resources/service-area.js","../../src/resources/service-rate.js","../../src/resources/service-quote.js","../../src/adapter.js","../../src/adapters/browser.js","../../src/adapters/node.js","../../src/adapters/ember.js","../../src/utils/string.js","../../src/resolver.js","../../src/store.js","../../src/fleetbase.js","../../src/utils/is-latitude.js","../../src/utils/is-longitude.js"],"sourcesContent":["const { isArray } = Array;\n\nexport {\n isArray\n};\n","import { isArray } from './array';\n\n/**\n * Collection\n * Extended array inspired by Ember's NativeArray\n **/\n\nconst CHUNK_SIZE = 60000;\n\n// To avoid overflowing the stack, we splice up to CHUNK_SIZE items at a time.\n// See https://code.google.com/p/chromium/issues/detail?id=56588 for more details.\nconst replace = (array, start, deleteCount, items = []) => {\n if (isArray(array)) {\n if (items.length <= CHUNK_SIZE) {\n array.splice(start, deleteCount, ...items);\n } else {\n array.splice(start, deleteCount);\n\n for (let i = 0; i < items.length; i += CHUNK_SIZE) {\n let chunk = items.slice(i, i + CHUNK_SIZE);\n array.splice(start + i, 0, ...chunk);\n }\n }\n } else if (isCollection(arr)) {\n array.replace(start, deleteCount, items);\n }\n};\n\nconst identityFunction = (item) => item;\n\nconst uniqBy = (array, key = identityFunction) => {\n let ret = [];\n let seen = new Set();\n let getter = typeof key === 'function' ? key : (item) => get(item, key);\n\n array.forEach((item) => {\n let val = getter(item);\n if (!seen.has(val)) {\n seen.add(val);\n ret.push(item);\n }\n });\n\n return ret;\n};\n\nconst isCollection = (mixed) => mixed instanceof Collection;\n\nconst objectAt = (array, index) => {\n if (isArray(array)) {\n return array[index];\n } else if (isCollection(array)) {\n return array.objectAt(index);\n }\n\n return null;\n};\n\nconst iter = (key, value) => {\n let valueProvided = arguments.length === 2;\n return valueProvided ? (item) => value === item[key] : (item) => Boolean(item[key]);\n};\n\nconst findIndex = (array, predicate, startAt = 0) => {\n let len = array.length;\n for (let index = startAt; index < len; index++) {\n let item = objectAt(array, index);\n if (predicate(item, index, array)) {\n return index;\n }\n }\n return -1;\n};\n\nconst find = (array, callback, target) => {\n let predicate = callback.bind(target);\n let index = findIndex(array, predicate, 0);\n return index === -1 ? undefined : objectAt(array, index);\n};\n\nconst any = (array, callback, target) => {\n let predicate = callback.bind(target);\n return findIndex(array, predicate, 0) !== -1;\n};\n\nconst every = (array, callback, target) => {\n let cb = callback.bind(target);\n let predicate = (item, index, array) => !cb(item, index, array);\n return findIndex(array, predicate, 0) === -1;\n};\n\nconst indexOf = (array, val, startAt = 0, withNaNCheck) => {\n let len = array.length;\n\n if (startAt < 0) {\n startAt += len;\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = withNaNCheck && val !== val ? (item) => item !== item : (item) => item === val;\n return findIndex(array, predicate, startAt);\n};\n\nconst removeAt = (array, index, len = 1) => {\n replace(array, index, len, []);\n return array;\n};\n\nconst insertAt = (array, index, item) => {\n replace(array, index, 0, [item]);\n return item;\n};\n\nclass Collection extends Array {\n constructor(...items) {\n if (isArray(arguments[0])) {\n super(...arguments[0]);\n } else {\n super(...arguments);\n }\n }\n\n get notEmpty() {\n return this.length > 0;\n }\n\n get empty() {\n return this.length === 0;\n }\n\n get first() {\n return objectAt(this, 0);\n }\n\n get last() {\n return objectAt(this, this.length - 1);\n }\n\n replace(start, deleteCount, items = []) {\n replace(this, start, deleteCount, items);\n\n return this;\n }\n\n objectsAt(indexes) {\n return indexes.map((idx) => objectAt(this, idx));\n }\n\n objectAt(index) {\n return objectAt(this, index);\n }\n\n indexOf(object, startAt) {\n return indexOf(this, object, startAt, false);\n }\n\n lastIndexOf(object, startAt) {\n let len = this.length;\n\n if (startAt === undefined || startAt >= len) {\n startAt = len - 1;\n }\n\n if (startAt < 0) {\n startAt += len;\n }\n\n for (let idx = startAt; idx >= 0; idx--) {\n if (objectAt(this, idx) === object) {\n return idx;\n }\n }\n\n return -1;\n }\n\n includes(object, startAt) {\n return indexOf(this, object, startAt, true) !== -1;\n }\n\n findBy() {\n return find(this, iter(...arguments));\n }\n\n findIndexBy() {\n return findIndex(this, iter(...arguments));\n }\n\n isEvery() {\n return every(this, iter(...arguments));\n }\n\n isAny() {\n return any(this, iter(...arguments));\n }\n\n invoke(methodName, ...args) {\n let ret = [];\n\n this.forEach((item) => ret.push(item[methodName]?.(...args)));\n\n return ret;\n }\n\n toArray() {\n return this.map((item) => item);\n }\n\n compact() {\n return this.filter((value) => value != null);\n }\n\n sortBy() {\n let sortKeys = arguments;\n\n return this.sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n let key = sortKeys[i];\n let propA = a[key];\n let propB = b[key];\n // return 1 or -1 else continue to the next sortKey\n let compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n }\n\n uniqBy(key) {\n return uniqBy(this, key);\n }\n\n without(value) {\n if (!this.includes(value)) {\n return this; // nothing to do\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = value === value ? (item) => item !== value : (item) => item === item;\n return this.filter(predicate);\n }\n\n clear() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n this.replace(0, len, []);\n return this;\n }\n\n insertAt(idx, object) {\n insertAt(this, idx, object);\n return this;\n }\n\n replaceAt(idx, object) {\n return this.replace(idx, 1, [object]);\n }\n\n removeAt(start, len) {\n return removeAt(this, start, len);\n }\n\n pushObject(obj) {\n return this.insertAt(this.length, obj);\n }\n\n pushObjects(objects) {\n this.replace(this.length, 0, objects);\n return this;\n }\n\n popObject() {\n let len = this.length;\n if (len === 0) {\n return null;\n }\n\n let ret = objectAt(this, len - 1);\n this.removeAt(len - 1, 1);\n return ret;\n }\n\n shiftObject() {\n if (this.length === 0) {\n return null;\n }\n\n let ret = objectAt(this, 0);\n this.removeAt(0);\n return ret;\n }\n\n unshiftObject(obj) {\n return insertAt(this, 0, obj);\n }\n\n unshiftObjects(objects) {\n this.replace(0, 0, objects);\n return this;\n }\n\n reverseObjects() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n let objects = this.toArray().reverse();\n this.replace(0, len, objects);\n return this;\n }\n\n setObjects(objects) {\n if (objects.length === 0) {\n return this.clear();\n }\n\n let len = this.length;\n this.replace(0, len, objects);\n return this;\n }\n\n removeObject(obj) {\n let loc = this.length || 0;\n while (--loc >= 0) {\n let curObject = objectAt(this, loc);\n\n if (curObject === obj) {\n this.removeAt(loc);\n }\n }\n return this;\n }\n\n removeObjects(objects) {\n for (let i = objects.length - 1; i >= 0; i--) {\n this.removeObject(objects[i]);\n }\n\n return this;\n }\n\n addObject(obj) {\n let included = this.includes(obj);\n\n if (!included) {\n this.pushObject(obj);\n }\n\n return this;\n }\n\n addObjects(objects) {\n objects.forEach((obj) => this.addObject(obj));\n return this;\n }\n}\n\nexport default Collection;\n\nexport { replace, uniqBy, isCollection, objectAt, iter, findIndex, find, any, every, indexOf, removeAt, insertAt };\n","const isEmpty = (obj) => {\n const none = obj === null || obj === undefined;\n if (none) {\n return none;\n }\n\n if (typeof obj.size === 'number') {\n return !obj.size;\n }\n\n const objectType = typeof obj;\n\n if (objectType === 'object') {\n const { size } = obj;\n if (typeof size === 'number') {\n return !size;\n }\n }\n\n if (typeof obj.length === 'number' && objectType !== 'function') {\n return !obj.length;\n }\n\n if (objectType === 'object') {\n const { length } = obj;\n if (typeof length === 'number') {\n return !length;\n }\n }\n\n return false;\n};\n\nexport default isEmpty;\n","import isEmpty from './is-empty';\n\nconst isBlank = (obj) => isEmpty(obj) || (typeof obj === 'string' && /\\S/.test(obj) === false);\n\nexport default isBlank;\n","import Resource from '../resource';\n\nexport default function isResource(record) {\n return record instanceof Resource;\n}\n","/**\n * Determines if environment SDK is initialized in is Node, additionally checks pass if environment is ReactNative.\n * \n * @returns boolean\n */\nconst isNodeEnvironment = () => {\n return (typeof process !== 'undefined') && (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) && (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative');\n};\n\nexport default isNodeEnvironment;","import { lookup } from '../resolver';\nimport isNodeEnvironment from './is-node-environment';\n\nconst detectAdapter = (options = {}) => {\n if (isNodeEnvironment()) {\n return lookup('adapter', 'NodeAdapter', options);\n }\n\n return lookup('adapter', 'BrowserAdapter', options);\n}\n\nexport default detectAdapter;","const { isArray } = Array;\n\nclass GoogleAddress {\n constructor(place) {\n this.place = place;\n this.geometry = place?.geometry;\n this.components = this.parseComponents();\n this.attributes = this.parseProperties();\n }\n\n parse() {\n this.parseComponents();\n this.parseProperties();\n }\n\n parseComponents() {\n const components = (this.place?.address_components || []).reduce(function (acc, data) {\n data.types.forEach(function (type) {\n acc[type] = data;\n });\n return acc;\n }, {});\n\n return components;\n }\n\n parseProperties() {\n const attributes = {\n streetNumber: this.get('street_number'),\n streetName: this.get('route'),\n coordinates: this.geometry?.location ? Object.values(this.geometry.location) : [0, 0],\n city: this.or(['locality', 'sublocality', 'sublocality_level_1', 'neighborhood', 'administrative_area_level_3', 'administrative_area_level_2']),\n county: this.get('administrative_area_level_2'),\n stateShort: this.get('administrative_area_level_1', true),\n stateLong: this.get('administrative_area_level_1'),\n countryShort: this.get('country', true),\n country: this.get('country', true),\n countryLong: this.get('country'),\n postalCode: this.get('postal_code'),\n };\n\n attributes.address = [attributes.streetNumber, attributes.streetName].filter(Boolean).join(' ');\n\n return attributes;\n }\n\n all() {\n return this.attributes;\n }\n\n or(keys = []) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (isArray(key)) {\n const pkey = key[0];\n const short = key[1];\n\n if (this.has(pkey)) {\n return this.get(pkey, short);\n }\n\n continue;\n }\n\n if (this.has(key)) {\n return this.get(key);\n }\n }\n\n return null;\n }\n\n has(key) {\n return (key in this.components);\n }\n\n get(key, short = false) {\n if (!(key in this.components)) {\n return null;\n }\n\n return short ? this.components[key].short_name : this.components[key].long_name;\n }\n\n setAttributes(attributes = {}) {\n this.attributes = {...this.attributes, ...attributes};\n\n return this;\n }\n\n setAttribute(key, value) {\n this.attributes[key] = value;\n\n return this;\n }\n\n getAttribute(key) {\n return this.attributes[key] || null;\n }\n}\n\nexport default GoogleAddress;\n","export default class Point {\n constructor(latitude = 0, longitude = 0) {\n this.type = 'Point';\n this.coordinates = [longitude, latitude];\n }\n\n get latitude() {\n return this.coordinates[1];\n }\n\n get longitude() {\n return this.coordinates[0];\n }\n\n lat() {\n return this.latitude;\n }\n\n lng() {\n return this.longitude;\n }\n\n static fromGeoJson(json) {\n [ longitude, latitude ] = json.coordinates;\n\n return new Point(latitude, longitude);\n }\n\n serialize() {\n return {\n type: 'Point',\n coorindates: [this.lat(), this.lng()]\n };\n }\n\n toJson() {\n return this.serialize();\n }\n\n toString() {\n return `(${this.latitude}, ${this.longitude})`;\n }\n}","import isEmpty from './is-empty';\n\nconst isResource = (mixed) => typeof mixed === 'object' && !isEmpty(mixed?.attributes) && typeof mixed?.attributes === 'object';\n\nconst isCallable = (object, property) => typeof object[property] === 'function';\n\nconst getResolved = (func, path) => {\n const resolved = func();\n return Array.isArray(resolved) || typeof resolved === 'object' ? get(resolved, path) : null;\n};\n\nconst invoke = (object, method) => {\n if (typeof object[method] === 'function') {\n return object[method].bind(object);\n }\n};\n\nconst get = (object, path) => {\n let current = object;\n\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n\n if (isArray || isObject) {\n for (let i = 0; i < pathArray.length; i++) {\n if (current && current[pathArray[i]] === undefined) {\n return null;\n } else if (current) {\n current = current[pathArray[i]];\n\n // if is resource then return get on it's attributes\n if (isResource(current) && pathArray[i + 1] !== undefined) {\n const newPath = pathArray.slice(i + 1).join('.');\n\n return get(current.attributes, newPath);\n }\n\n // resolve functions and continue\n if (typeof current === 'function') {\n const newPath = pathArray.slice(i + 1).join('.');\n return getResolved(current, newPath);\n }\n }\n }\n return current;\n }\n\n if (isFunction) {\n return getResolved(object, path);\n }\n};\n\nconst getProperties = (object, properties = []) => {\n const selected = {};\n let propertyNames = arguments;\n let i = 1;\n\n if (arguments.length === 2 && Array.isArray(properties)) {\n i = 0;\n propertyNames = arguments[1];\n }\n\n for (; i < propertyNames.length; i++) {\n selected[propertyNames[i]] = get(object, propertyNames[i]);\n }\n\n return selected;\n};\n\nconst set = (object, path, value) => {\n let current = object;\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n // if is function\n if (isFunction) {\n // throw error should be object or array or object like\n }\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n const iterations = pathArray.length;\n\n if (isArray || isObject) {\n for (let i = 0; i < iterations - 1; i++) {\n if (!current[pathArray[i]]) {\n current[pathArray[i]] = {};\n }\n current = current[pathArray[i]];\n }\n\n current[pathArray[iterations - 1]] = value;\n }\n\n return value;\n};\n\nconst setProperties = (object, properties = {}) => {\n for (const property in properties) {\n set(object, property, properties[property]);\n }\n\n return object;\n};\n\nconst extend = (target, classes = []) => {\n if (arguments.length > 1) {\n classes = arguments;\n }\n for (let index = 0; index < classes.length; index++) {\n for (const property in classes[index]) {\n if (Object.prototype.hasOwnProperty.call(classes[index], property)) {\n target[property] = classes[index][property];\n }\n }\n }\n return target;\n};\n\nexport { set, get, getProperties, setProperties, extend, isCallable, invoke };\n","import { set } from './object';\n\nexport default class StoreActions {\n constructor(actions = {}, bind = null) {\n this.actions = actions;\n this.bind = bind;\n }\n\n extend(bindTo = null) {\n const binding = bindTo || this.bind;\n\n if (!binding) {\n return this;\n }\n\n if (this?.actions && typeof this.actions === 'object') {\n for (let action in this.actions) {\n const fn = this.actions[action];\n\n if (typeof fn !== 'function') {\n set(binding, action, fn);\n continue;\n }\n\n set(binding, action, fn.bind(binding));\n }\n }\n\n return this;\n }\n}\n","import Store from './store';\nimport { isEmpty } from './utils';\nimport { isArray } from './utils/array';\nimport { set, get } from './utils/object';\n\nclass Resource {\n /**\n\t * The base resource for all resources\n\n\t * @return {[type]} [description]\n\t */\n constructor(attributes = {}, adapter, resource, options = {}) {\n this.attributes = attributes;\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isDestroying = false;\n this.isReloading = false;\n this.resource = resource;\n this.options = options;\n this.version = options.version || 'v1';\n this.setAdapter(adapter);\n }\n\n /**\n * Set a new adapter to the resource instance, this will update the Store instance\n *\n * @param {Adapter} adapter\n * @return {Resource} this\n */\n setAdapter(adapter) {\n this.adapter = adapter;\n this.store = new Store(this.resource, adapter, {\n onAfterFetch: this.syncAttributes.bind(this),\n actions: this.options?.actions\n });\n\n return this;\n }\n\n /**\n * Getter for id attribute\n *\n * @var {String}\n */\n get id() {\n return this.getAttribute('id');\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n create(attributes = {}) {\n const data = this.mergeAttributes(attributes);\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.create(data).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n update(attributes = {}) {\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.update(this.attributes.id, attributes).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Deletes the resource instance on the server\n *\n * @return {[type]} [description]\n */\n destroy() {\n this.setFlags(['isLoading', 'isDestroying']);\n\n return this.store.destroy(this.attributes.id).then((response) => {\n this.setFlags(['isLoading', 'isDestroying'], false);\n\n return response;\n });\n }\n\n /**\n * Reloads the resource from the server.\n *\n * @return {[type]} [description]\n */\n reload() {\n this.setFlags(['isLoading', 'isReloading']);\n\n return this.store.findRecord(this.attributes.id).then((response) => {\n this.reset();\n\n return response;\n });\n }\n\n /**\n * Sets flag properties.\n *\n * @return this\n */\n setFlags(flags = [], state = true) {\n const validFlags = ['isLoading', 'isSaving', 'isReloading', 'isDestroying'];\n\n for(let i = 0; i < flags.length; i++) {\n const flag = flags[i];\n\n if (typeof flag !== 'string' || !validFlags.includes(flag)) {\n throw new Error(`${flag} is not a valid flag!`);\n }\n\n this[flag] = state;\n }\n\n return this;\n }\n\n /**\n * Resets tracked properties\n *\n * @return this\n */\n reset() {\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isReloading = false;\n\n return this;\n }\n\n /**\n * Emptys resource.\n *\n * @return this\n */\n empty() {\n this.reset();\n this.attribues = {};\n\n return this;\n }\n\n /**\n * Saves the resource instance on the server\n *\n * @return {[type]} [description]\n */\n save(options = {}) {\n const attributes = this.getAttributes();\n\n if (isEmpty(this.id)) {\n return this.create(attributes);\n }\n\n if (options.onlyDirty === true) {\n return this.savedirty();\n }\n\n return this.update(attributes);\n }\n\n /**\n * Saves only dirtied attributes.\n *\n * @return {[type]} [description]\n */\n saveDirty() {\n const dirtyAttributeKeys = Object.keys(this.dirtyAttributes);\n const dirtyAttributes = {};\n\n for (let i = 0; i < dirtyAttributeKeys.length; i++) {\n const key = dirtyAttributeKeys[i];\n dirtyAttributes[key] = this.getAttribute(key);\n }\n\n return this.update(dirtyAttributes);\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get createdAt() {\n return this.hasAttribute('created_at') ? new Date(this.getAttribute('created_at')) : null;\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get updatedAt() {\n return this.hasAttribute('updated_at') ? new Date(this.getAttribute('updated_at')) : null;\n }\n\n /**\n * Checks if resource is loaded from the server.\n *\n * @return {Boolean}\n */\n get isLoaded() {\n return this.hasAttributes(['created_at', 'id']);\n }\n\n /**\n * Checks if resource ihas no attributes\n *\n * @return {Boolean}\n */\n get isEmpty() {\n return Object.values(this.attributes).length === 0;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isNew() {\n return !this.id;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isSaved() {\n return !this.isNew && this.isLoaded;\n }\n\n /**\n * Checks if resource is deleted on server.\n *\n * @return {Boolean}\n */\n get isDeleted() {\n return this.hasAttributes(['deleted', 'time']);\n }\n\n /**\n * Iterates over each attribute value and property executing a user supplied callback.\n *\n * @return {Object}\n */\n eachAttribute(callback) {\n if (typeof callback !== 'function') {\n return this;\n }\n\n Object.keys(this.attributes).forEach((property) => {\n const value = this.getAttribute(property);\n callback.call(this, value, property);\n });\n\n return this;\n }\n\n /**\n * Gets all changes\n *\n * @return {Object}\n */\n changes() {\n return this.changes;\n }\n\n /**\n * Gets all dirty attributes.\n *\n * @return {Object}\n */\n getDirtyAttributes() {\n return this.dirtyAttributes;\n }\n\n /**\n * Checks if property is dirty.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n isDirty(property) {\n return property in this.dirtyAttributes;\n }\n\n /**\n * Checks if any properties is dirty.\n *\n * @return {Boolean}\n */\n hasDirtyAttributes() {\n return Object.keys(this.dirtyAttributes).length > 0;\n }\n\n /**\n * Updates a instance property without tracking changes or dirtying attribute.\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n mutate(property, value) {\n this.attributes[property] = value;\n }\n\n /**\n * Set an instance property locally\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n setAttribute(property, value = null) {\n if (value === null && typeof property === 'object') {\n return this.setAttributes(property);\n }\n\n const previousValue = this.attributes[property] || null;\n\n // use object setter\n set(this.attributes, property, value);\n set(this.dirtyAttributes, property, previousValue);\n \n // this.attributes[property] = value;\n // this.dirtyAttributes[property] = previousValue;\n\n // track changes\n if (!isArray(this.changes[property])) {\n this.changes[property] = [];\n }\n\n this.changes[property].push({\n property,\n previousValue,\n value,\n changedAt: new Date(),\n });\n\n return this;\n }\n\n /**\n * Set multiple instance properties locally\n *\n * @param {Object} properties [description]\n */\n setAttributes(attributes = {}) {\n for (let property in attributes) {\n this.setAttribute(property, attributes[property]);\n }\n\n return this;\n }\n\n /**\n * Get an attribute\n *\n * @param {String} attribute The attribute key to get\n * @param {mixed} defaultValue The default value if no attribute value\n */\n getAttribute(attribute, defaultValue = null) {\n const value = get(this.attributes, attribute);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n }\n\n /**\n * Checks if attribute exists.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n hasAttribute(property) {\n if (isArray(property)) {\n const properties = property;\n const attributeKeys = Object.keys(this.attributes ?? {});\n \n return properties.every((prop) => attributeKeys.includes(prop));\n }\n\n if (!this.attributes) {\n return false;\n }\n\n return property in this.attributes;\n }\n\n /**\n * Alias for checking if has multiple attributes.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n hasAttributes(properties = []) {\n return this.hasAttribute(properties);\n }\n\n\n /**\n * Returns true if attribute has value.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n isAttributeFilled(property) {\n if (isArray(property)) {\n return this.hasAttribute(property) && property.every((prop) => !isEmpty(this.getAttribute(prop)));\n }\n\n return this.hasAttribute(property) && !isEmpty(this.getAttribute(property));\n }\n\n /**\n * Get multiple attributes.\n *\n * @param {Array} properties [description]\n * @param {[type]} value [description]\n */\n getAttributes(properties) {\n const attributes = {};\n\n if (properties === null || properties === undefined) {\n return this.attributes;\n }\n\n if (typeof properties === 'string') {\n return this.getAttribute([...arguments]);\n }\n\n if (!isArray(properties)) {\n throw new Error('No attribute properties provided!');\n }\n\n for (let i = 0; i < properties.length; i++) {\n const property = properties[i];\n\n if (typeof property !== 'string') {\n continue;\n }\n\n attributes[property] = this.getAttribute(property);\n }\n\n return attributes;\n }\n\n /**\n * Serialize resource to a POJO\n *\n * @returns {Object}\n */\n serialize() {\n return this.getAttributes();\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n mergeAttributes(attributes = {}) {\n const modelAttributes = this.attributes || {};\n this.attributes = { ...modelAttributes, ...attributes };\n\n return this.attributes;\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n syncAttributes(json = {}) {\n this.attributes = json;\n }\n}\n\nexport default Resource;\n","import Resource from '../resource';\nimport { StoreActions } from '../utils';\n\nconst orderActions = new StoreActions({\n getDistanceAndTime: function (id, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/distance-and-time`, {}, options);\n },\n});\n\nclass Order extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'order', { actions: orderActions, ...options });\n }\n\n getDistanceAndTime() {\n return this.store.getDistanceAndTime(this.id);\n }\n}\n\nexport default Order;\n\nexport { orderActions };","import Resource from '../resource';\nimport Collection from '../utils/collection';\n\nclass Payload extends Resource {\n\tconstructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\t\n /**\n\t * Attaches an entity to an existing payload and returns\n\t * the payload with the entity attached\n\t *\n\t * @param {[type]} Entity entity [description]\n\t * @return {[type]} [description]\n\t */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n\t * Returns all of the entities attached to this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get entities() {\n\n }\n\n /**\n\t * Returns the dropoff for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get dropoff() {\n\n }\n\n /**\n\t * Returns the pickup for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get pickup() {\n\n }\n\n /**\n\t * Returns all the waypoints for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get waypoints() {\n return new Collection(this.waypoints);\n }\n}\n\nexport default Payload;\n","import Resource from '../resource';\n\nclass Entity extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'entity', options);\n }\n}\n\nexport default Entity;\n","import Resource from '../resource';\nimport { isResource, Point } from '../utils';\n\nclass Place extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'place', options);\n }\n\n static fromGoogleAddress(googleAddress, adapter, options = {}) {\n const [ latitude, longitude ] = googleAddress.getAttribute('coordinates');\n const attributes = {\n name: null,\n address: googleAddress.getAttribute('address'),\n location: new Point(latitude, longitude),\n street1: googleAddress.getAttribute('streetName'),\n street2: null,\n city: googleAddress.getAttribute('city'),\n province: googleAddress.getAttribute('stateLong'),\n postal_code: googleAddress.getAttribute('postalCode'),\n neighborhood: googleAddress.get('neighborhood'),\n district: googleAddress.getAttribute('county'),\n building: googleAddress.get('building'),\n country: googleAddress.getAttribute('countryShort'),\n phone: null,\n security_access_code: null\n };\n\n return new Place(attributes, adapter, options);\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point()).coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point()).coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n * \n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [ latitude, longitude ];\n }\n\n /**\n * Set the owner of the place.\n * \n * @param {Object|String} owner\n * @return {Place}\n */\n setOwner(owner) {\n if (isResource(owner)) {\n this.setAttribute('owner', owner.id);\n }\n\n if (typeof owner === 'string') {\n this.setAttribute('owner', owner);\n }\n\n return this;\n }\n}\n\nexport default Place;\n","import Place from './place';\n\nclass Waypoint extends Place {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'waypoint', options);\n }\n}\n\nexport default Waypoint;\n","import Resource from '../resource';\n\nclass TrackingStatus extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'tracking-status', options);\n }\n}\n\nexport default TrackingStatus;\n","import Resource from '../resource';\n\nclass Vehicle extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vehicle', options);\n }\n}\n\nexport default Vehicle;\n","import Resource from '../resource';\n\nclass Driver extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'driver', options);\n }\n}\n\nexport default Driver;\n","import Resource from '../resource';\n\nclass Vendor extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vendor', options);\n }\n}\n\nexport default Vendor;\n","import Resource from '../resource';\n\nclass Contact extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'contact', options);\n }\n}\n\nexport default Contact;\n","import Resource from '../resource';\n\nclass Zone extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'zone', options);\n }\n}\n\nexport default Zone;\n","import Resource from '../resource';\n\nclass ServiceArea extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-area', options);\n }\n}\n\nexport default ServiceArea;\n","import Resource from '../resource';\n\nclass ServiceRate extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-rate', options);\n }\n}\n\nexport default ServiceRate;\n","import Resource from '../resource';\n\nclass ServiceQuote extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-quote', options);\n }\n\n fromPreliminary() {\n\n }\n\n fromPayload() {\n \n }\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n\t * Creates a configured base adapter for Fleetbase.\n\t *\n\t * @param {Object} config Configuration options for adapter\n\t */\n constructor(config = {}) {\n this.version = config.version || 'v1';\n this.host = config.host || null;\n this.namespace = config.namespace || null;\n this.headers = config.headers || {};\n }\n}\n\nexport default Adapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\n\nclass BrowserAdapter extends Adapter {\n /**\n * Setup browser adapter.\n * @param {Object} config\n */\n constructor(config) {\n super(config);\n\n this.setHeaders({\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;browser'\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n this.headers = { ...this.headers, ...headers };\n\n return this;\n }\n\n /**\n * Parses the JSON returned by a network request\n *\n * @param {Object} response A response from a network request\n * @return {Object} The parsed JSON, status from the response\n *\n * @return {Promise}\n */\n parseJSON(response) {\n return new Promise((resolve, reject) => response\n .json()\n .then((json) => resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n }))\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n }));\n }\n\n /**\n * The base request method\n *\n * @param {String} path\n * @param {String} method\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n request(path, method = 'GET', data = {}, options = {}) {\n return new Promise((resolve, reject) => fetch(options.url || `${this.host}/${this.namespace}/${path}`, {\n method,\n mode: options.mode || 'cors',\n headers: new Headers({\n ...(this.headers || {}),\n ...(options.headers || {}),\n }),\n ...data,\n })\n .then(this.parseJSON)\n .then((response) => {\n if (response.ok) {\n return resolve(response.json);\n }\n\n return reject(new Error(response.json.errors ? response.json.errors[0] : response.statusText));\n })\n .catch((error) => {\n reject(error);\n }));\n }\n\n /**\n * Makes a GET request with fetch\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.request(`${path}${urlParams ? `?${urlParams}` : ''}`, 'GET', {}, options);\n }\n\n /**\n * Makes a POST request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.request(path, 'POST', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a PUT request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.request(path, 'PUT', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a DELETE request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.request(path, 'DELETE', {}, options);\n }\n\n /**\n * Makes a PATCH request with fetch\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.request(path, 'PATCH', { body: JSON.stringify(data) }, options);\n }\n}\n\nexport default BrowserAdapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\nimport { isArray } from '../utils/array';\nimport axios from 'axios';\n\nclass NodeAdapter extends Adapter {\n constructor(config) {\n super(config);\n\n this.axios = axios.create({\n baseURL: `${this.host}/${this.namespace}`,\n headers: {\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;node',\n },\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n const commonHeaders = this.axios.defaults.headers.common;\n this.axios.defaults.headers.common = { ...commonHeaders, ...headers };\n\n return this;\n }\n\n /**\n * Tranform the response, and return the response data from axios.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n transform(response) {\n return response.data;\n }\n\n /**\n * Handles an erroneous request.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n handleError(error) {\n if (error.response) {\n const { data } = error.response;\n\n if (isArray(data.errors)) {\n throw new Error(data.errors[0]);\n }\n\n if (data.error) {\n throw new Error(data.error);\n }\n }\n\n throw error;\n }\n\n /**\n * Makes a GET request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.axios\n .get(`${path}${urlParams ? `?${urlParams}` : ''}`, options)\n .then(this.transform.bind(this))\n .catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a POST request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.axios.post(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PUT request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.axios.put(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a DELETE request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.axios.delete(path, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PATCH request with axios\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.axios.patch(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n}\n\nexport default NodeAdapter;\n","import Adapter from '../adapter';\n\nclass EmberJsAdapter extends Adapter {}\n\nexport default EmberJsAdapter;\n","'use strict';\n\n/**\n * Javascript String\n *\n * instance\n * new String('hello_world').humanize().get() => \"Hello world\"\n *\n * instance\n * const string = new String();\n * string.humanize('hello_world').get() => \"Hello world\"\n * \n * no chain\n * new String('hello_world', false).humanize() => \"Hello world\"\n *\n * static\n * String.invoke('humanize', 'hello_world') => \"Hello world\"\n *\n * exports {}\n * humanize('hello_world') => \"Hello world\"\n */\n\nexport default class String {\n constructor(string, chain = true) {\n this.str = string;\n this.chain = chain;\n }\n\n uncountableWords = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'moose', 'deer', 'news'];\n\n pluralRules = [\n [new RegExp('(m)an$', 'gi'), '$1en'],\n [new RegExp('(pe)rson$', 'gi'), '$1ople'],\n [new RegExp('(child)$', 'gi'), '$1ren'],\n [new RegExp('^(ox)$', 'gi'), '$1en'],\n [new RegExp('(ax|test)is$', 'gi'), '$1es'],\n [new RegExp('(octop|vir)us$', 'gi'), '$1i'],\n [new RegExp('(alias|status)$', 'gi'), '$1es'],\n [new RegExp('(bu)s$', 'gi'), '$1ses'],\n [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'],\n [new RegExp('([ti])um$', 'gi'), '$1a'],\n [new RegExp('sis$', 'gi'), 'ses'],\n [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'],\n [new RegExp('(hive)$', 'gi'), '$1s'],\n [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'],\n [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'],\n [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'],\n [new RegExp('([m|l])ouse$', 'gi'), '$1ice'],\n [new RegExp('(quiz)$', 'gi'), '$1zes'],\n [new RegExp('s$', 'gi'), 's'],\n [new RegExp('$', 'gi'), 's'],\n ];\n\n singularRules = [\n [new RegExp('(m)en$', 'gi'), '$1an'],\n [new RegExp('(pe)ople$', 'gi'), '$1rson'],\n [new RegExp('(child)ren$', 'gi'), '$1'],\n [new RegExp('([ti])a$', 'gi'), '$1um'],\n [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', 'gi'), '$1$2sis'],\n [new RegExp('(hive)s$', 'gi'), '$1'],\n [new RegExp('(tive)s$', 'gi'), '$1'],\n [new RegExp('(curve)s$', 'gi'), '$1'],\n [new RegExp('([lr])ves$', 'gi'), '$1f'],\n [new RegExp('([^fo])ves$', 'gi'), '$1fe'],\n [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'],\n [new RegExp('(s)eries$', 'gi'), '$1eries'],\n [new RegExp('(m)ovies$', 'gi'), '$1ovie'],\n [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'],\n [new RegExp('([m|l])ice$', 'gi'), '$1ouse'],\n [new RegExp('(bus)es$', 'gi'), '$1'],\n [new RegExp('(o)es$', 'gi'), '$1'],\n [new RegExp('(shoe)s$', 'gi'), '$1'],\n [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'],\n [new RegExp('(octop|vir)i$', 'gi'), '$1us'],\n [new RegExp('(alias|status)es$', 'gi'), '$1'],\n [new RegExp('^(ox)en', 'gi'), '$1'],\n [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'],\n [new RegExp('(matr)ices$', 'gi'), '$1ix'],\n [new RegExp('(quiz)zes$', 'gi'), '$1'],\n [new RegExp('s$', 'gi'), ''],\n ];\n\n nonTitlecasedWords = ['and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at', 'by', 'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over', 'with', 'for'];\n\n idSuffix = new RegExp('(_ids|_id)$', 'g');\n underbar = new RegExp('_', 'g');\n spaceOrUnderbar = new RegExp('[ _]', 'g');\n uppercase = new RegExp('([A-Z])', 'g');\n underbarPrefix = new RegExp('^_');\n\n get() {\n return this.str;\n }\n\n applyRules(str, rules, skip, override) {\n if (override) {\n str = override;\n } else {\n var ignore = skip.indexOf(str.toLowerCase()) > -1;\n if (!ignore) {\n for (var x = 0; x < rules.length; x++) {\n if (str.match(rules[x][0])) {\n str = str.replace(rules[x][0], rules[x][1]);\n break;\n }\n }\n }\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.pluralize('person') -> 'people'\n String.pluralize('octopus') -> 'octopi'\n String.pluralize('Hat') -> 'Hats'\n String.pluralize('person', 'guys') -> 'guys' \n */\n pluralize(str, plural = null) {\n str = str || this.str;\n\n return this.applyRules(str, this.pluralRules, this.uncountableWords, plural);\n }\n\n /*\n String.singularize('person') -> 'person'\n String.singularize('octopi') -> 'octopus'\n String.singularize('hats') -> 'hat'\n String.singularize('guys', 'person') -> 'person'\n */\n singularize(str, singular) {\n str = str || this.str;\n\n return this.applyRules(str, this.singularRules, this.uncountableWords, singular);\n }\n\n /*\n String.camelize('message_properties') -> 'MessageProperties'\n String.camelize('message_properties', true) -> 'messageProperties'\n */\n camelize(str, lowFirstLetter) {\n str = str || this.str;\n\n let str_path = str.split('/');\n for (var i = 0; i < str_path.length; i++) {\n let str_arr = str_path[i].split('_');\n let initX = lowFirstLetter && i + 1 === str_path.length ? 1 : 0;\n\n for (let x = initX; x < str_arr.length; x++) {\n str_arr[x] = str_arr[x].charAt(0).toUpperCase() + str_arr[x].substring(1);\n }\n str_path[i] = str_arr.join('');\n }\n str = str_path.join('::');\n\n // fix\n if (lowFirstLetter === true) {\n let first = str.charAt(0).toLowerCase();\n let last = str.slice(1);\n str = first + last;\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.underscore('MessageProperties') -> 'message_properties'\n String.underscore('messageProperties') -> 'message_properties'\n */\n underscore(str) {\n str = str || this.str;\n\n var str_path = str.split('::');\n for (var i = 0; i < str_path.length; i++) {\n str_path[i] = str_path[i].replace(this.uppercase, '_$1');\n str_path[i] = str_path[i].replace(this.underbarPrefix, '');\n }\n str = str_path.join('/').toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.humanize('message_properties') -> 'Message properties'\n String.humanize('message_properties') -> 'message properties'\n */\n humanize(str, lowFirstLetter) {\n str = str || this.str;\n\n var str = str.toLowerCase();\n str = str.replace(this.idSuffix, '');\n str = str.replace(this.underbar, ' ');\n if (!lowFirstLetter) {\n str = this.capitalize(str);\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.capitalize('message_properties') -> 'Message_properties'\n String.capitalize('message properties') -> 'Message properties'\n */\n capitalize(str) {\n str = str || this.str;\n\n str = str.toLowerCase();\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.dasherize('message_properties') -> 'message-properties'\n String.dasherize('message properties') -> 'message-properties'\n */\n dasherize(str) {\n str = str || this.str;\n\n str = str.replace(this.spaceOrUnderbar, '-');\n str = str.toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.normify('message_properties') -> 'Message Properties'\n String.normify('message properties') -> 'Message Properties'\n Inflactor.normify('Message_propertyId', true) -> 'Message Properties Id'\n */\n normify(str, allFirstUpper) {\n str = str || this.str;\n\n //var str = str.toLowerCase();\n if (allFirstUpper === true) {\n str = this.camelize(str);\n str = this.underscore(str);\n } else {\n str = str.toLowerCase();\n }\n\n str = str.replace(this.underbar, ' ');\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var d = str_arr[x].split('-');\n for (var i = 0; i < d.length; i++) {\n if (this.nonTitlecasedWords.indexOf(d[i].toLowerCase()) < 0) {\n d[i] = this.capitalize(d[i]);\n }\n }\n str_arr[x] = d.join('-');\n }\n str = str_arr.join(' ');\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.demodulize('Message::Bus::Properties') -> 'Properties'\n */\n demodulize(str) {\n str = str || this.str;\n\n var str_arr = str.split('::');\n str = str_arr[str_arr.length - 1];\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.tableize('MessageBusProperty') -> 'message_bus_properties'\n */\n tableize(str) {\n str = str || this.str;\n\n str = this.pluralize(this.underscore(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.classify('message_bus_properties') -> 'MessageBusProperty'\n */\n classify(str) {\n str = str || this.str;\n\n str = this.singularize(this.camelize(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.foreignKey('MessageBusProperty') -> 'message_bus_property_id'\n String.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'\n */\n foreignKey(str, dropIdUbar = false) {\n str = str || this.str;\n\n str = this.underscore(this.demodulize(str)) + (dropIdUbar ? '' : '_') + 'id';\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.ordinalize('the 1 pitch') -> 'the 1st pitch'\n */\n ordinalize(str) {\n str = str || this.str;\n\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var i = parseInt(str_arr[x]);\n if (i === NaN) {\n var ltd = str_arr[x].substring(str_arr[x].length - 2);\n var ld = str_arr[x].substring(str_arr[x].length - 1);\n var suf = 'th';\n if (ltd != '11' && ltd != '12' && ltd != '13') {\n if (ld === '1') {\n suf = 'st';\n } else if (ld === '2') {\n suf = 'nd';\n } else if (ld === '3') {\n suf = 'rd';\n }\n }\n str_arr[x] += suf;\n }\n }\n str = str_arr.join(' ');\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /**\n * @method invoke\n **/\n static invoke() {\n const argz = Object.values(arguments);\n const instance = new String(null, false);\n const method = arguments[0];\n argz.shift();\n\n if (typeof instance[method] === 'function') {\n return instance[method](...argz);\n }\n\n return null;\n }\n}\n\nconst pluralize = function() {\n const argz = ['pluralize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst singularize = function() {\n const argz = ['singularize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst humanize = function() {\n const argz = ['humanize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst underscore = function() {\n const argz = ['underscore', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst camelize = function() {\n const argz = ['camelize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst capitalize = function() {\n const argz = ['capitalize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst dasherize = function() {\n const argz = ['dasherize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst normify = function() {\n const argz = ['normify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst demodulize = function() {\n const argz = ['demodulize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst tableize = function() {\n const argz = ['tableize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst classify = function() {\n const argz = ['classify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst foreignKey = function() {\n const argz = ['foreignKey', ...arguments];\n\n return String.invoke(...argz);\n};\n\nexport {\n pluralize,\n singularize,\n humanize,\n underscore,\n camelize,\n capitalize,\n dasherize,\n normify,\n demodulize,\n tableize,\n classify,\n foreignKey\n}","import { Place, Payload, Order } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter } from './adapters';\nimport { pluralize, singularize } from './utils/string';\n\nconst resources = {\n Place,\n Payload,\n Order\n};\n\nconst adapters = {\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter\n};\n\nclass Resolver {\n constructor () {\n this.resources = resources;\n this.adapters = adapters;\n\n return this.lookup(...arguments);\n }\n\n lookup(type, className) {\n const key = pluralize(type);\n const params = [ ...arguments ].slice(2);\n\n if (!this[key]) {\n throw new Error('Attempted to resolve invalid type');\n }\n\n if (!this[key][className]) {\n throw new Error(`No ${singularize(type)} named ${className} to resolve`);\n }\n\n return new this[key][className](...params);\n }\n}\n\nconst lookup = function() {\n return new Resolver(...arguments);\n};\n\nexport {\n Resolver,\n lookup\n};\n","import { lookup } from './resolver';\nimport { pluralize, classify } from './utils/string';\nimport { isArray } from './utils/array';\nimport { Collection, detectAdapter, isResource, StoreActions } from './utils';\nimport { set, isCallable, invoke } from './utils/object';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (let i = 0; i < actions.length; i++) {\n const action = actions[i];\n\n store.extendActions(action);\n }\n return;\n }\n\n if (actions instanceof StoreActions) {\n actions.extend(store);\n }\n\n return store;\n};\n\nconst afterFetch = (store, json) => {\n if (typeof store.options.onAfterFetch === 'function') {\n store.options.onAfterFetch(json);\n }\n\n if (isArray(json)) {\n const serialized = [];\n\n for (let i = 0; i < json.length; i++) {\n serialized.push(store.afterFetch(json[i]));\n }\n\n return new Collection(...serialized);\n }\n\n const resourceInstance = store.serialize(json);\n return store.deposit(resourceInstance);\n};\n\nclass Store {\n constructor(resource, adapter, options = {}) {\n this.resource = resource;\n this.adapter = adapter || detectAdapter();\n this.namespace = pluralize(resource);\n this.storage = new Collection();\n this.options = options;\n this.extendActions(options.actions);\n }\n\n extendActions(actions = []) {\n return extendStoreActions(this, actions);\n }\n\n deposit(resourceInstance) {\n // this.storage[this.namespace].pushObject(resourceInstance);\n\n return resourceInstance;\n }\n\n serialize(json) {\n return lookup('resource', classify(this.resource), json, this.adapter);\n }\n\n afterFetch(json) {\n return afterFetch(this, json);\n }\n\n create(attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.post(`${this.namespace}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n update(id, attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.put(`${this.namespace}/${id}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findRecord(id, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findAll(options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n query(query = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n queryRecord(query = {}, options = {}) {\n query.single = true;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n destroy(record, options = {}) {\n const id = isResource(record) ? record.getAttribute('id') : record;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.delete(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n}\n\nexport default Store;\n\nexport { extendStoreActions, afterFetch };\n","import 'core-js/stable';\nimport 'regenerator-runtime/runtime';\nimport Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter, Adapter } from './adapters';\nimport { isNodeEnvironment, detectAdapter, isLatitude, isLongitude, Point, isResource, GoogleAddress, Collection, StoreActions } from './utils';\nimport { pluralize, singularize, classify, dasherize, camelize } from './utils/string';\nimport { extendStoreActions } from './store';\nimport { orderActions } from './resources/order';\n\n/**\n * // instance\n * const fleetbase = new Fleetbase();\n *\n * const contact = fleetbase.contacts.create({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * constact.update({ name: 'Hollywood Ron' });\n *\n * // export\n * import { Contact } from '@fleetbase/sdk';\n *\n * const contact = new Contact({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * contact.save();\n */\n\nexport default class Fleetbase {\n /**\n * Builds an instance of the Fleetbase SDK\n *\n * @param {String} publicKey The public key issued\n * @param {Object} config The version of resource to access\n * @param {Boolean} debug Debug mode for SDK\n * @return {Fleetbase} Instance\n */\n constructor(publicKey, config = {}, debug = false) {\n this.version = config.version || 'v1';\n this.options = {\n version: this.version,\n host: config.host || 'https://api.fleetbase.io',\n namespace: this.version || config.namespace,\n debug,\n publicKey,\n };\n\n if (typeof publicKey !== 'string' || publicKey.length === 0) {\n throw new Error('⚠️ Invalid public key given to Fleetbase SDK');\n }\n\n if (!isNodeEnvironment() && publicKey.toLowerCase().startsWith('$')) {\n throw new Error('Secret key provided. You must use a public key with Fleetbase Javascript SDK!');\n }\n\n this.adapter = config.adapter || detectAdapter(this.options);\n\n this.orders = new Store('order', this.adapter).extendActions(orderActions);\n this.entities = new Store('entity', this.adapter);\n this.places = new Store('place', this.adapter);\n this.drivers = new Store('driver', this.adapter);\n this.vehicles = new Store('vehicle', this.adapter);\n this.vendors = new Store('vendor', this.adapter);\n this.contacts = new Store('contact', this.adapter);\n }\n\n static newInstance() {\n return new Fleetbase(...arguments);\n }\n\n setAdapter(adapter) {\n this.adapter = adapter;\n }\n\n getAdapter() {\n return this.adapter;\n }\n}\n\nexport {\n Store,\n Resource,\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n Adapter,\n isNodeEnvironment,\n isLatitude,\n isLongitude,\n Point,\n isResource,\n GoogleAddress,\n Collection,\n StoreActions,\n extendStoreActions,\n pluralize,\n singularize,\n classify,\n dasherize,\n camelize,\n};\n","export default function isLatitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 90;\n}\n","export default function isLongitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 180 && Math.abs(coordinate) >= 90;\n}\n"],"names":["isArray","Array","replace","array","start","deleteCount","items","length","splice","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","arguments","Boolean","findIndex","predicate","startAt","len","find","callback","target","bind","undefined","any","every","cb","indexOf","val","withNaNCheck","insertAt","this","indexes","map","idx","_this2","object","methodName","args","ret","forEach","push","_item$methodName","filter","sortKeys","sort","a","b","propA","propB","compareValue","compare","seen","Set","getter","get","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","isBlank","test","isResource","record","Resource","isNodeEnvironment","process","_typeof","_process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","address_components","reduce","acc","data","types","type","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","keys","pkey","short","short_name","long_name","Point","latitude","longitude","coorindates","lat","lng","serialize","json","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","bindTo","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","store","Store","onAfterFetch","syncAttributes","_this$options","getAttribute","mergeAttributes","setFlags","create","then","response","_this","update","id","destroy","findRecord","_this4","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","hasAttribute","Date","hasAttributes","isNew","isLoaded","property","_this5","call","setAttributes","previousValue","changedAt","setAttribute","attribute","defaultValue","properties","attributeKeys","prop","_this6","modelAttributes","orderActions","getDistanceAndTime","namespace","Order","Payload","entity","waypoints","Entity","Place","owner","googleAddress","street1","street2","province","postal_code","neighborhood","district","building","phone","security_access_code","Waypoint","TrackingStatus","Vehicle","Driver","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","setHeaders","Authorization","publicKey","Promise","resolve","reject","statusText","status","ok","method","fetch","url","mode","Headers","parseJSON","errors","error","query","urlParams","URLSearchParams","toString","request","body","JSON","stringify","NodeAdapter","axios","baseURL","commonHeaders","defaults","common","transform","handleError","post","put","patch","EmberJsAdapter","String","string","chain","RegExp","str","rules","skip","override","toLowerCase","x","match","plural","applyRules","pluralRules","uncountableWords","singular","singularRules","lowFirstLetter","str_path","str_arr","charAt","toUpperCase","substring","first","last","uppercase","underbarPrefix","idSuffix","underbar","capitalize","spaceOrUnderbar","allFirstUpper","camelize","underscore","d","nonTitlecasedWords","pluralize","singularize","dropIdUbar","demodulize","NaN","parseInt","ltd","ld","suf","argz","instance","shift","invoke","classify","resources","adapters","Resolver","className","params","extendStoreActions","extend","extendActions","storage","resourceInstance","serialized","afterFetch","deposit","single","_this7","Fleetbase","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts","coordinate","isFinite","Math","abs"],"mappings":"uwJAAA,IAAQA,EAAYC,MAAZD,yDCWFE,EAAU,SAACC,EAAOC,EAAOC,OAAaC,yDAAQ,MAC5CN,EAAQG,MACJG,EAAMC,QANC,IAOPJ,EAAMK,aAANL,GAAaC,EAAOC,Y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AAI5L,GAAM,QAASvI,KAAK4H,cACjCwM,QAAU,IAAI7L,GAAM,SAAUvI,KAAK4H,cACnCyM,SAAW,IAAI9L,GAAM,UAAWvI,KAAK4H,cACrC0M,QAAU,IAAI/L,GAAM,SAAUvI,KAAK4H,cACnC2M,SAAW,IAAIhM,GAAM,UAAWvI,KAAK4H,6CAO9C,SAAWA,QACFA,QAAUA,4BAGnB,kBACW5H,KAAK4H,qCAThB,oBACekM,6BAAahV,8gBH+Yf,eACP4T,GAAQ,8CAAe5T,mBAEtB+Q,GAAOgD,aAAPhD,KAAiB6C,2CASV,eACRA,GAAQ,+CAAgB5T,mBAEvB+Q,GAAOgD,aAAPhD,KAAiB6C,yEIteb,SAAoB8B,UACxBC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,wBCD5C,SAAqBA,UACzBC,SAASD,IAAeE,KAAKC,IAAIH,IAAe,KAAOE,KAAKC,IAAIH,IAAe"} \ No newline at end of file diff --git a/dist/esm/fleetbase.js b/dist/esm/fleetbase.js new file mode 100644 index 0000000..62ba70f --- /dev/null +++ b/dist/esm/fleetbase.js @@ -0,0 +1,2 @@ +import"core-js/stable";import"regenerator-runtime/runtime";import t from"axios";function e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function n(t){for(var n=1;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n3&&void 0!==arguments[3]?arguments[3]:[];if(A(t))if(r.length<=6e4)t.splice.apply(t,[e,n].concat(m(r)));else{t.splice(e,n);for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:0,r=t.length,i=n;i2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0,i=t.length;n<0&&(n+=i);var o=r&&e!=e?function(t){return t!=t}:function(t){return t===e};return S(t,o,n)},F=function(t,e,n){return $(t,e,0,[n]),n},D=function(t){h(n,g(Array));var e=y(n);function n(){for(var t=arguments.length,r=new Array(t),i=0;i0}},{key:"empty",get:function(){return 0===this.length}},{key:"first",get:function(){return j(this,0)}},{key:"last",get:function(){return j(this,this.length-1)}},{key:"replace",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return $(this,t,e,n),this}},{key:"objectsAt",value:function(t){var e=this;return t.map((function(t){return j(e,t)}))}},{key:"objectAt",value:function(t){return j(this,t)}},{key:"indexOf",value:function(t,e){return L(this,t,e,!1)}},{key:"lastIndexOf",value:function(t,e){var n=this.length;(void 0===e||e>=n)&&(e=n-1),e<0&&(e+=n);for(var r=e;r>=0;r--)if(j(this,r)===t)return r;return-1}},{key:"includes",value:function(t,e){return-1!==L(this,t,e,!0)}},{key:"findBy",value:function(){return _(this,O.apply(void 0,arguments))}},{key:"findIndexBy",value:function(){return S(this,O.apply(void 0,arguments))}},{key:"isEvery",value:function(){return z(this,O.apply(void 0,arguments))}},{key:"isAny",value:function(){return P(this,O.apply(void 0,arguments))}},{key:"invoke",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:R,n=[],r=new Set,i="function"==typeof e?e:function(t){return get(t,e)};return t.forEach((function(t){var e=i(t);r.has(e)||(r.add(e),n.push(t))})),n}(this,t)}},{key:"without",value:function(t){if(!this.includes(t))return this;var e=t==t?function(e){return e!==t}:function(t){return t==t};return this.filter(e)}},{key:"clear",value:function(){var t=this.length;return 0===t||this.replace(0,t,[]),this}},{key:"insertAt",value:function(t,e){return F(this,t,e),this}},{key:"replaceAt",value:function(t,e){return this.replace(t,1,[e])}},{key:"removeAt",value:function(t,e){return function(t,e){return $(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,[]),t}(this,t,e)}},{key:"pushObject",value:function(t){return this.insertAt(this.length,t)}},{key:"pushObjects",value:function(t){return this.replace(this.length,0,t),this}},{key:"popObject",value:function(){var t=this.length;if(0===t)return null;var e=j(this,t-1);return this.removeAt(t-1,1),e}},{key:"shiftObject",value:function(){if(0===this.length)return null;var t=j(this,0);return this.removeAt(0),t}},{key:"unshiftObject",value:function(t){return F(this,0,t)}},{key:"unshiftObjects",value:function(t){return this.replace(0,0,t),this}},{key:"reverseObjects",value:function(){var t=this.length;if(0===t)return this;var e=this.toArray().reverse();return this.replace(0,t,e),this}},{key:"setObjects",value:function(t){if(0===t.length)return this.clear();var e=this.length;return this.replace(0,e,t),this}},{key:"removeObject",value:function(t){for(var e=this.length||0;--e>=0;){j(this,e)===t&&this.removeAt(e)}return this}},{key:"removeObjects",value:function(t){for(var e=t.length-1;e>=0;e--)this.removeObject(t[e]);return this}},{key:"addObject",value:function(t){return this.includes(t)||this.pushObject(t),this}},{key:"addObjects",value:function(t){var e=this;return t.forEach((function(t){return e.addObject(t)})),this}}]),n}(),C=function(t){var e=null==t;if(e)return e;if("number"==typeof t.size)return!t.size;var n=r(t);if("object"===n){var i=t.size;if("number"==typeof i)return!i}if("number"==typeof t.length&&"function"!==n)return!t.length;if("object"===n){var o=t.length;if("number"==typeof o)return!o}return!1},T=function(t){return C(t)||"string"==typeof t&&!1===/\S/.test(t)};function N(t){return isFinite(t)&&Math.abs(t)<=90}function q(t){return isFinite(t)&&Math.abs(t)<=180&&Math.abs(t)>=90}function B(t){return t instanceof Y}var U=function(){var t,e,n,i,o;return!("undefined"==typeof process||"object"!==r(null===(t=process)||void 0===t?void 0:t.env)&&-1===(null===(e=process.release)||void 0===e||null===(n=e.name)||void 0===n?void 0:n.search(/node|io.js/))||"undefined"!=typeof window&&"ReactNative"!==(null===(i=window)||void 0===i||null===(o=i.navigator)||void 0===o?void 0:o.product))},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return U()?Rt("adapter","NodeAdapter",t):Rt("adapter","BrowserAdapter",t)},J=Array.isArray,K=function(){function t(e){s(this,t),this.place=e,this.geometry=null==e?void 0:e.geometry,this.components=this.parseComponents(),this.attributes=this.parseProperties()}return a(t,[{key:"parse",value:function(){this.parseComponents(),this.parseProperties()}},{key:"parseComponents",value:function(){var t;return((null===(t=this.place)||void 0===t?void 0:t.address_components)||[]).reduce((function(t,e){return e.types.forEach((function(n){t[n]=e})),t}),{})}},{key:"parseProperties",value:function(){var t,e={streetNumber:this.get("street_number"),streetName:this.get("route"),coordinates:null!==(t=this.geometry)&&void 0!==t&&t.location?Object.values(this.geometry.location):[0,0],city:this.or(["locality","sublocality","sublocality_level_1","neighborhood","administrative_area_level_3","administrative_area_level_2"]),county:this.get("administrative_area_level_2"),stateShort:this.get("administrative_area_level_1",!0),stateLong:this.get("administrative_area_level_1"),countryShort:this.get("country",!0),country:this.get("country",!0),countryLong:this.get("country"),postalCode:this.get("postal_code")};return e.address=[e.streetNumber,e.streetName].filter(Boolean).join(" "),e}},{key:"all",value:function(){return this.attributes}},{key:"or",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=0;e1&&void 0!==arguments[1]&&arguments[1];return t in this.components?e?this.components[t].short_name:this.components[t].long_name:null}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.attributes=n(n({},this.attributes),t),this}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"getAttribute",value:function(t){return this.attributes[t]||null}}]),t}(),M=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;s(this,t),this.type="Point",this.coordinates=[n,e]}return a(t,[{key:"latitude",get:function(){return this.coordinates[1]}},{key:"longitude",get:function(){return this.coordinates[0]}},{key:"lat",value:function(){return this.latitude}},{key:"lng",value:function(){return this.longitude}},{key:"serialize",value:function(){return{type:"Point",coorindates:[this.lat(),this.lng()]}}},{key:"toJson",value:function(){return this.serialize()}},{key:"toString",value:function(){return"(".concat(this.latitude,", ").concat(this.longitude,")")}}],[{key:"fromGeoJson",value:function(e){var n=b(e.coordinates,2);return longitude=n[0],latitude=n[1],new t(latitude,longitude)}}]),t}();"undefined"==typeof arguments||arguments;var W=function(t,e){var n=t();return Array.isArray(n)||"object"===r(n)?H(n,e):null},H=function t(e,n){var i,o=e,s=r(e),u="object"===s,a="function"===s,c=Array.isArray(e),h="string"===r(n)&&n.includes(".")?n.split("."):[n];if(c||u){for(var l=0;l0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;s(this,t),this.actions=e,this.bind=n}return a(t,[{key:"extend",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=t||this.bind;if(!e)return this;if(null!=this&&this.actions&&"object"===r(this.actions))for(var n in this.actions){var i=this.actions[n];"function"==typeof i?G(e,n,i.bind(e)):G(e,n,i)}return this}}]),t}(),Y=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};s(this,t),this.attributes=e,this.dirtyAttributes={},this.changes={},this.isLoading=!1,this.isSaving=!1,this.isDestroying=!1,this.isReloading=!1,this.resource=r,this.options=i,this.version=i.version||"v1",this.setAdapter(n)}return a(t,[{key:"setAdapter",value:function(t){var e;return this.adapter=t,this.store=new jt(this.resource,t,{onAfterFetch:this.syncAttributes.bind(this),actions:null===(e=this.options)||void 0===e?void 0:e.actions}),this}},{key:"id",get:function(){return this.getAttribute("id")}},{key:"create",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.mergeAttributes(e);return this.setFlags(["isLoading","isSaving"]),this.store.create(n).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setFlags(["isLoading","isSaving"]),this.store.update(this.attributes.id,e).then((function(e){return t.setFlags(["isLoading","isSaving"],!1),e}))}},{key:"destroy",value:function(){var t=this;return this.setFlags(["isLoading","isDestroying"]),this.store.destroy(this.attributes.id).then((function(e){return t.setFlags(["isLoading","isDestroying"],!1),e}))}},{key:"reload",value:function(){var t=this;return this.setFlags(["isLoading","isReloading"]),this.store.findRecord(this.attributes.id).then((function(e){return t.reset(),e}))}},{key:"setFlags",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=["isLoading","isSaving","isReloading","isDestroying"],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},e=this.getAttributes();return C(this.id)?this.create(e):!0===t.onlyDirty?this.savedirty():this.update(e)}},{key:"saveDirty",value:function(){for(var t=Object.keys(this.dirtyAttributes),e={},n=0;n0}},{key:"mutate",value:function(t,e){this.attributes[t]=e}},{key:"setAttribute",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(null===e&&"object"===r(t))return this.setAttributes(t);var n=this.attributes[t]||null;return G(this.attributes,t,e),G(this.dirtyAttributes,t,n),A(this.changes[t])||(this.changes[t]=[]),this.changes[t].push({property:t,previousValue:n,value:e,changedAt:new Date}),this}},{key:"setAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in t)this.setAttribute(e,t[e]);return this}},{key:"getAttribute",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=H(this.attributes,t);return void 0===n?e:n}},{key:"hasAttribute",value:function(t){if(A(t)){var e,n=t,r=Object.keys(null!==(e=this.attributes)&&void 0!==e?e:{});return n.every((function(t){return r.includes(t)}))}return!!this.attributes&&t in this.attributes}},{key:"hasAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.hasAttribute(t)}},{key:"isAttributeFilled",value:function(t){var e=this;return A(t)?this.hasAttribute(t)&&t.every((function(t){return!C(e.getAttribute(t))})):this.hasAttribute(t)&&!C(this.getAttribute(t))}},{key:"getAttributes",value:function(t){var e={};if(null==t)return this.attributes;if("string"==typeof t)return this.getAttribute(Array.prototype.slice.call(arguments));if(!A(t))throw new Error("No attribute properties provided!");for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},e=this.attributes||{};return this.attributes=n(n({},e),t),this.attributes}},{key:"syncAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attributes=t}}]),t}(),Z=new V({getDistanceAndTime:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.adapter.get("".concat(this.namespace,"/").concat(t,"/distance-and-time"),{},e)}}),Q=function(t){h(r,Y);var e=y(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,r),e.call(this,t,i,"order",n({actions:Z},o))}return a(r,[{key:"getDistanceAndTime",value:function(){return this.store.getDistanceAndTime(this.id)}}]),r}(),X=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"payload",i)}return a(n,[{key:"attach",value:function(t){}},{key:"entities",get:function(){}},{key:"dropoff",get:function(){}},{key:"pickup",get:function(){}},{key:"waypoints",get:function(){return new D(this.waypoints)}}]),n}(),tt=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"entity",i)}return n}(),et=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"place",i)}return a(n,[{key:"latitude",get:function(){return this.getAttribute("location",new M).coordinates[1]}},{key:"longitude",get:function(){return this.getAttribute("location",new M).coordinates[0]}},{key:"coordinates",get:function(){return[this.latitude,this.longitude]}},{key:"setOwner",value:function(t){return B(t)&&this.setAttribute("owner",t.id),"string"==typeof t&&this.setAttribute("owner",t),this}}],[{key:"fromGoogleAddress",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.getAttribute("coordinates"),o=b(i,2),s=o[0],u=o[1],a={name:null,address:t.getAttribute("address"),location:new M(s,u),street1:t.getAttribute("streetName"),street2:null,city:t.getAttribute("city"),province:t.getAttribute("stateLong"),postal_code:t.getAttribute("postalCode"),neighborhood:t.get("neighborhood"),district:t.getAttribute("county"),building:t.get("building"),country:t.getAttribute("countryShort"),phone:null,security_access_code:null};return new n(a,e,r)}}]),n}(),nt=function(t){h(n,et);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"waypoint",i)}return n}(),rt=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"tracking-status",i)}return n}(),it=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"vehicle",i)}return n}(),ot=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"driver",i)}return n}(),st=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"vendor",i)}return n}(),ut=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"contact",i)}return n}(),at=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"zone",i)}return n}(),ct=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"service-area",i)}return n}(),ht=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"service-rate",i)}return n}(),lt=function(t){h(n,Y);var e=y(n);function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s(this,n),e.call(this,t,r,"service-quote",i)}return a(n,[{key:"fromPreliminary",value:function(){}},{key:"fromPayload",value:function(){}}]),n}(),ft=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,t),this.version=e.version||"v1",this.host=e.host||null,this.namespace=e.namespace||null,this.headers=e.headers||{}},vt=function(t){h(r,ft);var e=y(r);function r(t){var n;return s(this,r),(n=e.call(this,t)).setHeaders({Authorization:"Bearer ".concat(t.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;browser"}),n}return a(r,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.headers=n(n({},this.headers),t),this}},{key:"parseJSON",value:function(t){return new Promise((function(e,n){return t.json().then((function(n){return e({statusText:t.statusText,status:t.status,ok:t.ok,json:n})})).catch((function(){n(new Error("Oops! Something went wrong when handling your request."))}))}))}},{key:"request",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise((function(s,u){return fetch(o.url||"".concat(e.host,"/").concat(e.namespace,"/").concat(t),n({method:r,mode:o.mode||"cors",headers:new Headers(n(n({},e.headers||{}),o.headers||{}))},i)).then(e.parseJSON).then((function(t){return t.ok?s(t.json):u(new Error(t.json.errors?t.json.errors[0]:t.statusText))})).catch((function(t){u(t)}))}))}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=T(e)?"":new URLSearchParams(e).toString();return this.request("".concat(t).concat(r?"?".concat(r):""),"GET",{},n)}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"POST",{body:JSON.stringify(e)},n)}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PUT",{body:JSON.stringify(e)},n)}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request(t,"DELETE",{},e)}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(t,"PATCH",{body:JSON.stringify(e)},n)}}]),r}(),dt=function(e){h(i,ft);var r=y(i);function i(e){var n;return s(this,i),(n=r.call(this,e)).axios=t.create({baseURL:"".concat(n.host,"/").concat(n.namespace),headers:{Authorization:"Bearer ".concat(e.publicKey),"Content-Type":"application/json","User-Agent":"@fleetbase/sdk;node"}}),n}return a(i,[{key:"setHeaders",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.axios.defaults.headers.common;return this.axios.defaults.headers.common=n(n({},e),t),this}},{key:"transform",value:function(t){return t.data}},{key:"handleError",value:function(t){if(t.response){var e=t.response.data;if(A(e.errors))throw new Error(e.errors[0]);if(e.error)throw new Error(e.error)}throw t}},{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=T(e)?"":new URLSearchParams(e).toString();return this.axios.get("".concat(t).concat(r?"?".concat(r):""),n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"post",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.post(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"put",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.put(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"delete",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.axios.delete(t,e).then(this.transform.bind(this)).catch(this.handleError.bind(this))}},{key:"patch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.axios.patch(t,e,n).then(this.transform.bind(this)).catch(this.handleError.bind(this))}}]),i}(),gt=function(t){h(n,ft);var e=y(n);function n(){return s(this,n),e.apply(this,arguments)}return n}(),pt=function(){function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];s(this,t),c(this,"uncountableWords",["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"]),c(this,"pluralRules",[[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]]),c(this,"singularRules",[[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("s$","gi"),""]]),c(this,"nonTitlecasedWords",["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"]),c(this,"idSuffix",new RegExp("(_ids|_id)$","g")),c(this,"underbar",new RegExp("_","g")),c(this,"spaceOrUnderbar",new RegExp("[ _]","g")),c(this,"uppercase",new RegExp("([A-Z])","g")),c(this,"underbarPrefix",new RegExp("^_")),this.str=e,this.chain=n}return a(t,[{key:"get",value:function(){return this.str}},{key:"applyRules",value:function(t,e,n,r){if(r)t=r;else if(!(n.indexOf(t.toLowerCase())>-1))for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:null;return t=t||this.str,this.applyRules(t,this.pluralRules,this.uncountableWords,e)}},{key:"singularize",value:function(t,e){return t=t||this.str,this.applyRules(t,this.singularRules,this.uncountableWords,e)}},{key:"camelize",value:function(t,e){for(var n=(t=t||this.str).split("/"),r=0;r1&&void 0!==arguments[1]&&arguments[1];return t=t||this.str,t=this.underscore(this.demodulize(t))+(e?"":"_")+"id",this.str=t,!0===this.chain?this:t}},{key:"ordinalize",value:function(t){for(var e=(t=t||this.str).split(" "),n=0;n1&&void 0!==arguments[1]?arguments[1]:[];if(t.actions=A(e)?e:[e],!A(e))return e instanceof V&&e.extend(t),t;for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};s(this,t),this.resource=e,this.adapter=n||I(),this.namespace=yt(e),this.storage=new D,this.options=r,this.extendActions(r.actions)}return a(t,[{key:"extendActions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Et(this,t)}},{key:"deposit",value:function(t){return t}},{key:"serialize",value:function(t){return Rt("resource",wt(this.resource),t,this.adapter)}},{key:"afterFetch",value:function(t){return function(t,e){if("function"==typeof t.options.onAfterFetch&&t.options.onAfterFetch(e),A(e)){for(var n=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=o(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.post("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"update",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(){var i=o(regeneratorRuntime.mark((function i(o,s){var u;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,e.adapter.put("".concat(e.namespace,"/").concat(t),n,r).then(e.afterFetch.bind(e)).catch(s);case 2:u=i.sent,o(u);case 4:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}())}},{key:"findRecord",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=o(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e.adapter.get("".concat(e.namespace,"/").concat(t),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"findAll",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(){var n=o(regeneratorRuntime.mark((function n(r,i){var o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.adapter.get("".concat(t.namespace),{},e).then(t.afterFetch.bind(t)).catch(i);case 2:o=n.sent,r(o);case 4:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}())}},{key:"query",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(){var r=o(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"queryRecord",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.single=!0,new Promise(function(){var r=o(regeneratorRuntime.mark((function r(i,o){var s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.adapter.get("".concat(t.namespace),e,n).then(t.afterFetch.bind(t)).catch(o);case 2:s=r.sent,i(s);case 4:case"end":return r.stop()}}),r)})));return function(t,e){return r.apply(this,arguments)}}())}},{key:"destroy",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=B(t)?t.getAttribute("id"):t;return new Promise(function(){var t=o(regeneratorRuntime.mark((function t(i,o){var s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.adapter.delete("".concat(e.namespace,"/").concat(r),{},n).then(e.afterFetch.bind(e)).catch(o);case 2:s=t.sent,i(s);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}}]),t}(),Ot=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(s(this,t),this.version=n.version||"v1",this.options={version:this.version,host:n.host||"https://api.fleetbase.io",namespace:this.version||n.namespace,debug:r,publicKey:e},"string"!=typeof e||0===e.length)throw new Error("⚠️ Invalid public key given to Fleetbase SDK");if(!U()&&e.toLowerCase().startsWith("$"))throw new Error("Secret key provided. You must use a public key with Fleetbase Javascript SDK!");this.adapter=n.adapter||I(this.options),this.orders=new jt("order",this.adapter).extendActions(Z),this.entities=new jt("entity",this.adapter),this.places=new jt("place",this.adapter),this.drivers=new jt("driver",this.adapter),this.vehicles=new jt("vehicle",this.adapter),this.vendors=new jt("vendor",this.adapter),this.contacts=new jt("contact",this.adapter)}return a(t,[{key:"setAdapter",value:function(t){this.adapter=t}},{key:"getAdapter",value:function(){return this.adapter}}],[{key:"newInstance",value:function(){return d(t,Array.prototype.slice.call(arguments))}}]),t}();export default Ot;export{ft as Adapter,vt as BrowserAdapter,D as Collection,ut as Contact,ot as Driver,gt as EmberJsAdapter,tt as Entity,K as GoogleAddress,dt as NodeAdapter,Q as Order,X as Payload,et as Place,M as Point,Y as Resource,ct as ServiceArea,lt as ServiceQuote,ht as ServiceRate,jt as Store,V as StoreActions,rt as TrackingStatus,it as Vehicle,st as Vendor,nt as Waypoint,at as Zone,mt as camelize,wt as classify,kt as dasherize,Et as extendStoreActions,N as isLatitude,q as isLongitude,U as isNodeEnvironment,B as isResource,yt as pluralize,bt as singularize}; +//# sourceMappingURL=fleetbase.js.map diff --git a/dist/esm/fleetbase.js.map b/dist/esm/fleetbase.js.map new file mode 100644 index 0000000..11f96aa --- /dev/null +++ b/dist/esm/fleetbase.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fleetbase.js","sources":["../../src/utils/array.js","../../src/utils/collection.js","../../src/utils/is-empty.js","../../src/utils/is-blank.js","../../src/utils/is-latitude.js","../../src/utils/is-longitude.js","../../src/utils/is-resource.js","../../src/utils/is-node-environment.js","../../src/utils/detect-adapter.js","../../src/utils/google-address.js","../../src/utils/point.js","../../src/utils/object.js","../../src/utils/store-actions.js","../../src/resource.js","../../src/resources/order.js","../../src/resources/payload.js","../../src/resources/entity.js","../../src/resources/place.js","../../src/resources/waypoint.js","../../src/resources/tracking-status.js","../../src/resources/vehicle.js","../../src/resources/driver.js","../../src/resources/vendor.js","../../src/resources/contact.js","../../src/resources/zone.js","../../src/resources/service-area.js","../../src/resources/service-rate.js","../../src/resources/service-quote.js","../../src/adapter.js","../../src/adapters/browser.js","../../src/adapters/node.js","../../src/adapters/ember.js","../../src/utils/string.js","../../src/resolver.js","../../src/store.js","../../src/fleetbase.js"],"sourcesContent":["const { isArray } = Array;\n\nexport {\n isArray\n};\n","import { isArray } from './array';\n\n/**\n * Collection\n * Extended array inspired by Ember's NativeArray\n **/\n\nconst CHUNK_SIZE = 60000;\n\n// To avoid overflowing the stack, we splice up to CHUNK_SIZE items at a time.\n// See https://code.google.com/p/chromium/issues/detail?id=56588 for more details.\nconst replace = (array, start, deleteCount, items = []) => {\n if (isArray(array)) {\n if (items.length <= CHUNK_SIZE) {\n array.splice(start, deleteCount, ...items);\n } else {\n array.splice(start, deleteCount);\n\n for (let i = 0; i < items.length; i += CHUNK_SIZE) {\n let chunk = items.slice(i, i + CHUNK_SIZE);\n array.splice(start + i, 0, ...chunk);\n }\n }\n } else if (isCollection(arr)) {\n array.replace(start, deleteCount, items);\n }\n};\n\nconst identityFunction = (item) => item;\n\nconst uniqBy = (array, key = identityFunction) => {\n let ret = [];\n let seen = new Set();\n let getter = typeof key === 'function' ? key : (item) => get(item, key);\n\n array.forEach((item) => {\n let val = getter(item);\n if (!seen.has(val)) {\n seen.add(val);\n ret.push(item);\n }\n });\n\n return ret;\n};\n\nconst isCollection = (mixed) => mixed instanceof Collection;\n\nconst objectAt = (array, index) => {\n if (isArray(array)) {\n return array[index];\n } else if (isCollection(array)) {\n return array.objectAt(index);\n }\n\n return null;\n};\n\nconst iter = (key, value) => {\n let valueProvided = arguments.length === 2;\n return valueProvided ? (item) => value === item[key] : (item) => Boolean(item[key]);\n};\n\nconst findIndex = (array, predicate, startAt = 0) => {\n let len = array.length;\n for (let index = startAt; index < len; index++) {\n let item = objectAt(array, index);\n if (predicate(item, index, array)) {\n return index;\n }\n }\n return -1;\n};\n\nconst find = (array, callback, target) => {\n let predicate = callback.bind(target);\n let index = findIndex(array, predicate, 0);\n return index === -1 ? undefined : objectAt(array, index);\n};\n\nconst any = (array, callback, target) => {\n let predicate = callback.bind(target);\n return findIndex(array, predicate, 0) !== -1;\n};\n\nconst every = (array, callback, target) => {\n let cb = callback.bind(target);\n let predicate = (item, index, array) => !cb(item, index, array);\n return findIndex(array, predicate, 0) === -1;\n};\n\nconst indexOf = (array, val, startAt = 0, withNaNCheck) => {\n let len = array.length;\n\n if (startAt < 0) {\n startAt += len;\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = withNaNCheck && val !== val ? (item) => item !== item : (item) => item === val;\n return findIndex(array, predicate, startAt);\n};\n\nconst removeAt = (array, index, len = 1) => {\n replace(array, index, len, []);\n return array;\n};\n\nconst insertAt = (array, index, item) => {\n replace(array, index, 0, [item]);\n return item;\n};\n\nclass Collection extends Array {\n constructor(...items) {\n if (isArray(arguments[0])) {\n super(...arguments[0]);\n } else {\n super(...arguments);\n }\n }\n\n get notEmpty() {\n return this.length > 0;\n }\n\n get empty() {\n return this.length === 0;\n }\n\n get first() {\n return objectAt(this, 0);\n }\n\n get last() {\n return objectAt(this, this.length - 1);\n }\n\n replace(start, deleteCount, items = []) {\n replace(this, start, deleteCount, items);\n\n return this;\n }\n\n objectsAt(indexes) {\n return indexes.map((idx) => objectAt(this, idx));\n }\n\n objectAt(index) {\n return objectAt(this, index);\n }\n\n indexOf(object, startAt) {\n return indexOf(this, object, startAt, false);\n }\n\n lastIndexOf(object, startAt) {\n let len = this.length;\n\n if (startAt === undefined || startAt >= len) {\n startAt = len - 1;\n }\n\n if (startAt < 0) {\n startAt += len;\n }\n\n for (let idx = startAt; idx >= 0; idx--) {\n if (objectAt(this, idx) === object) {\n return idx;\n }\n }\n\n return -1;\n }\n\n includes(object, startAt) {\n return indexOf(this, object, startAt, true) !== -1;\n }\n\n findBy() {\n return find(this, iter(...arguments));\n }\n\n findIndexBy() {\n return findIndex(this, iter(...arguments));\n }\n\n isEvery() {\n return every(this, iter(...arguments));\n }\n\n isAny() {\n return any(this, iter(...arguments));\n }\n\n invoke(methodName, ...args) {\n let ret = [];\n\n this.forEach((item) => ret.push(item[methodName]?.(...args)));\n\n return ret;\n }\n\n toArray() {\n return this.map((item) => item);\n }\n\n compact() {\n return this.filter((value) => value != null);\n }\n\n sortBy() {\n let sortKeys = arguments;\n\n return this.sort((a, b) => {\n for (let i = 0; i < sortKeys.length; i++) {\n let key = sortKeys[i];\n let propA = a[key];\n let propB = b[key];\n // return 1 or -1 else continue to the next sortKey\n let compareValue = compare(propA, propB);\n\n if (compareValue) {\n return compareValue;\n }\n }\n return 0;\n });\n }\n\n uniqBy(key) {\n return uniqBy(this, key);\n }\n\n without(value) {\n if (!this.includes(value)) {\n return this; // nothing to do\n }\n\n // SameValueZero comparison (NaN !== NaN)\n let predicate = value === value ? (item) => item !== value : (item) => item === item;\n return this.filter(predicate);\n }\n\n clear() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n this.replace(0, len, []);\n return this;\n }\n\n insertAt(idx, object) {\n insertAt(this, idx, object);\n return this;\n }\n\n replaceAt(idx, object) {\n return this.replace(idx, 1, [object]);\n }\n\n removeAt(start, len) {\n return removeAt(this, start, len);\n }\n\n pushObject(obj) {\n return this.insertAt(this.length, obj);\n }\n\n pushObjects(objects) {\n this.replace(this.length, 0, objects);\n return this;\n }\n\n popObject() {\n let len = this.length;\n if (len === 0) {\n return null;\n }\n\n let ret = objectAt(this, len - 1);\n this.removeAt(len - 1, 1);\n return ret;\n }\n\n shiftObject() {\n if (this.length === 0) {\n return null;\n }\n\n let ret = objectAt(this, 0);\n this.removeAt(0);\n return ret;\n }\n\n unshiftObject(obj) {\n return insertAt(this, 0, obj);\n }\n\n unshiftObjects(objects) {\n this.replace(0, 0, objects);\n return this;\n }\n\n reverseObjects() {\n let len = this.length;\n if (len === 0) {\n return this;\n }\n\n let objects = this.toArray().reverse();\n this.replace(0, len, objects);\n return this;\n }\n\n setObjects(objects) {\n if (objects.length === 0) {\n return this.clear();\n }\n\n let len = this.length;\n this.replace(0, len, objects);\n return this;\n }\n\n removeObject(obj) {\n let loc = this.length || 0;\n while (--loc >= 0) {\n let curObject = objectAt(this, loc);\n\n if (curObject === obj) {\n this.removeAt(loc);\n }\n }\n return this;\n }\n\n removeObjects(objects) {\n for (let i = objects.length - 1; i >= 0; i--) {\n this.removeObject(objects[i]);\n }\n\n return this;\n }\n\n addObject(obj) {\n let included = this.includes(obj);\n\n if (!included) {\n this.pushObject(obj);\n }\n\n return this;\n }\n\n addObjects(objects) {\n objects.forEach((obj) => this.addObject(obj));\n return this;\n }\n}\n\nexport default Collection;\n\nexport { replace, uniqBy, isCollection, objectAt, iter, findIndex, find, any, every, indexOf, removeAt, insertAt };\n","const isEmpty = (obj) => {\n const none = obj === null || obj === undefined;\n if (none) {\n return none;\n }\n\n if (typeof obj.size === 'number') {\n return !obj.size;\n }\n\n const objectType = typeof obj;\n\n if (objectType === 'object') {\n const { size } = obj;\n if (typeof size === 'number') {\n return !size;\n }\n }\n\n if (typeof obj.length === 'number' && objectType !== 'function') {\n return !obj.length;\n }\n\n if (objectType === 'object') {\n const { length } = obj;\n if (typeof length === 'number') {\n return !length;\n }\n }\n\n return false;\n};\n\nexport default isEmpty;\n","import isEmpty from './is-empty';\n\nconst isBlank = (obj) => isEmpty(obj) || (typeof obj === 'string' && /\\S/.test(obj) === false);\n\nexport default isBlank;\n","export default function isLatitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 90;\n}\n","export default function isLongitude(coordinate) {\n return isFinite(coordinate) && Math.abs(coordinate) <= 180 && Math.abs(coordinate) >= 90;\n}\n","import Resource from '../resource';\n\nexport default function isResource(record) {\n return record instanceof Resource;\n}\n","/**\n * Determines if environment SDK is initialized in is Node, additionally checks pass if environment is ReactNative.\n * \n * @returns boolean\n */\nconst isNodeEnvironment = () => {\n return (typeof process !== 'undefined') && (typeof process?.env === 'object' || process.release?.name?.search(/node|io.js/) !== -1) && (typeof window === 'undefined' || window?.navigator?.product === 'ReactNative');\n};\n\nexport default isNodeEnvironment;","import { lookup } from '../resolver';\nimport isNodeEnvironment from './is-node-environment';\n\nconst detectAdapter = (options = {}) => {\n if (isNodeEnvironment()) {\n return lookup('adapter', 'NodeAdapter', options);\n }\n\n return lookup('adapter', 'BrowserAdapter', options);\n}\n\nexport default detectAdapter;","const { isArray } = Array;\n\nclass GoogleAddress {\n constructor(place) {\n this.place = place;\n this.geometry = place?.geometry;\n this.components = this.parseComponents();\n this.attributes = this.parseProperties();\n }\n\n parse() {\n this.parseComponents();\n this.parseProperties();\n }\n\n parseComponents() {\n const components = (this.place?.address_components || []).reduce(function (acc, data) {\n data.types.forEach(function (type) {\n acc[type] = data;\n });\n return acc;\n }, {});\n\n return components;\n }\n\n parseProperties() {\n const attributes = {\n streetNumber: this.get('street_number'),\n streetName: this.get('route'),\n coordinates: this.geometry?.location ? Object.values(this.geometry.location) : [0, 0],\n city: this.or(['locality', 'sublocality', 'sublocality_level_1', 'neighborhood', 'administrative_area_level_3', 'administrative_area_level_2']),\n county: this.get('administrative_area_level_2'),\n stateShort: this.get('administrative_area_level_1', true),\n stateLong: this.get('administrative_area_level_1'),\n countryShort: this.get('country', true),\n country: this.get('country', true),\n countryLong: this.get('country'),\n postalCode: this.get('postal_code'),\n };\n\n attributes.address = [attributes.streetNumber, attributes.streetName].filter(Boolean).join(' ');\n\n return attributes;\n }\n\n all() {\n return this.attributes;\n }\n\n or(keys = []) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (isArray(key)) {\n const pkey = key[0];\n const short = key[1];\n\n if (this.has(pkey)) {\n return this.get(pkey, short);\n }\n\n continue;\n }\n\n if (this.has(key)) {\n return this.get(key);\n }\n }\n\n return null;\n }\n\n has(key) {\n return (key in this.components);\n }\n\n get(key, short = false) {\n if (!(key in this.components)) {\n return null;\n }\n\n return short ? this.components[key].short_name : this.components[key].long_name;\n }\n\n setAttributes(attributes = {}) {\n this.attributes = {...this.attributes, ...attributes};\n\n return this;\n }\n\n setAttribute(key, value) {\n this.attributes[key] = value;\n\n return this;\n }\n\n getAttribute(key) {\n return this.attributes[key] || null;\n }\n}\n\nexport default GoogleAddress;\n","export default class Point {\n constructor(latitude = 0, longitude = 0) {\n this.type = 'Point';\n this.coordinates = [longitude, latitude];\n }\n\n get latitude() {\n return this.coordinates[1];\n }\n\n get longitude() {\n return this.coordinates[0];\n }\n\n lat() {\n return this.latitude;\n }\n\n lng() {\n return this.longitude;\n }\n\n static fromGeoJson(json) {\n [ longitude, latitude ] = json.coordinates;\n\n return new Point(latitude, longitude);\n }\n\n serialize() {\n return {\n type: 'Point',\n coorindates: [this.lat(), this.lng()]\n };\n }\n\n toJson() {\n return this.serialize();\n }\n\n toString() {\n return `(${this.latitude}, ${this.longitude})`;\n }\n}","import isEmpty from './is-empty';\n\nconst isResource = (mixed) => typeof mixed === 'object' && !isEmpty(mixed?.attributes) && typeof mixed?.attributes === 'object';\n\nconst isCallable = (object, property) => typeof object[property] === 'function';\n\nconst getResolved = (func, path) => {\n const resolved = func();\n return Array.isArray(resolved) || typeof resolved === 'object' ? get(resolved, path) : null;\n};\n\nconst invoke = (object, method) => {\n if (typeof object[method] === 'function') {\n return object[method].bind(object);\n }\n};\n\nconst get = (object, path) => {\n let current = object;\n\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n\n if (isArray || isObject) {\n for (let i = 0; i < pathArray.length; i++) {\n if (current && current[pathArray[i]] === undefined) {\n return null;\n } else if (current) {\n current = current[pathArray[i]];\n\n // if is resource then return get on it's attributes\n if (isResource(current) && pathArray[i + 1] !== undefined) {\n const newPath = pathArray.slice(i + 1).join('.');\n\n return get(current.attributes, newPath);\n }\n\n // resolve functions and continue\n if (typeof current === 'function') {\n const newPath = pathArray.slice(i + 1).join('.');\n return getResolved(current, newPath);\n }\n }\n }\n return current;\n }\n\n if (isFunction) {\n return getResolved(object, path);\n }\n};\n\nconst getProperties = (object, properties = []) => {\n const selected = {};\n let propertyNames = arguments;\n let i = 1;\n\n if (arguments.length === 2 && Array.isArray(properties)) {\n i = 0;\n propertyNames = arguments[1];\n }\n\n for (; i < propertyNames.length; i++) {\n selected[propertyNames[i]] = get(object, propertyNames[i]);\n }\n\n return selected;\n};\n\nconst set = (object, path, value) => {\n let current = object;\n const type = typeof object;\n const isObject = type === 'object';\n const isFunction = type === 'function';\n const isArray = Array.isArray(object);\n\n // if is function\n if (isFunction) {\n // throw error should be object or array or object like\n }\n\n const pathType = typeof path;\n const pathIsString = pathType === 'string';\n const pathIsDotted = pathIsString && path.includes('.');\n const pathArray = pathIsDotted ? path.split('.') : [path];\n const iterations = pathArray.length;\n\n if (isArray || isObject) {\n for (let i = 0; i < iterations - 1; i++) {\n if (!current[pathArray[i]]) {\n current[pathArray[i]] = {};\n }\n current = current[pathArray[i]];\n }\n\n current[pathArray[iterations - 1]] = value;\n }\n\n return value;\n};\n\nconst setProperties = (object, properties = {}) => {\n for (const property in properties) {\n set(object, property, properties[property]);\n }\n\n return object;\n};\n\nconst extend = (target, classes = []) => {\n if (arguments.length > 1) {\n classes = arguments;\n }\n for (let index = 0; index < classes.length; index++) {\n for (const property in classes[index]) {\n if (Object.prototype.hasOwnProperty.call(classes[index], property)) {\n target[property] = classes[index][property];\n }\n }\n }\n return target;\n};\n\nexport { set, get, getProperties, setProperties, extend, isCallable, invoke };\n","import { set } from './object';\n\nexport default class StoreActions {\n constructor(actions = {}, bind = null) {\n this.actions = actions;\n this.bind = bind;\n }\n\n extend(bindTo = null) {\n const binding = bindTo || this.bind;\n\n if (!binding) {\n return this;\n }\n\n if (this?.actions && typeof this.actions === 'object') {\n for (let action in this.actions) {\n const fn = this.actions[action];\n\n if (typeof fn !== 'function') {\n set(binding, action, fn);\n continue;\n }\n\n set(binding, action, fn.bind(binding));\n }\n }\n\n return this;\n }\n}\n","import Store from './store';\nimport { isEmpty } from './utils';\nimport { isArray } from './utils/array';\nimport { set, get } from './utils/object';\n\nclass Resource {\n /**\n\t * The base resource for all resources\n\n\t * @return {[type]} [description]\n\t */\n constructor(attributes = {}, adapter, resource, options = {}) {\n this.attributes = attributes;\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isDestroying = false;\n this.isReloading = false;\n this.resource = resource;\n this.options = options;\n this.version = options.version || 'v1';\n this.setAdapter(adapter);\n }\n\n /**\n * Set a new adapter to the resource instance, this will update the Store instance\n *\n * @param {Adapter} adapter\n * @return {Resource} this\n */\n setAdapter(adapter) {\n this.adapter = adapter;\n this.store = new Store(this.resource, adapter, {\n onAfterFetch: this.syncAttributes.bind(this),\n actions: this.options?.actions\n });\n\n return this;\n }\n\n /**\n * Getter for id attribute\n *\n * @var {String}\n */\n get id() {\n return this.getAttribute('id');\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n create(attributes = {}) {\n const data = this.mergeAttributes(attributes);\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.create(data).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Creates a new resource on the server\n *\n * @param {Object} payload [description]\n * @return {[type]} [description]\n */\n update(attributes = {}) {\n this.setFlags(['isLoading', 'isSaving']);\n\n return this.store.update(this.attributes.id, attributes).then((response) => {\n this.setFlags(['isLoading', 'isSaving'], false);\n\n return response;\n });\n }\n\n /**\n * Deletes the resource instance on the server\n *\n * @return {[type]} [description]\n */\n destroy() {\n this.setFlags(['isLoading', 'isDestroying']);\n\n return this.store.destroy(this.attributes.id).then((response) => {\n this.setFlags(['isLoading', 'isDestroying'], false);\n\n return response;\n });\n }\n\n /**\n * Reloads the resource from the server.\n *\n * @return {[type]} [description]\n */\n reload() {\n this.setFlags(['isLoading', 'isReloading']);\n\n return this.store.findRecord(this.attributes.id).then((response) => {\n this.reset();\n\n return response;\n });\n }\n\n /**\n * Sets flag properties.\n *\n * @return this\n */\n setFlags(flags = [], state = true) {\n const validFlags = ['isLoading', 'isSaving', 'isReloading', 'isDestroying'];\n\n for(let i = 0; i < flags.length; i++) {\n const flag = flags[i];\n\n if (typeof flag !== 'string' || !validFlags.includes(flag)) {\n throw new Error(`${flag} is not a valid flag!`);\n }\n\n this[flag] = state;\n }\n\n return this;\n }\n\n /**\n * Resets tracked properties\n *\n * @return this\n */\n reset() {\n this.dirtyAttributes = {};\n this.changes = {};\n this.isLoading = false;\n this.isSaving = false;\n this.isReloading = false;\n\n return this;\n }\n\n /**\n * Emptys resource.\n *\n * @return this\n */\n empty() {\n this.reset();\n this.attribues = {};\n\n return this;\n }\n\n /**\n * Saves the resource instance on the server\n *\n * @return {[type]} [description]\n */\n save(options = {}) {\n const attributes = this.getAttributes();\n\n if (isEmpty(this.id)) {\n return this.create(attributes);\n }\n\n if (options.onlyDirty === true) {\n return this.savedirty();\n }\n\n return this.update(attributes);\n }\n\n /**\n * Saves only dirtied attributes.\n *\n * @return {[type]} [description]\n */\n saveDirty() {\n const dirtyAttributeKeys = Object.keys(this.dirtyAttributes);\n const dirtyAttributes = {};\n\n for (let i = 0; i < dirtyAttributeKeys.length; i++) {\n const key = dirtyAttributeKeys[i];\n dirtyAttributes[key] = this.getAttribute(key);\n }\n\n return this.update(dirtyAttributes);\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get createdAt() {\n return this.hasAttribute('created_at') ? new Date(this.getAttribute('created_at')) : null;\n }\n\n /**\n * Returns the date instance resource was created.\n *\n * @return {Date}\n */\n get updatedAt() {\n return this.hasAttribute('updated_at') ? new Date(this.getAttribute('updated_at')) : null;\n }\n\n /**\n * Checks if resource is loaded from the server.\n *\n * @return {Boolean}\n */\n get isLoaded() {\n return this.hasAttributes(['created_at', 'id']);\n }\n\n /**\n * Checks if resource ihas no attributes\n *\n * @return {Boolean}\n */\n get isEmpty() {\n return Object.values(this.attributes).length === 0;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isNew() {\n return !this.id;\n }\n\n /**\n * Checks if resource is not saved to server.\n *\n * @return {Boolean}\n */\n get isSaved() {\n return !this.isNew && this.isLoaded;\n }\n\n /**\n * Checks if resource is deleted on server.\n *\n * @return {Boolean}\n */\n get isDeleted() {\n return this.hasAttributes(['deleted', 'time']);\n }\n\n /**\n * Iterates over each attribute value and property executing a user supplied callback.\n *\n * @return {Object}\n */\n eachAttribute(callback) {\n if (typeof callback !== 'function') {\n return this;\n }\n\n Object.keys(this.attributes).forEach((property) => {\n const value = this.getAttribute(property);\n callback.call(this, value, property);\n });\n\n return this;\n }\n\n /**\n * Gets all changes\n *\n * @return {Object}\n */\n changes() {\n return this.changes;\n }\n\n /**\n * Gets all dirty attributes.\n *\n * @return {Object}\n */\n getDirtyAttributes() {\n return this.dirtyAttributes;\n }\n\n /**\n * Checks if property is dirty.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n isDirty(property) {\n return property in this.dirtyAttributes;\n }\n\n /**\n * Checks if any properties is dirty.\n *\n * @return {Boolean}\n */\n hasDirtyAttributes() {\n return Object.keys(this.dirtyAttributes).length > 0;\n }\n\n /**\n * Updates a instance property without tracking changes or dirtying attribute.\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n mutate(property, value) {\n this.attributes[property] = value;\n }\n\n /**\n * Set an instance property locally\n *\n * @param {String} property [description]\n * @param {mixed} value [description]\n */\n setAttribute(property, value = null) {\n if (value === null && typeof property === 'object') {\n return this.setAttributes(property);\n }\n\n const previousValue = this.attributes[property] || null;\n\n // use object setter\n set(this.attributes, property, value);\n set(this.dirtyAttributes, property, previousValue);\n \n // this.attributes[property] = value;\n // this.dirtyAttributes[property] = previousValue;\n\n // track changes\n if (!isArray(this.changes[property])) {\n this.changes[property] = [];\n }\n\n this.changes[property].push({\n property,\n previousValue,\n value,\n changedAt: new Date(),\n });\n\n return this;\n }\n\n /**\n * Set multiple instance properties locally\n *\n * @param {Object} properties [description]\n */\n setAttributes(attributes = {}) {\n for (let property in attributes) {\n this.setAttribute(property, attributes[property]);\n }\n\n return this;\n }\n\n /**\n * Get an attribute\n *\n * @param {String} attribute The attribute key to get\n * @param {mixed} defaultValue The default value if no attribute value\n */\n getAttribute(attribute, defaultValue = null) {\n const value = get(this.attributes, attribute);\n\n if (value === undefined) {\n return defaultValue;\n }\n\n return value;\n }\n\n /**\n * Checks if attribute exists.\n *\n * @param {String} property [description]\n * @return {Boolean}\n */\n hasAttribute(property) {\n if (isArray(property)) {\n const properties = property;\n const attributeKeys = Object.keys(this.attributes ?? {});\n \n return properties.every((prop) => attributeKeys.includes(prop));\n }\n\n if (!this.attributes) {\n return false;\n }\n\n return property in this.attributes;\n }\n\n /**\n * Alias for checking if has multiple attributes.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n hasAttributes(properties = []) {\n return this.hasAttribute(properties);\n }\n\n\n /**\n * Returns true if attribute has value.\n *\n * @param {Array} properties \n * @return {Boolean}\n */\n isAttributeFilled(property) {\n if (isArray(property)) {\n return this.hasAttribute(property) && property.every((prop) => !isEmpty(this.getAttribute(prop)));\n }\n\n return this.hasAttribute(property) && !isEmpty(this.getAttribute(property));\n }\n\n /**\n * Get multiple attributes.\n *\n * @param {Array} properties [description]\n * @param {[type]} value [description]\n */\n getAttributes(properties) {\n const attributes = {};\n\n if (properties === null || properties === undefined) {\n return this.attributes;\n }\n\n if (typeof properties === 'string') {\n return this.getAttribute([...arguments]);\n }\n\n if (!isArray(properties)) {\n throw new Error('No attribute properties provided!');\n }\n\n for (let i = 0; i < properties.length; i++) {\n const property = properties[i];\n\n if (typeof property !== 'string') {\n continue;\n }\n\n attributes[property] = this.getAttribute(property);\n }\n\n return attributes;\n }\n\n /**\n * Serialize resource to a POJO\n *\n * @returns {Object}\n */\n serialize() {\n return this.getAttributes();\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n mergeAttributes(attributes = {}) {\n const modelAttributes = this.attributes || {};\n this.attributes = { ...modelAttributes, ...attributes };\n\n return this.attributes;\n }\n\n /**\n * Merge and return attributes on the resource instance.\n *\n * @param {[type]} property [description]\n * @param {[type]} value [description]\n */\n syncAttributes(json = {}) {\n this.attributes = json;\n }\n}\n\nexport default Resource;\n","import Resource from '../resource';\nimport { StoreActions } from '../utils';\n\nconst orderActions = new StoreActions({\n getDistanceAndTime: function (id, options = {}) {\n return this.adapter.get(`${this.namespace}/${id}/distance-and-time`, {}, options);\n },\n});\n\nclass Order extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'order', { actions: orderActions, ...options });\n }\n\n getDistanceAndTime() {\n return this.store.getDistanceAndTime(this.id);\n }\n}\n\nexport default Order;\n\nexport { orderActions };","import Resource from '../resource';\nimport Collection from '../utils/collection';\n\nclass Payload extends Resource {\n\tconstructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'payload', options);\n }\n\t\n /**\n\t * Attaches an entity to an existing payload and returns\n\t * the payload with the entity attached\n\t *\n\t * @param {[type]} Entity entity [description]\n\t * @return {[type]} [description]\n\t */\n attach(entity) {\n // perform op return payload\n }\n\n /**\n\t * Returns all of the entities attached to this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get entities() {\n\n }\n\n /**\n\t * Returns the dropoff for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get dropoff() {\n\n }\n\n /**\n\t * Returns the pickup for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get pickup() {\n\n }\n\n /**\n\t * Returns all the waypoints for this payload\n\t *\n\t * @return {[type]} [description]\n\t */\n get waypoints() {\n return new Collection(this.waypoints);\n }\n}\n\nexport default Payload;\n","import Resource from '../resource';\n\nclass Entity extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'entity', options);\n }\n}\n\nexport default Entity;\n","import Resource from '../resource';\nimport { isResource, Point } from '../utils';\n\nclass Place extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'place', options);\n }\n\n static fromGoogleAddress(googleAddress, adapter, options = {}) {\n const [ latitude, longitude ] = googleAddress.getAttribute('coordinates');\n const attributes = {\n name: null,\n address: googleAddress.getAttribute('address'),\n location: new Point(latitude, longitude),\n street1: googleAddress.getAttribute('streetName'),\n street2: null,\n city: googleAddress.getAttribute('city'),\n province: googleAddress.getAttribute('stateLong'),\n postal_code: googleAddress.getAttribute('postalCode'),\n neighborhood: googleAddress.get('neighborhood'),\n district: googleAddress.getAttribute('county'),\n building: googleAddress.get('building'),\n country: googleAddress.getAttribute('countryShort'),\n phone: null,\n security_access_code: null\n };\n\n return new Place(attributes, adapter, options);\n }\n\n /**\n * The latitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get latitude() {\n return this.getAttribute('location', new Point()).coordinates[1];\n }\n\n /**\n * The longitude coordinate for the 'Place' location.\n * \n * @var {Integer}\n */\n get longitude() {\n return this.getAttribute('location', new Point()).coordinates[0];\n }\n\n /**\n * Array coordinate pair for Place location.\n * \n * @var {Array}\n */\n get coordinates() {\n const { latitude, longitude } = this;\n\n return [ latitude, longitude ];\n }\n\n /**\n * Set the owner of the place.\n * \n * @param {Object|String} owner\n * @return {Place}\n */\n setOwner(owner) {\n if (isResource(owner)) {\n this.setAttribute('owner', owner.id);\n }\n\n if (typeof owner === 'string') {\n this.setAttribute('owner', owner);\n }\n\n return this;\n }\n}\n\nexport default Place;\n","import Place from './place';\n\nclass Waypoint extends Place {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'waypoint', options);\n }\n}\n\nexport default Waypoint;\n","import Resource from '../resource';\n\nclass TrackingStatus extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'tracking-status', options);\n }\n}\n\nexport default TrackingStatus;\n","import Resource from '../resource';\n\nclass Vehicle extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vehicle', options);\n }\n}\n\nexport default Vehicle;\n","import Resource from '../resource';\n\nclass Driver extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'driver', options);\n }\n}\n\nexport default Driver;\n","import Resource from '../resource';\n\nclass Vendor extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'vendor', options);\n }\n}\n\nexport default Vendor;\n","import Resource from '../resource';\n\nclass Contact extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'contact', options);\n }\n}\n\nexport default Contact;\n","import Resource from '../resource';\n\nclass Zone extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'zone', options);\n }\n}\n\nexport default Zone;\n","import Resource from '../resource';\n\nclass ServiceArea extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-area', options);\n }\n}\n\nexport default ServiceArea;\n","import Resource from '../resource';\n\nclass ServiceRate extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-rate', options);\n }\n}\n\nexport default ServiceRate;\n","import Resource from '../resource';\n\nclass ServiceQuote extends Resource {\n constructor(attributes = {}, adapter, options = {}) {\n super(attributes, adapter, 'service-quote', options);\n }\n\n fromPreliminary() {\n\n }\n\n fromPayload() {\n \n }\n}\n\nexport default ServiceQuote;\n","class Adapter {\n /**\n\t * Creates a configured base adapter for Fleetbase.\n\t *\n\t * @param {Object} config Configuration options for adapter\n\t */\n constructor(config = {}) {\n this.version = config.version || 'v1';\n this.host = config.host || null;\n this.namespace = config.namespace || null;\n this.headers = config.headers || {};\n }\n}\n\nexport default Adapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\n\nclass BrowserAdapter extends Adapter {\n /**\n * Setup browser adapter.\n * @param {Object} config\n */\n constructor(config) {\n super(config);\n\n this.setHeaders({\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;browser'\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n this.headers = { ...this.headers, ...headers };\n\n return this;\n }\n\n /**\n * Parses the JSON returned by a network request\n *\n * @param {Object} response A response from a network request\n * @return {Object} The parsed JSON, status from the response\n *\n * @return {Promise}\n */\n parseJSON(response) {\n return new Promise((resolve, reject) => response\n .json()\n .then((json) => resolve({\n statusText: response.statusText,\n status: response.status,\n ok: response.ok,\n json,\n }))\n .catch(() => {\n reject(new Error('Oops! Something went wrong when handling your request.'));\n }));\n }\n\n /**\n * The base request method\n *\n * @param {String} path\n * @param {String} method\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n request(path, method = 'GET', data = {}, options = {}) {\n return new Promise((resolve, reject) => fetch(options.url || `${this.host}/${this.namespace}/${path}`, {\n method,\n mode: options.mode || 'cors',\n headers: new Headers({\n ...(this.headers || {}),\n ...(options.headers || {}),\n }),\n ...data,\n })\n .then(this.parseJSON)\n .then((response) => {\n if (response.ok) {\n return resolve(response.json);\n }\n\n return reject(new Error(response.json.errors ? response.json.errors[0] : response.statusText));\n })\n .catch((error) => {\n reject(error);\n }));\n }\n\n /**\n * Makes a GET request with fetch\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.request(`${path}${urlParams ? `?${urlParams}` : ''}`, 'GET', {}, options);\n }\n\n /**\n * Makes a POST request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.request(path, 'POST', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a PUT request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.request(path, 'PUT', { body: JSON.stringify(data) }, options);\n }\n\n /**\n * Makes a DELETE request with fetch\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.request(path, 'DELETE', {}, options);\n }\n\n /**\n * Makes a PATCH request with fetch\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.request(path, 'PATCH', { body: JSON.stringify(data) }, options);\n }\n}\n\nexport default BrowserAdapter;\n","import Adapter from '../adapter';\nimport { isBlank } from '../utils';\nimport { isArray } from '../utils/array';\nimport axios from 'axios';\n\nclass NodeAdapter extends Adapter {\n constructor(config) {\n super(config);\n\n this.axios = axios.create({\n baseURL: `${this.host}/${this.namespace}`,\n headers: {\n Authorization: `Bearer ${config.publicKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': '@fleetbase/sdk;node',\n },\n });\n }\n\n /**\n * Updates the adapter headers.\n *\n * @param {Object} headers\n */\n setHeaders(headers = {}) {\n const commonHeaders = this.axios.defaults.headers.common;\n this.axios.defaults.headers.common = { ...commonHeaders, ...headers };\n\n return this;\n }\n\n /**\n * Tranform the response, and return the response data from axios.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n transform(response) {\n return response.data;\n }\n\n /**\n * Handles an erroneous request.\n *\n * @param {AxiosResponse} response\n * @returns {Object}\n */\n handleError(error) {\n if (error.response) {\n const { data } = error.response;\n\n if (isArray(data.errors)) {\n throw new Error(data.errors[0]);\n }\n\n if (data.error) {\n throw new Error(data.error);\n }\n }\n\n throw error;\n }\n\n /**\n * Makes a GET request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n get(path, query = {}, options = {}) {\n const urlParams = !isBlank(query) ? new URLSearchParams(query).toString() : '';\n\n return this.axios\n .get(`${path}${urlParams ? `?${urlParams}` : ''}`, options)\n .then(this.transform.bind(this))\n .catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a POST request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n post(path, data = {}, options = {}) {\n return this.axios.post(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PUT request with axios\n *\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n put(path, data = {}, options = {}) {\n return this.axios.put(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a DELETE request with axios\n *\n * @param {String} path\n * @param {Object} query\n * @param {Object} options\n *\n * @return {Promise}\n */\n delete(path, options = {}) {\n return this.axios.delete(path, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n\n /**\n * Makes a PATCH request with axios\n * @param {String} path\n * @param {Object} data\n * @param {Object} options\n *\n * @return {Promise}\n */\n patch(path, data = {}, options = {}) {\n return this.axios.patch(path, data, options).then(this.transform.bind(this)).catch(this.handleError.bind(this));\n }\n}\n\nexport default NodeAdapter;\n","import Adapter from '../adapter';\n\nclass EmberJsAdapter extends Adapter {}\n\nexport default EmberJsAdapter;\n","'use strict';\n\n/**\n * Javascript String\n *\n * instance\n * new String('hello_world').humanize().get() => \"Hello world\"\n *\n * instance\n * const string = new String();\n * string.humanize('hello_world').get() => \"Hello world\"\n * \n * no chain\n * new String('hello_world', false).humanize() => \"Hello world\"\n *\n * static\n * String.invoke('humanize', 'hello_world') => \"Hello world\"\n *\n * exports {}\n * humanize('hello_world') => \"Hello world\"\n */\n\nexport default class String {\n constructor(string, chain = true) {\n this.str = string;\n this.chain = chain;\n }\n\n uncountableWords = ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'moose', 'deer', 'news'];\n\n pluralRules = [\n [new RegExp('(m)an$', 'gi'), '$1en'],\n [new RegExp('(pe)rson$', 'gi'), '$1ople'],\n [new RegExp('(child)$', 'gi'), '$1ren'],\n [new RegExp('^(ox)$', 'gi'), '$1en'],\n [new RegExp('(ax|test)is$', 'gi'), '$1es'],\n [new RegExp('(octop|vir)us$', 'gi'), '$1i'],\n [new RegExp('(alias|status)$', 'gi'), '$1es'],\n [new RegExp('(bu)s$', 'gi'), '$1ses'],\n [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'],\n [new RegExp('([ti])um$', 'gi'), '$1a'],\n [new RegExp('sis$', 'gi'), 'ses'],\n [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'],\n [new RegExp('(hive)$', 'gi'), '$1s'],\n [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'],\n [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'],\n [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'],\n [new RegExp('([m|l])ouse$', 'gi'), '$1ice'],\n [new RegExp('(quiz)$', 'gi'), '$1zes'],\n [new RegExp('s$', 'gi'), 's'],\n [new RegExp('$', 'gi'), 's'],\n ];\n\n singularRules = [\n [new RegExp('(m)en$', 'gi'), '$1an'],\n [new RegExp('(pe)ople$', 'gi'), '$1rson'],\n [new RegExp('(child)ren$', 'gi'), '$1'],\n [new RegExp('([ti])a$', 'gi'), '$1um'],\n [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$', 'gi'), '$1$2sis'],\n [new RegExp('(hive)s$', 'gi'), '$1'],\n [new RegExp('(tive)s$', 'gi'), '$1'],\n [new RegExp('(curve)s$', 'gi'), '$1'],\n [new RegExp('([lr])ves$', 'gi'), '$1f'],\n [new RegExp('([^fo])ves$', 'gi'), '$1fe'],\n [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'],\n [new RegExp('(s)eries$', 'gi'), '$1eries'],\n [new RegExp('(m)ovies$', 'gi'), '$1ovie'],\n [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'],\n [new RegExp('([m|l])ice$', 'gi'), '$1ouse'],\n [new RegExp('(bus)es$', 'gi'), '$1'],\n [new RegExp('(o)es$', 'gi'), '$1'],\n [new RegExp('(shoe)s$', 'gi'), '$1'],\n [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'],\n [new RegExp('(octop|vir)i$', 'gi'), '$1us'],\n [new RegExp('(alias|status)es$', 'gi'), '$1'],\n [new RegExp('^(ox)en', 'gi'), '$1'],\n [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'],\n [new RegExp('(matr)ices$', 'gi'), '$1ix'],\n [new RegExp('(quiz)zes$', 'gi'), '$1'],\n [new RegExp('s$', 'gi'), ''],\n ];\n\n nonTitlecasedWords = ['and', 'or', 'nor', 'a', 'an', 'the', 'so', 'but', 'to', 'of', 'at', 'by', 'from', 'into', 'on', 'onto', 'off', 'out', 'in', 'over', 'with', 'for'];\n\n idSuffix = new RegExp('(_ids|_id)$', 'g');\n underbar = new RegExp('_', 'g');\n spaceOrUnderbar = new RegExp('[ _]', 'g');\n uppercase = new RegExp('([A-Z])', 'g');\n underbarPrefix = new RegExp('^_');\n\n get() {\n return this.str;\n }\n\n applyRules(str, rules, skip, override) {\n if (override) {\n str = override;\n } else {\n var ignore = skip.indexOf(str.toLowerCase()) > -1;\n if (!ignore) {\n for (var x = 0; x < rules.length; x++) {\n if (str.match(rules[x][0])) {\n str = str.replace(rules[x][0], rules[x][1]);\n break;\n }\n }\n }\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.pluralize('person') -> 'people'\n String.pluralize('octopus') -> 'octopi'\n String.pluralize('Hat') -> 'Hats'\n String.pluralize('person', 'guys') -> 'guys' \n */\n pluralize(str, plural = null) {\n str = str || this.str;\n\n return this.applyRules(str, this.pluralRules, this.uncountableWords, plural);\n }\n\n /*\n String.singularize('person') -> 'person'\n String.singularize('octopi') -> 'octopus'\n String.singularize('hats') -> 'hat'\n String.singularize('guys', 'person') -> 'person'\n */\n singularize(str, singular) {\n str = str || this.str;\n\n return this.applyRules(str, this.singularRules, this.uncountableWords, singular);\n }\n\n /*\n String.camelize('message_properties') -> 'MessageProperties'\n String.camelize('message_properties', true) -> 'messageProperties'\n */\n camelize(str, lowFirstLetter) {\n str = str || this.str;\n\n let str_path = str.split('/');\n for (var i = 0; i < str_path.length; i++) {\n let str_arr = str_path[i].split('_');\n let initX = lowFirstLetter && i + 1 === str_path.length ? 1 : 0;\n\n for (let x = initX; x < str_arr.length; x++) {\n str_arr[x] = str_arr[x].charAt(0).toUpperCase() + str_arr[x].substring(1);\n }\n str_path[i] = str_arr.join('');\n }\n str = str_path.join('::');\n\n // fix\n if (lowFirstLetter === true) {\n let first = str.charAt(0).toLowerCase();\n let last = str.slice(1);\n str = first + last;\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.underscore('MessageProperties') -> 'message_properties'\n String.underscore('messageProperties') -> 'message_properties'\n */\n underscore(str) {\n str = str || this.str;\n\n var str_path = str.split('::');\n for (var i = 0; i < str_path.length; i++) {\n str_path[i] = str_path[i].replace(this.uppercase, '_$1');\n str_path[i] = str_path[i].replace(this.underbarPrefix, '');\n }\n str = str_path.join('/').toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.humanize('message_properties') -> 'Message properties'\n String.humanize('message_properties') -> 'message properties'\n */\n humanize(str, lowFirstLetter) {\n str = str || this.str;\n\n var str = str.toLowerCase();\n str = str.replace(this.idSuffix, '');\n str = str.replace(this.underbar, ' ');\n if (!lowFirstLetter) {\n str = this.capitalize(str);\n }\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.capitalize('message_properties') -> 'Message_properties'\n String.capitalize('message properties') -> 'Message properties'\n */\n capitalize(str) {\n str = str || this.str;\n\n str = str.toLowerCase();\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.dasherize('message_properties') -> 'message-properties'\n String.dasherize('message properties') -> 'message-properties'\n */\n dasherize(str) {\n str = str || this.str;\n\n str = str.replace(this.spaceOrUnderbar, '-');\n str = str.toLowerCase();\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.normify('message_properties') -> 'Message Properties'\n String.normify('message properties') -> 'Message Properties'\n Inflactor.normify('Message_propertyId', true) -> 'Message Properties Id'\n */\n normify(str, allFirstUpper) {\n str = str || this.str;\n\n //var str = str.toLowerCase();\n if (allFirstUpper === true) {\n str = this.camelize(str);\n str = this.underscore(str);\n } else {\n str = str.toLowerCase();\n }\n\n str = str.replace(this.underbar, ' ');\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var d = str_arr[x].split('-');\n for (var i = 0; i < d.length; i++) {\n if (this.nonTitlecasedWords.indexOf(d[i].toLowerCase()) < 0) {\n d[i] = this.capitalize(d[i]);\n }\n }\n str_arr[x] = d.join('-');\n }\n str = str_arr.join(' ');\n str = str.substring(0, 1).toUpperCase() + str.substring(1);\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.demodulize('Message::Bus::Properties') -> 'Properties'\n */\n demodulize(str) {\n str = str || this.str;\n\n var str_arr = str.split('::');\n str = str_arr[str_arr.length - 1];\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.tableize('MessageBusProperty') -> 'message_bus_properties'\n */\n tableize(str) {\n str = str || this.str;\n\n str = this.pluralize(this.underscore(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.classify('message_bus_properties') -> 'MessageBusProperty'\n */\n classify(str) {\n str = str || this.str;\n\n str = this.singularize(this.camelize(str));\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.foreignKey('MessageBusProperty') -> 'message_bus_property_id'\n String.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'\n */\n foreignKey(str, dropIdUbar = false) {\n str = str || this.str;\n\n str = this.underscore(this.demodulize(str)) + (dropIdUbar ? '' : '_') + 'id';\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /*\n String.ordinalize('the 1 pitch') -> 'the 1st pitch'\n */\n ordinalize(str) {\n str = str || this.str;\n\n var str_arr = str.split(' ');\n for (var x = 0; x < str_arr.length; x++) {\n var i = parseInt(str_arr[x]);\n if (i === NaN) {\n var ltd = str_arr[x].substring(str_arr[x].length - 2);\n var ld = str_arr[x].substring(str_arr[x].length - 1);\n var suf = 'th';\n if (ltd != '11' && ltd != '12' && ltd != '13') {\n if (ld === '1') {\n suf = 'st';\n } else if (ld === '2') {\n suf = 'nd';\n } else if (ld === '3') {\n suf = 'rd';\n }\n }\n str_arr[x] += suf;\n }\n }\n str = str_arr.join(' ');\n\n // set str\n this.str = str;\n\n if (this.chain === true) {\n return this;\n }\n\n // return result\n return str;\n }\n\n /**\n * @method invoke\n **/\n static invoke() {\n const argz = Object.values(arguments);\n const instance = new String(null, false);\n const method = arguments[0];\n argz.shift();\n\n if (typeof instance[method] === 'function') {\n return instance[method](...argz);\n }\n\n return null;\n }\n}\n\nconst pluralize = function() {\n const argz = ['pluralize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst singularize = function() {\n const argz = ['singularize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst humanize = function() {\n const argz = ['humanize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst underscore = function() {\n const argz = ['underscore', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst camelize = function() {\n const argz = ['camelize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst capitalize = function() {\n const argz = ['capitalize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst dasherize = function() {\n const argz = ['dasherize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst normify = function() {\n const argz = ['normify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst demodulize = function() {\n const argz = ['demodulize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst tableize = function() {\n const argz = ['tableize', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst classify = function() {\n const argz = ['classify', ...arguments];\n\n return String.invoke(...argz);\n};\n\nconst foreignKey = function() {\n const argz = ['foreignKey', ...arguments];\n\n return String.invoke(...argz);\n};\n\nexport {\n pluralize,\n singularize,\n humanize,\n underscore,\n camelize,\n capitalize,\n dasherize,\n normify,\n demodulize,\n tableize,\n classify,\n foreignKey\n}","import { Place, Payload, Order } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter } from './adapters';\nimport { pluralize, singularize } from './utils/string';\n\nconst resources = {\n Place,\n Payload,\n Order\n};\n\nconst adapters = {\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter\n};\n\nclass Resolver {\n constructor () {\n this.resources = resources;\n this.adapters = adapters;\n\n return this.lookup(...arguments);\n }\n\n lookup(type, className) {\n const key = pluralize(type);\n const params = [ ...arguments ].slice(2);\n\n if (!this[key]) {\n throw new Error('Attempted to resolve invalid type');\n }\n\n if (!this[key][className]) {\n throw new Error(`No ${singularize(type)} named ${className} to resolve`);\n }\n\n return new this[key][className](...params);\n }\n}\n\nconst lookup = function() {\n return new Resolver(...arguments);\n};\n\nexport {\n Resolver,\n lookup\n};\n","import { lookup } from './resolver';\nimport { pluralize, classify } from './utils/string';\nimport { isArray } from './utils/array';\nimport { Collection, detectAdapter, isResource, StoreActions } from './utils';\nimport { set, isCallable, invoke } from './utils/object';\n\nconst extendStoreActions = (store, actions = []) => {\n store.actions = isArray(actions) ? actions : [actions];\n\n if (isArray(actions)) {\n for (let i = 0; i < actions.length; i++) {\n const action = actions[i];\n\n store.extendActions(action);\n }\n return;\n }\n\n if (actions instanceof StoreActions) {\n actions.extend(store);\n }\n\n return store;\n};\n\nconst afterFetch = (store, json) => {\n if (typeof store.options.onAfterFetch === 'function') {\n store.options.onAfterFetch(json);\n }\n\n if (isArray(json)) {\n const serialized = [];\n\n for (let i = 0; i < json.length; i++) {\n serialized.push(store.afterFetch(json[i]));\n }\n\n return new Collection(...serialized);\n }\n\n const resourceInstance = store.serialize(json);\n return store.deposit(resourceInstance);\n};\n\nclass Store {\n constructor(resource, adapter, options = {}) {\n this.resource = resource;\n this.adapter = adapter || detectAdapter();\n this.namespace = pluralize(resource);\n this.storage = new Collection();\n this.options = options;\n this.extendActions(options.actions);\n }\n\n extendActions(actions = []) {\n return extendStoreActions(this, actions);\n }\n\n deposit(resourceInstance) {\n // this.storage[this.namespace].pushObject(resourceInstance);\n\n return resourceInstance;\n }\n\n serialize(json) {\n return lookup('resource', classify(this.resource), json, this.adapter);\n }\n\n afterFetch(json) {\n return afterFetch(this, json);\n }\n\n create(attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.post(`${this.namespace}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n update(id, attributes = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.put(`${this.namespace}/${id}`, attributes, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findRecord(id, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n findAll(options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n query(query = {}, options = {}) {\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n queryRecord(query = {}, options = {}) {\n query.single = true;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.get(`${this.namespace}`, query, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n\n destroy(record, options = {}) {\n const id = isResource(record) ? record.getAttribute('id') : record;\n\n return new Promise(async (resolve, reject) => {\n const response = await this.adapter.delete(`${this.namespace}/${id}`, {}, options).then(this.afterFetch.bind(this)).catch(reject);\n\n resolve(response);\n });\n }\n}\n\nexport default Store;\n\nexport { extendStoreActions, afterFetch };\n","import 'core-js/stable';\nimport 'regenerator-runtime/runtime';\nimport Store from './store';\nimport Resource from './resource';\nimport { Contact, Driver, Entity, Order, Payload, Place, TrackingStatus, Vehicle, Vendor, Waypoint, Zone, ServiceArea, ServiceRate, ServiceQuote } from './resources';\nimport { BrowserAdapter, NodeAdapter, EmberJsAdapter, Adapter } from './adapters';\nimport { isNodeEnvironment, detectAdapter, isLatitude, isLongitude, Point, isResource, GoogleAddress, Collection, StoreActions } from './utils';\nimport { pluralize, singularize, classify, dasherize, camelize } from './utils/string';\nimport { extendStoreActions } from './store';\nimport { orderActions } from './resources/order';\n\n/**\n * // instance\n * const fleetbase = new Fleetbase();\n *\n * const contact = fleetbase.contacts.create({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * constact.update({ name: 'Hollywood Ron' });\n *\n * // export\n * import { Contact } from '@fleetbase/sdk';\n *\n * const contact = new Contact({\n * \t\tname: 'Ron',\n * \t\tphone: '+65 9999 8888'\n * });\n *\n * contact.save();\n */\n\nexport default class Fleetbase {\n /**\n * Builds an instance of the Fleetbase SDK\n *\n * @param {String} publicKey The public key issued\n * @param {Object} config The version of resource to access\n * @param {Boolean} debug Debug mode for SDK\n * @return {Fleetbase} Instance\n */\n constructor(publicKey, config = {}, debug = false) {\n this.version = config.version || 'v1';\n this.options = {\n version: this.version,\n host: config.host || 'https://api.fleetbase.io',\n namespace: this.version || config.namespace,\n debug,\n publicKey,\n };\n\n if (typeof publicKey !== 'string' || publicKey.length === 0) {\n throw new Error('⚠️ Invalid public key given to Fleetbase SDK');\n }\n\n if (!isNodeEnvironment() && publicKey.toLowerCase().startsWith('$')) {\n throw new Error('Secret key provided. You must use a public key with Fleetbase Javascript SDK!');\n }\n\n this.adapter = config.adapter || detectAdapter(this.options);\n\n this.orders = new Store('order', this.adapter).extendActions(orderActions);\n this.entities = new Store('entity', this.adapter);\n this.places = new Store('place', this.adapter);\n this.drivers = new Store('driver', this.adapter);\n this.vehicles = new Store('vehicle', this.adapter);\n this.vendors = new Store('vendor', this.adapter);\n this.contacts = new Store('contact', this.adapter);\n }\n\n static newInstance() {\n return new Fleetbase(...arguments);\n }\n\n setAdapter(adapter) {\n this.adapter = adapter;\n }\n\n getAdapter() {\n return this.adapter;\n }\n}\n\nexport {\n Store,\n Resource,\n Contact,\n Driver,\n Entity,\n Order,\n Payload,\n Place,\n TrackingStatus,\n Vehicle,\n Vendor,\n Waypoint,\n Zone,\n ServiceArea,\n ServiceRate,\n ServiceQuote,\n BrowserAdapter,\n NodeAdapter,\n EmberJsAdapter,\n Adapter,\n isNodeEnvironment,\n isLatitude,\n isLongitude,\n Point,\n isResource,\n GoogleAddress,\n Collection,\n StoreActions,\n extendStoreActions,\n pluralize,\n singularize,\n classify,\n dasherize,\n camelize,\n};\n"],"names":["isArray","Array","replace","array","start","deleteCount","items","length","splice","i","chunk","slice","isCollection","arr","identityFunction","item","mixed","Collection","objectAt","index","iter","key","value","arguments","Boolean","findIndex","predicate","startAt","len","find","callback","target","bind","undefined","any","every","cb","indexOf","val","withNaNCheck","insertAt","this","indexes","map","idx","_this2","object","methodName","args","ret","forEach","push","_item$methodName","filter","sortKeys","sort","a","b","propA","propB","compareValue","compare","seen","Set","getter","get","has","add","uniqBy","includes","removeAt","obj","objects","toArray","reverse","clear","loc","removeObject","pushObject","_this3","addObject","isEmpty","none","size","objectType","isBlank","test","isLatitude","coordinate","isFinite","Math","abs","isLongitude","isResource","record","Resource","isNodeEnvironment","process","_typeof","_process","env","release","name","search","window","navigator","product","detectAdapter","options","lookup","GoogleAddress","place","geometry","components","parseComponents","attributes","parseProperties","address_components","reduce","acc","data","types","type","streetNumber","streetName","coordinates","location","Object","values","city","or","county","stateShort","stateLong","countryShort","country","countryLong","postalCode","address","join","keys","pkey","short","short_name","long_name","Point","latitude","longitude","coorindates","lat","lng","serialize","json","getResolved","func","path","resolved","current","isObject","isFunction","pathArray","split","newPath","set","iterations","StoreActions","actions","bindTo","binding","action","fn","adapter","resource","dirtyAttributes","changes","isLoading","isSaving","isDestroying","isReloading","version","setAdapter","store","Store","onAfterFetch","syncAttributes","_this$options","getAttribute","mergeAttributes","setFlags","create","then","response","_this","update","id","destroy","findRecord","_this4","reset","flags","state","validFlags","flag","Error","attribues","getAttributes","onlyDirty","savedirty","dirtyAttributeKeys","hasAttribute","Date","hasAttributes","isNew","isLoaded","property","_this5","call","setAttributes","previousValue","changedAt","setAttribute","attribute","defaultValue","properties","attributeKeys","prop","_this6","modelAttributes","orderActions","getDistanceAndTime","namespace","Order","Payload","entity","waypoints","Entity","Place","owner","googleAddress","street1","street2","province","postal_code","neighborhood","district","building","phone","security_access_code","Waypoint","TrackingStatus","Vehicle","Driver","Vendor","Contact","Zone","ServiceArea","ServiceRate","ServiceQuote","Adapter","config","host","headers","BrowserAdapter","setHeaders","Authorization","publicKey","Promise","resolve","reject","statusText","status","ok","method","fetch","url","mode","Headers","parseJSON","errors","error","query","urlParams","URLSearchParams","toString","request","body","JSON","stringify","NodeAdapter","axios","baseURL","commonHeaders","defaults","common","transform","handleError","post","put","patch","EmberJsAdapter","String","string","chain","RegExp","str","rules","skip","override","toLowerCase","x","match","plural","applyRules","pluralRules","uncountableWords","singular","singularRules","lowFirstLetter","str_path","str_arr","charAt","toUpperCase","substring","first","last","uppercase","underbarPrefix","idSuffix","underbar","capitalize","spaceOrUnderbar","allFirstUpper","camelize","underscore","d","nonTitlecasedWords","pluralize","singularize","dropIdUbar","demodulize","NaN","parseInt","ltd","ld","suf","argz","instance","shift","invoke","dasherize","classify","resources","adapters","Resolver","className","params","extendStoreActions","extend","extendActions","storage","resourceInstance","serialized","afterFetch","deposit","single","_this7","Fleetbase","debug","startsWith","orders","entities","places","drivers","vehicles","vendors","contacts"],"mappings":"gnJAAA,IAAQA,EAAYC,MAAZD,yDCWFE,EAAU,SAACC,EAAOC,EAAOC,OAAaC,yDAAQ,MAC5CN,EAAQG,MACJG,EAAMC,QANC,IAOPJ,EAAMK,aAANL,GAAaC,EAAOC,YAAgBC,SACjC,CACHH,EAAMK,OAAOJ,EAAOC,OAEf,IAAII,EAAI,EAAGA,EAAIH,EAAMC,OAAQE,GAX3B,IAW4C,KAC3CC,EAAQJ,EAAMK,MAAMF,EAAGA,EAZxB,KAaHN,EAAMK,aAANL,GAAaC,EAAQK,EAAG,YAAMC,WAG/BE,EAAaC,MACpBV,EAAMD,QAAQE,EAAOC,EAAaC,IAIpCQ,EAAmB,SAACC,UAASA,GAkB7BH,EAAe,SAACI,UAAUA,aAAiBC,GAE3CC,EAAW,SAACf,EAAOgB,UACjBnB,EAAQG,GACDA,EAAMgB,GACNP,EAAaT,GACbA,EAAMe,SAASC,GAGnB,MAGLC,EAAO,SAACC,EAAKC,UAC0B,IAArBC,EAAUhB,OACP,SAACQ,UAASO,IAAUP,EAAKM,IAAO,SAACN,UAASS,QAAQT,EAAKM,MAG5EI,EAAY,SAACtB,EAAOuB,WAAWC,yDAAU,EACvCC,EAAMzB,EAAMI,OACPY,EAAQQ,EAASR,EAAQS,EAAKT,IAAS,KACxCJ,EAAOG,EAASf,EAAOgB,MACvBO,EAAUX,EAAMI,EAAOhB,UAChBgB,SAGP,GAG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