@firtoz/drizzle-indexeddb 4.0.1 → 5.0.1

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 (57) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +9 -1
  3. package/dist/bin/generate-migrations.d.ts +15 -0
  4. package/dist/bin/generate-migrations.js +184 -0
  5. package/dist/bin/generate-migrations.js.map +1 -0
  6. package/dist/chunk-5KCMKETG.js +212 -0
  7. package/dist/chunk-5KCMKETG.js.map +1 -0
  8. package/dist/chunk-7X4EIKN4.js +128 -0
  9. package/dist/chunk-7X4EIKN4.js.map +1 -0
  10. package/dist/chunk-CPLA7X66.js +129 -0
  11. package/dist/chunk-CPLA7X66.js.map +1 -0
  12. package/dist/chunk-HJFI7QKW.js +28 -0
  13. package/dist/chunk-HJFI7QKW.js.map +1 -0
  14. package/dist/chunk-JVUF63L6.js +27 -0
  15. package/dist/chunk-JVUF63L6.js.map +1 -0
  16. package/dist/chunk-OSOLYU2M.js +126 -0
  17. package/dist/chunk-OSOLYU2M.js.map +1 -0
  18. package/dist/chunk-WMCUJFEC.js +311 -0
  19. package/dist/chunk-WMCUJFEC.js.map +1 -0
  20. package/dist/chunk-Y6XE3FVT.js +147 -0
  21. package/dist/chunk-Y6XE3FVT.js.map +1 -0
  22. package/dist/collections/drizzle-indexeddb-collection.d.ts +62 -0
  23. package/dist/collections/drizzle-indexeddb-collection.js +3 -0
  24. package/dist/collections/drizzle-indexeddb-collection.js.map +1 -0
  25. package/dist/context/DrizzleIndexedDBProvider.d.ts +35 -0
  26. package/dist/context/DrizzleIndexedDBProvider.js +7 -0
  27. package/dist/context/DrizzleIndexedDBProvider.js.map +1 -0
  28. package/dist/context/useDrizzleIndexedDB.d.ts +17 -0
  29. package/dist/context/useDrizzleIndexedDB.js +8 -0
  30. package/dist/context/useDrizzleIndexedDB.js.map +1 -0
  31. package/dist/function-migrator.d.ts +56 -0
  32. package/dist/function-migrator.js +5 -0
  33. package/dist/function-migrator.js.map +1 -0
  34. package/dist/idb-interceptor.d.ts +68 -0
  35. package/dist/idb-interceptor.js +3 -0
  36. package/dist/idb-interceptor.js.map +1 -0
  37. package/dist/idb-operations.d.ts +13 -0
  38. package/dist/idb-operations.js +4 -0
  39. package/dist/idb-operations.js.map +1 -0
  40. package/dist/idb-types.d.ts +82 -0
  41. package/dist/idb-types.js +3 -0
  42. package/dist/idb-types.js.map +1 -0
  43. package/dist/index.d.ts +17 -0
  44. package/dist/index.js +10 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/instrumented-idb-database.d.ts +17 -0
  47. package/dist/instrumented-idb-database.js +4 -0
  48. package/dist/instrumented-idb-database.js.map +1 -0
  49. package/dist/native-idb-database.d.ts +9 -0
  50. package/dist/native-idb-database.js +3 -0
  51. package/dist/native-idb-database.js.map +1 -0
  52. package/dist/standalone-collection.d.ts +154 -0
  53. package/dist/standalone-collection.js +7 -0
  54. package/dist/standalone-collection.js.map +1 -0
  55. package/package.json +34 -29
  56. package/src/collections/drizzle-indexeddb-collection.ts +4 -4
  57. package/src/context/DrizzleIndexedDBProvider.tsx +1 -1
@@ -18,7 +18,6 @@ import {
18
18
  type SyncBackend,
19
19
  createSyncFunction,
20
20
  createInsertSchemaWithDefaults,
21
- createGetKeyFunction,
22
21
  createCollectionConfig,
23
22
  } from "@firtoz/drizzle-utils";
24
23
  import { evaluateExpression, type CollectionUtils } from "@firtoz/db-helpers";
@@ -340,15 +339,16 @@ export function drizzleIndexedDBCollectionOptions<const TTable extends Table>(
340
339
  },
341
340
  };
342
341
 
343
- type TItem = InferSchemaOutput<SelectSchema<TTable>>;
344
- const getKey = createGetKeyFunction<TTable>();
342
+ const getKey = (
343
+ item: InferSchemaOutput<SelectSchema<TTable>>,
344
+ ): IdOf<TTable> => (item as { id: IdOf<TTable> }).id;
345
345
 
346
346
  const baseSyncConfig: BaseSyncConfig<TTable> = {
347
347
  table,
348
348
  readyPromise: config.readyPromise,
349
349
  syncMode: config.syncMode,
350
350
  debug: config.debug,
351
- getSyncPersistKey: (item: TItem) => String(getKey(item)),
351
+ getSyncPersistKey: (item) => String(getKey(item)),
352
352
  ...(config.deferLocalPersistence !== undefined
353
353
  ? { deferLocalPersistence: config.deferLocalPersistence }
354
354
  : {}),
@@ -18,7 +18,7 @@ import { getTableName, type Table } from "drizzle-orm";
18
18
  import {
19
19
  drizzleIndexedDBCollectionOptions,
20
20
  type DrizzleIndexedDBCollectionConfig,
21
- } from "@firtoz/drizzle-indexeddb";
21
+ } from "../collections/drizzle-indexeddb-collection";
22
22
  import type { CollectionUtils } from "@firtoz/db-helpers";
23
23
  import type {
24
24
  IdOf,