@rimori/client 2.5.3 → 2.5.4-next.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.
|
@@ -24,6 +24,7 @@ export class SettingsController {
|
|
|
24
24
|
var _a;
|
|
25
25
|
const isGuildSetting = !this.guild.allowUserPluginSettings;
|
|
26
26
|
const { data } = yield this.supabase
|
|
27
|
+
.schema('public')
|
|
27
28
|
.from('plugin_settings')
|
|
28
29
|
.select('*')
|
|
29
30
|
.eq('plugin_id', this.pluginId)
|
|
@@ -55,6 +56,7 @@ export class SettingsController {
|
|
|
55
56
|
}
|
|
56
57
|
// Try UPDATE first (safe with RLS). If nothing updated, INSERT.
|
|
57
58
|
const updateQuery = this.supabase
|
|
59
|
+
.schema('public')
|
|
58
60
|
.from('plugin_settings')
|
|
59
61
|
.update({ settings })
|
|
60
62
|
.eq('plugin_id', this.pluginId)
|
|
@@ -73,11 +75,12 @@ export class SettingsController {
|
|
|
73
75
|
return; // updated successfully
|
|
74
76
|
}
|
|
75
77
|
// No row updated -> INSERT
|
|
76
|
-
const { error: insertError } = yield this.supabase.from('plugin_settings').insert(payload);
|
|
78
|
+
const { error: insertError } = yield this.supabase.schema('public').from('plugin_settings').insert(payload);
|
|
77
79
|
if (insertError) {
|
|
78
80
|
// In case of race condition (duplicate), try one more UPDATE
|
|
79
81
|
if (insertError.code === '23505' /* unique_violation */) {
|
|
80
82
|
const retry = this.supabase
|
|
83
|
+
.schema('public')
|
|
81
84
|
.from('plugin_settings')
|
|
82
85
|
.update({ settings })
|
|
83
86
|
.eq('plugin_id', this.pluginId)
|
|
@@ -80,7 +80,7 @@ export class RimoriCommunicationHandler {
|
|
|
80
80
|
// Listen for updates from rimori-main (data changes, token refresh, etc.)
|
|
81
81
|
// Topic format: {pluginId}.supabase.triggerUpdate
|
|
82
82
|
EventBus.on(`${this.pluginId}.supabase.triggerUpdate`, (ev) => {
|
|
83
|
-
console.log('[RimoriCommunicationHandler] Received update from rimori-main');
|
|
83
|
+
console.log('[RimoriCommunicationHandler] Received update from rimori-main', ev.data);
|
|
84
84
|
this.handleRimoriInfoUpdate(ev.data);
|
|
85
85
|
});
|
|
86
86
|
// Mark MessageChannel as ready and process pending requests
|
|
@@ -210,6 +210,10 @@ export class RimoriCommunicationHandler {
|
|
|
210
210
|
* Updates the cached info and Supabase client, then notifies all registered callbacks.
|
|
211
211
|
*/
|
|
212
212
|
handleRimoriInfoUpdate(newInfo) {
|
|
213
|
+
if (JSON.stringify(this.rimoriInfo) === JSON.stringify(newInfo)) {
|
|
214
|
+
console.log('[RimoriCommunicationHandler] RimoriInfo update is the same as the cached info, skipping update');
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
213
217
|
// Update cached rimoriInfo
|
|
214
218
|
this.rimoriInfo = newInfo;
|
|
215
219
|
// Update Supabase client with new token
|
|
@@ -28,7 +28,7 @@ export class DbModule {
|
|
|
28
28
|
// Plugin tables use the schema provided by rimori-main (plugins or plugins_alpha)
|
|
29
29
|
if (relation.startsWith('global_')) {
|
|
30
30
|
// Global tables stay in public schema
|
|
31
|
-
return this.supabase.from(tableName);
|
|
31
|
+
return this.supabase.schema('public').from(tableName);
|
|
32
32
|
}
|
|
33
33
|
// Plugin tables go to the schema provided by rimori-main
|
|
34
34
|
return this.supabase.schema(this.rimoriInfo.dbSchema).from(tableName);
|