@donotdev/crud 0.0.12 → 0.0.13

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.
Files changed (145) hide show
  1. package/dist/CrudService.js +1 -1
  2. package/dist/CrudStore.js +1 -1
  3. package/dist/FieldRegistry.js +1 -1
  4. package/dist/adapters/FirestoreAdapter.js +1 -1
  5. package/dist/adapters/FunctionsAdapter.js +1 -1
  6. package/dist/adapters/index.js +1 -1
  7. package/dist/components/CrudButton.js +1 -1
  8. package/dist/components/DisplayFieldRenderer.js +1 -1
  9. package/dist/components/EntityDisplayRenderer.js +1 -1
  10. package/dist/components/EntityFilters.d.ts.map +1 -1
  11. package/dist/components/EntityFilters.js +1 -1
  12. package/dist/components/FormFieldRenderer.js +1 -1
  13. package/dist/components/FormLayout.js +1 -1
  14. package/dist/components/controlled/complex/ControlledAddressField.js +1 -1
  15. package/dist/components/controlled/complex/ControlledDateField.js +1 -1
  16. package/dist/components/controlled/complex/ControlledGeoPointField.js +1 -1
  17. package/dist/components/controlled/complex/ControlledMapField.js +1 -1
  18. package/dist/components/controlled/complex/ControlledMultiInputField.js +1 -1
  19. package/dist/components/controlled/complex/ControlledRichTextField.js +1 -1
  20. package/dist/components/controlled/complex/ControlledTimestampField.js +1 -1
  21. package/dist/components/controlled/complex/index.js +1 -1
  22. package/dist/components/controlled/file/ControlledDocumentField.js +1 -1
  23. package/dist/components/controlled/file/ControlledFileField.js +1 -1
  24. package/dist/components/controlled/file/ControlledImageField.js +1 -1
  25. package/dist/components/controlled/file/ControlledMultiDocumentField.js +1 -1
  26. package/dist/components/controlled/file/ControlledMultiFileField.js +1 -1
  27. package/dist/components/controlled/file/ControlledMultiImageField.js +1 -1
  28. package/dist/components/controlled/file/index.js +1 -1
  29. package/dist/components/controlled/index.js +1 -1
  30. package/dist/components/controlled/input/ControlledCheckboxField.js +1 -1
  31. package/dist/components/controlled/input/ControlledCurrencyField.js +1 -1
  32. package/dist/components/controlled/input/ControlledDurationField.js +1 -1
  33. package/dist/components/controlled/input/ControlledGdprConsentField.js +1 -1
  34. package/dist/components/controlled/input/ControlledNumberField.js +1 -1
  35. package/dist/components/controlled/input/ControlledPasswordField.js +1 -1
  36. package/dist/components/controlled/input/ControlledPhoneField.js +1 -1
  37. package/dist/components/controlled/input/ControlledPriceField.js +1 -1
  38. package/dist/components/controlled/input/ControlledRangeField.js +1 -1
  39. package/dist/components/controlled/input/ControlledRatingField.js +1 -1
  40. package/dist/components/controlled/input/ControlledSwitchField.js +1 -1
  41. package/dist/components/controlled/input/ControlledTextField.js +1 -1
  42. package/dist/components/controlled/input/ControlledTextareaField.js +1 -1
  43. package/dist/components/controlled/input/index.js +1 -1
  44. package/dist/components/controlled/select/ControlledComboboxField.js +1 -1
  45. package/dist/components/controlled/select/ControlledDropdownField.js +1 -1
  46. package/dist/components/controlled/select/ControlledMultiDropdownField.js +1 -1
  47. package/dist/components/controlled/select/ControlledRadioField.js +1 -1
  48. package/dist/components/controlled/select/ControlledYearField.js +1 -1
  49. package/dist/components/controlled/select/index.js +1 -1
  50. package/dist/components/controlled/types.js +1 -1
  51. package/dist/components/fields/display/AvatarFieldDisplay.js +1 -1
  52. package/dist/components/fields/display/BadgeFieldDisplay.js +1 -1
  53. package/dist/components/fields/display/ButtonFieldDisplay.js +1 -1
  54. package/dist/components/fields/display/CheckboxFieldDisplay.js +1 -1
  55. package/dist/components/fields/display/DateFieldDisplay.js +1 -1
  56. package/dist/components/fields/display/DropdownDisplay.js +1 -1
  57. package/dist/components/fields/display/FileFieldDisplay.js +1 -1
  58. package/dist/components/fields/display/GeoPointFieldDisplay.js +1 -1
  59. package/dist/components/fields/display/HiddenFieldDisplay.js +1 -1
  60. package/dist/components/fields/display/ImageFieldDisplay.js +1 -1
  61. package/dist/components/fields/display/LinkFieldDisplay.js +1 -1
  62. package/dist/components/fields/display/MapFieldDisplay.js +1 -1
  63. package/dist/components/fields/display/MultiDropdownDisplay.js +1 -1
  64. package/dist/components/fields/display/MultiInputTextFieldDisplay.js +1 -1
  65. package/dist/components/fields/display/NumberFieldDisplay.js +1 -1
  66. package/dist/components/fields/display/PasswordFieldDisplay.js +1 -1
  67. package/dist/components/fields/display/PhoneNumberDisplay.js +1 -1
  68. package/dist/components/fields/display/RadioFieldDisplay.js +1 -1
  69. package/dist/components/fields/display/RangeFieldDisplay.js +1 -1
  70. package/dist/components/fields/display/ReferenceFieldDisplay.js +1 -1
  71. package/dist/components/fields/display/RichTextDisplay.js +2 -2
  72. package/dist/components/fields/display/TextAreaDisplay.js +1 -1
  73. package/dist/components/fields/display/TextFieldDisplay.js +1 -1
  74. package/dist/components/fields/display/TimestampFieldDisplay.js +1 -1
  75. package/dist/components/fields/display/index.js +1 -1
  76. package/dist/components/form/fields/AddressFieldComponent.js +1 -1
  77. package/dist/components/form/fields/AvatarFieldComponent.js +1 -1
  78. package/dist/components/form/fields/BadgeFieldComponent.js +1 -1
  79. package/dist/components/form/fields/ButtonFieldComponent.js +1 -1
  80. package/dist/components/form/fields/CheckboxFieldComponent.js +1 -1
  81. package/dist/components/form/fields/ComboboxComponent.js +1 -1
  82. package/dist/components/form/fields/CurrencyFieldComponent.js +1 -1
  83. package/dist/components/form/fields/DateFieldComponent.js +1 -1
  84. package/dist/components/form/fields/DocumentFieldComponent.js +1 -1
  85. package/dist/components/form/fields/DropdownComponent.js +1 -1
  86. package/dist/components/form/fields/DurationFieldComponent.js +1 -1
  87. package/dist/components/form/fields/FileFieldComponent.js +1 -1
  88. package/dist/components/form/fields/GdprConsentFieldComponent.js +1 -1
  89. package/dist/components/form/fields/GeoPointFieldComponent.js +1 -1
  90. package/dist/components/form/fields/HiddenFieldComponent.js +1 -1
  91. package/dist/components/form/fields/ImageFieldComponent.js +1 -1
  92. package/dist/components/form/fields/MapFieldComponent.js +1 -1
  93. package/dist/components/form/fields/MultiDropdownComponent.js +1 -1
  94. package/dist/components/form/fields/MultiInputTextFieldComponent.js +1 -1
  95. package/dist/components/form/fields/NumberFieldComponent.js +1 -1
  96. package/dist/components/form/fields/PasswordFieldComponent.js +1 -1
  97. package/dist/components/form/fields/PriceFieldComponent.js +1 -1
  98. package/dist/components/form/fields/RadioFieldComponent.js +1 -1
  99. package/dist/components/form/fields/RangeFieldComponent.js +1 -1
  100. package/dist/components/form/fields/RatingFieldComponent.js +1 -1
  101. package/dist/components/form/fields/ReferenceFieldComponent.js +1 -1
  102. package/dist/components/form/fields/RichTextComponent.js +1 -1
  103. package/dist/components/form/fields/SwitchFieldComponent.js +1 -1
  104. package/dist/components/form/fields/TextAreaComponent.js +1 -1
  105. package/dist/components/form/fields/TextFieldComponent.js +1 -1
  106. package/dist/components/form/fields/TimestampFieldComponent.js +1 -1
  107. package/dist/components/form/fields/index.js +1 -1
  108. package/dist/components/form/fields/internal/TiptapEditor.js +2 -2
  109. package/dist/components/form/internal/ImageViewerDialog.js +1 -1
  110. package/dist/components/index.js +1 -1
  111. package/dist/contexts/UploadContext.js +1 -1
  112. package/dist/contexts/index.js +1 -1
  113. package/dist/fieldTypeRegistry.js +1 -1
  114. package/dist/forms/hooks/index.js +1 -1
  115. package/dist/forms/hooks/useController.js +1 -1
  116. package/dist/forms/hooks/useEntityField.js +1 -1
  117. package/dist/forms/index.js +1 -1
  118. package/dist/forms/utils/getFieldsForOperation.js +1 -1
  119. package/dist/forms/utils/index.js +1 -1
  120. package/dist/forms/utils/isFieldEditable.js +1 -1
  121. package/dist/forms/utils/validateEntity.js +1 -1
  122. package/dist/hooks/index.js +1 -1
  123. package/dist/hooks/useEntityFavorites.js +1 -1
  124. package/dist/hooks/useFileUpload.js +1 -1
  125. package/dist/hooks/useFormNavigationGuard.js +1 -1
  126. package/dist/hooks/useRelatedItems.js +1 -1
  127. package/dist/hooks/useUnsavedChangesWarning.js +1 -1
  128. package/dist/index.js +1 -1
  129. package/dist/stores/FormStore.js +1 -1
  130. package/dist/stores/UploadStore.js +1 -1
  131. package/dist/stores/index.js +1 -1
  132. package/dist/tsconfig.tsbuildinfo +1 -1
  133. package/dist/useBaseCrudList.js +1 -1
  134. package/dist/useCrud.js +1 -1
  135. package/dist/useCrudCardList.js +1 -1
  136. package/dist/useCrudList.js +1 -1
  137. package/dist/utils/collections.js +1 -1
  138. package/dist/utils/fileStorage.js +1 -1
  139. package/dist/utils/imageProcessing.js +1 -1
  140. package/dist/utils/imageStorage.js +1 -1
  141. package/dist/utils/imageUtils.js +1 -1
  142. package/dist/utils/mergeWithOptimistic.js +1 -1
  143. package/dist/utils/scopeUtils.js +1 -1
  144. package/dist/utils/uploadValidation.js +1 -1
  145. package/package.json +2 -2
@@ -1 +1 @@
1
- import{useMemo as P,useCallback as H,useRef as Q}from"react";import{useQuery as J}from"@donotdev/core";import{useCrudStore as N}from"./CrudStore";import{useCrud as j,getCrudServiceInstance as U,EMPTY_OPTIMISTIC as X}from"./useCrud";import{mergeWithOptimistic as Z}from"./utils/mergeWithOptimistic";import{injectScopeFilter as $,getCurrentScopeValue as ee}from"./utils/scopeUtils";function te(x,f,t,p={}){const K=p.enabled??!0,b=j("status"),a=b==="ready",V=j(x,p),{error:w,invalidate:I,_collection:d,_schemas:g,_cacheOptions:C,_scope:O}=V,M=N(e=>e.collections[d]?.optimistic||X),q=Q(new Map([[1,null]])),h=Q(0),k=ee(O),v=P(()=>{if(!a||!g)return null;const e=U();if(!e)return null;const y=f==="listCard"?g.listCard:g.list,m=$(p.queryOptions,O);if(!t||t.mode==="client")return e.getListQueryOptions(d,m,y,C,f);const o=q.current,n=h.current,{page:l,pageSize:s}=t;let i,r;if(o.has(l))i=o.get(l)??void 0,r=s;else if(l>n&&o.has(n)){const u=l-n;i=o.get(n)??void 0,r=u*s}else i=void 0,r=l*s;return e.getListQueryOptions(d,{...m,limit:r,startAfterId:i},y,C,f)},[a,d,C,g?"hasSchema":"noSchema",f,t?.mode,t?.page,t?.pageSize,p.queryOptions,O?.provider,k]),{data:c,isLoading:B,isFetching:E,error:R,refetch:T}=J({queryKey:v?.queryKey??["crud",d,"disabled"],queryFn:v?.queryFn??(()=>Promise.resolve({items:[]})),staleTime:v?.staleTime,enabled:K&&!!v}),_=P(()=>{if(!c||!a)return{items:[],total:void 0};let e=c.items;if(t?.mode==="server"&&e.length>0){const s=q.current,i=h.current,{page:r,pageSize:u}=t,Y=e.length;if(Math.ceil(Y/u)>1||r>i){const L=s.has(r)?r:i+1;for(let S=L;S<=r;S++){const A=(S-L+1)*u-1;if(A<e.length){const G=e[A];s.set(S+1,G.id)}}}c.lastVisible&&s.set(r+1,c.lastVisible),h.current=Math.max(i,r);const F=s.has(r)?0:(r-i-1)*u,D=F+u;e=e.slice(F,D)}const y=Z(e,M),m=new Set(e.map(s=>s.id));let o=0,n=0;for(const[s,i]of Object.entries(M))i.operation==="add"&&!m.has(s)?o++:i.operation==="delete"&&m.has(s)&&n++;const l=(c.total??e.length)+o-n;return{items:y,total:t?l:void 0}},[c,M,a,t?.mode,t?.page,t?.pageSize]),z=H(async()=>{a&&(t?.mode==="server"&&(q.current=new Map([[1,null]]),h.current=0),await I(),await T())},[I,T,a,t?.mode]);if(!a){const e=async()=>{};return{status:b,data:{items:[],total:void 0},items:[],loading:!1,fetching:!1,error:w,mutate:e,refresh:e,isAvailable:!1}}const W=_?.items??[];return{status:b,data:_,items:W,loading:B,fetching:E,error:R??w,mutate:z,refresh:z,isAvailable:!0}}export{te as useBaseCrudList};
1
+ import{useMemo as _,useCallback as J,useRef as z}from"react";import{useQuery as N}from"@donotdev/core";import{useCrudStore as U}from"./CrudStore";import{useCrud as D,getCrudServiceInstance as X,EMPTY_OPTIMISTIC as Z}from"./useCrud";import{mergeWithOptimistic as $}from"./utils/mergeWithOptimistic";import{injectScopeFilter as ee,getCurrentScopeValue as te}from"./utils/scopeUtils";function le(V,m,t,p={}){const j=p.enabled??!0,I=D("status"),c=I==="ready",E=D(V,p),{error:P,invalidate:M,_collection:a,_schemas:g,_cacheOptions:y,_scope:S}=E,q=U(e=>e.collections[a]?.optimistic||Z),v=z(new Map([[1,null]])),b=z(0),R=te(S),O=_(()=>{if(!c||!g)return null;const e=X();if(!e)return null;const f=m==="listCard"?g.listCard:g.list,u=ee(p.queryOptions,S);if(!t||t.mode==="client")return e.getListQueryOptions(a,u,f,y,m);const i=v.current,n=b.current,{page:d,pageSize:h}=t;let s,r;if(i.has(d))s=i.get(d)??void 0,r=h;else if(d>n&&i.has(n)){const o=d-n;s=i.get(n)??void 0,r=o*h}else s=void 0,r=d*h;return e.getListQueryOptions(a,{...u,limit:r,startAfterId:s},f,y,m)},[c,a,y,g?"hasSchema":"noSchema",m,t?.mode,t?.page,t?.pageSize,p.queryOptions,S?.provider,R]),{data:l,isLoading:K,isFetching:k,error:B,refetch:L}=N({queryKey:O?.queryKey??["crud",a,"disabled"],queryFn:O?.queryFn??(()=>Promise.resolve({items:[]})),staleTime:O?.staleTime,enabled:j&&!!O}),T=_(()=>{if(!l||!c)return{items:[],total:void 0};let e=l.items;if(t?.mode==="server"&&e.length>0){const s=v.current,r=b.current,{page:o,pageSize:C}=t,Y=e.length;if(Math.ceil(Y/C)>1||o>r){const A=s.has(o)?o:r+1;for(let F=A;F<=o;F++){const Q=(F-A+1)*C-1;if(Q<e.length){const H=e[Q];s.set(F+1,H.id)}}}l.lastVisible&&s.set(o+1,l.lastVisible),b.current=Math.max(r,o);const x=s.has(o)?0:(o-r-1)*C,G=x+C;e=e.slice(x,G)}const f=$(e,q),u=new Set(e.map(s=>s.id));let i=0,n=0;for(const[s,r]of Object.entries(q))r.operation==="add"&&!u.has(s)?i++:r.operation==="delete"&&u.has(s)&&n++;const h=(l.total??e.length)+i-n;return{items:f,total:t?h:void 0}},[l,q,c,t?.mode,t?.page,t?.pageSize]),w=J(async()=>{c&&(t?.mode==="server"&&(v.current=new Map([[1,null]]),b.current=0),await M(),await L())},[M,L,c,t?.mode]);if(!c){const e=async()=>{};return{status:I,data:{items:[],total:void 0},items:[],loading:!1,fetching:!1,error:P,mutate:e,refresh:e,isAvailable:!1}}const W=T?.items??[];return{status:I,data:T,items:W,loading:K,fetching:k,error:B??P,mutate:w,refresh:w,isAvailable:!0}}export{le as useBaseCrudList};
package/dist/useCrud.js CHANGED
@@ -1 +1 @@
1
- "use client";import{useEffect as B,useMemo as w,useCallback as r}from"react";import{useFeatureConsent as L,FRAMEWORK_FEATURES as W,FEATURE_STATUS as S,handleError as Z,isClient as H,createSchemas as J,DEGRADED_CRUD_API as K}from"@donotdev/core";import{getCrudService as Q}from"./CrudService";import{useCrudStore as u}from"./CrudStore";import{injectScope as F,injectScopeFilter as V}from"./utils/scopeUtils";const X={},$={};let M=null,y=null,E=!1;function n(){return M}function ee(m,l={}){const f=L(W.CRUD),U=u(e=>e.crudService),g=f&&!U,b=f?g?S.INITIALIZING:S.READY:S.DEGRADED;if(m==="status")return b;const p=typeof m=="object"?m:l.entity,t=typeof m=="string"?m:m.collection,o=p?.scope,h=l.backend||"functions",T=l.noCache??!1,v=l.staleTime,d=w(()=>({noCache:T,staleTime:v}),[T,v]),a=w(()=>{if(l.schema){const e=l.schema;return{create:e,draft:e,update:e,get:e,list:e,listCard:e,delete:e}}if(p)return J(p)},[l.schema?"custom":p?.name,t]),k=u(e=>e.collections[t]?.loading||!1),A=u(e=>e.collections[t]?.error||null),Y=null;B(()=>{if(!H()||!f||!a)return;const{crudService:e,backend:c}=u.getState();e&&c===h||y||(y=(async()=>{try{const s=Q();M=s,s.setStore(u),await s.initialize(h),E=!1,u.getState().setBackend(h),u.getState().setCrudService(s)}catch(s){E||(Z(s,{userMessage:"Failed to initialize CRUD service.",context:{backend:h,collection:t},severity:"error"}),E=!0)}finally{y=null}})())},[f,h,t,a?"hasSchema":"noSchema"]);const _=g||k,O=b===S.READY,P=r(async e=>{const c=n();return!c||!a?null:c.get(t,e,a.get,d)},[t,a?"hasSchema":"noSchema",d]),j=r(async(e,c,s)=>{const i=n();if(!i||!a)return;const C=F(c,o),N=C?.status==="draft"?a.draft:a.create;await i.set(t,e,C,N,s)},[t,a?"hasSchema":"noSchema",o?.provider]),G=r(async(e,c,s)=>{const i=n();i&&await i.update(t,e,c,s)},[t]),q=r(async(e,c)=>{const s=n();s&&await s.delete(t,e,c)},[t]),x=r(async(e,c)=>{const s=n();if(!s||!a)return"";const i=F(e,o),C=i?.status==="draft"?a.draft:a.create;return s.add(t,i,C,c)},[t,a?"hasSchema":"noSchema",o?.provider]),z=r(async e=>{const c=n();if(!c||!a)return[];const s=V(e,o);return(await c.query(t,s,a.list,d)).items},[t,a?"hasSchema":"noSchema",d,o?.provider]),D=r((e,c)=>{const s=n();return!s||!a?()=>{}:s.subscribe(t,e,c,a.get)},[t,a?"hasSchema":"noSchema"]),R=r((e,c)=>{const s=n();return!s||!a?()=>{}:s.subscribeToCollection(t,e,c,a.list)},[t,a?"hasSchema":"noSchema"]),I=r(async()=>{const e=n();e&&await e.invalidateCollection(t)},[t]);return O?{status:S.READY,data:Y,loading:_,error:A,get:P,set:j,update:G,delete:q,add:x,query:z,subscribe:D,subscribeToCollection:R,invalidate:I,isAvailable:!0,_collection:t,_schemas:a,_cacheOptions:d,_scope:o}:{...K,status:b,loading:_,error:A,subscribe:D,subscribeToCollection:R,invalidate:I,_collection:t,_schemas:a,_cacheOptions:d,_scope:o}}export{X as EMPTY_DATA,$ as EMPTY_OPTIMISTIC,n as getCrudServiceInstance,ee as useCrud};
1
+ "use client";import{useEffect as Q,useMemo as w,useCallback as a}from"react";import{useFeatureConsent as V,FRAMEWORK_FEATURES as W,FEATURE_STATUS as h,handleError as Z,isClient as $,createSchemas as H,DEGRADED_CRUD_API as J}from"@donotdev/core";import{getCrudService as X}from"./CrudService";import{useCrudStore as l}from"./CrudStore";import{injectScope as F,injectScopeFilter as O}from"./utils/scopeUtils";const re={},ne={};let P=null,E=null,g=!1;function o(){return P}function ae(d,u={}){const S=V(W.CRUD),k=l(e=>e.crudService),T=S&&!k,p=S?T?h.INITIALIZING:h.READY:h.DEGRADED;if(d==="status")return p;const v=typeof d=="object"?d:u.entity,t=typeof d=="string"?d:d.collection,i=v?.scope,m=u.backend||"functions",b=u.noCache??!1,A=u.staleTime,f=w(()=>({noCache:b,staleTime:A}),[b,A]),s=w(()=>{if(u.schema){const e=u.schema;return{create:e,draft:e,update:e,get:e,list:e,listCard:e,delete:e}}if(v)return H(v)},[u.schema?"custom":v?.name,t]),x=l(e=>e.collections[t]?.loading||!1),C=l(e=>e.collections[t]?.error||null),M=null;Q(()=>{if(!$()||!S||!s)return;const{crudService:e,backend:r}=l.getState();e&&r===m||E||(E=(async()=>{try{const c=X();P=c,c.setStore(l),await c.initialize(m),g=!1,l.getState().setBackend(m),l.getState().setCrudService(c)}catch(c){g||(Z(c,{userMessage:"Failed to initialize CRUD service.",context:{backend:m,collection:t},severity:"error"}),g=!0)}finally{E=null}})())},[S,m,t,s?"hasSchema":"noSchema"]);const _=T||x,N=p===h.READY,z=a(async e=>{const r=o();return!r||!s?null:r.get(t,e,s.get,f)},[t,s?"hasSchema":"noSchema",f]),Y=a(async(e,r,c)=>{const n=o();if(!n||!s)return;const D=F(r,i),L=D?.status==="draft"?s.draft:s.create;await n.set(t,e,D,L,c)},[t,s?"hasSchema":"noSchema",i?.provider]),j=a(async(e,r,c)=>{const n=o();n&&await n.update(t,e,r,c)},[t]),q=a(async(e,r)=>{const c=o();c&&await c.delete(t,e,r)},[t]),G=a(async(e,r)=>{const c=o();if(!c||!s)return"";const n=F(e,i),U=n?.status==="draft"?s.draft:s.create;return c.add(t,n,U,r)},[t,s?"hasSchema":"noSchema",i?.provider]),B=a(async e=>{const r=o();if(!r||!s)return[];const c=O(e,i);return(await r.query(t,c,s.list,f)).items},[t,s?"hasSchema":"noSchema",f,i?.provider]),I=a((e,r)=>{const c=o();return!c||!s?()=>{}:c.subscribe(t,e,r,s.get)},[t,s?"hasSchema":"noSchema"]),R=a((e,r)=>{const c=o();return!c||!s?()=>{}:c.subscribeToCollection(t,e,r,s.list)},[t,s?"hasSchema":"noSchema"]),y=a(async()=>{const e=o();e&&await e.invalidateCollection(t)},[t]);return N?{status:h.READY,data:M,loading:_,error:C,get:z,set:Y,update:j,delete:q,add:G,query:B,subscribe:I,subscribeToCollection:R,invalidate:y,isAvailable:!0,_collection:t,_schemas:s,_cacheOptions:f,_scope:i}:{...J,status:p,loading:_,error:C,subscribe:I,subscribeToCollection:R,invalidate:y,_collection:t,_schemas:s,_cacheOptions:f,_scope:i}}export{re as EMPTY_DATA,ne as EMPTY_OPTIMISTIC,o as getCrudServiceInstance,ae as useCrud};
@@ -1 +1 @@
1
- import{useBaseCrudList as i}from"./useBaseCrudList";function r(s,t={}){const a={enabled:t.enabled,queryOptions:t.queryOptions,backend:t.backend,schema:t.schema,entity:t.entity,staleTime:t.staleTime,noCache:t.noCache},e=i(s,"listCard",null,a);return{status:e.status,data:e.data?{items:e.data.items}:null,items:e.items,loading:e.loading,fetching:e.fetching,error:e.error,mutate:e.mutate,refresh:e.refresh,isAvailable:e.isAvailable}}export{r as useCrudCardList};
1
+ import{useBaseCrudList as r}from"./useBaseCrudList";function l(t,a={}){const s={enabled:a.enabled,queryOptions:a.queryOptions,backend:a.backend,schema:a.schema,entity:a.entity,staleTime:a.staleTime,noCache:a.noCache},e=r(t,"listCard",null,s);return{status:e.status,data:e.data?{items:e.data.items}:null,items:e.items,loading:e.loading,fetching:e.fetching,error:e.error,mutate:e.mutate,refresh:e.refresh,isAvailable:e.isAvailable}}export{l as useCrudCardList};
@@ -1 +1 @@
1
- import{useBaseCrudList as c}from"./useBaseCrudList";function r(a,e={}){const t=e.pagination??"client",n=e.page??1,i=e.pageSize??10,s={mode:t,page:n,pageSize:i},o={enabled:e.enabled,queryOptions:e.queryOptions,backend:e.backend,schema:e.schema,entity:e.entity,staleTime:e.staleTime,noCache:e.noCache};return c(a,"list",s,o)}export{r as useCrudList};
1
+ import{useBaseCrudList as r}from"./useBaseCrudList";function u(a,e={}){const n=e.pagination??"client",t=e.page??1,c=e.pageSize??10,i={mode:n,page:t,pageSize:c},s={enabled:e.enabled,queryOptions:e.queryOptions,backend:e.backend,schema:e.schema,entity:e.entity,staleTime:e.staleTime,noCache:e.noCache};return r(a,"list",i,s)}export{u as useCrudList};
@@ -1 +1 @@
1
- import{getCrudService as c}from"../CrudService";async function d(r,n){const a=c(),e=[],t=n.range?.start??1,s=n.range?.end??28;for(let o=t;o<=s;o++){const m=String(o),i=await a.get(n.path(r),m,n.schema);i&&e.push(i)}return e}async function h(r,n,a){const e=c();for(const t of a){const s=n.idOf(t);await e.set(n.path(r),s,t,n.schema)}}async function p(r,n,a){const e=c();if(n.idFrom){const t=n.idFrom(a);return e.set(n.path(r),t,a,n.schema)}return e.add(n.path(r),a,n.schema)}export{p as appendToCollection,d as loadDeterministicRange,h as upsertDeterministic};
1
+ import{getCrudService as o}from"../CrudService";async function u(s,t){const e=o(),r=[],a=t.range?.start??1,n=t.range?.end??28;for(let c=a;c<=n;c++){const i=String(c),d=await e.get(t.path(s),i,t.schema);d&&r.push(d)}return r}async function m(s,t,e){const r=o();for(const a of e){const n=t.idOf(a);await r.set(t.path(s),n,a,t.schema)}}async function h(s,t,e){const r=o();if(t.idFrom){const a=t.idFrom(e);return r.set(t.path(s),a,e,t.schema)}return r.add(t.path(s),e,t.schema)}export{h as appendToCollection,u as loadDeterministicRange,m as upsertDeterministic};
@@ -1 +1 @@
1
- "use client";import{handleError as p}from"@donotdev/core";import{uploadFileResumable as x,deleteFileByUrl as h}from"@donotdev/firebase";function g(e){return e.replace(/[^a-zA-Z0-9.-]/g,"_").replace(/_{2,}/g,"_").toLowerCase()}async function u(e,t={}){const{storagePath:r="uploads/files",filename:n,onProgress:o}=t,s=Date.now(),i=g(e.name),c=n||`${s}_${i}`,l=`${r}/${c}`;try{const{promise:a}=x(e,{basePath:r,filename:c,onProgress:o,metadata:{contentType:e.type}});return{url:(await a).url,filename:e.name,size:e.size,mimeType:e.type,uploadedAt:new Date().toISOString()}}catch(a){throw p(a,{userMessage:"Failed to upload file",severity:"error",context:{filename:e.name,fileSize:e.size}})}}async function w(e,t={}){const r=[],n=e.reduce((s,i)=>s+i.size,0);let o=0;for(const s of e){const i=t.onProgress?l=>{const a=l.bytesTransferred/l.totalBytes*s.size;t.onProgress({bytesTransferred:o+a,totalBytes:n,progress:(o+a)/n*100})}:void 0,c=await u(s,{...t,onProgress:i});r.push(c),o+=s.size}return r}async function y(e){try{await h(e.url)}catch(t){throw p(t,{userMessage:"Failed to delete file",severity:"error",context:{url:e.url,filename:e.filename}}),t}}function v(){return`${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function d(e){const t=e.split(".");return t.length>1?t.pop().toLowerCase():""}function F(e,t){const r=t?d(t):"";if(e){if(e.startsWith("image/"))return"image";if(e.startsWith("video/"))return"video";if(e.startsWith("audio/"))return"audio";if(e==="application/pdf")return"pdf";if(e.includes("word")||e.includes("document"))return"doc";if(e.includes("excel")||e.includes("spreadsheet"))return"xls";if(e.includes("powerpoint")||e.includes("presentation"))return"ppt"}switch(r){case"pdf":return"pdf";case"doc":case"docx":return"doc";case"xls":case"xlsx":case"csv":return"xls";case"ppt":case"pptx":return"ppt";case"md":case"txt":return"text";case"html":case"htm":return"html";case"zip":case"rar":case"7z":return"archive";default:return"file"}}function M(e){if(e===0)return"0 B";const t=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,n)).toFixed(1))} ${r[n]}`}const f=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/markdown","text/html","text/csv"],m=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".html",".csv"];function z(){return[...f,...m].join(",")}export{m as DOCUMENT_EXTENSIONS,f as DOCUMENT_MIME_TYPES,y as deleteFile,M as formatFileSize,v as generateFileId,z as getDocumentAcceptString,d as getFileExtension,F as getFileIcon,u as uploadFile,w as uploadFiles};
1
+ "use client";import{handleError as p}from"@donotdev/core";import{uploadFileResumable as u,deleteFileByUrl as d}from"@donotdev/firebase";function f(e){return e.replace(/[^a-zA-Z0-9.-]/g,"_").replace(/_{2,}/g,"_").toLowerCase()}async function x(e,t={}){const{storagePath:r="uploads/files",filename:n,onProgress:a}=t,o=Date.now(),i=f(e.name),c=n||`${o}_${i}`,l=`${r}/${c}`;try{const{promise:s}=u(e,{basePath:r,filename:c,onProgress:a,metadata:{contentType:e.type}});return{url:(await s).url,filename:e.name,size:e.size,mimeType:e.type,uploadedAt:new Date().toISOString()}}catch(s){throw p(s,{userMessage:"Failed to upload file",severity:"error",context:{filename:e.name,fileSize:e.size}})}}async function v(e,t={}){const r=[],n=e.reduce((o,i)=>o+i.size,0);let a=0;for(const o of e){const i=t.onProgress?l=>{const s=l.bytesTransferred/l.totalBytes*o.size;t.onProgress({bytesTransferred:a+s,totalBytes:n,progress:(a+s)/n*100})}:void 0,c=await x(o,{...t,onProgress:i});r.push(c),a+=o.size}return r}async function M(e){try{await d(e.url)}catch(t){throw p(t,{userMessage:"Failed to delete file",severity:"error",context:{url:e.url,filename:e.filename}}),t}}function S(){return`${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function m(e){const t=e.split(".");return t.length>1?t.pop().toLowerCase():""}function P(e,t){const r=t?m(t):"";if(e){if(e.startsWith("image/"))return"image";if(e.startsWith("video/"))return"video";if(e.startsWith("audio/"))return"audio";if(e==="application/pdf")return"pdf";if(e.includes("word")||e.includes("document"))return"doc";if(e.includes("excel")||e.includes("spreadsheet"))return"xls";if(e.includes("powerpoint")||e.includes("presentation"))return"ppt"}switch(r){case"pdf":return"pdf";case"doc":case"docx":return"doc";case"xls":case"xlsx":case"csv":return"xls";case"ppt":case"pptx":return"ppt";case"md":case"txt":return"text";case"html":case"htm":return"html";case"zip":case"rar":case"7z":return"archive";default:return"file"}}function B(e){if(e===0)return"0 B";const t=1024,r=["B","KB","MB","GB"],n=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,n)).toFixed(1))} ${r[n]}`}const h=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/markdown","text/html","text/csv"],g=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".txt",".md",".html",".csv"];function E(){return[...h,...g].join(",")}export{g as DOCUMENT_EXTENSIONS,h as DOCUMENT_MIME_TYPES,M as deleteFile,B as formatFileSize,S as generateFileId,E as getDocumentAcceptString,m as getFileExtension,P as getFileIcon,x as uploadFile,v as uploadFiles};
@@ -1 +1 @@
1
- async function v(t,r={}){const{maxWidth:n=1920,maxHeight:o=1440,thumbWidth:d=300,thumbHeight:i=225,aspectRatio:e=4/3,quality:l=.85,transparentBackground:s=!0,crop:h}=r;return new Promise((u,c)=>{const a=new Image,g=new FileReader;g.onload=w=>{a.src=w.target?.result},g.onerror=()=>c(new Error("Failed to read file")),a.onload=async()=>{try{const{width:w,height:m}=x(h?h.width:a.width,h?h.height:a.height,n,o,e),b=await F(a,w,m,e,l,s,h),f=await F(a,d,i,e,.65,s,h);u({fullBlob:b,thumbBlob:f,width:w,height:m})}catch(w){c(w)}},a.onerror=()=>c(new Error("Failed to load image")),g.readAsDataURL(t)})}function x(t,r,n,o,d){let i=t,e=r;i>n&&(e=n/i*e,i=n),e>o&&(i=o/e*i,e=o);const l=i/e;return Math.abs(l-d)>.01&&(l>d?e=i/d:i=e*d),{width:Math.round(i),height:Math.round(e)}}async function F(t,r,n,o,d,i,e){const l=document.createElement("canvas"),s=l.getContext("2d");if(!s)throw new Error("Failed to get canvas context");l.width=r,l.height=n,i?s.clearRect(0,0,r,n):(s.fillStyle="#FFFFFF",s.fillRect(0,0,r,n));let h,u,c,a;if(e)h=e.x,u=e.y,c=e.width,a=e.height;else{const g=t.width/t.height;c=t.width,a=t.height,h=0,u=0,g>o?(c=t.height*o,h=(t.width-c)/2):g<o&&(a=t.width/o,u=(t.height-a)/2)}return s.drawImage(t,h,u,c,a,0,0,r,n),new Promise((g,w)=>{l.toBlob(m=>{m?g(m):w(new Error("Failed to convert canvas to blob"))},"image/webp",d)})}function y(t,r){return t.type.startsWith("image/")?r&&t.size>r?{valid:!1,error:`File size exceeds ${(r/1048576).toFixed(1)}MB limit`}:{valid:!0}:{valid:!1,error:"File must be an image"}}export{v as processImage,y as validateImageFile};
1
+ async function x(t,r={}){const{maxWidth:o=1920,maxHeight:a=1440,thumbWidth:d=300,thumbHeight:i=225,aspectRatio:e=4/3,quality:h=.85,transparentBackground:c=!0,crop:l}=r;return new Promise((f,s)=>{const n=new Image,u=new FileReader;u.onload=w=>{n.src=w.target?.result},u.onerror=()=>s(new Error("Failed to read file")),n.onload=async()=>{try{const{width:w,height:F}=g(l?l.width:n.width,l?l.height:n.height,o,a,e),m=await b(n,w,F,e,h,c,l),v=await b(n,d,i,e,.65,c,l);f({fullBlob:m,thumbBlob:v,width:w,height:F})}catch(w){s(w)}},n.onerror=()=>s(new Error("Failed to load image")),u.readAsDataURL(t)})}function g(t,r,o,a,d){let i=t,e=r;i>o&&(e=o/i*e,i=o),e>a&&(i=a/e*i,e=a);const h=i/e;return Math.abs(h-d)>.01&&(h>d?e=i/d:i=e*d),{width:Math.round(i),height:Math.round(e)}}async function b(t,r,o,a,d,i,e){const h=document.createElement("canvas"),c=h.getContext("2d");if(!c)throw new Error("Failed to get canvas context");h.width=r,h.height=o,i?c.clearRect(0,0,r,o):(c.fillStyle="#FFFFFF",c.fillRect(0,0,r,o));let l,f,s,n;if(e)l=e.x,f=e.y,s=e.width,n=e.height;else{const u=t.width/t.height;s=t.width,n=t.height,l=0,f=0,u>a?(s=t.height*a,l=(t.width-s)/2):u<a&&(n=t.width/a,f=(t.height-n)/2)}return c.drawImage(t,l,f,s,n,0,0,r,o),new Promise((u,w)=>{h.toBlob(F=>{F?u(F):w(new Error("Failed to convert canvas to blob"))},"image/webp",d)})}function y(t,r){return t.type.startsWith("image/")?r&&t.size>r?{valid:!1,error:`File size exceeds ${(r/1048576).toFixed(1)}MB limit`}:{valid:!0}:{valid:!1,error:"File must be an image"}}export{x as processImage,y as validateImageFile};
@@ -1 +1 @@
1
- import{handleError as P}from"@donotdev/core";import{uploadFileResumable as u,deleteFileByUrl as n,getFileUrl as c}from"@donotdev/firebase";function F(e){return e.replace(/[^a-zA-Z0-9.-]/g,"_").replace(/_{2,}/g,"_").toLowerCase()}async function T(e,r,m,b={}){const{storagePath:l="uploads/images",filename:w,onProgress:s}=b,g=Date.now(),t=(w||`${g}_${F(m)}`).replace(/\.[^/.]+$/,""),f=`${l}/${t}_full.webp`,h=`${l}/${t}_thumb.webp`;try{const p=s?a=>{s({bytesTransferred:a.bytesTransferred,totalBytes:a.totalBytes*2,progress:a.progress*.5})}:void 0,o=new File([e],`${t}_full.webp`,{type:"image/webp"}),{promise:i}=u(o,{basePath:l,filename:`${t}_full.webp`,onProgress:p,metadata:{contentType:"image/webp"}}),y=(await i).url,d=s?a=>{s({bytesTransferred:a.bytesTransferred+e.size,totalBytes:e.size+r.size,progress:50+a.progress*.5})}:void 0,$=new File([r],`${t}_thumb.webp`,{type:"image/webp"}),{promise:U}=u($,{basePath:l,filename:`${t}_thumb.webp`,onProgress:d,metadata:{contentType:"image/webp"}}),_=(await U).url;return{fullUrl:y,thumbUrl:_}}catch(p){try{const o=await c(f).catch(()=>null),i=await c(h).catch(()=>null);o&&await n(o).catch(()=>{}),i&&await n(i).catch(()=>{})}catch{}throw p}}async function z(e){try{await Promise.all([n(e.fullUrl),n(e.thumbUrl)])}catch(r){throw P(r,{userMessage:"Failed to delete image",severity:"error",context:{fullUrl:e.fullUrl,thumbUrl:e.thumbUrl}}),r}}export{z as deleteImage,T as uploadImage};
1
+ import{handleError as _}from"@donotdev/core";import{uploadFileResumable as c,deleteFileByUrl as i,getFileUrl as m}from"@donotdev/firebase";function F(e){return e.replace(/[^a-zA-Z0-9.-]/g,"_").replace(/_{2,}/g,"_").toLowerCase()}async function N(e,l,b,h={}){const{storagePath:r="uploads/images",filename:f,onProgress:s}=h,p=Date.now(),t=(f||`${p}_${F(b)}`).replace(/\.[^/.]+$/,""),w=`${r}/${t}_full.webp`,g=`${r}/${t}_thumb.webp`;try{const u=s?a=>{s({bytesTransferred:a.bytesTransferred,totalBytes:a.totalBytes*2,progress:a.progress*.5})}:void 0,o=new File([e],`${t}_full.webp`,{type:"image/webp"}),{promise:n}=c(o,{basePath:r,filename:`${t}_full.webp`,onProgress:u,metadata:{contentType:"image/webp"}}),d=(await n).url,y=s?a=>{s({bytesTransferred:a.bytesTransferred+e.size,totalBytes:e.size+l.size,progress:50+a.progress*.5})}:void 0,P=new File([l],`${t}_thumb.webp`,{type:"image/webp"}),{promise:U}=c(P,{basePath:r,filename:`${t}_thumb.webp`,onProgress:y,metadata:{contentType:"image/webp"}}),$=(await U).url;return{fullUrl:d,thumbUrl:$}}catch(u){try{const o=await m(w).catch(()=>null),n=await m(g).catch(()=>null);o&&await i(o).catch(()=>{}),n&&await i(n).catch(()=>{})}catch{}throw u}}async function k(e){try{await Promise.all([i(e.fullUrl),i(e.thumbUrl)])}catch(l){throw _(l,{userMessage:"Failed to delete image",severity:"error",context:{fullUrl:e.fullUrl,thumbUrl:e.thumbUrl}}),l}}export{k as deleteImage,N as uploadImage};
@@ -1 +1 @@
1
- async function d(e){const t=await e.arrayBuffer(),r=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(r)).map(a=>a.toString(16).padStart(2,"0")).join("")}function h(e){return URL.createObjectURL(e)}function u(e){e.startsWith("blob:")&&URL.revokeObjectURL(e)}async function l(e){return new Promise((t,r)=>{const a=new Image,i=new FileReader;i.onload=n=>{if(!n.target?.result){r(new Error("Failed to read file"));return}a.src=n.target.result},i.onerror=()=>r(new Error("Failed to read file")),a.onload=()=>{const n=document.createElement("canvas"),o=n.getContext("2d");if(!o){r(new Error("Failed to get canvas context"));return}n.width=a.height,n.height=a.width,o.translate(n.width/2,n.height/2),o.rotate(Math.PI/2),o.drawImage(a,-a.width/2,-a.height/2),n.toBlob(s=>{if(s){const c=new File([s],e.name,{type:e.type,lastModified:Date.now()});t(c)}else r(new Error("Failed to create blob from canvas"))},e.type,.95)},a.onerror=()=>r(new Error("Failed to load image")),i.readAsDataURL(e)})}class g{undoStack=[];redoStack=[];maxStackSize=50;push(t){this.undoStack.push(t),this.undoStack.length>this.maxStackSize&&this.undoStack.shift(),this.redoStack=[]}undo(){const t=this.undoStack.pop();return t?(this.redoStack.push(t),t):null}redo(){const t=this.redoStack.pop();return t?(this.undoStack.push(t),t):null}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}clear(){this.undoStack=[],this.redoStack=[]}}function S(e,t){return e.filter(r=>r.hash===t)}function w(){return`img_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}export{g as UndoRedoManager,h as createPreviewURL,S as findDuplicatesByHash,d as generateFileHash,w as generateImageId,u as revokePreviewURL,l as rotateImage90};
1
+ async function d(e){const t=await e.arrayBuffer(),r=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(r)).map(o=>o.toString(16).padStart(2,"0")).join("")}function h(e){return URL.createObjectURL(e)}function u(e){e.startsWith("blob:")&&URL.revokeObjectURL(e)}async function l(e){return new Promise((t,r)=>{const a=new Image,o=new FileReader;o.onload=n=>{if(!n.target?.result){r(new Error("Failed to read file"));return}a.src=n.target.result},o.onerror=()=>r(new Error("Failed to read file")),a.onload=()=>{const n=document.createElement("canvas"),i=n.getContext("2d");if(!i){r(new Error("Failed to get canvas context"));return}n.width=a.height,n.height=a.width,i.translate(n.width/2,n.height/2),i.rotate(Math.PI/2),i.drawImage(a,-a.width/2,-a.height/2),n.toBlob(s=>{if(s){const c=new File([s],e.name,{type:e.type,lastModified:Date.now()});t(c)}else r(new Error("Failed to create blob from canvas"))},e.type,.95)},a.onerror=()=>r(new Error("Failed to load image")),o.readAsDataURL(e)})}class f{undoStack=[];redoStack=[];maxStackSize=50;push(t){this.undoStack.push(t),this.undoStack.length>this.maxStackSize&&this.undoStack.shift(),this.redoStack=[]}undo(){const t=this.undoStack.pop();return t?(this.redoStack.push(t),t):null}redo(){const t=this.redoStack.pop();return t?(this.undoStack.push(t),t):null}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}clear(){this.undoStack=[],this.redoStack=[]}}function g(e,t){return e.filter(r=>r.hash===t)}function p(){return`img_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}export{f as UndoRedoManager,h as createPreviewURL,g as findDuplicatesByHash,d as generateFileHash,p as generateImageId,u as revokePreviewURL,l as rotateImage90};
@@ -1 +1 @@
1
- function n(s,e){const o=[],a=new Set;for(const i of s){const t=e[i.id];t?.operation!=="delete"&&(t?.operation==="update"&&t.optimisticData?o.push(t.optimisticData):o.push(i),a.add(i.id))}for(const[i,t]of Object.entries(e))t.operation==="add"&&!a.has(i)&&t.optimisticData&&o.push(t.optimisticData);return o}export{n as mergeWithOptimistic};
1
+ function n(a,o){const e=[],s=new Set;for(const i of a){const t=o[i.id];t?.operation!=="delete"&&(t?.operation==="update"&&t.optimisticData?e.push(t.optimisticData):e.push(i),s.add(i.id))}for(const[i,t]of Object.entries(o))t.operation==="add"&&!s.has(i)&&t.optimisticData&&e.push(t.optimisticData);return e}export{n as mergeWithOptimistic};
@@ -1 +1 @@
1
- import{getScopeValue as n}from"@donotdev/core";function u(r,t){if(!t)return r;const e=n(t.provider);return e?{...r,[t.field]:e}:r}function c(r,t){const e=r??{};if(!t)return e;const i=n(t.provider);if(!i)return e;const o={field:t.field,operator:"==",value:i};return{...e,where:e.where?[...e.where,o]:[o]}}function f(r){return r?n(r.provider):null}export{f as getCurrentScopeValue,u as injectScope,c as injectScopeFilter};
1
+ import{getScopeValue as n}from"@donotdev/core";function c(e,o){if(!o)return e;const r=n(o.provider);return r?{...e,[o.field]:r}:e}function l(e,o){const r=e??{};if(!o)return r;const t=n(o.provider);if(!t)return r;const i={field:o.field,operator:"==",value:t};return{...r,where:r.where?[...r.where,i]:[i]}}function u(e){return e?n(e.provider):null}export{u as getCurrentScopeValue,c as injectScope,l as injectScopeFilter};
@@ -1 +1 @@
1
- "use client";function e(t){return!t||typeof t!="string"?!1:t.startsWith("https://")&&!t.startsWith("blob:")}function n(t){return!t||typeof t!="object"?!1:e(t.fullUrl)&&e(t.thumbUrl)}function u(t,o=""){const s=[];if(t==null)return s;if(typeof t=="string")return t.startsWith("blob:")&&s.push(o||"root"),s;if(typeof t!="object")return s;if(Array.isArray(t))t.forEach((l,r)=>{const i=o?`${o}[${r}]`:`[${r}]`;s.push(...u(l,i))});else if(t.fullUrl!==void 0&&t.thumbUrl!==void 0){if(!e(t.fullUrl)||!e(t.thumbUrl)){const l=o||"root";s.push(`${l}.fullUrl or ${l}.thumbUrl contains blob URL`)}}else Object.entries(t).forEach(([l,r])=>{const i=o?`${o}.${l}`:l;s.push(...u(r,i))});return s}function f(t){return u(t).length>0}export{u as checkForBlobUrls,f as hasBlobUrls,e as isStorageUrl,n as validatePicture};
1
+ "use client";function l(r){return!r||typeof r!="string"?!1:r.startsWith("https://")&&!r.startsWith("blob:")}function i(r){return!r||typeof r!="object"?!1:l(r.fullUrl)&&l(r.thumbUrl)}function f(r,n=""){const e=[];if(r==null)return e;if(typeof r=="string")return r.startsWith("blob:")&&e.push(n||"root"),e;if(typeof r!="object")return e;if(Array.isArray(r))r.forEach((t,o)=>{const s=n?`${n}[${o}]`:`[${o}]`;e.push(...f(t,s))});else if(r.fullUrl!==void 0&&r.thumbUrl!==void 0){if(!l(r.fullUrl)||!l(r.thumbUrl)){const t=n||"root";e.push(`${t}.fullUrl or ${t}.thumbUrl contains blob URL`)}}else Object.entries(r).forEach(([t,o])=>{const s=n?`${n}.${t}`:t;e.push(...f(o,s))});return e}function u(r){return f(r).length>0}export{f as checkForBlobUrls,u as hasBlobUrls,l as isStorageUrl,i as validatePicture};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donotdev/crud",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -54,7 +54,7 @@
54
54
  "@dnd-kit/sortable": "^10.0.0",
55
55
  "@dnd-kit/utilities": "^3.2.2",
56
56
  "@donotdev/components": "^0.0.16",
57
- "@donotdev/core": "^0.0.21",
57
+ "@donotdev/core": "^0.0.22",
58
58
  "@hookform/resolvers": "^5.2.2",
59
59
  "react-easy-crop": "^5.5.6"
60
60
  },