@pol-studios/db 1.0.47 → 1.0.49

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 (53) hide show
  1. package/dist/{DataLayerContext-DWlohoEg.d.ts → DataLayerContext--jqUiEMX.d.ts} +39 -2
  2. package/dist/auth/context.js +3 -3
  3. package/dist/auth/hooks.js +4 -4
  4. package/dist/auth/index.js +4 -4
  5. package/dist/chunk-CTRY7JDP.js +4112 -0
  6. package/dist/chunk-CTRY7JDP.js.map +1 -0
  7. package/dist/{chunk-5TWB3SMJ.js → chunk-DKUF2FKB.js} +2 -2
  8. package/dist/{chunk-UCXYYGFG.js → chunk-FLGHJCW3.js} +2 -2
  9. package/dist/{chunk-HJXJIBXC.js → chunk-GAJHPZ6N.js} +14 -11
  10. package/dist/chunk-GAJHPZ6N.js.map +1 -0
  11. package/dist/{chunk-POU4MVXN.js → chunk-GY7HDOBA.js} +3 -3
  12. package/dist/chunk-INEUG6MC.js +521 -0
  13. package/dist/chunk-INEUG6MC.js.map +1 -0
  14. package/dist/{chunk-LF3V3ERS.js → chunk-OKYHI6JG.js} +3 -3
  15. package/dist/{chunk-AKIRHA4Q.js → chunk-UJWETW36.js} +418 -527
  16. package/dist/chunk-UJWETW36.js.map +1 -0
  17. package/dist/{chunk-5KZ5ZB7B.js → chunk-V4MNSMMA.js} +70 -13
  18. package/dist/chunk-V4MNSMMA.js.map +1 -0
  19. package/dist/{chunk-FI6JAD5G.js → chunk-YA6MUTA7.js} +3 -3
  20. package/dist/{chunk-Z456IHCB.js → chunk-Z3EJX3VG.js} +3 -3
  21. package/dist/{chunk-WM25QE7E.js → chunk-ZGQ7Q4ZU.js} +2 -2
  22. package/dist/hooks/index.d.ts +2 -2
  23. package/dist/{index-CvAHE2Y2.d.ts → index-CJ8GAb_-.d.ts} +1 -1
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +11 -11
  26. package/dist/index.native.d.ts +5 -5
  27. package/dist/index.native.js +11 -11
  28. package/dist/index.web.d.ts +6 -6
  29. package/dist/index.web.js +11 -11
  30. package/dist/mutation/index.js +3 -3
  31. package/dist/parser/index.js +3 -3
  32. package/dist/query/index.js +4 -4
  33. package/dist/realtime/index.js +3 -3
  34. package/dist/types/index.d.ts +2 -2
  35. package/dist/types/index.js +4 -4
  36. package/dist/{useDbCount-Chl9uuR1.d.ts → useDbCount-DeXtNH0E.d.ts} +1 -1
  37. package/dist/{useResolveFeedback-lNxMVfUw.d.ts → useResolveFeedback-HTdDM4AQ.d.ts} +3 -3
  38. package/dist/with-auth/index.js +5 -5
  39. package/package.json +1 -1
  40. package/dist/chunk-5KZ5ZB7B.js.map +0 -1
  41. package/dist/chunk-AKIRHA4Q.js.map +0 -1
  42. package/dist/chunk-HJXJIBXC.js.map +0 -1
  43. package/dist/chunk-JOULSXOI.js +0 -415
  44. package/dist/chunk-JOULSXOI.js.map +0 -1
  45. package/dist/chunk-YUX6RGLZ.js +0 -1858
  46. package/dist/chunk-YUX6RGLZ.js.map +0 -1
  47. /package/dist/{chunk-5TWB3SMJ.js.map → chunk-DKUF2FKB.js.map} +0 -0
  48. /package/dist/{chunk-UCXYYGFG.js.map → chunk-FLGHJCW3.js.map} +0 -0
  49. /package/dist/{chunk-POU4MVXN.js.map → chunk-GY7HDOBA.js.map} +0 -0
  50. /package/dist/{chunk-LF3V3ERS.js.map → chunk-OKYHI6JG.js.map} +0 -0
  51. /package/dist/{chunk-FI6JAD5G.js.map → chunk-YA6MUTA7.js.map} +0 -0
  52. /package/dist/{chunk-Z456IHCB.js.map → chunk-Z3EJX3VG.js.map} +0 -0
  53. /package/dist/{chunk-WM25QE7E.js.map → chunk-ZGQ7Q4ZU.js.map} +0 -0
@@ -292,6 +292,13 @@ declare class AdapterAutoDetector {
292
292
  private lastResult;
293
293
  private syncStatus;
294
294
  constructor(powerSyncDb: PowerSyncDatabase | null, supabase: SupabaseClient | null, options?: AutoDetectorOptions);
295
+ /**
296
+ * Update the PowerSync database reference.
297
+ * Called when PowerSync becomes available after initial construction.
298
+ *
299
+ * @param db - PowerSync database instance or null
300
+ */
301
+ setPowerSyncDb(db: PowerSyncDatabase | null): void;
295
302
  /**
296
303
  * Update the sync status from PowerSync.
297
304
  * Called when sync status changes to re-evaluate backend recommendation.
@@ -530,9 +537,19 @@ declare class AdapterRegistry {
530
537
  */
531
538
  private adapters;
532
539
  /**
533
- * PowerSync adapter instance (set during initialization)
540
+ * PowerSync adapter instance (set during initialization or lazily via getter)
534
541
  */
535
542
  private powerSyncAdapter;
543
+ /**
544
+ * Getter function to retrieve PowerSync database instance.
545
+ * Used for lazy initialization when PowerSync becomes available after registry creation.
546
+ */
547
+ private powerSyncGetter;
548
+ /**
549
+ * Factory function to create PowerSync adapter from database instance.
550
+ * Set via setPowerSyncGetter along with the getter.
551
+ */
552
+ private powerSyncAdapterFactory;
536
553
  /**
537
554
  * Supabase adapter instance (set during initialization)
538
555
  */
@@ -592,6 +609,26 @@ declare class AdapterRegistry {
592
609
  * @param adapter - PowerSync adapter implementation
593
610
  */
594
611
  setPowerSyncAdapter(adapter: TableDataAdapter): void;
612
+ /**
613
+ * Set a getter function for lazy PowerSync adapter initialization.
614
+ *
615
+ * This allows the registry to lazily create the PowerSync adapter when
616
+ * PowerSync becomes available, rather than requiring it at initialization time.
617
+ * Solves race conditions where queries/mutations run before PowerSync is ready.
618
+ *
619
+ * @param getter - Function that returns the PowerSync database instance (or null if not ready)
620
+ * @param factory - Function that creates a TableDataAdapter from the database instance
621
+ */
622
+ setPowerSyncGetter(getter: () => unknown, factory: (db: unknown) => TableDataAdapter): void;
623
+ /**
624
+ * Ensure PowerSync adapter is initialized if available.
625
+ *
626
+ * Checks the getter (if set) and lazily creates the adapter if PowerSync
627
+ * is now available. Also updates the auto-detector with the new reference.
628
+ *
629
+ * @returns true if PowerSync adapter is available, false otherwise
630
+ */
631
+ private ensurePowerSyncAdapter;
595
632
  /**
596
633
  * Set the sync tracker for mutation tracking.
597
634
  * When set, write operations on PowerSync tables will
@@ -643,7 +680,7 @@ declare class AdapterRegistry {
643
680
  * @returns The appropriate adapter for the table
644
681
  * @throws Error if adapters are not initialized
645
682
  */
646
- getAdapter(table: string, operation?: 'read' | 'write'): TableDataAdapter;
683
+ getAdapter(table: string, _operation?: 'read' | 'write'): TableDataAdapter;
647
684
  /**
648
685
  * Get the PowerSync adapter directly
649
686
  *
@@ -11,11 +11,11 @@ import {
11
11
  useUserMetadataState,
12
12
  useUserMetadataValue,
13
13
  userMetadataContext
14
- } from "../chunk-5TWB3SMJ.js";
14
+ } from "../chunk-DKUF2FKB.js";
15
15
  import "../chunk-AIYPSXIO.js";
16
16
  import "../chunk-J4ZVCXZ4.js";
17
- import "../chunk-YUX6RGLZ.js";
18
- import "../chunk-AKIRHA4Q.js";
17
+ import "../chunk-CTRY7JDP.js";
18
+ import "../chunk-INEUG6MC.js";
19
19
  import "../chunk-DMVUEJG2.js";
20
20
  import "../chunk-7D4SUZUM.js";
21
21
  export {
@@ -11,17 +11,17 @@ import {
11
11
  usePermissionLoading,
12
12
  usePermissionsBatch,
13
13
  useSetupAuth
14
- } from "../chunk-UCXYYGFG.js";
14
+ } from "../chunk-FLGHJCW3.js";
15
15
  import {
16
16
  useSetUserMetadata,
17
17
  useUserMetadata,
18
18
  useUserMetadataState,
19
19
  useUserMetadataValue
20
- } from "../chunk-5TWB3SMJ.js";
20
+ } from "../chunk-DKUF2FKB.js";
21
21
  import "../chunk-AIYPSXIO.js";
22
22
  import "../chunk-J4ZVCXZ4.js";
23
- import "../chunk-YUX6RGLZ.js";
24
- import "../chunk-AKIRHA4Q.js";
23
+ import "../chunk-CTRY7JDP.js";
24
+ import "../chunk-INEUG6MC.js";
25
25
  import "../chunk-DMVUEJG2.js";
26
26
  import "../chunk-7D4SUZUM.js";
27
27
  export {
@@ -12,7 +12,7 @@ import {
12
12
  usePermissionLoading,
13
13
  usePermissionsBatch,
14
14
  useSetupAuth
15
- } from "../chunk-UCXYYGFG.js";
15
+ } from "../chunk-FLGHJCW3.js";
16
16
  import {
17
17
  AuthProvider,
18
18
  PermissionProvider,
@@ -26,7 +26,7 @@ import {
26
26
  useUserMetadataState,
27
27
  useUserMetadataValue,
28
28
  userMetadataContext
29
- } from "../chunk-5TWB3SMJ.js";
29
+ } from "../chunk-DKUF2FKB.js";
30
30
  import "../chunk-AIYPSXIO.js";
31
31
  import {
32
32
  hasAccess,
@@ -39,8 +39,8 @@ import {
39
39
  isPermissionLoaded
40
40
  } from "../chunk-RT4O5H2E.js";
41
41
  import "../chunk-J4ZVCXZ4.js";
42
- import "../chunk-YUX6RGLZ.js";
43
- import "../chunk-AKIRHA4Q.js";
42
+ import "../chunk-CTRY7JDP.js";
43
+ import "../chunk-INEUG6MC.js";
44
44
  import "../chunk-DMVUEJG2.js";
45
45
  import "../chunk-7D4SUZUM.js";
46
46
  export {