@pol-studios/db 1.0.52 → 1.0.53

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.
@@ -742,7 +742,7 @@ declare class AdapterRegistry {
742
742
  /**
743
743
  * Get adapter using auto-detection.
744
744
  *
745
- * Simple logic: PowerSync first, Supabase fallback.
745
+ * Simple logic: PowerSync first, Supabase fallback ONLY when online.
746
746
  * Once PowerSync is initialized, always use it for offline-first behavior.
747
747
  */
748
748
  private getAutoAdapter;
@@ -3,7 +3,7 @@ import {
3
3
  createAdapterRegistry,
4
4
  createSupabaseAdapter,
5
5
  stripSchemaPrefix
6
- } from "./chunk-EOJGUOJR.js";
6
+ } from "./chunk-FZJX2FZS.js";
7
7
  import {
8
8
  DataLayerContext,
9
9
  DataLayerCoreContext,
@@ -13,7 +13,7 @@ import {
13
13
  QueryExecutor,
14
14
  extractRelationNames,
15
15
  parseSelect
16
- } from "./chunk-QJZUIAHA.js";
16
+ } from "./chunk-HZIVE5AZ.js";
17
17
  import {
18
18
  useSupabase
19
19
  } from "./chunk-DMVUEJG2.js";
@@ -4968,4 +4968,4 @@ object-assign/index.js:
4968
4968
  @license MIT
4969
4969
  *)
4970
4970
  */
4971
- //# sourceMappingURL=chunk-GSORUAS7.js.map
4971
+ //# sourceMappingURL=chunk-D55QGM4P.js.map
@@ -4512,7 +4512,11 @@ var AdapterRegistry = class {
4512
4512
  return this.syncTrackingAdapter ?? this.powerSyncAdapter;
4513
4513
  }
4514
4514
  if (this.supabaseAdapter) {
4515
- return this.supabaseAdapter;
4515
+ const isOnline = this.autoDetector?.getSyncStatus()?.isOnline ?? (typeof navigator !== "undefined" ? navigator.onLine : false);
4516
+ if (isOnline) {
4517
+ return this.supabaseAdapter;
4518
+ }
4519
+ throw new Error(`Offline and PowerSync not ready for table "${table}". Wait for initialization.`);
4516
4520
  }
4517
4521
  }
4518
4522
  const existing = this.adapters.get(table);
@@ -4610,15 +4614,19 @@ var AdapterRegistry = class {
4610
4614
  /**
4611
4615
  * Get adapter using auto-detection.
4612
4616
  *
4613
- * Simple logic: PowerSync first, Supabase fallback.
4617
+ * Simple logic: PowerSync first, Supabase fallback ONLY when online.
4614
4618
  * Once PowerSync is initialized, always use it for offline-first behavior.
4615
4619
  */
4616
4620
  getAutoAdapter(_strategy, _table) {
4617
4621
  if (this.powerSyncAdapter) {
4618
- return this.powerSyncAdapter;
4622
+ return this.syncTrackingAdapter ?? this.powerSyncAdapter;
4619
4623
  }
4620
4624
  if (this.supabaseAdapter) {
4621
- return this.supabaseAdapter;
4625
+ const isOnline = this.autoDetector?.getSyncStatus()?.isOnline ?? (typeof navigator !== "undefined" ? navigator.onLine : false);
4626
+ if (isOnline) {
4627
+ return this.supabaseAdapter;
4628
+ }
4629
+ throw new Error("Offline and PowerSync not ready. Wait for PowerSync initialization.");
4622
4630
  }
4623
4631
  throw new Error("No adapters available. Initialize PowerSync or Supabase.");
4624
4632
  }
@@ -7984,4 +7992,4 @@ moment/moment.js:
7984
7992
  (*! license : MIT *)
7985
7993
  (*! momentjs.com *)
7986
7994
  */
7987
- //# sourceMappingURL=chunk-EOJGUOJR.js.map
7995
+ //# sourceMappingURL=chunk-FZJX2FZS.js.map