@pol-studios/db 1.0.17 → 1.0.19
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/{chunk-FHVF26YA.js → chunk-2T6WTCP4.js} +56 -27
- package/dist/chunk-2T6WTCP4.js.map +1 -0
- package/dist/{chunk-PMRV6WND.js → chunk-R5B2XMN5.js} +57 -13
- package/dist/chunk-R5B2XMN5.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/index.native.js +2 -2
- package/dist/index.web.js +1 -1
- package/package.json +1 -1
- package/dist/DataLayerContext-Cm1nAvT7.d.ts +0 -807
- package/dist/EntityPermissions-DwFt4tUd.d.ts +0 -35
- package/dist/FilterConfig-Bt2Ek74z.d.ts +0 -99
- package/dist/UserMetadataContext-B8gVWGMl.d.ts +0 -35
- package/dist/UserMetadataContext-DntmpK41.d.ts +0 -33
- package/dist/auth/context.d.ts +0 -48
- package/dist/auth/guards.d.ts +0 -180
- package/dist/auth/hooks.d.ts +0 -312
- package/dist/auth/index.d.ts +0 -11
- package/dist/chunk-FHVF26YA.js.map +0 -1
- package/dist/chunk-PMRV6WND.js.map +0 -1
- package/dist/client/index.d.ts +0 -16
- package/dist/core/index.d.ts +0 -527
- package/dist/database.types-ChFCG-4M.d.ts +0 -8604
- package/dist/executor-CB4KHyYG.d.ts +0 -507
- package/dist/gen/index.d.ts +0 -1099
- package/dist/hooks/index.d.ts +0 -100
- package/dist/index-BHFInYVr.d.ts +0 -433
- package/dist/index.d.ts +0 -33
- package/dist/index.native.d.ts +0 -773
- package/dist/index.web.d.ts +0 -321
- package/dist/mutation/index.d.ts +0 -58
- package/dist/parser/index.d.ts +0 -366
- package/dist/powersync-bridge/index.d.ts +0 -284
- package/dist/query/index.d.ts +0 -723
- package/dist/realtime/index.d.ts +0 -44
- package/dist/select-query-parser-BwyHum1L.d.ts +0 -352
- package/dist/setupAuthContext-Kv-THH-h.d.ts +0 -61
- package/dist/types/index.d.ts +0 -10
- package/dist/types-CYr9JiUE.d.ts +0 -62
- package/dist/useBatchUpsert-9OYjibLh.d.ts +0 -24
- package/dist/useDbCount-Cu2Q5ZdH.d.ts +0 -1082
- package/dist/useDbQuery-C-TL8jY1.d.ts +0 -19
- package/dist/useReceiptAI-6HkRpRml.d.ts +0 -58
- package/dist/useResolveFeedback-Bg3JDRs8.d.ts +0 -997
- package/dist/useSupabase-DvWVuHHE.d.ts +0 -28
- package/dist/with-auth/index.d.ts +0 -704
|
@@ -1554,6 +1554,21 @@ function createAdapterAutoDetector(powerSyncDb, supabase, options) {
|
|
|
1554
1554
|
}
|
|
1555
1555
|
|
|
1556
1556
|
// src/adapters/registry.ts
|
|
1557
|
+
function stripSchemaPrefix(tableName) {
|
|
1558
|
+
if (!tableName.includes(".")) {
|
|
1559
|
+
return tableName;
|
|
1560
|
+
}
|
|
1561
|
+
return tableName.split(".")[1];
|
|
1562
|
+
}
|
|
1563
|
+
function getPowerSyncAlias(tableName, strategy) {
|
|
1564
|
+
if (strategy && (strategy.strategy === "powersync" || strategy.strategy === "hybrid")) {
|
|
1565
|
+
const typedStrategy = strategy;
|
|
1566
|
+
if (typedStrategy.alias) {
|
|
1567
|
+
return typedStrategy.alias;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
return stripSchemaPrefix(tableName);
|
|
1571
|
+
}
|
|
1557
1572
|
var AdapterRegistry = class {
|
|
1558
1573
|
/**
|
|
1559
1574
|
* Create a new adapter registry
|
|
@@ -1670,16 +1685,22 @@ var AdapterRegistry = class {
|
|
|
1670
1685
|
* For tables not in config, defaults to auto-detection if available,
|
|
1671
1686
|
* otherwise falls back to SupabaseAdapter.
|
|
1672
1687
|
*
|
|
1673
|
-
*
|
|
1688
|
+
* Supports schema-qualified table names:
|
|
1689
|
+
* - "core.Profile" looks up config["core.Profile"] first, then config["Profile"]
|
|
1690
|
+
* - Auto-generates PowerSync alias as "CoreProfile" if not explicitly set
|
|
1691
|
+
*
|
|
1692
|
+
* @param table - The table name (may be schema-qualified like "core.Profile")
|
|
1674
1693
|
* @returns The appropriate adapter for the table
|
|
1675
1694
|
* @throws Error if adapters are not initialized
|
|
1676
1695
|
*/
|
|
1677
1696
|
getAdapter(table) {
|
|
1678
|
-
const
|
|
1697
|
+
const tableWithoutSchema = table.includes(".") ? table.split(".")[1] : table;
|
|
1698
|
+
const strategy = this.config.tables[table] ?? this.config.tables[tableWithoutSchema];
|
|
1679
1699
|
if (!strategy || strategy.strategy === "auto") {
|
|
1680
1700
|
if (this.powerSyncAdapter) {
|
|
1681
|
-
const
|
|
1682
|
-
|
|
1701
|
+
const powerSyncTableKeys = this.getPowerSyncTableKeys();
|
|
1702
|
+
const isConfigured = powerSyncTableKeys.some((key) => key === table || key === tableWithoutSchema || key.includes(".") && key.split(".")[1] === tableWithoutSchema);
|
|
1703
|
+
if (!isConfigured) {
|
|
1683
1704
|
if (this.supabaseAdapter) {
|
|
1684
1705
|
return this.supabaseAdapter;
|
|
1685
1706
|
}
|
|
@@ -1737,29 +1758,51 @@ var AdapterRegistry = class {
|
|
|
1737
1758
|
/**
|
|
1738
1759
|
* Get the strategy for a specific table
|
|
1739
1760
|
*
|
|
1740
|
-
* @param table - The table name
|
|
1761
|
+
* @param table - The table name (may include schema prefix like "core.Profile")
|
|
1741
1762
|
* @returns The table strategy or undefined if not configured
|
|
1742
1763
|
*/
|
|
1743
1764
|
getTableStrategy(table) {
|
|
1744
|
-
|
|
1765
|
+
const tableWithoutSchema = table.includes(".") ? table.split(".")[1] : table;
|
|
1766
|
+
return this.config.tables[table] ?? this.config.tables[tableWithoutSchema];
|
|
1745
1767
|
}
|
|
1746
1768
|
/**
|
|
1747
1769
|
* Check if a table uses PowerSync strategy
|
|
1748
1770
|
*
|
|
1749
|
-
* @param table - The table name
|
|
1771
|
+
* @param table - The table name (may include schema prefix like "core.Profile")
|
|
1750
1772
|
* @returns True if table uses PowerSync or Hybrid strategy
|
|
1751
1773
|
*/
|
|
1752
1774
|
usesPowerSync(table) {
|
|
1753
|
-
const strategy = this.
|
|
1775
|
+
const strategy = this.getTableStrategy(table);
|
|
1754
1776
|
return strategy?.strategy === "powersync" || strategy?.strategy === "hybrid";
|
|
1755
1777
|
}
|
|
1756
1778
|
/**
|
|
1757
|
-
* Get all
|
|
1779
|
+
* Get all table config keys that use PowerSync (may be schema-qualified)
|
|
1758
1780
|
*
|
|
1759
|
-
* @returns Array of
|
|
1781
|
+
* @returns Array of config keys using PowerSync or Hybrid strategy
|
|
1782
|
+
*/
|
|
1783
|
+
getPowerSyncTableKeys() {
|
|
1784
|
+
return Object.entries(this.config.tables).filter(([_, strategy]) => strategy.strategy === "powersync" || strategy.strategy === "hybrid").map(([key]) => key);
|
|
1785
|
+
}
|
|
1786
|
+
/**
|
|
1787
|
+
* Get all tables that use PowerSync (returns aliases for PowerSync schema)
|
|
1788
|
+
*
|
|
1789
|
+
* @returns Array of PowerSync table aliases
|
|
1760
1790
|
*/
|
|
1761
1791
|
getPowerSyncTables() {
|
|
1762
|
-
return Object.entries(this.config.tables).filter(([_, strategy]) => strategy.strategy === "powersync" || strategy.strategy === "hybrid").map(([
|
|
1792
|
+
return Object.entries(this.config.tables).filter(([_, strategy]) => strategy.strategy === "powersync" || strategy.strategy === "hybrid").map(([key, strategy]) => getPowerSyncAlias(key, strategy));
|
|
1793
|
+
}
|
|
1794
|
+
/**
|
|
1795
|
+
* Get the PowerSync alias for a table.
|
|
1796
|
+
* Uses explicit alias from config if set, otherwise auto-generates.
|
|
1797
|
+
*
|
|
1798
|
+
* @param table - Table name (may be schema-qualified)
|
|
1799
|
+
* @returns The alias to use in PowerSync schema
|
|
1800
|
+
*/
|
|
1801
|
+
getTableAlias(table) {
|
|
1802
|
+
const strategy = this.getTableStrategy(table);
|
|
1803
|
+
const tableWithoutSchema = table.includes(".") ? table.split(".")[1] : table;
|
|
1804
|
+
const configKey = this.config.tables[table] ? table : tableWithoutSchema;
|
|
1805
|
+
return getPowerSyncAlias(configKey, strategy);
|
|
1763
1806
|
}
|
|
1764
1807
|
// ===========================================================================
|
|
1765
1808
|
// Auto-Detection Methods
|
|
@@ -1770,7 +1813,7 @@ var AdapterRegistry = class {
|
|
|
1770
1813
|
* @param strategy - Optional auto strategy configuration
|
|
1771
1814
|
* @returns The automatically selected adapter
|
|
1772
1815
|
*/
|
|
1773
|
-
getAutoAdapter(
|
|
1816
|
+
getAutoAdapter(_strategy) {
|
|
1774
1817
|
if (!this.autoDetector) {
|
|
1775
1818
|
if (!this.supabaseAdapter) {
|
|
1776
1819
|
throw new Error("No auto-detector configured and Supabase adapter not available. Either initialize auto-detection or set adapters explicitly.");
|
|
@@ -3833,6 +3876,7 @@ export {
|
|
|
3833
3876
|
BackendStatus,
|
|
3834
3877
|
AdapterAutoDetector,
|
|
3835
3878
|
createAdapterAutoDetector,
|
|
3879
|
+
stripSchemaPrefix,
|
|
3836
3880
|
AdapterRegistry,
|
|
3837
3881
|
createAdapterRegistry,
|
|
3838
3882
|
SupabaseAdapter,
|
|
@@ -3871,4 +3915,4 @@ export {
|
|
|
3871
3915
|
useApplyFeedback,
|
|
3872
3916
|
useResolveFeedback
|
|
3873
3917
|
};
|
|
3874
|
-
//# sourceMappingURL=chunk-
|
|
3918
|
+
//# sourceMappingURL=chunk-R5B2XMN5.js.map
|