@donotdev/core 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.
package/index.d.ts CHANGED
@@ -21819,6 +21819,15 @@ interface UseViewportVisibilityReturn {
21819
21819
  */
21820
21820
  declare function useViewportVisibility(options?: UseViewportVisibilityOptions): UseViewportVisibilityReturn;
21821
21821
 
21822
+ /**
21823
+ * @fileoverview useAddOrUpdate hook
21824
+ * @description Generic hook for creating or updating entities
21825
+ *
21826
+ * @version 0.0.1
21827
+ * @since 0.0.1
21828
+ * @author AMBROISE PARK Consulting
21829
+ */
21830
+
21822
21831
  /**
21823
21832
  * Hook for creating or updating an entity.
21824
21833
  * If the data contains an 'id' field, it will perform an update; otherwise, a create.
@@ -21856,6 +21865,15 @@ declare function useBreathingTimer({ duration, onComplete, }: UseBreathingTimerP
21856
21865
  onComplete: (() => void) | undefined;
21857
21866
  };
21858
21867
 
21868
+ /**
21869
+ * @fileoverview useDelete hook
21870
+ * @description Generic hook for deleting entities by ID
21871
+ *
21872
+ * @version 0.0.1
21873
+ * @since 0.0.1
21874
+ * @author AMBROISE PARK Consulting
21875
+ */
21876
+
21859
21877
  /**
21860
21878
  * Hook for deleting an entity by ID.
21861
21879
  *
@@ -21867,6 +21885,43 @@ declare function useBreathingTimer({ duration, onComplete, }: UseBreathingTimerP
21867
21885
  */
21868
21886
  declare function useDelete<T>(schema: dndevSchema<T>): UseMutationResult<MutationResponse, EntityHookError, string>;
21869
21887
 
21888
+ /**
21889
+ * @fileoverview useGet hook for single entity retrieval
21890
+ * @description Generic hook for fetching a single entity by ID with full type safety
21891
+ *
21892
+ * This hook provides a simple, type-safe way to fetch individual entities
21893
+ * from the database using DoNotDev schemas. It handles loading states,
21894
+ * error handling, and caching automatically.
21895
+ *
21896
+ * **Key Features:**
21897
+ * - Type-safe entity retrieval
21898
+ * - Automatic loading and error states
21899
+ * - React Query integration for caching
21900
+ * - Optimistic updates support
21901
+ * - Automatic refetching on focus
21902
+ *
21903
+ * @version 0.0.1
21904
+ * @since 0.0.1
21905
+ * @author AMBROISE PARK Consulting
21906
+ *
21907
+ * **Usage Pattern:**
21908
+ * ```typescript
21909
+ * const { data: product, isLoading, error } = useGet(ProductSchema, productId);
21910
+ *
21911
+ * if (isLoading) return <LoadingSpinner />;
21912
+ * if (error) return <ErrorMessage error={error} />;
21913
+ * if (!product) return <NotFound />;
21914
+ *
21915
+ * return <ProductView product={product} />;
21916
+ * ```
21917
+ *
21918
+ * **Performance:**
21919
+ * - Automatic caching with React Query
21920
+ * - Background refetching for fresh data
21921
+ * - Optimized re-renders
21922
+ * - Memory-efficient cleanup
21923
+ */
21924
+
21870
21925
  /**
21871
21926
  * Hook for fetching a single entity by ID with full type safety
21872
21927
  *