rest-client-vue 1.1.1-b7 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +33 -2
- package/dist/rest-client-vue.js +478 -392
- package/dist/rest-client-vue.umd.cjs +1 -1
- package/dist/src/rest-collection.d.ts +32 -2
- package/dist/src/rest-collection.d.ts.map +1 -1
- package/dist/src/rest-resource.d.ts +1 -0
- package/dist/src/rest-resource.d.ts.map +1 -1
- package/dist/src/stores/rest-collection-store.d.ts +51 -4
- package/dist/src/stores/rest-collection-store.d.ts.map +1 -1
- package/dist/src/stores/rest-resource-store.d.ts +22 -0
- package/dist/src/stores/rest-resource-store.d.ts.map +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
(function(v,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("lodash"),require("uuid"),require("vue"),require("axios"),require("jsog"),require("json-stringify-deterministic"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","lodash","uuid","vue","axios","jsog","json-stringify-deterministic","pinia"],s):(v=typeof globalThis<"u"?globalThis:v||self,s(v["rest-client-vue"]={},v._,v.uuid,v.Vue,v.axios,v.jsog,v.stringify,v.pinia))})(this,function(v,s,I,o,$,ae,G,ce){"use strict";var Pe=Object.defineProperty;var Fe=(v,s,I)=>s in v?Pe(v,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):v[s]=I;var oe=(v,s,I)=>(Fe(v,typeof s!="symbol"?s+"":s,I),I),Ne=(v,s,I)=>{if(!s.has(v))throw TypeError("Cannot "+I)};var j=(v,s,I)=>(Ne(v,s,"read from private field"),I?I.call(v):s.get(v)),Ie=(v,s,I)=>{if(s.has(v))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(v):s.set(v,I)};var A;const ue={apiBaseUrl:"",useVueLogger:!1};class we extends Error{constructor(U,q=void 0,e=void 0){super(U);oe(this,"context");oe(this,"innerError");this.context=q,this.innerError=e}}class de{constructor(){Ie(this,A,{})}clearAllStores(){for(const n in j(this,A))j(this,A)[n].clear()}destroyStore(n){j(this,A)[n]&&(j(this,A)[n].$dispose(),delete j(this,A)[n])}getStore(n){return j(this,A)[n]}registerStore(n,U){j(this,A)[n]=U}}A=new WeakMap;function g(w,n){return s.get(w,(n==null?void 0:n.idProperty)||"_id")}function De(w,n){var U;return w&&((U=n.filter)!=null&&U.resourceIds)&&!n.order?n.filter.resourceIds.map(q=>w.find(e=>g(e,n)==q)).filter(q=>q!=null):w}const he={detail:{allowMultiple:!0,autoEdit:!1,autoFromMultipleSelection:!0,autoFromSingleInsertion:!0,autoFromSingleSelection:!0,constrainToSelection:!0},filter:{namedFilter:null,query:null,resourceIds:null},idProperty:"_id",limit:5e3,limitTransientDataToLocalCollection:!0,loading:{firstPageSize:500,pageSize:5e3},order:[[{path:"history.creation.timestamp"},"desc"],[{path:"history.creation.indexInBatch"},"desc"]]},K={resources:[],remoteCollectionSize:null,status:"NotLoaded",selection:[],detailSelection:[],invalidResources:[],transientData:{}},se={editingDetailSelection:!1,batchSaveAttempted:!1,editors:[],listNavigators:{}},Ce=(w,n)=>{console.log(s.cloneDeep(n)),n=s.merge({},he,n),console.log(s.cloneDeep(n));const U=ce.defineStore(w,{state:()=>({idProperty:n.idProperty,filter:n.filter,order:n.order||null,propertyBlacklist:n.propertyBlacklist||null,referencePathsToExpand:n.referencePathsToExpand||null,...K,...se}),getters:{fixedQueryParams:e=>{var l,d,u,h;const r={};(l=e.filter)!=null&&l.namedFilter&&(r.namedFilter=e.filter.namedFilter);const t=[];if((d=e.filter)!=null&&d.resourceIds&&t.push({l:{path:e.idProperty},r:{constant:e.filter.resourceIds},operator:"in"}),(u=e.filter)!=null&&u.query&&t.push((h=e.filter)==null?void 0:h.query),t.length>0){const S=t.length==1?t[0]:{and:t};r.q=G(S)}return e.order&&(r.o=G(e.order)),e.propertyBlacklist&&(r.ex=G(e.propertyBlacklist)),e.referencePathsToExpand&&(r.r=G(e.referencePathsToExpand)),r}},actions:{reset(){for(const e in K)this[e]=K[e];for(const e in se)this[e]=se[e]},resetRetainingTransientData(){if(n.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},setEditingDetailSelection(e){this.editingDetailSelection=e},setFilter(e){s.isEqual(e,this.filter)||(this.filter=e,this.status="NotLoaded",this.resources=[],this.remoteCollectionSize=null,this.selection=[],this.detailSelection=[],this.invalidResources=[],this.editingDetailSelection=!1)},async setQuery(e){var r,t;if(!s.isEqual(e,(r=this.filter)==null?void 0:r.query)&&(e!=null||((t=this.filter)==null?void 0:t.query)!=null)){const l=s.cloneDeep(this.filter)||{};e!==null?l.query=e:s.unset(l,"query");const d=this.status;this.setFilter(l),d!="NotLoaded"&&await this.loadResources()}},async setFilterResourceIds(e){if(!s.isEqual(e,s.get(this.filter,"resourceIds"))){const r=s.cloneDeep(this.filter)||{};e!=null?r.resourceIds=e:s.unset(r,"resourceIds");const t=this.status;this.setFilter(r),t!="NotLoaded"&&await this.loadResources()}},setBatchSaveAttempted(e){e!=this.batchSaveAttempted&&(this.batchSaveAttempted=e)},clear(){for(const e in K)this[e]=K[e]},clearRetainingTransientData(){if(n.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},async ensureCollectionLoaded(){["Loaded","Loading","LoadingMore","Failed"].includes(this.status)||await this.loadResources()},async loadResources(e={}){this.resetRetainingTransientData();const r=I.v4();this._loadId=r,await this._loadResources(0,r,e)},async _loadResources(e,r,t){var b,N,k,B,Q;const l=e==0;if(this.status=l?"Loading":"LoadingMore",this._loadOffset=e,((b=this.filter)==null?void 0:b.query)===!1){this.resources=[],this.remoteCollectionSize=0;return}const d=this.fixedQueryParams,u=s.cloneDeep(d),h=l?(N=this.filter)!=null&&N.resourceIds&&!this.order?null:t.firstPageSize||((k=n.loading)==null?void 0:k.firstPageSize)||t.pageSize||((B=n.loading)==null?void 0:B.pageSize)||null:t.pageSize||((Q=n.loading)==null?void 0:Q.pageSize)||null,S=h!=null||n.limit!=null?s.min(s.filter([h,n.limit],p=>p!=null)):void 0;S!=null?(u.offset=e,u.limit=S):e!=0&&(u.offset=e);const D=s.map(u,(p,m)=>p!=null?`${encodeURIComponent(m)}=${encodeURIComponent(p)}`:null).filter(p=>p!=null).join("&"),L=s.isEmpty(D)?n.restCollectionUrl:`${n.restCollectionUrl}?${D}`;try{const p=await $.get(L),m=this.fixedQueryParams;if(r!=this._loadId||e!=this._loadOffset||!s.isEqual(d,m))console.log(`Discarding resources fetched by obsolete query from ${n.restCollectionUrl}.`);else{const C=ae.decode(s.get(p,"data.data",[])),T=(l?0:this.resources.length)+C.length,y=S==null||C.length<S||n.limit&&T>=n.limit;console.log(`Loaded ${C.length}${l?"":" more"} resources from ${n.restCollectionUrl}`),l&&(this.resources=[]);const H=[...this.resources,...C.map(Z=>Object.freeze(Z))];this.resources=De(H,this),s.get(p,"data.totalCollectionSize")?this.remoteCollectionSize=s.get(p,"data.totalCollectionSize"):this.remoteCollectionSize=null,this.status=y?"Loaded":"LoadingMore",y||this._loadResources(this.resources.length,r,t)}}catch(p){console.log(`Error while loading resources (URL="${L}"):`,p),this.clearRetainingTransientData(),this.status="Failed"}},async checkForDeletedResource(e){let r;try{r=await $.get(`${n.restCollectionUrl}/${e}`)}catch(t){$.isAxiosError(t)&&(r=t.response)}return r&&r.status==404?(this.recordDeletion(e),!0):!1},recordDeletion(e){var r;if(["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>g(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>g(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>g(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=((r=n.detail)==null?void 0:r.autoEdit)||!1)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},recordInsertion(e,{insertAtBeginning:r,transientData:t}={}){var l;if(["Loaded","LoadingMore"].includes(this.status)){const d=Object.freeze(e);r?this.resources.unshift(d):this.resources.push(d),(l=n.detail)!=null&&l.autoFromSingleInsertion&&(this.detailSelection.length==0||this.detailSelection.length==1&&g(this.detailSelection[0],this)==null)&&(this.detailSelection=[d],this.editingDetailSelection=n.detail.autoEdit);const u=g(e,this);u&&(t===void 0?delete this.transientData[u]:this.transientData[u]=t)}},recordUpdate(e){const r=g(e,this);if(r&&["Loaded","LoadingMore"].includes(this.status)){const t=Object.freeze(e);let l=this.resources.findIndex(d=>g(d,this)==r);l>=0&&(this.resources[l]=t),l=this.selection.findIndex(d=>g(d,this)==r),l>=0&&(this.selection[l]=t),l=this.detailSelection.findIndex(d=>g(d,this)==r),l>=0&&(this.detailSelection[l]=t)}},async refreshResource(e){if(e){const r={};this.referencePathsToExpand&&(r.r=G(this.referencePathsToExpand));const t=s.map(r,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),l=s.isEmpty(t)?`${n.restCollectionUrl}/${e}`:`${n.restCollectionUrl}/${e}?${t}`,d=await $.get(l);if(d.status==200){const u=d.data;return this.recordUpdate(u),u}}return null},addResource(e={}){this.detailSelection=[s.omit(s.merge({},e),this.idProperty)],this.editingDetailSelection=!0},async deleteResource(e){if((await $.delete(`${n.restCollectionUrl}/${e}`)).status==200&&["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>g(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>g(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>g(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=n.detail.autoEdit)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},async saveResource(e){const r=g(e,this),t=r==null,l=await $({method:t?"post":"put",url:t?n.restCollectionUrl:`${n.restCollectionUrl}/${r}`,data:e});if(l.status==200){const d=l.data,u=g(d,this),h=u?await this.refreshResource(u):null;return t&&this.recordInsertion(h||Object.freeze(d)),h||d}return null},async saveResources(e){const r=await $({method:"put",url:n.restCollectionUrl,data:e});if(r.status==200){const t=r.data||[],l=[];for(const[d,u]of t.entries()){const h=g(e[d],this)==null,S=g(u,this),D=S?await this.refreshResource(S):null;h&&this.recordInsertion(D||u),l.push(D||Object.freeze(u))}return l}return[]},clearTransientData(){this.transientData={}},setInvalidResourceIds(e){s.isEqual(e,this.invalidResources.map(r=>g(r,this)))||(this.invalidResources=e.map(r=>this.resources.find(t=>g(t,this)==r)).filter(r=>r!=null))},setTransientDataForResources(e){const{transientData:r,merge:t=!0}=e;t?s.merge(this.transientData,r):s.assign(this.transientData,r)},clearSelection(){this.setSelection([])},deselectResources(e){const r=this.selection.map(t=>g(t,this)).filter(t=>t!=null&&!e.includes(t));this.setSelection(r)},selectResources(e,r){const{addToSelection:t,edit:l}=r||{},d=this.selection.map(h=>g(h,this));let u=e;if(t){const h=s.difference(e,d);h.length>0&&(u=d.concat(h).filter(S=>S!=null))}s.isEqual(d,u)||this.setSelection(u,l)},setSelection(e,r){if(!s.isEqual(e,this.selection.map(t=>g(t,this)))){let t=!0;if(this.editors.length>0){if(n.detail.autoFromSingleSelection&&this.selection.length==1)t=!1;else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)t=!1;else if(n.detail.constrainToSelection){const l=this.selection.map(h=>g(h,this)),u=this.detailSelection.map(h=>g(h,this)).filter(h=>l.includes(h));this.detailSelection.filter(h=>!u.includes(g(h,this))).length>0&&(t=!1)}}if(!t)return;if(this.selection=e.map(l=>this.resources.find(d=>g(d,this)==l)).filter(l=>l!=null),n.detail.autoFromSingleSelection&&this.selection.length==1){const l=this.selection[0];(this.detailSelection.length!=1||g(this.detailSelection[0],this)!=g(l,this))&&(this.detailSelection=[l])}else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)s.isEqual(this.selection.map(l=>g(l,this)),this.detailSelection.map(l=>g(l,this)))||(this.detailSelection=s.clone(this.selection));else if(n.detail.constrainToSelection){const l=this.selection.map(h=>g(h,this)),d=this.detailSelection.map(h=>g(h,this)),u=d.filter(h=>l.includes(h));s.isEqual(u,d)||(this.detailSelection=this.detailSelection.filter(h=>u.includes(g(h,this))))}this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=r!==void 0?r:this.editingDetailSelection||n.detail.autoEdit}},hideDetail(){this.detailSelection.length>0&&(this.detailSelection=[],this.editingDetailSelection=!1)},showSelectionAsDetail(e){if(this.selection.length<=1||n.detail.allowMultiple){const r=this.selection.map(l=>g(l,this)),t=this.detailSelection.map(l=>g(l,this));s.isEqual(r,t)||(this.detailSelection=s.clone(this.selection)),this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=e!==void 0?e:this.editingDetailSelection||n.detail.autoEdit}},deregisterEditor(e){s.remove(this.editors,r=>r==e)},registerEditor(e){this.editors.includes(e)||this.editors.push(e)},deregisterListNavigator({name:e,listNavigator:r}){(r==null||this.listNavigators[e]==r)&&delete this.listNavigators[e]},registerListNavigator({name:e,listNavigator:r}){this.listNavigators[e]!=r&&(this.listNavigators[e]=r)}}});return(()=>{const e=(r,t)=>{const l=U(r,t);return ee.registerStore(l.$id,l),l};return e.$id=U.$id,e})()},ee=new de,Ee=(w={})=>{var ge,ve,pe,me;const{collectionId:n,draftBatchId:U,enabled:q,resourceType:e,options:r}=w,t=o.ref(void 0),l=o.ref(n),d=o.ref(U),u=o.ref(q??!0),h=o.ref([o.toRef(e)]),S=o.ref(r),D=o.computed(()=>d.value),L=o.ref(u.value),b=o.ref(I.v4()),N=o.ref((ve=(ge=S.value)==null?void 0:ge.filter)==null?void 0:ve.resourceIds),k=o.ref((me=(pe=S.value)==null?void 0:pe.filter)==null?void 0:me.query),B=o.computed(()=>d.value==null&&l.value!=null&&ee.getStore(l.value)!=null),Q=o.ref(B.value),p=o.computed(()=>T("status","Uninitialized"));function m(i){if(t.value)return i(t.value)}async function C(i){if(t.value)return await i(t.value)}function T(i,c){if(t.value)return t.value[i];if(c!==void 0)return c;throw"Attempted to use a REST collection store that has not been created, with no default value."}const y=(i={})=>{var ie,Re,Se,ye;const{collectionId:c,draftBatchId:E,enabled:F,resourceType:ne,options:te}=i;l.value=c,d.value=E,u.value=F??!0,h.value=[o.toRef(ne)],te!=null&&(S.value=te,N.value=(Re=(ie=S.value)==null?void 0:ie.filter)==null?void 0:Re.resourceIds,k.value=(ye=(Se=S.value)==null?void 0:Se.filter)==null?void 0:ye.query),b.value=I.v4(),H(u.value)},H=async i=>{i!=L.value&&(L.value=i,i&&(_(),z()))},Z=async i=>{N.value=i,await C(async c=>await c.setFilterResourceIds(N.value||null))},V=async i=>{if(k.value=i,p.value!="Uninitialized"){const c=i,E=o.computed(()=>s.isFunction(c)?R.value?c(R.value):null:c);await C(F=>F.setQuery(E.value||null))}},_=()=>{S.value=s.merge({},S.value||{},{filter:{resourceIds:N.value,query:k.value}})},R=o.computed(()=>h.value[0].value||void 0),O=function(i){const c=s.get(i,"filter.query"),E=s.get(i,"propertyBlacklist"),F=s.get(i,"referencePathsToExpand"),ne=s.isFunction(c)?c(R.value):c,te=R.value?s.isFunction(E)?E(R.value):E||[]:[],ie=R.value?s.isFunction(F)?F(R.value):F||[]:[];return{...s.cloneDeep(i||{}),filter:{...s.cloneDeep((i==null?void 0:i.filter)||{}),query:ne},propertyBlacklist:te,referencePathsToExpand:ie}},P=o.computed(()=>O(S.value)),M=o.computed(()=>{if(!R.value)return null;if(P.value.restCollectionUrl!==void 0)return P.value.restCollectionUrl;if(!Q.value)return!R.value||!R.value.collectionName?null:D.value?`${X.config.apiBaseUrl}/draft-batches/${D.value}/${R.value.collectionName}`:`${X.config.apiBaseUrl}/${R.value.collectionName}`}),a=o.computed(()=>{var i;if(R.value)return s.mergeWith(s.cloneDeep(he),P.value,{idProperty:(i=R.value)==null?void 0:i.idProperty,restCollectionUrl:M.value||""},(c,E)=>{if(s.isArray(E)&&E.length==0&&(c==null||s.isArray(c)))return E})}),f=o.ref(0),x=o.computed(()=>{var i;return f.value,l.value||R.value&&((i=R.value)==null?void 0:i.collectionName)&&(D.value?`draftBatches/${D.value}/${R.value.collectionName}/${b.value}`:`${R.value.collectionName}/${b.value}`)||null}),z=()=>{if(L.value){let i=!1;return R.value&&x.value&&(t.value=ee.getStore(x.value),t.value?i=!1:a.value&&(Q.value=!1,t.value=Ce(x.value,a.value)(),i=!0)),i}else return!1},J=()=>{x.value&&l.value==x.value?(t.value=void 0,z()):(t.value=void 0,f.value=f.value+1,z())};o.watch(D,(i,c)=>{s.isEqual(i,c)||J()}),o.watch(L,(i,c)=>{i!=c&&(i?z():t.value=void 0)}),o.watch(R,(i,c)=>{i&&!c?z():!i&&c||s.isEqual(i,c)||J()}),o.watch(a,(i,c)=>{s.isEqual(i,c)||J()}),o.watch(B,()=>{B.value||(Q.value=!1)}),o.watch(x,()=>z()),o.watch(M,(i,c)=>{s.isEqual(i,c)||J()});const W=[],qe=function(i){p.value!="Uninitialized"?o.nextTick(i):W.push(i)};return o.watch(p,(i,c)=>{if(i!="Uninitialized"&&c=="Uninitialized"){const E=s.clone(W);W.splice(0,W.length);for(const F of E)F()}}),z(),{collectionId:x,draftBatchId:D,resourceType:R,enabled:L,status:p,batchSaveAttempted:o.computed(()=>T("batchSaveAttempted",!1)),listNavigators:o.computed(()=>T("listNavigators",!1)),invalidResources:o.computed(()=>T("invalidResources",[])),resources:o.computed(()=>p.value!="Uninitialized"?(C(i=>i.ensureCollectionLoaded()),T("resources",[])):[]),remoteCollectionSize:o.computed(()=>T("remoteCollectionSize",null)),transientData:o.computed(()=>T("transientData",[])),detailSelection:o.computed(()=>T("detailSelection",[])),editingDetailSelection:o.computed(()=>T("editingDetailSelection",!1)),selection:o.computed(()=>T("selection",[])),reconfigureCollection:y,setEditingDetailSelection:i=>m(c=>c.setEditingDetailSelection(i)),setEnabled:H,setFilterResourceIds:Z,setQuery:V,ensureStore:z,setBatchSaveAttempted:i=>m(c=>c.setBatchSaveAttempted(i)),clear:()=>m(i=>i.clear()),ensureCollectionLoaded:async()=>await C(async i=>i.ensureCollectionLoaded()),loadResources:async()=>await C(async i=>await i.loadResources()),addResource:i=>m(c=>c.addResource(i)),checkForDeletedResource:async i=>await C(async c=>await c.checkForDeletedResource(i))==!0,recordDeletion:i=>m(c=>c.recordDeletion(i)),recordInsertion:(i,{insertAtBeginning:c=!1,transientData:E=void 0}={})=>m(F=>F.recordInsertion(i,{insertAtBeginning:c,transientData:E})),recordUpdate:i=>m(c=>c.recordUpdate(i)),refreshResource:async i=>await C(async c=>await c.refreshResource(i)),deleteResource:async i=>await C(async c=>await c.deleteResource(i)),saveResource:async i=>await C(async c=>await c.saveResource(i)),saveResources:async i=>await C(async c=>await c.saveResources(i)),clearTransientData:()=>m(i=>i.clearTransientData()),setInvalidResourceIds:i=>m(c=>c.setInvalidResourceIds(i)),setTransientDataForResources:i=>m(c=>c.setTransientDataForResources(i)),clearSelection:()=>m(i=>i.clearSelection()),deselectResources:i=>m(c=>c.deselectResources(i)),selectResources:(i,c)=>m(E=>E.selectResources(i,c)),hideDetail:()=>m(i=>i.hideDetail()),deregisterEditor:i=>m(c=>c.deregisterEditor(i)),registerEditor:i=>m(c=>c.registerEditor(i)),deregisterListNavigator:i=>m(c=>c.deregisterListNavigator(i)),registerListNavigator:i=>m(c=>c.registerListNavigator(i)),onItemsStoreReady:qe}},Ue=()=>{ee.clearAllStores()};function re(w,n){return s.get(w,(n==null?void 0:n.idProperty)||"_id")}const fe={idProperty:"_id"},Y={resource:null,status:"NotLoaded"},Te=(w,n)=>{n=s.merge({},fe,n);const U=ce.defineStore(w,{state:()=>({idProperty:n.idProperty,resourceId:n.resourceId||null,resourceUrl:n.resourceUrl||null,referencePathsToExpand:n.referencePathsToExpand||null,...Y}),getters:{currentResourceUrl:e=>e.resourceUrl||(n.restCollectionUrl&&e.resourceId?`${n.restCollectionUrl}/${e.resourceId}`:null)||n.restCollectionUrl||null,fixedQueryParams:e=>{const r={};return e.referencePathsToExpand&&(r.r=G(e.referencePathsToExpand)),r}},actions:{reset(){for(const e in Y)this[e]=Y[e]},async setResourceId(e){const r=this.currentResourceUrl;this.resourceId=e,!s.isEqual(this.currentResourceUrl,r)&&this.status!="NotLoaded"&&await this.loadResource()},async setResourceUrl(e){const r=this.currentResourceUrl;this.resourceUrl=e,!s.isEqual(this.currentResourceUrl,r)&&this.status!="NotLoaded"&&await this.loadResource()},clear(){for(const e in Y)this[e]=Y[e]},async ensureResourceLoaded(){["Loaded","Loading","Failed"].includes(this.status)||await this.loadResource()},async loadResource(){this.reset();const e=I.v4();if(this._loadId=e,this.currentResourceUrl){this.status="Loading";const r=this.fixedQueryParams,t=s.cloneDeep(r),l=s.map(t,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),d=s.isEmpty(l)?this.currentResourceUrl:`${this.currentResourceUrl}?${l}`;try{const u=await $.get(d),h=this.fixedQueryParams;e!=this._loadId||!s.isEqual(r,h)?console.log(`Discarding resource fetched by obsolete query from ${d}.`):(this.resource=ae.decode(s.get(u,"data",{})),this.status="Loaded")}catch(u){console.log(`Error while loading resource (URL="${d}")`,u),this.reset(),this.status="Failed"}}else throw"Cannot load a resource because its URL, or its ID and collection URL, are unknown."},async checkForDeletedResource(){if(this.currentResourceUrl){let e;try{e=await $.get(this.currentResourceUrl)}catch(r){$.isAxiosError(r)&&(e=r.response)}return e&&e.status==404?(this.recordDeletion(),!0):!1}else throw"Cannot check for a deleted resource because its URL, or its ID and collection URL, are unknown."},recordDeletion(){this.resource=null,this.status="Loaded"},recordInsertion(e){this.resourceId=re(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},recordUpdate(e){this.resourceId=re(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},async refreshResource(){return await this.loadResource(),this.resource},async deleteResource(){if(this.currentResourceUrl)(await $.delete(this.currentResourceUrl)).status==200&&this.recordDeletion();else throw"Cannot delete a resource because its URL, or its ID and collection URL, are unknown."},async saveResource(e){const r=re(e,this),t=r==null;if(!r)throw"The REST resource store cannot create new resources on the server.";if(!this.currentResourceUrl)throw"Cannot save a resource because its URL, or its ID and collection URL, are unknown.";const l=await $({method:t?"post":"put",url:this.currentResourceUrl,data:e});if(l.status==200){const d=l.data,u=await this.refreshResource();return t&&this.recordInsertion(u||d),u||Object.freeze(d)}return null},async makeCustomApiRequest(e){const{method:r,subpath:t,url:l,data:d}=e;let u=l;if(!u)if(this.currentResourceUrl)u=`${this.currentResourceUrl}/${t}`;else throw"Cannot make a custom API request for a resource because its URL, or its ID and collection URL, are unknown.";const h=await $({method:r||"get",url:u,data:d});return h.status>=200&&h.status<300?h.data:null}}});return(()=>{const e=(r,t)=>{const l=U(r,t);return le.registerStore(l.$id,l),l};return e.$id=U.$id,e})()},le=new de,Le=(w={})=>{const{resourceClientId:n,draftBatchId:U,enabled:q,resourceType:e,options:r}=w,t=o.ref(void 0),l=o.ref(n),d=o.ref(U),u=o.ref(q??!0),h=o.ref([o.toRef(e)]),S=o.ref(r),D=o.computed(()=>d.value),L=o.ref(u.value),b=o.ref(I.v4()),N=o.computed(()=>d.value==null&&l.value!=null&&le.getStore(l.value)!=null),k=o.ref(N.value),B=o.computed(()=>m("status","Uninitialized"));function Q(a){if(t.value)return a(t.value)}async function p(a){if(t.value)return await a(t.value)}function m(a,f){if(t.value)return t.value[a];if(f!==void 0)return f;throw"Attempted to use a REST resource store that has not been created, with no default value."}const C=(a={})=>{const{resourceClientId:f,draftBatchId:x,enabled:z,resourceType:J,options:W}=a;l.value=f,d.value=x,u.value=z??!0,h.value=[o.toRef(J)],W!=null&&(S.value=W),b.value=I.v4(),T(u.value)},T=async a=>{a!=L.value&&(L.value=a,a&&P())},y=o.computed(()=>h.value[0].value||void 0),H=function(a){const f=s.get(a,"referencePathsToExpand"),x=y.value?s.isFunction(f)?f(y.value):f||[]:[];return{...s.cloneDeep(a||{}),referencePathsToExpand:x}},Z=o.computed(()=>H(S.value)),V=o.computed(()=>{if(!y.value)return null;if(!k.value)return!y.value||!y.value.collectionName?null:D.value?`${X.config.apiBaseUrl}/draft-batches/${D.value}/${y.value.collectionName}`:`${X.config.apiBaseUrl}/${y.value.collectionName}`}),_=o.computed(()=>{if(y.value&&V.value)return s.mergeWith(s.cloneDeep(fe),Z.value,{idProperty:y.value.idProperty,restCollectionUrl:V.value},(a,f)=>{if(s.isArray(f)&&f.length==0&&(a==null||s.isArray(a)))return f})}),R=o.ref(0),O=o.computed(()=>{var a;return R.value,l.value||y.value&&((a=y.value)==null?void 0:a.collectionName)&&(D.value?`draftBatches/${D.value}/${y.value.collectionName}/${b.value}`:`${y.value.collectionName}/${b.value}`)||null}),P=()=>{if(L.value){let a=!1;return y.value&&O.value&&(t.value=le.getStore(O.value),t.value?a=!1:_.value&&(k.value=!1,t.value=Te(O.value,_.value)(),a=!0)),a}else return!1},M=()=>{O.value&&l.value==O.value?(t.value=void 0,P()):(t.value=void 0,R.value=R.value+1,P())};return o.watch(D,(a,f)=>{s.isEqual(a,f)||M()}),o.watch(L,(a,f)=>{a!=f&&(a?P():t.value=void 0)}),o.watch(y,(a,f)=>{a&&!f?P():!a&&f||s.isEqual(a,f)||M()}),o.watch(_,(a,f)=>{s.isEqual(a,f)||M()}),o.watch(N,()=>{N.value||(k.value=!1)}),o.watch(O,()=>P()),o.watch(V,(a,f)=>{s.isEqual(a,f)||M()}),P(),{resourceClientId:O,draftBatchId:D,enabled:L,resourceType:y,status:B,resource:o.computed(()=>B.value!="Uninitialized"?(p(a=>a.ensureResourceLoaded()),m("resource",[])):[]),resourceId:o.computed(()=>m("resourceId",null)),resourceUrl:o.computed(()=>m("resourceUrl",null)),reconfigureClient:C,setEnabled:T,setResourceId:async a=>await p(async f=>await f.setResourceId(a)),setResourceUrl:async a=>await p(async f=>await f.setResourceUrl(a)),ensureStore:P,clear:()=>Q(a=>a.clear()),ensureResourceLoaded:async()=>await p(async a=>a.ensureResourceLoaded()),loadResource:async()=>await p(async a=>await a.loadResource()),checkForDeletedResource:async()=>await p(async a=>await a.checkForDeletedResource())==!0,recordDeletion:()=>p(a=>a.recordDeletion()),recordInsertion:a=>p(f=>f.recordInsertion(a)),recordUpdate:a=>p(f=>f.recordUpdate(a)),refreshResource:async()=>await p(async a=>await a.refreshResource()),deleteResource:async()=>await p(async a=>await a.deleteResource()),saveResource:async a=>await p(async f=>await f.saveResource(a)),makeCustomApiRequest:async a=>await p(async f=>await f.makeCustomApiRequest(a))}},X={config:{...ue}};function $e(w){X.config=s.merge({},ue,w)}v.ApiClientError=we,v.clearAllRestCollections=Ue,v.initRestClient=$e,v.restClient=X,v.useRestCollection=Ee,v.useRestResource=Le,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
|
1
|
+
(function(p,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("lodash"),require("uuid"),require("vue"),require("axios"),require("jsog"),require("json-stringify-deterministic"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","lodash","uuid","vue","axios","jsog","json-stringify-deterministic","pinia"],l):(p=typeof globalThis<"u"?globalThis:p||self,l(p["rest-client-vue"]={},p._,p.uuid,p.Vue,p.axios,p.jsog,p.stringify,p.pinia))})(this,function(p,l,D,a,L,ae,G,ce){"use strict";var Fe=Object.defineProperty;var Ne=(p,l,D)=>l in p?Fe(p,l,{enumerable:!0,configurable:!0,writable:!0,value:D}):p[l]=D;var ne=(p,l,D)=>(Ne(p,typeof l!="symbol"?l+"":l,D),D),xe=(p,l,D)=>{if(!l.has(p))throw TypeError("Cannot "+D)};var Q=(p,l,D)=>(xe(p,l,"read from private field"),D?D.call(p):l.get(p)),Ie=(p,l,D)=>{if(l.has(p))throw TypeError("Cannot add the same private member more than once");l instanceof WeakSet?l.add(p):l.set(p,D)};var A;const ue={apiBaseUrl:"",useVueLogger:!1};class we extends Error{constructor(I,w=void 0,e=void 0){super(I);ne(this,"context");ne(this,"innerError");this.context=w,this.innerError=e}}class de{constructor(){Ie(this,A,{})}clearAllStores(){for(const o in Q(this,A))Q(this,A)[o].clear()}destroyStore(o){Q(this,A)[o]&&(Q(this,A)[o].$dispose(),delete Q(this,A)[o])}getStore(o){return Q(this,A)[o]}registerStore(o,I){Q(this,A)[o]=I}}A=new WeakMap;function R(g,o){return l.get(g,(o==null?void 0:o.idProperty)||"_id")}function Ue(g,o){const I=l.map(o,(w,e)=>w!=null?`${encodeURIComponent(e)}=${encodeURIComponent(w)}`:null).filter(w=>w!=null).join("&");if(I.length>0){const w=g.indexOf("?");return w==g.length-1?`${g}${I}`:w>=0?`${g}&${I}`:`${g}?${I}`}else return g}function De(g,o){var I;return g&&((I=o.filter)!=null&&I.resourceIds)&&!o.order?o.filter.resourceIds.map(w=>g.find(e=>R(e,o)==w)).filter(w=>w!=null):g}const he={detail:{allowMultiple:!0,autoEdit:!1,autoFromMultipleSelection:!0,autoFromSingleInsertion:!0,autoFromSingleSelection:!0,constrainToSelection:!0},filter:{namedFilter:null,query:null,resourceIds:null},idProperty:"_id",limit:5e3,limitTransientDataToLocalCollection:!0,loading:{firstPageSize:500,pageSize:5e3},order:[[{path:"history.creation.timestamp"},"desc"],[{path:"history.creation.indexInBatch"},"desc"]]},K={resources:[],remoteCollectionSize:null,status:"NotLoaded",selection:[],detailSelection:[],invalidResources:[],transientData:{}},se={editingDetailSelection:!1,batchSaveAttempted:!1,editors:[],listNavigators:{}},Ee=(g,o)=>{o=l.merge({},he,o);const I=ce.defineStore(g,{state:()=>({idProperty:o.idProperty,filter:o.filter,order:o.order||null,propertiesToExclude:o.propertiesToExclude||null,referencePathsToExpand:o.referencePathsToExpand||null,restCollectionUrl:o.restCollectionUrl,...K,...se}),getters:{fixedQueryParams:e=>{var r,d,u,h;const i={};(r=e.filter)!=null&&r.namedFilter&&(i.namedFilter=e.filter.namedFilter);const t=[];if((d=e.filter)!=null&&d.resourceIds&&t.push({l:{path:e.idProperty},r:{constant:e.filter.resourceIds},operator:"in"}),(u=e.filter)!=null&&u.query&&t.push((h=e.filter)==null?void 0:h.query),t.length>0){const S=t.length==1?t[0]:{and:t};i.q=G(S)}return e.order&&(i.o=G(e.order)),e.propertiesToExclude&&(i.ex=G(e.propertiesToExclude)),e.referencePathsToExpand&&(i.r=G(e.referencePathsToExpand)),i}},actions:{reset(){for(const e in K)this[e]=K[e];for(const e in se)this[e]=se[e]},resetRetainingTransientData(){if(o.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},setEditingDetailSelection(e){this.editingDetailSelection=e},setFilter(e){l.isEqual(e,this.filter)||(this.filter=e,this.status="NotLoaded",this.resources=[],this.remoteCollectionSize=null,this.selection=[],this.detailSelection=[],this.invalidResources=[],this.editingDetailSelection=!1)},async setQuery(e){var i,t;if(!l.isEqual(e,(i=this.filter)==null?void 0:i.query)&&(e!=null||((t=this.filter)==null?void 0:t.query)!=null)){const r=l.cloneDeep(this.filter)||{};e!==null?r.query=e:l.unset(r,"query");const d=this.status;this.setFilter(r),d!="NotLoaded"&&await this.loadResources()}},async setFilterResourceIds(e){if(!l.isEqual(e,l.get(this.filter,"resourceIds"))){const i=l.cloneDeep(this.filter)||{};e!=null?i.resourceIds=e:l.unset(i,"resourceIds");const t=this.status;this.setFilter(i),t!="NotLoaded"&&await this.loadResources()}},setBatchSaveAttempted(e){e!=this.batchSaveAttempted&&(this.batchSaveAttempted=e)},clear(){for(const e in K)this[e]=K[e]},clearRetainingTransientData(){if(o.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},async ensureCollectionLoaded(){["Loaded","Loading","LoadingMore","Failed"].includes(this.status)||await this.loadResources()},async loadResources(e={}){this.resetRetainingTransientData();const i=D.v4();this._loadId=i,await this._loadResources(0,i,e)},async _loadResources(e,i,t){var q,O,x,k,B;const r=e==0;if(this.status=r?"Loading":"LoadingMore",this._loadOffset=e,((q=this.filter)==null?void 0:q.query)===!1){this.resources=[],this.remoteCollectionSize=0;return}const d=this.fixedQueryParams,u=l.cloneDeep(d),h=r?(O=this.filter)!=null&&O.resourceIds&&!this.order?null:t.firstPageSize||((x=o.loading)==null?void 0:x.firstPageSize)||t.pageSize||((k=o.loading)==null?void 0:k.pageSize)||null:t.pageSize||((B=o.loading)==null?void 0:B.pageSize)||null,S=h!=null||o.limit!=null?l.min(l.filter([h,o.limit],P=>P!=null)):void 0;S!=null?(u.offset=e,u.limit=S):e!=0&&(u.offset=e);const E=Ue(o.restCollectionUrl,u);try{const P=await L.get(E),y=this.fixedQueryParams;if(i!=this._loadId||e!=this._loadOffset||!l.isEqual(d,y))console.log(`Discarding resources fetched by obsolete query from ${o.restCollectionUrl}.`);else{const v=ae.decode(l.get(P,"data.data",[])),$=(r?0:this.resources.length)+v.length,C=S==null||v.length<S||o.limit&&$>=o.limit;console.log(`Loaded ${v.length}${r?"":" more"} resources from ${o.restCollectionUrl}`),r&&(this.resources=[]);const U=[...this.resources,...v.map(H=>Object.freeze(H))];this.resources=De(U,this),l.get(P,"data.totalCollectionSize")?this.remoteCollectionSize=l.get(P,"data.totalCollectionSize"):this.remoteCollectionSize=null,this.status=C?"Loaded":"LoadingMore",C||this._loadResources(this.resources.length,i,t)}}catch(P){console.log(`Error while loading resources (URL="${E}"):`,P),this.clearRetainingTransientData(),this.status="Failed"}},async checkForDeletedResource(e){let i;try{i=await L.get(`${o.restCollectionUrl}/${e}`)}catch(t){L.isAxiosError(t)&&(i=t.response)}return i&&i.status==404?(this.recordDeletion(e),!0):!1},recordDeletion(e){var i;if(["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(r=>R(r,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(r=>R(r,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(r=>R(r,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=((i=o.detail)==null?void 0:i.autoEdit)||!1)),o.limitTransientDataToLocalCollection&&delete this.transientData[e]}},recordInsertion(e,{insertAtBeginning:i,transientData:t}={}){var r;if(["Loaded","LoadingMore"].includes(this.status)){const d=Object.freeze(e);i?this.resources.unshift(d):this.resources.push(d),(r=o.detail)!=null&&r.autoFromSingleInsertion&&(this.detailSelection.length==0||this.detailSelection.length==1&&R(this.detailSelection[0],this)==null)&&(this.detailSelection=[d],this.editingDetailSelection=o.detail.autoEdit);const u=R(e,this);u&&(t===void 0?delete this.transientData[u]:this.transientData[u]=t)}},recordUpdate(e){const i=R(e,this);if(i&&["Loaded","LoadingMore"].includes(this.status)){const t=Object.freeze(e);let r=this.resources.findIndex(d=>R(d,this)==i);r>=0&&(this.resources[r]=t),r=this.selection.findIndex(d=>R(d,this)==i),r>=0&&(this.selection[r]=t),r=this.detailSelection.findIndex(d=>R(d,this)==i),r>=0&&(this.detailSelection[r]=t)}},async refreshResource(e){if(e){const i={};this.referencePathsToExpand&&(i.r=G(this.referencePathsToExpand));const t=l.map(i,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),r=l.isEmpty(t)?`${o.restCollectionUrl}/${e}`:`${o.restCollectionUrl}/${e}?${t}`,d=await L.get(r);if(d.status==200){const u=d.data;return this.recordUpdate(u),u}}return null},addResource(e={}){this.detailSelection=[l.omit(l.merge({},e),this.idProperty)],this.editingDetailSelection=!0},async deleteResource(e){if((await L.delete(`${o.restCollectionUrl}/${e}`)).status==200&&["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(r=>R(r,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(r=>R(r,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(r=>R(r,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=o.detail.autoEdit)),o.limitTransientDataToLocalCollection&&delete this.transientData[e]}},async saveResource(e){const i=R(e,this),t=i==null,r=await L({method:t?"post":"put",url:t?o.restCollectionUrl:`${o.restCollectionUrl}/${i}`,data:e});if(r.status==200){const d=r.data,u=R(d,this),h=u?await this.refreshResource(u):null;return t&&this.recordInsertion(h||Object.freeze(d)),h||d}return null},async saveResources(e){const i=await L({method:"put",url:o.restCollectionUrl,data:e});if(i.status==200){const t=i.data||[],r=[];for(const[d,u]of t.entries()){const h=R(e[d],this)==null,S=R(u,this),E=S?await this.refreshResource(S):null;h&&this.recordInsertion(E||u),r.push(E||Object.freeze(u))}return r}return[]},async updateResource(e){const i=R(e,this);if(!i)throw"To update a REST collection resource, the resource must have an ID.";const t=await L({method:"patch",url:`${o.restCollectionUrl}/${i}`,data:e});if(t.status==200){const r=t.data,d=R(r,this);return(d?await this.refreshResource(d):null)||r}return null},async updateResources(e){const i=await L({method:"patch",url:`${o.restCollectionUrl}`,data:e});if(i.status==200){const t=i.data||[],r=[];for(const d of t){const u=R(d,this),h=u?await this.refreshResource(u):null;r.push(h||Object.freeze(d))}return r}return[]},clearTransientData(){this.transientData={}},setInvalidResourceIds(e){l.isEqual(e,this.invalidResources.map(i=>R(i,this)))||(this.invalidResources=e.map(i=>this.resources.find(t=>R(t,this)==i)).filter(i=>i!=null))},setTransientDataForResources(e){const{transientData:i,merge:t=!0}=e;t?l.merge(this.transientData,i):l.assign(this.transientData,i)},clearSelection(){this.setSelection([])},deselectResources(e){const i=this.selection.map(t=>R(t,this)).filter(t=>t!=null&&!e.includes(t));this.setSelection(i)},selectResources(e,i){const{addToSelection:t,edit:r}=i||{},d=this.selection.map(h=>R(h,this));let u=e;if(t){const h=l.difference(e,d);h.length>0&&(u=d.concat(h).filter(S=>S!=null))}l.isEqual(d,u)||this.setSelection(u,r)},setSelection(e,i){if(!l.isEqual(e,this.selection.map(t=>R(t,this)))){let t=!0;if(this.editors.length>0){if(o.detail.autoFromSingleSelection&&this.selection.length==1)t=!1;else if(o.detail.autoFromMultipleSelection&&o.detail.allowMultiple&&this.selection.length>1)t=!1;else if(o.detail.constrainToSelection){const r=this.selection.map(h=>R(h,this)),u=this.detailSelection.map(h=>R(h,this)).filter(h=>r.includes(h));this.detailSelection.filter(h=>!u.includes(R(h,this))).length>0&&(t=!1)}}if(!t)return;if(this.selection=e.map(r=>this.resources.find(d=>R(d,this)==r)).filter(r=>r!=null),o.detail.autoFromSingleSelection&&this.selection.length==1){const r=this.selection[0];(this.detailSelection.length!=1||R(this.detailSelection[0],this)!=R(r,this))&&(this.detailSelection=[r])}else if(o.detail.autoFromMultipleSelection&&o.detail.allowMultiple&&this.selection.length>1)l.isEqual(this.selection.map(r=>R(r,this)),this.detailSelection.map(r=>R(r,this)))||(this.detailSelection=l.clone(this.selection));else if(o.detail.constrainToSelection){const r=this.selection.map(h=>R(h,this)),d=this.detailSelection.map(h=>R(h,this)),u=d.filter(h=>r.includes(h));l.isEqual(u,d)||(this.detailSelection=this.detailSelection.filter(h=>u.includes(R(h,this))))}this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=i!==void 0?i:this.editingDetailSelection||o.detail.autoEdit}},hideDetail(){this.detailSelection.length>0&&(this.detailSelection=[],this.editingDetailSelection=!1)},showSelectionAsDetail(e){if(this.selection.length<=1||o.detail.allowMultiple){const i=this.selection.map(r=>R(r,this)),t=this.detailSelection.map(r=>R(r,this));l.isEqual(i,t)||(this.detailSelection=l.clone(this.selection)),this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=e!==void 0?e:this.editingDetailSelection||o.detail.autoEdit}},deregisterEditor(e){l.remove(this.editors,i=>i==e)},registerEditor(e){this.editors.includes(e)||this.editors.push(e)},deregisterListNavigator({name:e,listNavigator:i}){(i==null||this.listNavigators[e]==i)&&delete this.listNavigators[e]},registerListNavigator({name:e,listNavigator:i}){this.listNavigators[e]!=i&&(this.listNavigators[e]=i)}}});return(()=>{const e=(i,t)=>{const r=I(i,t);return _.registerStore(r.$id,r),r};return e.$id=I.$id,e})()},_=new de,Ce=(g={})=>{var Re,pe,ve,ge;const{collectionId:o,draftBatchId:I,enabled:w,resourceType:e,options:i}=g,t=a.ref(void 0),r=a.ref(o),d=a.ref(I),u=a.ref(w??!0),h=a.ref([a.toRef(e)]),S=a.ref(i),E=a.computed(()=>d.value),q=a.ref(u.value),O=a.ref(D.v4()),x=a.ref((pe=(Re=S.value)==null?void 0:Re.filter)==null?void 0:pe.resourceIds),k=a.ref((ge=(ve=S.value)==null?void 0:ve.filter)==null?void 0:ge.query),B=a.computed(()=>d.value==null&&r.value!=null&&_.getStore(r.value)!=null),P=a.ref(B.value),y=a.computed(()=>C("status","Uninitialized"));function v(s){if(t.value)return s(t.value)}async function $(s){if(t.value)return await s(t.value)}function C(s,n){if(t.value)return t.value[s];if(n!==void 0)return n;throw"Attempted to use a REST collection store that has not been created, with no default value."}const U=(s={})=>{var te,me,Se,ye;const{collectionId:n,draftBatchId:T,enabled:N,resourceType:oe,options:ee}=s;r.value=n,d.value=T,u.value=N??!0,h.value=[a.toRef(oe)],ee!=null&&(S.value=ee,x.value=(me=(te=S.value)==null?void 0:te.filter)==null?void 0:me.resourceIds,k.value=(ye=(Se=S.value)==null?void 0:Se.filter)==null?void 0:ye.query),O.value=D.v4(),H(u.value)},H=async s=>{s!=q.value&&(q.value=s,s&&(V(),b()))},le=async s=>{x.value=s,await $(async n=>await n.setFilterResourceIds(x.value||null))},Z=async s=>{if(k.value=s,y.value!="Uninitialized"){const n=s,T=a.computed(()=>l.isFunction(n)?m.value?n(m.value):null:n);await $(N=>N.setQuery(T.value||null))}},V=()=>{S.value=l.merge({},S.value||{},{filter:{resourceIds:x.value,query:k.value}})},m=a.computed(()=>h.value[0].value||void 0),j=function(s){const n=l.get(s,"filter.query"),T=l.get(s,"propertiesToExclude"),N=l.get(s,"referencePathsToExpand"),oe=l.isFunction(n)?n(m.value):n,ee=m.value?l.isFunction(T)?T(m.value):T||[]:[],te=m.value?l.isFunction(N)?N(m.value):N||[]:[];return{...l.cloneDeep(s||{}),filter:{...l.cloneDeep((s==null?void 0:s.filter)||{}),query:oe},propertiesToExclude:ee,referencePathsToExpand:te}},F=a.computed(()=>j(S.value)),M=a.computed(()=>{if(F.value.restCollectionUrl!==void 0)return F.value.restCollectionUrl;if(!P.value)return!m.value||!m.value.collectionName?null:E.value?`${X.config.apiBaseUrl}/draft-batches/${E.value}/${m.value.collectionName}`:`${X.config.apiBaseUrl}/${m.value.collectionName}`}),c=a.computed(()=>{var s;if(m.value)return l.mergeWith(l.cloneDeep(he),F.value,{idProperty:(s=m.value)==null?void 0:s.idProperty,restCollectionUrl:M.value||""},(n,T)=>{if(l.isArray(T)&&T.length==0&&(n==null||l.isArray(n)))return T})}),f=a.ref(0),z=a.computed(()=>{var s;return f.value,r.value||m.value&&((s=m.value)==null?void 0:s.collectionName)&&(E.value?`draftBatches/${E.value}/${m.value.collectionName}/${O.value}`:`${m.value.collectionName}/${O.value}`)||null}),b=()=>{if(q.value){let s=!1;return m.value&&z.value&&(t.value=_.getStore(z.value),t.value?s=!1:c.value&&(P.value=!1,t.value=Ee(z.value,c.value)(),s=!0)),s}else return!1},J=()=>{z.value&&r.value==z.value?(t.value=void 0,b()):(t.value=void 0,f.value=f.value+1,b())};a.watch(E,(s,n)=>{l.isEqual(s,n)||J()}),a.watch(q,(s,n)=>{s!=n&&(s?b():t.value=void 0)}),a.watch(m,(s,n)=>{s&&!n?b():!s&&n||l.isEqual(s,n)||J()}),a.watch(c,(s,n)=>{l.isEqual(s,n)||J()}),a.watch(B,()=>{B.value||(P.value=!1)}),a.watch(z,()=>b()),a.watch(M,(s,n)=>{l.isEqual(s,n)||J()});const W=[],Pe=function(s){y.value!="Uninitialized"?a.nextTick(s):W.push(s)};return a.watch(y,(s,n)=>{if(s!="Uninitialized"&&n=="Uninitialized"){const T=l.clone(W);W.splice(0,W.length);for(const N of T)N()}}),b(),{collectionId:z,draftBatchId:E,resourceType:m,restCollectionUrl:a.computed(()=>C("restCollectionUrl",null)),enabled:q,status:y,batchSaveAttempted:a.computed(()=>C("batchSaveAttempted",!1)),listNavigators:a.computed(()=>C("listNavigators",!1)),invalidResources:a.computed(()=>C("invalidResources",[])),resources:a.computed(()=>y.value!="Uninitialized"?($(s=>s.ensureCollectionLoaded()),C("resources",[])):[]),remoteCollectionSize:a.computed(()=>C("remoteCollectionSize",null)),transientData:a.computed(()=>C("transientData",[])),detailSelection:a.computed(()=>C("detailSelection",[])),editingDetailSelection:a.computed(()=>C("editingDetailSelection",!1)),selection:a.computed(()=>C("selection",[])),reconfigureCollection:U,setEditingDetailSelection:s=>v(n=>n.setEditingDetailSelection(s)),setEnabled:H,setFilterResourceIds:le,setQuery:Z,ensureStore:b,setBatchSaveAttempted:s=>v(n=>n.setBatchSaveAttempted(s)),clear:()=>v(s=>s.clear()),ensureCollectionLoaded:async()=>await $(async s=>s.ensureCollectionLoaded()),loadResources:async()=>await $(async s=>await s.loadResources()),addResource:s=>v(n=>n.addResource(s)),checkForDeletedResource:async s=>await $(async n=>await n.checkForDeletedResource(s))==!0,recordDeletion:s=>v(n=>n.recordDeletion(s)),recordInsertion:(s,{insertAtBeginning:n=!1,transientData:T=void 0}={})=>v(N=>N.recordInsertion(s,{insertAtBeginning:n,transientData:T})),recordUpdate:s=>v(n=>n.recordUpdate(s)),refreshResource:async s=>await $(async n=>await n.refreshResource(s)),deleteResource:async s=>await $(async n=>await n.deleteResource(s)),saveResource:async s=>await $(async n=>await n.saveResource(s)),saveResources:async s=>await $(async n=>await n.saveResources(s)),updateResource:async s=>await $(async n=>await n.updateResource(s)),updateResources:async s=>await $(async n=>await n.updateResources(s)),clearTransientData:()=>v(s=>s.clearTransientData()),setInvalidResourceIds:s=>v(n=>n.setInvalidResourceIds(s)),setTransientDataForResources:s=>v(n=>n.setTransientDataForResources(s)),clearSelection:()=>v(s=>s.clearSelection()),deselectResources:s=>v(n=>n.deselectResources(s)),selectResources:(s,n)=>v(T=>T.selectResources(s,n)),hideDetail:()=>v(s=>s.hideDetail()),deregisterEditor:s=>v(n=>n.deregisterEditor(s)),registerEditor:s=>v(n=>n.registerEditor(s)),deregisterListNavigator:s=>v(n=>n.deregisterListNavigator(s)),registerListNavigator:s=>v(n=>n.registerListNavigator(s)),onItemsStoreReady:Pe}},Te=()=>{_.clearAllStores()};function ie(g,o){return l.get(g,(o==null?void 0:o.idProperty)||"_id")}const fe={idProperty:"_id"},Y={resource:null,status:"NotLoaded"},Le=(g,o)=>{o=l.merge({},fe,o);const I=ce.defineStore(g,{state:()=>({idProperty:o.idProperty,resourceId:o.resourceId||null,resourceUrl:o.resourceUrl||null,referencePathsToExpand:o.referencePathsToExpand||null,...Y}),getters:{currentResourceUrl:e=>e.resourceUrl||(o.restCollectionUrl&&e.resourceId?`${o.restCollectionUrl}/${e.resourceId}`:null)||o.restCollectionUrl||null,fixedQueryParams:e=>{const i={};return e.referencePathsToExpand&&(i.r=G(e.referencePathsToExpand)),i}},actions:{reset(){for(const e in Y)this[e]=Y[e]},async setResourceId(e){const i=this.currentResourceUrl;this.resourceId=e,!l.isEqual(this.currentResourceUrl,i)&&this.status!="NotLoaded"&&await this.loadResource()},async setResourceUrl(e){const i=this.currentResourceUrl;this.resourceUrl=e,!l.isEqual(this.currentResourceUrl,i)&&this.status!="NotLoaded"&&await this.loadResource()},clear(){for(const e in Y)this[e]=Y[e]},async ensureResourceLoaded(){["Loaded","Loading","Failed"].includes(this.status)||await this.loadResource()},async loadResource(){this.reset();const e=D.v4();if(this._loadId=e,this.currentResourceUrl){this.status="Loading";const i=this.fixedQueryParams,t=l.cloneDeep(i),r=l.map(t,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),d=l.isEmpty(r)?this.currentResourceUrl:`${this.currentResourceUrl}?${r}`;try{const u=await L.get(d),h=this.fixedQueryParams;e!=this._loadId||!l.isEqual(i,h)?console.log(`Discarding resource fetched by obsolete query from ${d}.`):(this.resource=ae.decode(l.get(u,"data",{})),this.status="Loaded")}catch(u){console.log(`Error while loading resource (URL="${d}")`,u),this.reset(),this.status="Failed"}}else throw"Cannot load a resource because its URL, or its ID and collection URL, are unknown."},async checkForDeletedResource(){if(this.currentResourceUrl){let e;try{e=await L.get(this.currentResourceUrl)}catch(i){L.isAxiosError(i)&&(e=i.response)}return e&&e.status==404?(this.recordDeletion(),!0):!1}else throw"Cannot check for a deleted resource because its URL, or its ID and collection URL, are unknown."},recordDeletion(){this.resource=null,this.status="Loaded"},recordInsertion(e){this.resourceId=ie(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},recordUpdate(e){this.resourceId=ie(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},async refreshResource(){return await this.loadResource(),this.resource},async deleteResource(){if(this.currentResourceUrl)(await L.delete(this.currentResourceUrl)).status==200&&this.recordDeletion();else throw"Cannot delete a resource because its URL, or its ID and collection URL, are unknown."},async saveResource(e){const i=ie(e,this),t=i==null;if(!i)throw"The REST resource store cannot create new resources on the server.";if(!this.currentResourceUrl)throw"Cannot save a resource because its URL, or its ID and collection URL, are unknown.";const r=await L({method:t?"post":"put",url:this.currentResourceUrl,data:e});if(r.status==200){const d=r.data,u=await this.refreshResource();return t&&this.recordInsertion(u||d),u||Object.freeze(d)}return null},async updateResource(e){if(!this.currentResourceUrl)throw"Cannot save a resource because its URL, or its ID and collection URL, are unknown.";const i=await L({method:"patch",url:this.currentResourceUrl,data:e});if(i.status==200){const t=i.data;return await this.refreshResource()||Object.freeze(t)}return null},async makeCustomApiRequest(e){const{method:i,subpath:t,url:r,data:d}=e;let u=r;if(!u)if(this.currentResourceUrl)u=`${this.currentResourceUrl}/${t}`;else throw"Cannot make a custom API request for a resource because its URL, or its ID and collection URL, are unknown.";const h=await L({method:i||"get",url:u,data:d});return h.status>=200&&h.status<300?h.data:null}}});return(()=>{const e=(i,t)=>{const r=I(i,t);return re.registerStore(r.$id,r),r};return e.$id=I.$id,e})()},re=new de,$e=(g={})=>{const{resourceClientId:o,draftBatchId:I,enabled:w,resourceType:e,options:i}=g,t=a.ref(void 0),r=a.ref(o),d=a.ref(I),u=a.ref(w??!0),h=a.ref([a.toRef(e)]),S=a.ref(i),E=a.computed(()=>d.value),q=a.ref(u.value),O=a.ref(D.v4()),x=a.computed(()=>d.value==null&&r.value!=null&&re.getStore(r.value)!=null),k=a.ref(x.value),B=a.computed(()=>v("status","Uninitialized"));function P(c){if(t.value)return c(t.value)}async function y(c){if(t.value)return await c(t.value)}function v(c,f){if(t.value)return t.value[c];if(f!==void 0)return f;throw"Attempted to use a REST resource store that has not been created, with no default value."}const $=(c={})=>{const{resourceClientId:f,draftBatchId:z,enabled:b,resourceType:J,options:W}=c;r.value=f,d.value=z,u.value=b??!0,h.value=[a.toRef(J)],W!=null&&(S.value=W),O.value=D.v4(),C(u.value)},C=async c=>{c!=q.value&&(q.value=c,c&&F())},U=a.computed(()=>h.value[0].value||void 0),H=function(c){const f=l.get(c,"referencePathsToExpand"),z=U.value?l.isFunction(f)?f(U.value):f||[]:[];return{...l.cloneDeep(c||{}),referencePathsToExpand:z}},le=a.computed(()=>H(S.value)),Z=a.computed(()=>{if(!U.value)return null;if(!k.value)return!U.value||!U.value.collectionName?null:E.value?`${X.config.apiBaseUrl}/draft-batches/${E.value}/${U.value.collectionName}`:`${X.config.apiBaseUrl}/${U.value.collectionName}`}),V=a.computed(()=>{if(U.value&&Z.value)return l.mergeWith(l.cloneDeep(fe),le.value,{idProperty:U.value.idProperty,restCollectionUrl:Z.value},(c,f)=>{if(l.isArray(f)&&f.length==0&&(c==null||l.isArray(c)))return f})}),m=a.ref(0),j=a.computed(()=>{var c;return m.value,r.value||U.value&&((c=U.value)==null?void 0:c.collectionName)&&(E.value?`draftBatches/${E.value}/${U.value.collectionName}/${O.value}`:`${U.value.collectionName}/${O.value}`)||null}),F=()=>{if(q.value){let c=!1;return U.value&&j.value&&(t.value=re.getStore(j.value),t.value?c=!1:V.value&&(k.value=!1,t.value=Le(j.value,V.value)(),c=!0)),c}else return!1},M=()=>{j.value&&r.value==j.value?(t.value=void 0,F()):(t.value=void 0,m.value=m.value+1,F())};return a.watch(E,(c,f)=>{l.isEqual(c,f)||M()}),a.watch(q,(c,f)=>{c!=f&&(c?F():t.value=void 0)}),a.watch(U,(c,f)=>{c&&!f?F():!c&&f||l.isEqual(c,f)||M()}),a.watch(V,(c,f)=>{l.isEqual(c,f)||M()}),a.watch(x,()=>{x.value||(k.value=!1)}),a.watch(j,()=>F()),a.watch(Z,(c,f)=>{l.isEqual(c,f)||M()}),F(),{resourceClientId:j,draftBatchId:E,enabled:q,resourceType:U,status:B,resource:a.computed(()=>B.value!="Uninitialized"?(y(c=>c.ensureResourceLoaded()),v("resource",[])):[]),resourceId:a.computed(()=>v("resourceId",null)),resourceUrl:a.computed(()=>v("resourceUrl",null)),reconfigureClient:$,setEnabled:C,setResourceId:async c=>await y(async f=>await f.setResourceId(c)),setResourceUrl:async c=>await y(async f=>await f.setResourceUrl(c)),ensureStore:F,clear:()=>P(c=>c.clear()),ensureResourceLoaded:async()=>await y(async c=>c.ensureResourceLoaded()),loadResource:async()=>await y(async c=>await c.loadResource()),checkForDeletedResource:async()=>await y(async c=>await c.checkForDeletedResource())==!0,recordDeletion:()=>y(c=>c.recordDeletion()),recordInsertion:c=>y(f=>f.recordInsertion(c)),recordUpdate:c=>y(f=>f.recordUpdate(c)),refreshResource:async()=>await y(async c=>await c.refreshResource()),deleteResource:async()=>await y(async c=>await c.deleteResource()),saveResource:async c=>await y(async f=>await f.saveResource(c)),updateResource:async c=>await y(async f=>await f.updateResource(c)),makeCustomApiRequest:async c=>await y(async f=>await f.makeCustomApiRequest(c))}},X={config:{...ue}};function qe(g){X.config=l.merge({},ue,g)}p.ApiClientError=we,p.clearAllRestCollections=Te,p.initRestClient=qe,p.restClient=X,p.useRestCollection=Ce,p.useRestResource=$e,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
@@ -54,7 +54,7 @@ export interface ConcreteRestCollectionStoreOptionsInput {
|
|
54
54
|
pageSize?: number | null;
|
55
55
|
};
|
56
56
|
order?: [any, string][];
|
57
|
-
|
57
|
+
propertiesToExclude?: string[];
|
58
58
|
referencePathsToExpand?: string[];
|
59
59
|
restCollectionUrl?: string | null;
|
60
60
|
}
|
@@ -80,7 +80,7 @@ export interface RestCollectionStoreOptionsInput {
|
|
80
80
|
pageSize?: number | null;
|
81
81
|
};
|
82
82
|
order?: [any, string][];
|
83
|
-
|
83
|
+
propertiesToExclude?: string[] | ((resourceType: ResourceType) => string[]);
|
84
84
|
referencePathsToExpand?: string[] | ((resourceType: ResourceType) => string[]);
|
85
85
|
restCollectionUrl?: string | null;
|
86
86
|
}
|
@@ -131,6 +131,18 @@ export interface RestCollection<T extends Resource = Resource> {
|
|
131
131
|
* To allow for asynchronous loading of resource types, this may be undefined.
|
132
132
|
*/
|
133
133
|
resourceType: Ref<ResourceType | undefined>;
|
134
|
+
/**
|
135
|
+
* The REST collection URL.
|
136
|
+
*
|
137
|
+
* This is reported by the actual Pinia store. It may be arrived at in three ways:
|
138
|
+
* - It may have been specified in {@link RestCollectionOptions.options}.
|
139
|
+
* - It may have been calculated from the entity type and draft batch ID. This is the most common scenario.
|
140
|
+
* - Or this RestCollection may reference an existing store, in which case the URL was determined by the collection
|
141
|
+
* that originally created the store.
|
142
|
+
*
|
143
|
+
* It defaults to null when no store is present.
|
144
|
+
*/
|
145
|
+
restCollectionUrl: Ref<string | null>;
|
134
146
|
/** A status indicating whether resources have been loaded yet from the REST API. */
|
135
147
|
status: Ref<RestCollectionStatus>;
|
136
148
|
batchSaveAttempted: Ref<boolean>;
|
@@ -276,6 +288,24 @@ export interface RestCollection<T extends Resource = Resource> {
|
|
276
288
|
* @param params TODO
|
277
289
|
*/
|
278
290
|
saveResources: (resources: T[]) => Promise<T[] | undefined>;
|
291
|
+
/**
|
292
|
+
* Partial update of one resource.
|
293
|
+
*
|
294
|
+
* If you call this with await, it will return once the API call has completed, and if the APi call succeeded, it will
|
295
|
+
* return the newly saved item.
|
296
|
+
*
|
297
|
+
* @param partialResource The partial resource to update.
|
298
|
+
*/
|
299
|
+
updateResource: (partialResource: T) => Promise<T | null | undefined>;
|
300
|
+
/**
|
301
|
+
* Partial update of multiple resources.
|
302
|
+
*
|
303
|
+
* If you call this with await, it will return once the API call has completed, and if the APi call succeeded, it will
|
304
|
+
* return the saved items.
|
305
|
+
*
|
306
|
+
* @param partialResources The partial resources to update.
|
307
|
+
*/
|
308
|
+
updateResources: (partialResources: T[]) => Promise<T[] | undefined>;
|
279
309
|
/**
|
280
310
|
* Record which resources have failed validation.
|
281
311
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rest-collection.d.ts","sourceRoot":"","sources":["../../src/rest-collection.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0B,GAAG,EAAe,MAAM,KAAK,CAAA;AAI9D,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAC,MAAM,gCAAgC,CAAA;AACjF,OAAkB,EAEhB,oBAAoB,EAIrB,MAAM,mCAAmC,CAAA;AAE1C,6CAA6C;AAC7C,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yBAAyB;IACzB,YAAY,CAAC,EAAE,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,YAAY,CAAA;IAC3D,oFAAoF;IACpF,OAAO,CAAC,EAAE,+BAA+B,CAAA;CAC1C;AAED,MAAM,WAAW,uCAAuC;IACtD,MAAM,CAAC,EAAE;QACP,aAAa,CAAC,EAAE,OAAO,CAAA;QACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,yBAAyB,CAAC,EAAE,OAAO,CAAA;QACnC,uBAAuB,CAAC,EAAE,OAAO,CAAA;QACjC,uBAAuB,CAAC,EAAE,OAAO,CAAA;QACjC,oBAAoB,CAAC,EAAE,OAAO,CAAA;KAC/B,CAAC;IACF,MAAM,CAAC,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC3B,KAAK,CAAC,EAAE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AAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAA;IAMrC,uBAAuB,EAAE,CAAC,EAAC,IAAI,EAAE,aAAa,EAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,GAAG,CAAA;KAAC,KAAK,IAAI,CAAA;IAC5F,qBAAqB,EAAE,CAAC,EAAC,IAAI,EAAE,aAAa,EAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,GAAG,CAAA;KAAC,KAAK,IAAI,CAAA;IAM1F,iBAAiB,EAAE,CAAC,QAAQ,EAAE,gCAAgC,KAAK,IAAI,CAAA;CACxE;6DAEsD,qBAAqB;AAA5E,wBAmdC;AAED,eAAO,MAAM,uBAAuB,YAA2C,CAAA"}
|
@@ -134,6 +134,7 @@ export interface RestResourceClient<T extends Resource = Resource> {
|
|
134
134
|
refreshResource: () => Promise<T | null | undefined>;
|
135
135
|
deleteResource: () => Promise<void>;
|
136
136
|
saveResource: (resource: T) => Promise<T | null | undefined>;
|
137
|
+
updateResource: (partialResource: T) => Promise<T | null | undefined>;
|
137
138
|
makeCustomApiRequest: (params: MakeCustomApiRequestParams) => Promise<any>;
|
138
139
|
}
|
139
140
|
declare const _default: <T extends object = object>(params?: RestResourceOptions) => RestResourceClient<T>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rest-resource.d.ts","sourceRoot":"","sources":["../../src/rest-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,OAAO,CAAA;AAG5B,OAAO,EAAgB,GAAG,EAAe,MAAM,KAAK,CAAA;AAGpD,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAC,MAAM,gCAAgC,CAAA;AACjF,OAAkB,EAEhB,kBAAkB,EAInB,MAAM,iCAAiC,CAAA;AAExC,kDAAkD;AAClD,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,gBAAgB,C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;IAC/C,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,eAAe,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,IAAI,CAAA;IACtC,YAAY,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,IAAI,CAAA;IACnC,eAAe,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;IAMpD,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,YAAY,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;IAC5D,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;IAMrE,oBAAoB,EAAE,CAAC,MAAM,EAAE,0BAA0B,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;CAC3E;6DAEsD,mBAAmB;AAA1E,wBAqVC"}
|
@@ -27,7 +27,7 @@ export interface RestCollectionStoreOptions {
|
|
27
27
|
pageSize?: number;
|
28
28
|
};
|
29
29
|
order?: QueryOrder;
|
30
|
-
|
30
|
+
propertiesToExclude?: string[];
|
31
31
|
referencePathsToExpand?: string[];
|
32
32
|
restCollectionUrl: string;
|
33
33
|
}
|
@@ -40,8 +40,9 @@ export interface RestCollectionStoreState {
|
|
40
40
|
idProperty: string;
|
41
41
|
filter: RestCollectionFilter;
|
42
42
|
order: QueryOrder | null;
|
43
|
-
|
43
|
+
propertiesToExclude: string[] | null;
|
44
44
|
referencePathsToExpand: string[] | null;
|
45
|
+
restCollectionUrl: string;
|
45
46
|
resources: Resource[];
|
46
47
|
remoteCollectionSize: number | null;
|
47
48
|
status: RestCollectionStoreStatus;
|
@@ -100,8 +101,9 @@ declare const makeStore: (storeId: string, options: RestCollectionStoreOptions)
|
|
100
101
|
path: string;
|
101
102
|
sqlType?: string | undefined;
|
102
103
|
}, import("../queries.js").QueryOrderDirection])[] | null;
|
103
|
-
|
104
|
+
propertiesToExclude: string[] | null;
|
104
105
|
referencePathsToExpand: string[] | null;
|
106
|
+
restCollectionUrl: string;
|
105
107
|
resources: Resource[];
|
106
108
|
remoteCollectionSize: number | null;
|
107
109
|
status: RestCollectionStoreStatus;
|
@@ -329,6 +331,28 @@ declare const makeStore: (storeId: string, options: RestCollectionStoreOptions)
|
|
329
331
|
* @returns An array of refreshed local resources, one for each remote resource whose save operation succeeded.
|
330
332
|
*/
|
331
333
|
saveResources(resources: Resource[]): Promise<Resource[]>;
|
334
|
+
/**
|
335
|
+
* Perform an update of a resource of the remote collection, then mirror the changes in the local collection.
|
336
|
+
*
|
337
|
+
* After writing changes, {@link refreshResource} is called to ensure that the local resource (which is also the
|
338
|
+
* return value) has the same object-graph characteristics as the rest of the local collection.
|
339
|
+
*
|
340
|
+
* @param partialResource The partial resource to merge.
|
341
|
+
* @returns The refreshed local resource after the change has been persisted to the remote collection, or null if
|
342
|
+
* the operation failed.
|
343
|
+
*/
|
344
|
+
updateResource(partialResource: Resource): Promise<Resource | null>;
|
345
|
+
/**
|
346
|
+
* Perform an update of multiple resource of the remote collection, then mirror the changes in the local collection.
|
347
|
+
*
|
348
|
+
* After writing changes, {@link refreshResource} is called to ensure that the local resource (which is also the
|
349
|
+
* return value) has the same object-graph characteristics as the rest of the local collection.
|
350
|
+
*
|
351
|
+
* @param partialResources The partial resources to merge.
|
352
|
+
* @returns The refreshed local resource after the change has been persisted to the remote collection, or null if
|
353
|
+
* the operation failed.
|
354
|
+
*/
|
355
|
+
updateResources(partialResources: Resource[]): Promise<Resource[] | null>;
|
332
356
|
/** Clear all transient data. */
|
333
357
|
clearTransientData(): void;
|
334
358
|
/**
|
@@ -451,8 +475,9 @@ export declare const storeRegistry: StoreRegistry<import("pinia").Store<string,
|
|
451
475
|
path: string;
|
452
476
|
sqlType?: string | undefined;
|
453
477
|
}, import("../queries.js").QueryOrderDirection])[] | null;
|
454
|
-
|
478
|
+
propertiesToExclude: string[] | null;
|
455
479
|
referencePathsToExpand: string[] | null;
|
480
|
+
restCollectionUrl: string;
|
456
481
|
resources: Resource[];
|
457
482
|
remoteCollectionSize: number | null;
|
458
483
|
status: RestCollectionStoreStatus;
|
@@ -680,6 +705,28 @@ export declare const storeRegistry: StoreRegistry<import("pinia").Store<string,
|
|
680
705
|
* @returns An array of refreshed local resources, one for each remote resource whose save operation succeeded.
|
681
706
|
*/
|
682
707
|
saveResources(resources: Resource[]): Promise<Resource[]>;
|
708
|
+
/**
|
709
|
+
* Perform an update of a resource of the remote collection, then mirror the changes in the local collection.
|
710
|
+
*
|
711
|
+
* After writing changes, {@link refreshResource} is called to ensure that the local resource (which is also the
|
712
|
+
* return value) has the same object-graph characteristics as the rest of the local collection.
|
713
|
+
*
|
714
|
+
* @param partialResource The partial resource to merge.
|
715
|
+
* @returns The refreshed local resource after the change has been persisted to the remote collection, or null if
|
716
|
+
* the operation failed.
|
717
|
+
*/
|
718
|
+
updateResource(partialResource: Resource): Promise<Resource | null>;
|
719
|
+
/**
|
720
|
+
* Perform an update of multiple resource of the remote collection, then mirror the changes in the local collection.
|
721
|
+
*
|
722
|
+
* After writing changes, {@link refreshResource} is called to ensure that the local resource (which is also the
|
723
|
+
* return value) has the same object-graph characteristics as the rest of the local collection.
|
724
|
+
*
|
725
|
+
* @param partialResources The partial resources to merge.
|
726
|
+
* @returns The refreshed local resource after the change has been persisted to the remote collection, or null if
|
727
|
+
* the operation failed.
|
728
|
+
*/
|
729
|
+
updateResources(partialResources: Resource[]): Promise<Resource[] | null>;
|
683
730
|
/** Clear all transient data. */
|
684
731
|
clearTransientData(): void;
|
685
732
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rest-collection-store.d.ts","sourceRoot":"","sources":["../../../src/stores/rest-collection-store.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,uBAAuB,CAAA;AACpF,OAAO,EAAC,Q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AU,GAAG,QAAQ,QAAQ,GAAG,IAAI,CAAC;IAmCvE;;;;OAIG;mCAC2B,QAAQ;IAKtC;;;;;;OAMG;+BAC8B,UAAU;IAmC3C;;;;;;;;;;OAUG;2BAC0B,QAAQ,GAAG,QAAQ,QAAQ,GAAG,IAAI,CAAC;IA2BhE;;;;;;;;;OASG;6BAC4B,QAAQ,EAAE,GAAG,QAAQ,QAAQ,EAAE,CAAC;IA+B/D;;;;;;;;;OASG;oCACmC,QAAQ,GAAG,QAAQ,QAAQ,GAAG,IAAI,CAAC;IAuBzE;;;;;;;;;OASG;sCACqC,QAAQ,EAAE,GAAG,QAAQ,QAAQ,EAAE,GAAG,IAAI,CAAC;IAyB/E,gCAAgC;;IAKhC;;;;;;OAMG;uCACgC,UAAU,EAAE;IAQ/C;;;;;;OAMG;yCACkC,sBAAsB;IAa3D;;OAEG;;IAKH;;;;OAIG;mCAC4B,UAAU,EAAE;IAM3C;;;;;;;OAOG;iCAC0B,UAAU,EAAE,YAAY,sBAAsB;IAiB3E;;;;;;OAMG;sCAC+B,UAAU,EAAE,SAAS,OAAO;IAsE9D;;;;OAIG;;IAQH;;;;;;;;OAQG;gCACyB,OAAO;IAsBnC;;;;OAIG;6BACsB,GAAG;IAI5B;;;;OAIG;2BACoB,GAAG;IAU1B;;;;;;OAMG;;cACmD,MAAM;uBAAiB,GAAG;;IAMhF;;;;;;;;;;;OAWG;;cACiD,MAAM;uBAAiB,GAAG;;GAuBf,CAAA;AAErE,eAAe,SAAS,CAAA"}
|
@@ -148,6 +148,17 @@ declare const makeStore: (storeId: string, options: RestResourceStoreOptions) =>
|
|
148
148
|
* the operation failed.
|
149
149
|
*/
|
150
150
|
saveResource(resource: Resource): Promise<Resource | null>;
|
151
|
+
/**
|
152
|
+
* Update only the specified properties of the remote resource, then mirror the change locally.
|
153
|
+
*
|
154
|
+
* After writing changes, {@link refreshResource} is called to ensure that the local resource (which is also the
|
155
|
+
* return value) has the same object-graph characteristics as the rest of the local collection.
|
156
|
+
*
|
157
|
+
* @param partialResource The partial resource to merge.
|
158
|
+
* @returns The refreshed local resource after the change has been persisted to the remote collection, or null if
|
159
|
+
* the operation failed.
|
160
|
+
*/
|
161
|
+
updateResource(partialResource: Resource): Promise<Resource | null>;
|
151
162
|
makeCustomApiRequest(params: MakeCustomApiRequestParams): Promise<any>;
|
152
163
|
}>;
|
153
164
|
export type RestResourceStore = ReturnType<ReturnType<typeof makeStore>>;
|
@@ -272,6 +283,17 @@ export declare const storeRegistry: StoreRegistry<import("pinia").Store<string,
|
|
272
283
|
* the operation failed.
|
273
284
|
*/
|
274
285
|
saveResource(resource: Resource): Promise<Resource | null>;
|
286
|
+
/**
|
287
|
+
* Update only the specified properties of the remote resource, then mirror the change locally.
|
288
|
+
*
|
289
|
+
* After writing changes, {@link refreshResource} is called to ensure that the local resource (which is also the
|
290
|
+
* return value) has the same object-graph characteristics as the rest of the local collection.
|
291
|
+
*
|
292
|
+
* @param partialResource The partial resource to merge.
|
293
|
+
* @returns The refreshed local resource after the change has been persisted to the remote collection, or null if
|
294
|
+
* the operation failed.
|
295
|
+
*/
|
296
|
+
updateResource(partialResource: Resource): Promise<Resource | null>;
|
275
297
|
makeCustomApiRequest(params: MakeCustomApiRequestParams): Promise<any>;
|
276
298
|
}>>;
|
277
299
|
export default makeStore;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rest-resource-store.d.ts","sourceRoot":"","sources":["../../../src/stores/rest-resource-store.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAC,0BAA0B,EAAC,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAA;AAcvD,sEAAsE;AACtE,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,C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