@pol-studios/db 1.0.46 → 1.0.47

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 (33) hide show
  1. package/dist/{DataLayerContext-BwMk4VpG.d.ts → DataLayerContext-DWlohoEg.d.ts} +2 -2
  2. package/dist/auth/context.js +2 -2
  3. package/dist/auth/hooks.js +3 -3
  4. package/dist/auth/index.js +3 -3
  5. package/dist/{chunk-VOC2RRFE.js → chunk-5KZ5ZB7B.js} +16 -23
  6. package/dist/{chunk-VOC2RRFE.js.map → chunk-5KZ5ZB7B.js.map} +1 -1
  7. package/dist/{chunk-CNKNEYRB.js → chunk-5TWB3SMJ.js} +3 -15
  8. package/dist/chunk-5TWB3SMJ.js.map +1 -0
  9. package/dist/{chunk-6TZOUA3G.js → chunk-AIYPSXIO.js} +7 -24
  10. package/dist/{chunk-6TZOUA3G.js.map → chunk-AIYPSXIO.js.map} +1 -1
  11. package/dist/{chunk-ADYMMIIJ.js → chunk-HJXJIBXC.js} +3 -3
  12. package/dist/{chunk-FFHMWRRW.js → chunk-POU4MVXN.js} +4 -4
  13. package/dist/{chunk-ROLZ635F.js → chunk-RJIVXO4U.js} +2 -2
  14. package/dist/{chunk-V54K6CMB.js → chunk-UCXYYGFG.js} +2 -2
  15. package/dist/hooks/index.d.ts +2 -2
  16. package/dist/hooks/index.js +2 -2
  17. package/dist/{index-lveh8qb0.d.ts → index-CvAHE2Y2.d.ts} +1 -1
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.js +7 -7
  20. package/dist/index.native.d.ts +5 -5
  21. package/dist/index.native.js +7 -7
  22. package/dist/index.web.d.ts +6 -6
  23. package/dist/index.web.js +6 -6
  24. package/dist/types/index.d.ts +2 -2
  25. package/dist/{useDbCount-DWfYB2iu.d.ts → useDbCount-Chl9uuR1.d.ts} +1 -1
  26. package/dist/{useResolveFeedback-CxLccZKK.d.ts → useResolveFeedback-lNxMVfUw.d.ts} +3 -3
  27. package/dist/with-auth/index.js +5 -5
  28. package/package.json +1 -1
  29. package/dist/chunk-CNKNEYRB.js.map +0 -1
  30. /package/dist/{chunk-ADYMMIIJ.js.map → chunk-HJXJIBXC.js.map} +0 -0
  31. /package/dist/{chunk-FFHMWRRW.js.map → chunk-POU4MVXN.js.map} +0 -0
  32. /package/dist/{chunk-ROLZ635F.js.map → chunk-RJIVXO4U.js.map} +0 -0
  33. /package/dist/{chunk-V54K6CMB.js.map → chunk-UCXYYGFG.js.map} +0 -0
@@ -679,13 +679,13 @@ declare class AdapterRegistry {
679
679
  * Check if a table uses PowerSync strategy
680
680
  *
681
681
  * @param table - The table name (may include schema prefix like "core.Profile")
682
- * @returns True if table uses PowerSync or Hybrid strategy
682
+ * @returns True if table uses PowerSync, Hybrid, or Auto strategy
683
683
  */
684
684
  usesPowerSync(table: string): boolean;
685
685
  /**
686
686
  * Get all table config keys that use PowerSync (may be schema-qualified)
687
687
  *
688
- * @returns Array of config keys using PowerSync or Hybrid strategy
688
+ * @returns Array of config keys using PowerSync, Hybrid, or Auto strategy
689
689
  */
690
690
  getPowerSyncTableKeys(): string[];
691
691
  /**
@@ -11,8 +11,8 @@ import {
11
11
  useUserMetadataState,
12
12
  useUserMetadataValue,
13
13
  userMetadataContext
14
- } from "../chunk-CNKNEYRB.js";
15
- import "../chunk-6TZOUA3G.js";
14
+ } from "../chunk-5TWB3SMJ.js";
15
+ import "../chunk-AIYPSXIO.js";
16
16
  import "../chunk-J4ZVCXZ4.js";
17
17
  import "../chunk-YUX6RGLZ.js";
18
18
  import "../chunk-AKIRHA4Q.js";
@@ -11,14 +11,14 @@ import {
11
11
  usePermissionLoading,
12
12
  usePermissionsBatch,
13
13
  useSetupAuth
14
- } from "../chunk-V54K6CMB.js";
14
+ } from "../chunk-UCXYYGFG.js";
15
15
  import {
16
16
  useSetUserMetadata,
17
17
  useUserMetadata,
18
18
  useUserMetadataState,
19
19
  useUserMetadataValue
20
- } from "../chunk-CNKNEYRB.js";
21
- import "../chunk-6TZOUA3G.js";
20
+ } from "../chunk-5TWB3SMJ.js";
21
+ import "../chunk-AIYPSXIO.js";
22
22
  import "../chunk-J4ZVCXZ4.js";
23
23
  import "../chunk-YUX6RGLZ.js";
24
24
  import "../chunk-AKIRHA4Q.js";
@@ -12,7 +12,7 @@ import {
12
12
  usePermissionLoading,
13
13
  usePermissionsBatch,
14
14
  useSetupAuth
15
- } from "../chunk-V54K6CMB.js";
15
+ } from "../chunk-UCXYYGFG.js";
16
16
  import {
17
17
  AuthProvider,
18
18
  PermissionProvider,
@@ -26,8 +26,8 @@ import {
26
26
  useUserMetadataState,
27
27
  useUserMetadataValue,
28
28
  userMetadataContext
29
- } from "../chunk-CNKNEYRB.js";
30
- import "../chunk-6TZOUA3G.js";
29
+ } from "../chunk-5TWB3SMJ.js";
30
+ import "../chunk-AIYPSXIO.js";
31
31
  import {
32
32
  hasAccess,
33
33
  hasAllAccess,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDbUpsert
3
- } from "./chunk-ROLZ635F.js";
3
+ } from "./chunk-RJIVXO4U.js";
4
4
  import {
5
5
  normalizeFilter
6
6
  } from "./chunk-Z456IHCB.js";
@@ -9,10 +9,10 @@ import {
9
9
  } from "./chunk-7SCJNYTE.js";
10
10
  import {
11
11
  useDbQuery
12
- } from "./chunk-CNKNEYRB.js";
12
+ } from "./chunk-5TWB3SMJ.js";
13
13
  import {
14
14
  useDataLayerCoreOptional
15
- } from "./chunk-6TZOUA3G.js";
15
+ } from "./chunk-AIYPSXIO.js";
16
16
  import {
17
17
  getSupabaseUrl
18
18
  } from "./chunk-GC3TBUWE.js";
@@ -4755,19 +4755,12 @@ var AdapterRegistry = class {
4755
4755
  getAdapter(table, operation = "read") {
4756
4756
  const tableWithoutSchema = table.includes(".") ? table.split(".")[1] : table;
4757
4757
  const strategy = this.config.tables[table] ?? this.config.tables[tableWithoutSchema];
4758
- if (table.includes("Profile") || table.includes("UserAccess")) {
4759
- console.log(`[AdapterRegistry.getAdapter] table=${table}, strategy=${strategy?.strategy ?? "undefined"}, operation=${operation}`);
4760
- }
4761
4758
  if (!strategy || strategy.strategy === "auto") {
4762
4759
  if (this.powerSyncAdapter) {
4763
4760
  const powerSyncTableKeys = this.getPowerSyncTableKeys();
4764
4761
  const isConfigured = powerSyncTableKeys.some((key) => key === table || key === tableWithoutSchema || key.includes(".") && key.split(".")[1] === tableWithoutSchema);
4765
- if (table.includes("Profile") || table.includes("UserAccess")) {
4766
- console.log(`[AdapterRegistry.getAdapter] auto strategy check: isConfigured=${isConfigured}, hasPowerSync=${!!this.powerSyncAdapter}, hasSupabase=${!!this.supabaseAdapter}`);
4767
- }
4768
4762
  if (!isConfigured) {
4769
4763
  if (this.supabaseAdapter) {
4770
- console.log(`[AdapterRegistry.getAdapter] Returning Supabase adapter for ${table} (not in PowerSync schema)`);
4771
4764
  return this.supabaseAdapter;
4772
4765
  }
4773
4766
  throw new Error(`Table "${table}" is not configured for PowerSync sync and Supabase adapter is not available. Either add this table to the PowerSync schema or initialize the Supabase adapter.`);
@@ -4841,19 +4834,19 @@ var AdapterRegistry = class {
4841
4834
  * Check if a table uses PowerSync strategy
4842
4835
  *
4843
4836
  * @param table - The table name (may include schema prefix like "core.Profile")
4844
- * @returns True if table uses PowerSync or Hybrid strategy
4837
+ * @returns True if table uses PowerSync, Hybrid, or Auto strategy
4845
4838
  */
4846
4839
  usesPowerSync(table) {
4847
4840
  const strategy = this.getTableStrategy(table);
4848
- return strategy?.strategy === "powersync" || strategy?.strategy === "hybrid";
4841
+ return strategy?.strategy === "powersync" || strategy?.strategy === "hybrid" || strategy?.strategy === "auto";
4849
4842
  }
4850
4843
  /**
4851
4844
  * Get all table config keys that use PowerSync (may be schema-qualified)
4852
4845
  *
4853
- * @returns Array of config keys using PowerSync or Hybrid strategy
4846
+ * @returns Array of config keys using PowerSync, Hybrid, or Auto strategy
4854
4847
  */
4855
4848
  getPowerSyncTableKeys() {
4856
- return Object.entries(this.config.tables).filter(([_, strategy]) => strategy.strategy === "powersync" || strategy.strategy === "hybrid").map(([key]) => key);
4849
+ return Object.entries(this.config.tables).filter(([_, strategy]) => strategy.strategy === "powersync" || strategy.strategy === "hybrid" || strategy.strategy === "auto").map(([key]) => key);
4857
4850
  }
4858
4851
  /**
4859
4852
  * Get all tables that use PowerSync (returns aliases for PowerSync schema)
@@ -4861,7 +4854,7 @@ var AdapterRegistry = class {
4861
4854
  * @returns Array of PowerSync table aliases
4862
4855
  */
4863
4856
  getPowerSyncTables() {
4864
- return Object.entries(this.config.tables).filter(([_, strategy]) => strategy.strategy === "powersync" || strategy.strategy === "hybrid").map(([key, strategy]) => getPowerSyncAlias(key, strategy));
4857
+ return Object.entries(this.config.tables).filter(([_, strategy]) => strategy.strategy === "powersync" || strategy.strategy === "hybrid" || strategy.strategy === "auto").map(([key, strategy]) => getPowerSyncAlias(key, strategy));
4865
4858
  }
4866
4859
  /**
4867
4860
  * Get the PowerSync alias for a table.
@@ -4964,7 +4957,13 @@ var AdapterRegistry = class {
4964
4957
  switch (strategy.strategy) {
4965
4958
  case "powersync":
4966
4959
  if (!this.powerSyncAdapter) {
4967
- throw new Error("PowerSync adapter not initialized. Ensure PowerSyncAdapter is set before accessing PowerSync tables.");
4960
+ if (this.supabaseAdapter) {
4961
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
4962
+ console.warn(`[AdapterRegistry] PowerSync not ready, falling back to Supabase`);
4963
+ }
4964
+ return this.supabaseAdapter;
4965
+ }
4966
+ throw new Error("PowerSync adapter not initialized and Supabase not available. Ensure PowerSyncAdapter is set before accessing PowerSync tables.");
4968
4967
  }
4969
4968
  return this.syncTrackingAdapter ?? this.powerSyncAdapter;
4970
4969
  case "supabase":
@@ -5164,16 +5163,10 @@ var SupabaseAdapter = class {
5164
5163
  schema,
5165
5164
  tableName
5166
5165
  } = this.parseTableIdentifier(table);
5167
- console.log(`[SupabaseAdapter.queryById] Querying ${schema}.${tableName} where id=${id}`);
5168
5166
  const {
5169
5167
  data,
5170
5168
  error
5171
5169
  } = await this.supabase.schema(schema).from(tableName).select(select).eq("id", id).single();
5172
- console.log(`[SupabaseAdapter.queryById] Result:`, {
5173
- data: !!data,
5174
- error: error?.message,
5175
- errorCode: error?.code
5176
- });
5177
5170
  if (error) {
5178
5171
  if (error.code === "PGRST116") {
5179
5172
  return null;
@@ -7937,4 +7930,4 @@ moment/moment.js:
7937
7930
  (*! license : MIT *)
7938
7931
  (*! momentjs.com *)
7939
7932
  */
7940
- //# sourceMappingURL=chunk-VOC2RRFE.js.map
7933
+ //# sourceMappingURL=chunk-5KZ5ZB7B.js.map