@classic-homes/offline-react 0.1.3 → 0.1.4

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FileConstraints, FileValidationError, PersistedFile, DraftMetadata, CreateDraftOptions, StoredDraftV2, SyncAdapter, SyncResult, DraftConflict, ConflictResolution } from '@classic-homes/offline-core';
2
- export { ConflictResolution, CreateDraftOptions, DraftConflict, DraftMetadata, DraftSyncStatus, ListDraftsOptions, OfflineStorage, OfflineStorageOptions, StoredDraftV2, SyncAdapter, SyncConfig, SyncResult, getOfflineStorage, getOfflineStorageOrNull, initOfflineStorage, isOfflineStorageInitialized } from '@classic-homes/offline-core';
2
+ export { ConflictResolution, CreateDraftOptions, DraftConflict, DraftMetadata, DraftSyncStatus, ListDraftsOptions, OfflineStorage, OfflineStorageOptions, StoredDraftV2, SyncAdapter, SyncConfig, SyncResult, getOfflineStorage, getOfflineStorageOrNull, initOfflineStorage, invalidateAllCache, invalidateCacheByTag, isOfflineStorageInitialized } from '@classic-homes/offline-core';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -182,6 +182,7 @@ declare function usePersistedForm<T extends z.ZodObject<z.ZodRawShape>>(options:
182
182
  * }
183
183
  * ```
184
184
  */
185
+
185
186
  interface UseOfflineCacheOptions {
186
187
  key: string;
187
188
  ttl?: number;
@@ -202,14 +203,6 @@ interface UseOfflineCacheReturn<T> {
202
203
  has: () => Promise<boolean>;
203
204
  }
204
205
  declare function useOfflineCache<T>(options: UseOfflineCacheOptions): UseOfflineCacheReturn<T>;
205
- /**
206
- * Invalidate cache entries by tag
207
- */
208
- declare function invalidateCacheByTag(tag: string): Promise<number>;
209
- /**
210
- * Invalidate all cache entries
211
- */
212
- declare function invalidateAllCache(): Promise<number>;
213
206
 
214
207
  /**
215
208
  * useDraftManager - React hook for multi-draft management
@@ -396,4 +389,4 @@ interface UseDraftSyncReturn {
396
389
  */
397
390
  declare function useDraftSync(options: UseDraftSyncOptions): UseDraftSyncReturn;
398
391
 
399
- export { type FieldErrors, type UseDraftManagerOptions, type UseDraftManagerReturn, type UseDraftSyncOptions, type UseDraftSyncReturn, type UseFileStorageOptions, type UseFileStorageReturn, type UseOfflineCacheOptions, type UseOfflineCacheReturn, type UsePersistedFormOptions, type UsePersistedFormReturn, invalidateAllCache, invalidateCacheByTag, useDraftManager, useDraftSync, useFileStorage, useOfflineCache, usePersistedForm };
392
+ export { type FieldErrors, type UseDraftManagerOptions, type UseDraftManagerReturn, type UseDraftSyncOptions, type UseDraftSyncReturn, type UseFileStorageOptions, type UseFileStorageReturn, type UseOfflineCacheOptions, type UseOfflineCacheReturn, type UsePersistedFormOptions, type UsePersistedFormReturn, useDraftManager, useDraftSync, useFileStorage, useOfflineCache, usePersistedForm };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useState, useRef, useCallback, useEffect } from 'react';
2
2
  import { isOfflineStorageInitialized, getOfflineStorage, createSyncService } from '@classic-homes/offline-core';
3
- export { getOfflineStorage, getOfflineStorageOrNull, initOfflineStorage, isOfflineStorageInitialized } from '@classic-homes/offline-core';
3
+ export { getOfflineStorage, getOfflineStorageOrNull, initOfflineStorage, invalidateAllCache, invalidateCacheByTag, isOfflineStorageInitialized } from '@classic-homes/offline-core';
4
4
 
5
5
  // src/useFileStorage.ts
6
6
  function useFileStorage(options) {
@@ -664,20 +664,6 @@ function useOfflineCache(options) {
664
664
  has
665
665
  };
666
666
  }
667
- async function invalidateCacheByTag(tag) {
668
- if (!isOfflineStorageInitialized()) {
669
- return 0;
670
- }
671
- const storage = getOfflineStorage();
672
- return storage.cache.invalidateByTag(tag);
673
- }
674
- async function invalidateAllCache() {
675
- if (!isOfflineStorageInitialized()) {
676
- return 0;
677
- }
678
- const storage = getOfflineStorage();
679
- return storage.cache.invalidateAll();
680
- }
681
667
  function useDraftManager(options = {}) {
682
668
  const { formKey, autoLoad = true, sortBy = "updatedAt", sortOrder = "desc" } = options;
683
669
  const [drafts, setDrafts] = useState([]);
@@ -986,4 +972,4 @@ function useDraftSync(options) {
986
972
  };
987
973
  }
988
974
 
989
- export { invalidateAllCache, invalidateCacheByTag, useDraftManager, useDraftSync, useFileStorage, useOfflineCache, usePersistedForm };
975
+ export { useDraftManager, useDraftSync, useFileStorage, useOfflineCache, usePersistedForm };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/offline-react",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "React bindings for offline persistence and caching",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "scripts": {
20
20
  "build": "tsup",
21
21
  "dev": "tsup --watch",
22
- "clean": "rm -rf dist",
22
+ "clean": "node ../../scripts/rm.mjs dist",
23
23
  "typecheck": "tsc --noEmit",
24
24
  "test": "vitest run",
25
25
  "test:watch": "vitest",
@@ -58,14 +58,15 @@
58
58
  "@testing-library/jest-dom": "^6.0.0",
59
59
  "@testing-library/react": "^16.0.0",
60
60
  "@types/react": "^18.2.0",
61
- "@vitejs/plugin-react": "^4.3.0",
62
- "@vitest/coverage-v8": "^2.0.0",
61
+ "@vitejs/plugin-react": "^6.0.0",
62
+ "@vitest/coverage-v8": "^4.1.10",
63
63
  "fake-indexeddb": "^6.0.0",
64
64
  "jsdom": "^25.0.0",
65
65
  "react": "^18.2.0",
66
+ "react-dom": "^18.2.0",
66
67
  "tsup": "^8.0.0",
67
68
  "typescript": "^5.3.0",
68
- "vitest": "^2.0.0",
69
+ "vitest": "^4.1.10",
69
70
  "zod": "^3.23.0"
70
71
  }
71
72
  }