vue-service-model
Version:
Vue.js library for handling REST service requests with caching, aggregation and model definitions
2 lines (1 loc) • 22.6 kB
JavaScript
var VueServiceModel=function(e,t,s){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),a=r(s);const i=(e,t=!1)=>!(!e||"object"!=typeof e)&&(!Array.isArray(e)||t),o=e=>null==e,l=e=>{if(null===e||"object"!=typeof e)return e;const t=e.constructor();for(const s of Object.keys(e))t[s]=l(e[s]);return t},d=(e,...t)=>{if(!t.length)return e;const s=t.shift();if(s&&i(e)&&i(s))for(const t of Object.keys(s)){const r=s[t];i(r)?(e[t]||Object.assign(e,{[t]:{}}),d(e[t],r)):Object.assign(e,{[t]:r})}return d(e,...t)},u=(e,t,...s)=>Promise.resolve(((e,t,...s)=>"function"==typeof e?e.call(t,...s):e)(e,t,...s)),c=(e,t)=>Object.keys(t).reduce(((e,s)=>e.replace(new RegExp(`\\{${s}\\}`,"gi"),t[s])),e.toString()),h={};class p{get cls(){return this.constructor}static get cls(){return this}}class f extends Error{constructor(e){super(`[vue-service-model] ${e}`)}}class m extends f{constructor(e,t){super('Field "'+t+'" not declared on Model "'+e.cls.name+'"'),this.constructor=m,this.__proto__=m.prototype}}class y extends f{constructor(e){super('Missing url configuration in Model "'+e+'"'),this.constructor=y,this.__proto__=y.prototype}}class g extends p{constructor(e={}){super(),this._fields={},this._data=e,n.default.observable(this._data),this.cls.register(),this._bindFields()}static get _modelRegistered(){return!!Object.prototype.hasOwnProperty.call(this,"__modelRegistered")&&this.__modelRegistered}static set _modelRegistered(e){this.__modelRegistered=e}get data(){return this._data}set data(e){this._data=e}get fields(){return this._fields}get val(){return new Proxy(this,{get(e,t){const s=e.getField(t);return Promise.resolve(s.value)},set:(e,t,s)=>(e.getField(t).value=s,!0)})}get pk(){const e=this.getPrimaryKeyField();if(!e)return null;const t=e.valueGetter(this.data);return o(t)?null:t}static getField(e){if(-1===Object.keys(this.fieldsDef).indexOf(e))throw new m(this,e);return this.fieldsDef[e]}getField(e){if(-1===Object.keys(this.fields).indexOf(e))throw new m(this,e);return this.fields[e]}getPrimaryKeyField(){const e=Object.values(this.fields).filter((e=>e.isPrimaryKey));return e.length>1&&console.error("[vue-service-model] Multiple primary key fields found in model",this.constructor.name),e.length?e[0]:null}_bindFields(){this._fields={};const e=this.cls.fieldsDef;for(const t of Object.keys(e)){const s=e[t];this._fields[t]=s.bind({name:t,model:this})}}static register(){return!this._modelRegistered&&(this._modelRegistered=!0,!0)}}g.fieldsDef={},g.__modelRegistered=!1;const v={};function _(){return v}const b={useAsyncComputed:!1,i18n:{no:"No",yes:"Yes"},events:{onSendDetailRequest:()=>{},onSendListRequest:()=>{},onSendCreateRequest:()=>{},onSendUpdateRequest:()=>{},onSendPartialUpdateRequest:()=>{},onSendDeleteRequest:()=>{},onResponseError:()=>{}}},R={defaultConfig:b,getConfig:()=>d({},b,_()),useAsyncComputed(){const e=this.getConfig();return Boolean(e.useAsyncComputed)},checkWarningUseAsyncComputed(){R.useAsyncComputed()||console.warn("[vue-service-model] asyncComputed has been called, but useAsyncComputed config is false.")},async getTranslation(e){const t=this.getConfig();if(!t.i18n[e])throw new Error("Try to get unknown translation key: "+e);return u(t.i18n[e],null,e)},emitEvent(e,t){const s=this.getConfig();if(!s.events[e])throw new Error("Try to emit unknown event: "+e);s.events[e](...t)}};class w extends f{constructor(e,t="Unhandled APIException"){super(t),this.constructor=w,this.__proto__=w.prototype,this._response=e}get response(){return this._response}}class C extends w{constructor(e,t="Bad Request"){super(e,t),this.constructor=C,this.__proto__=C.prototype}}C.statusCode=400;class D extends w{constructor(e,t="Unauthorized"){super(e,t),this.constructor=D,this.__proto__=D.prototype}}D.statusCode=401;class P extends w{constructor(e,t="Forbidden"){super(e,t),this.constructor=P,this.__proto__=P.prototype}}P.statusCode=403;class O extends w{constructor(e,t="Not Found"){super(e,t),this.constructor=O,this.__proto__=O.prototype}}O.statusCode=404;class F extends w{constructor(e,t="Internal Server Error"){super(e,t),this.constructor=F,this.__proto__=F.prototype}}F.statusCode=500;class x{constructor(e){this.model=e}getServiceStoreOptions(e,t){return{noCache:Boolean(t&&t.noCache),noRequestAggregation:Boolean(t&&t.noRequestAggregation),refreshCache:Boolean(t&&t.refreshCache),...e}}async detail(e,t){const s=t&&t.parents;return new(0,this.model)(await this.retrieveDetailData(e,t),s)}async list(e){const t={...e||{}};Object.prototype.hasOwnProperty.call(t,"noCache")||(t.noCache=!0);const s=this.model,r=await s.getListUrl(t.parents),n=[r];t.filter&&Object.keys(t.filter).length>0&&n.push(JSON.stringify(t.filter));const a=this.getServiceStoreOptions({key:n.join("?"),sendRequest:this.sendListRequest.bind(this),args:[r,t]},t);return(await s.store.getData(a)).map((e=>new s(e,t.parents)))}async create(e,t){const s=t&&t.parents,r=this.model,n=await r.getListUrl(s);return this.sendCreateRequest(n,e,t)}async update(e,t,s){const r=s&&s.parents,n=this.model,a=await n.getDetailUrl(e,r);return s&&s.partial?this.sendPartialUpdateRequest(a,e,t,s):this.sendUpdateRequest(a,e,t,s)}async delete(e,t){const s=t&&t.parents,r=this.model,n=await r.getDetailUrl(e,s);return this.sendDeleteRequest(n,e,t)}async buildRetrieveRequestConfig(e){if(!e)return{};const t={};return e.filter&&Object.keys(e.filter).length&&(t.params=e.filter),t}async retrieveDetailData(e,t){const s=t&&t.parents,r=this.model,n=await r.getDetailUrl(e,s),a=this.getServiceStoreOptions({key:n,sendRequest:this.sendDetailRequest.bind(this),args:[n,e,t]},t);return r.store.getData(a)}async sendDetailRequest(e,t,s,r){const n=await this.buildRetrieveRequestConfig(r);let i;R.emitEvent("onSendDetailRequest",[{modelManager:this,url:t,pk:s,params:r}]);try{i=await a.default.get(t,n)}catch(e){throw await this.handleResponseError(e)}return this.mapDetailResponseBeforeCache(e,i.data,t,s,r)}async mapDetailResponseBeforeCache(e,t,s,r,n){return t}async sendListRequest(e,t,s){const r=await this.buildRetrieveRequestConfig(s);let n;R.emitEvent("onSendListRequest",[{modelManager:this,url:t,params:s}]);try{n=await a.default.get(t,r)}catch(e){throw await this.handleResponseError(e)}return this.mapListResponseBeforeCache(e,n.data,t,s)}async mapListResponseBeforeCache(e,t,s,r){return t}async sendCreateRequest(e,t,s){let r;R.emitEvent("onSendCreateRequest",[{modelManager:this,url:e,data:t,params:s}]);try{r=await a.default.post(e,t)}catch(e){throw await this.handleResponseError(e)}return r.data}async sendUpdateRequest(e,t,s,r){let n;R.emitEvent("onSendUpdateRequest",[{modelManager:this,url:e,pk:t,data:s,params:r}]);try{n=await a.default.put(e,s)}catch(e){throw await this.handleResponseError(e)}return n.data}async sendPartialUpdateRequest(e,t,s,r){let n;R.emitEvent("onSendPartialUpdateRequest",[{modelManager:this,url:e,pk:t,data:s,params:r}]);try{n=await a.default.patch(e,s)}catch(e){throw await this.handleResponseError(e)}return n.data}async sendDeleteRequest(e,t,s){R.emitEvent("onSendDeleteRequest",[{modelManager:this,url:e,pk:t,params:s}]);try{await a.default.delete(e)}catch(e){throw await this.handleResponseError(e)}return null}async handleResponseError(e){if(R.emitEvent("onResponseError",[{modelManager:this,error:e}]),!e.response)return e;switch(e.response.status){case C.statusCode:return new C(e.response);case D.statusCode:return new D(e.response);case P.statusCode:return new P(e.response);case O.statusCode:return new O(e.response);case F.statusCode:return new F(e.response);default:return new w(e.response)}}}class S{constructor(e){this.cacheDuration=e,this._data={},this._requests={}}async getData(e){const t=e.key;if(this.useCache(e)&&Object.prototype.hasOwnProperty.call(this._data,t)){const e=this._data[t];if(!e.expires||e.expires>Date.now())return e.data}return this.loadData(e)}async loadData(e){const t=e.key,s=this.getRequestAggregation(e);if(s)return s;const r=e.sendRequest(e,...e.args||[]).then((s=>(e.noCache||this._setData(t,s),this.removeRequest(t),s)),(e=>{throw this.removeRequest(t),e}));return e.noRequestAggregation||this._setRequest(t,r),r}_setData(e,t){if(0!==this.cacheDuration){const s={data:t};null!==this.cacheDuration&&(s.expires=Date.now()+1e3*this.cacheDuration),this._data[e]=s}}_setRequest(e,t){this._requests[e]=t}useCache(e){return!e.noCache&&!e.refreshCache}getRequestAggregation(e){if(e.noRequestAggregation)return null;const t=e.key;return Object.prototype.hasOwnProperty.call(this._requests,t)?this._requests[t]:null}removeRequest(e){delete this._requests[e]}clean(){let e;const t=Date.now();for(e of Object.keys(this._data)){const s=this._data[e].expires;s&&s<t&&delete this._data[e]}}clear(){this._data={},this._requests={}}}class j extends g{constructor(e={},t={}){super(e),this._parents=l(t)}static get store(){return Object.prototype.hasOwnProperty.call(this,"__store")||(this.__store=this.createStoreModule()),this.__store}static async getListUrl(e){this.checkServiceParents(e);const t=(()=>{if("string"==typeof this.urls)return this.urls;if(this.urls.LIST)return this.urls.LIST;if(this.urls.BASE)return this.urls.BASE;throw new y(this.name)})();return e?c(t,e):t}static async getDetailUrl(e,t){this.checkServiceParents(t);const s=(()=>{if("string"==typeof this.urls)return this.urls+"{pk}/";if(this.urls.DETAIL)return this.urls.DETAIL;if(this.urls.BASE)return this.urls.BASE+"{pk}/";throw new y(this.name)})();return c(s,{pk:e,...t||{}})}static get objects(){if(!Object.prototype.hasOwnProperty.call(this,"__modelManager")){this.register();const e=this.ModelManager;this.__modelManager=new e(this)}return this.__modelManager}get parents(){return this._parents}set parents(e){this._parents=l(e)}static checkServiceParents(e){const t=e||{};if(this.parentNames.length<Object.keys(t).length)return console.error("[vue-service-model] Too much parents given",this.name,t),!1;if(this.parentNames.length>0){const e=this.parentNames.filter((e=>!t[e]));if(e.length)return console.error("[vue-service-model] Missing parents",this.name,e),!1}return!0}async mapPartialUpdateFields(e,t){const s={};return t.forEach((t=>{this.getField(t).mapFieldValue(e,s)})),s}async reload(){const e=this.pk;if(null===e)return!1;const t=this.constructor;return this.data=await t.objects.retrieveDetailData(e,{refreshCache:!0,parents:this.parents}),!0}async save(){return null===this.pk?(await this.create(),!0):(await this.update(),!1)}async create(){const e=this.constructor,t=await e.objects.create(this.data,{parents:this.parents});return t&&Object.keys(t).length&&(this.data=t),!0}async update(e){const t=this.pk;if(null===t)return!1;const s=e&&e.updateFields,r=Boolean(s),n=r?await this.mapPartialUpdateFields(this.data,s):this.data,a=this.constructor,i=await a.objects.update(t,n,{parents:this.parents,partial:r});return i&&Object.keys(i).length&&(this.data=i),!0}async delete(){const e=this.pk;if(null===e)return!1;const t=this.constructor;return await t.objects.delete(e,{parents:this.parents}),!0}static createStoreModule(){return new(0,this.storeClass)(this.cacheDuration)}}j.urls={},j.parentNames=[],j.cacheDuration=30,j.storeClass=S,j.ModelManager=x;class q extends f{constructor(e){super('Field "'+e.cls.name+'" not bound or fieldName not set on new'),this.constructor=q,this.__proto__=q.prototype}}class k extends f{constructor(e,t,s){super(`Invalid ${t} in field ${e.cls.name}: ${s}`),this.constructor=k,this.__proto__=k.prototype}}class A extends k{constructor(e,t){super(e,t,`${t} is required`),this.constructor=A,this.__proto__=A.prototype}}class E extends p{constructor(e={},t){super(),this._name=null,this._model=null,this._data=null,this._def=e||{},t&&(this._name=t.name||null,Object.prototype.hasOwnProperty.call(t,"value")?(this._name||(this._name="value"),this._model=null,this._data=n.default.observable({}),this.value=t.value):(this._model=t.model||null,this._data=t.data?n.default.observable(t.data):null))}clone(){const e=this.cls,t={};return this._name&&(t.name=this._name),this._model&&(t.model=this._model),this._data&&(t.data=this._data),new e(this._def,t)}bind(e){return new(0,this.cls)(this._def,e)}get name(){if(null===this._name)throw new q(this);return this._name}get attributeName(){return this.definition.attributeName||this.name}get definition(){return this._def}get model(){if(null===this._model)throw new q(this);return this._model}get data(){return this._data||this.model.data}get value(){return this.getValue()}async getValue(){return this.valueGetter(this.data)}set value(e){this.setValue(e)}setValue(e){this.valueSetter(e,this.data)}async setParseValue(e){const t=await this.valueParser(e);return this.value=t,t}get label(){return u(this.definition.label,this)}get options(){return u(this.definition.options,this).then((e=>this.validateOptions(e)))}async validateOptions(e){return e||{}}get isPrimaryKey(){return Boolean(this.definition.primaryKey)}get isNestedAttribute(){return this.attributeName.includes(".")}valueGetter(e){if(!e||"object"!=typeof e)return null;if(!this.isNestedAttribute){const t=e[this.attributeName];return o(t)?null:t}const t=this.attributeName.split(".");let s,r=e;for(s of t)if(r=r[s],o(r))return null;return o(r)?null:r}valueSetter(e,t){if(this.attributeName.includes(".")){const s=this.attributeName.split(".");let r=0,a=s[r],i=t;for(;Object.prototype.hasOwnProperty.call(i,a)&&!o(i[a])&&(i=i[a],r++,a=s[r],r+1!==s.length););const l=s.splice(r+1).reduceRight(((e,t)=>{const s={};return s[t]=e,s}),e);n.default.set(i,a,l)}else n.default.set(t,this.attributeName,e)}async valueParser(e){return e}mapFieldValue(e,t){const s=this.valueGetter(e);this.valueSetter(s,t)}}class I extends E{get displayComponent(){return Promise.resolve().then((function(){return N}))}async prepareDisplayRender(e){return this.value}displayRender(e,t){return e("span",t)}get inputComponent(){return Promise.resolve().then((function(){return T}))}async prepareInputRender(e,t){return{value:await this.value,inputProps:e}}inputRender(e,t){const{disabled:s,readonly:r}=t.inputProps;return e("input",{attrs:{type:"text",value:t.value,disabled:s,readonly:r},on:{input:e=>{const t=e.target;this.setParseValue(t.value)}}})}}class L extends I{async prepareDisplayRender(){return this.valueFormatter()}async valueFormatter(){const e=await this.value;return o(e)?null:String(e)}}var M=n.default.extend({props:{field:{type:I,required:!0},renderProps:{type:Object,default:null}}}),B=M.extend({name:"BaseDisplayFieldRender",inheritAttrs:!1,data:()=>({renderData:h}),computed:{hasResolvedRenderData(){return this.renderData!==h}},asyncComputed:{renderData:{default:h,get(){return this.resolveRenderData()}}},watch:{field(){this.setResolveRenderData()},"field.data":{deep:!0,handler(){this.setResolveRenderData()}},renderProps:{deep:!0,handler(){this.setResolveRenderData()}}},created(){this.setResolveRenderData()},methods:{async setResolveRenderData(){R.useAsyncComputed()||(this.renderData=await this.resolveRenderData())},async resolveRenderData(){return this.field.prepareDisplayRender(this.renderProps)},renderField(e){return this.field.displayRender(e,this.renderData)}},render(e){return this.hasResolvedRenderData?this.renderField(e):void 0}}),N=Object.freeze({__proto__:null,default:B});function U(...e){return n.default.extend({mixins:e})}var V=M.extend({props:{disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1}}}),$=U(B,V).extend({name:"BaseInputFieldRender",computed:{inputProps(){return{disabled:this.disabled,readonly:this.readonly}}},watch:{inputProps(){this.setResolveRenderData()}},methods:{async resolveRenderData(){return this.field.prepareInputRender(this.inputProps,this.renderProps)},renderField(e){return this.field.inputRender(e,this.renderData)}}}),T=Object.freeze({__proto__:null,default:$}),K=n.default.extend({inheritAttrs:!1,props:{model:{default:null,validator:e=>null===e||e instanceof g},fieldName:{type:String,default:null},field:{default:null,validator:e=>null===e||e instanceof I},renderProps:{type:Object,default:null}},computed:{fieldObj(){if(this.field)return this.field;if(this.model&&this.fieldName){return this.model.getField(this.fieldName)}return null}}}),z=n.default.extend({methods:{renderDefaultLoading(e){},renderLoading(e){return this.$slots&&this.$slots.loading?e("div",this.$slots.loading):this.$scopedSlots&&this.$scopedSlots.loading?e("div",this.$scopedSlots.loading({})):this.renderDefaultLoading(e)}}}),G=U(z,K).extend({name:"DisplayField",inheritAttrs:!1,data:()=>({displayComponent:null}),asyncComputed:{async displayComponent(){return R.checkWarningUseAsyncComputed(),this.resolveDisplayComponent()}},watch:{fieldObj(){this.setResolveDisplayComponent()}},created(){this.setResolveDisplayComponent()},methods:{async setResolveDisplayComponent(){R.useAsyncComputed()||(this.displayComponent=await this.resolveDisplayComponent())},async resolveDisplayComponent(){if(this.fieldObj){return(await this.fieldObj.displayComponent).default}return null}},render(e){return this.displayComponent&&this.fieldObj?e(this.displayComponent,{props:{field:this.fieldObj,renderProps:this.renderProps}}):this.renderLoading(e)}}),W=Object.freeze({__proto__:null,default:G}),J=U(z,K).extend({name:"InputField",inheritAttrs:!1,props:{disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1}},data:()=>({inputComponent:null}),asyncComputed:{async inputComponent(){return R.checkWarningUseAsyncComputed(),this.resolveInputComponent()}},watch:{fieldObj(){this.setResolveInputComponent()}},created(){this.setResolveInputComponent()},methods:{async setResolveInputComponent(){R.useAsyncComputed()||(this.inputComponent=await this.resolveInputComponent())},async resolveInputComponent(){if(this.fieldObj){return(await this.fieldObj.inputComponent).default}return null}},render(e){return this.inputComponent&&this.fieldObj?e(this.inputComponent,{props:{field:this.fieldObj,renderProps:this.renderProps,disabled:this.disabled,readonly:this.readonly}}):this.renderLoading(e)}}),Y=U(z,K).extend({name:"FieldLabel",inheritAttrs:!1,props:{model:{default:null,validator:e=>null===e||e instanceof g||Boolean(e&&e.prototype instanceof g)},tag:{type:String,default:"span"}},data:()=>({label:null}),asyncComputed:{async label(){return R.checkWarningUseAsyncComputed(),this.resolveLabel()}},watch:{fieldObj(){this.setResolveLabel()}},created(){this.setResolveLabel()},methods:{async setResolveLabel(){R.useAsyncComputed()||(this.label=await this.resolveLabel())},async resolveLabel(){if(this.fieldObj){return this.fieldObj.label}return null},renderLabel(e){return this.$scopedSlots&&this.$scopedSlots.default?e(this.tag,this.$scopedSlots.default({label:this.label})):e(this.tag,this.label)}},render(e){return this.label?this.renderLabel(e):this.renderLoading(e)}});return e.APIException=w,e.BadRequestAPIException=C,e.BaseDisplayFieldRender=B,e.BaseInputFieldRender=$,e.BaseModel=g,e.BooleanField=class extends L{async valueFormatter(){return await this.value?R.getTranslation("yes"):R.getTranslation("no")}async valueParser(e){return Boolean(e)}inputRender(e,{value:t,inputProps:s}){const{disabled:r,readonly:n}=s;return e("input",{attrs:{type:"checkbox",checked:Boolean(t),disabled:r},on:{click:e=>{n&&e.preventDefault()},change:e=>{const t=e.target;this.setParseValue(t.checked)}}})}},e.CharField=class extends L{async valueParser(e){return""===e||o(e)?null:String(e)}},e.DecimalField=class extends L{async validateOptions(e){return e=await super.validateOptions(e),Number.isInteger(e.decimalPlaces)||(console.error("[vue-service-model] Invalid options.decimalPlaces for DecimalField: ",e.decimalPlaces),e.decimalPlaces=0),e}async prepareInputRender(e){const[t,s]=await Promise.all([this.value,this.options]);return{value:t,decimalPlaces:s.decimalPlaces,inputProps:e}}inputRender(e,{value:t,decimalPlaces:s,inputProps:r}){const{disabled:n,readonly:a}=r;return e("input",{attrs:{type:"number",value:t,step:Math.pow(.1,s).toPrecision(1),disabled:n,readonly:a},on:{input:e=>{const t=e.target;this.setParseValue(t.value)}}})}async valueParser(e){return o(e)?null:parseFloat(e)}},e.DisplayComponentPropsMixin=M,e.DisplayField=G,e.Field=E,e.FieldLabel=Y,e.FieldNotBoundException=q,e.ForbiddenAPIException=P,e.ForeignKeyField=class extends I{async getValue(){const e=await super.getValue();if(o(e))return null;return(await this.options).model.objects.detail(e)}async validateOptions(e){if(!(e=await super.validateOptions(e)).model)throw new A(this,"options.model");if(!e.fieldName)throw new A(this,"options.fieldName");if(!(e.model.prototype instanceof j))throw new k(this,"options.model","Model does not inherit from ServiceModel");return e}async prepareDisplayRender(){const e=await this.value;if(null===e)return{field:null,displayField:null};const t=await this.options;return{displayField:await Promise.resolve().then((function(){return W})).then((e=>e.default)),field:e.getField(t.fieldName)}}displayRender(e,{field:t,displayField:s}){return e(s,{props:{field:t}})}async prepareInputRender(e){const[t,s]=await Promise.all([super.getValue(),this.options]);return{value:o(t)?null:String(t),list:await this.mapInputSelectList(s),inputProps:e}}async mapInputSelectList(e){const t=await this.getInputSelectList(e);return Promise.all(t.map((async t=>{const s=t.pk;o(s)&&console.warn("[vue-service-model] No primary key defined for model",t.cls.name);const r=t.getField(e.fieldName);let n;return r instanceof L?n=await r.valueFormatter():(console.error("[vue-service-model] Cannot use non string field for ForeignKeyField input. Used field name:",r.name),n="unknown"),{value:String(s),text:n}})))}async getInputSelectList(e){return e.model.objects.list()}inputRender(e,{value:t,list:s,inputProps:r}){const{disabled:n,readonly:a}=r;return e("select",{attrs:{disabled:n,readonly:a},on:{input:e=>{const t=e.target;this.setParseValue(t.value)}}},s.map((s=>e("option",{attrs:{value:s.value,selected:null!==t&&t===s.value}},s.text))))}},e.FormatStringField=L,e.InputComponentPropsMixin=V,e.InputField=J,e.IntegerField=class extends L{inputRender(e,{value:t,inputProps:s}){const{disabled:r,readonly:n}=s;return e("input",{attrs:{type:"number",value:t,disabled:r,readonly:n},on:{input:e=>{const t=e.target;this.setParseValue(t.value)}}})}async valueParser(e){return o(e)?null:parseInt(e)}},e.InternalServerErrorAPIException=F,e.MissingUrlException=y,e.ModelManager=x,e.NotDeclaredFieldException=m,e.NotFoundAPIException=O,e.RenderableField=I,e.ServiceModel=j,e.ServiceStore=S,e.UnauthorizedAPIException=D,e.getConfig=_,e.setConfig=function(e){Object.assign(v,e)},Object.defineProperty(e,"__esModule",{value:!0}),e}({},Vue,axios);