@rimori/client 2.5.14-next.3 → 2.5.14-next.5
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/index.d.ts +12 -12
- package/dist/index.js +5 -5
- package/dist/modules.d.ts +1 -1
- package/dist/modules.js +1 -1
- package/dist/plugin/CommunicationHandler.d.ts +2 -2
- package/dist/plugin/CommunicationHandler.js +1 -1
- package/dist/plugin/RimoriClient.js +5 -1
- package/dist/plugin/module/AIModule.d.ts +11 -1
- package/dist/plugin/module/AIModule.js +43 -1
- package/dist/plugin/module/EventModule.d.ts +6 -2
- package/dist/plugin/module/EventModule.js +31 -2
- package/dist/plugin/module/PluginModule.d.ts +87 -11
- package/dist/plugin/module/PluginModule.js +103 -7
- package/package.json +1 -1
- package/dist/controller/SettingsController.d.ts +0 -93
- package/dist/controller/SettingsController.js +0 -132
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export * from './plugin/CommunicationHandler';
|
|
2
|
-
export * from './cli/types/DatabaseTypes';
|
|
3
|
-
export * from './utils/difficultyConverter';
|
|
4
|
-
export * from './fromRimori/PluginTypes';
|
|
5
1
|
export * from './fromRimori/EventBus';
|
|
6
2
|
export * from './plugin/RimoriClient';
|
|
3
|
+
export * from './fromRimori/PluginTypes';
|
|
7
4
|
export * from './plugin/StandaloneClient';
|
|
5
|
+
export * from './cli/types/DatabaseTypes';
|
|
6
|
+
export * from './plugin/TTS/MessageSender';
|
|
7
|
+
export * from './utils/difficultyConverter';
|
|
8
|
+
export * from './plugin/CommunicationHandler';
|
|
9
|
+
export type { TOptions } from 'i18next';
|
|
8
10
|
export { setupWorker } from './worker/WorkerSetup';
|
|
11
|
+
export type { EventBusMessage } from './fromRimori/EventBus';
|
|
9
12
|
export { AudioController } from './controller/AudioController';
|
|
10
|
-
export { Translator } from './controller/TranslationController';
|
|
11
|
-
export type { TOptions } from 'i18next';
|
|
12
|
-
export type { SharedContent, BasicSharedContent, ContentStatus } from './plugin/module/SharedContentController';
|
|
13
13
|
export type { Exercise } from './plugin/module/ExerciseModule';
|
|
14
|
-
export
|
|
15
|
-
export type { Message, ToolInvocation } from './plugin/module/AIModule';
|
|
14
|
+
export { Translator } from './controller/TranslationController';
|
|
16
15
|
export type { TriggerAction } from './plugin/module/ExerciseModule';
|
|
17
|
-
export type {
|
|
18
|
-
export type { EventBusMessage } from './fromRimori/EventBus';
|
|
16
|
+
export type { Message, ToolInvocation } from './plugin/module/AIModule';
|
|
19
17
|
export type { Theme, ApplicationMode } from './plugin/module/PluginModule';
|
|
20
|
-
export
|
|
18
|
+
export type { UserInfo, Language, UserRole, ExplicitUndefined } from './plugin/module/PluginModule';
|
|
19
|
+
export type { SharedContent, BasicSharedContent, ContentStatus } from './plugin/module/SharedContentController';
|
|
20
|
+
export type { MacroAccomplishmentPayload, MicroAccomplishmentPayload } from './controller/AccomplishmentController';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Re-export everything
|
|
2
|
-
export * from './plugin/CommunicationHandler';
|
|
3
|
-
export * from './cli/types/DatabaseTypes';
|
|
4
|
-
export * from './utils/difficultyConverter';
|
|
5
|
-
export * from './fromRimori/PluginTypes';
|
|
6
2
|
export * from './fromRimori/EventBus';
|
|
7
3
|
export * from './plugin/RimoriClient';
|
|
4
|
+
export * from './fromRimori/PluginTypes';
|
|
8
5
|
export * from './plugin/StandaloneClient';
|
|
6
|
+
export * from './cli/types/DatabaseTypes';
|
|
7
|
+
export * from './plugin/TTS/MessageSender';
|
|
8
|
+
export * from './utils/difficultyConverter';
|
|
9
|
+
export * from './plugin/CommunicationHandler';
|
|
9
10
|
export { setupWorker } from './worker/WorkerSetup';
|
|
10
11
|
export { AudioController } from './controller/AudioController';
|
|
11
12
|
export { Translator } from './controller/TranslationController';
|
|
12
|
-
export * from './plugin/TTS/MessageSender';
|
package/dist/modules.d.ts
CHANGED
package/dist/modules.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Re-export everything
|
|
2
|
+
export * from './fromRimori/EventBus';
|
|
2
3
|
export * from './plugin/module/AIModule';
|
|
3
4
|
export * from './fromRimori/PluginTypes';
|
|
4
|
-
export * from './fromRimori/EventBus';
|
|
5
5
|
export * from './cli/types/DatabaseTypes';
|
|
6
6
|
export * from './plugin/TTS/MessageSender';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UserInfo } from '
|
|
2
|
-
import { ActivePlugin, Plugin } from '../fromRimori/PluginTypes';
|
|
1
|
+
import { UserInfo } from './module/PluginModule';
|
|
3
2
|
import { PostgrestClient } from '@supabase/postgrest-js';
|
|
3
|
+
import { ActivePlugin, Plugin } from '../fromRimori/PluginTypes';
|
|
4
4
|
export type SupabaseClient = PostgrestClient;
|
|
5
5
|
export interface Guild {
|
|
6
6
|
allowUserPluginSettings: boolean;
|
|
@@ -7,8 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { EventBus } from '../fromRimori/EventBus';
|
|
11
10
|
import { PostgrestClient } from '@supabase/postgrest-js';
|
|
11
|
+
import { EventBus } from '../fromRimori/EventBus';
|
|
12
12
|
export class RimoriCommunicationHandler {
|
|
13
13
|
constructor(pluginId, standalone) {
|
|
14
14
|
this.port = null;
|
|
@@ -15,6 +15,7 @@ import { DbModule } from './module/DbModule';
|
|
|
15
15
|
import { EventModule } from './module/EventModule';
|
|
16
16
|
import { AIModule } from './module/AIModule';
|
|
17
17
|
import { ExerciseModule } from './module/ExerciseModule';
|
|
18
|
+
import { EventBus } from '../fromRimori/EventBus';
|
|
18
19
|
export class RimoriClient {
|
|
19
20
|
constructor(controller, supabase, info) {
|
|
20
21
|
this.navigation = {
|
|
@@ -30,7 +31,10 @@ export class RimoriClient {
|
|
|
30
31
|
this.rimoriInfo = info;
|
|
31
32
|
this.sharedContent = new SharedContentController(supabase, this);
|
|
32
33
|
this.ai = new AIModule(info.backendUrl, () => this.rimoriInfo.token);
|
|
33
|
-
this.
|
|
34
|
+
this.ai.setOnRateLimited((exercisesRemaining) => {
|
|
35
|
+
EventBus.emit(info.pluginId, 'global.quota.triggerExceeded', { exercises_remaining: exercisesRemaining });
|
|
36
|
+
});
|
|
37
|
+
this.event = new EventModule(info.pluginId, info.backendUrl, () => this.rimoriInfo.token, this.ai);
|
|
34
38
|
this.db = new DbModule(supabase, controller, info);
|
|
35
39
|
this.plugin = new PluginModule(supabase, controller, info, this.ai);
|
|
36
40
|
this.exercise = new ExerciseModule(supabase, controller, info, this.event);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Language } from './PluginModule';
|
|
1
2
|
import { Tool } from '../../fromRimori/PluginTypes';
|
|
2
|
-
import { Language } from '../../controller/SettingsController';
|
|
3
3
|
export type OnStreamedObjectResult<T = any> = (result: T, isLoading: boolean) => void;
|
|
4
4
|
type PrimitiveType = 'string' | 'number' | 'boolean';
|
|
5
5
|
type ObjectToolParameterType = PrimitiveType | {
|
|
@@ -58,7 +58,17 @@ export interface ObjectRequest {
|
|
|
58
58
|
export declare class AIModule {
|
|
59
59
|
private getToken;
|
|
60
60
|
private backendUrl;
|
|
61
|
+
private sessionTokenId;
|
|
62
|
+
private onRateLimitedCb?;
|
|
61
63
|
constructor(backendUrl: string, getToken: () => string);
|
|
64
|
+
/** Returns the current exercise session token ID (null if no active session). */
|
|
65
|
+
getSessionTokenId(): string | null;
|
|
66
|
+
/** Sets the session token ID (used by workers inheriting a session from the plugin). */
|
|
67
|
+
setSessionToken(id: string): void;
|
|
68
|
+
/** Clears the stored session token (called after macro accomplishment). */
|
|
69
|
+
clearSessionToken(): void;
|
|
70
|
+
/** Registers a callback invoked whenever a 429 rate-limit response is received. */
|
|
71
|
+
setOnRateLimited(cb: (exercisesRemaining: number) => void): void;
|
|
62
72
|
/**
|
|
63
73
|
* Generate text from messages using AI.
|
|
64
74
|
* @param messages The messages to generate text from.
|
|
@@ -13,9 +13,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
*/
|
|
14
14
|
export class AIModule {
|
|
15
15
|
constructor(backendUrl, getToken) {
|
|
16
|
+
this.sessionTokenId = null;
|
|
16
17
|
this.backendUrl = backendUrl;
|
|
17
18
|
this.getToken = getToken;
|
|
18
19
|
}
|
|
20
|
+
/** Returns the current exercise session token ID (null if no active session). */
|
|
21
|
+
getSessionTokenId() {
|
|
22
|
+
return this.sessionTokenId;
|
|
23
|
+
}
|
|
24
|
+
/** Sets the session token ID (used by workers inheriting a session from the plugin). */
|
|
25
|
+
setSessionToken(id) {
|
|
26
|
+
this.sessionTokenId = id;
|
|
27
|
+
}
|
|
28
|
+
/** Clears the stored session token (called after macro accomplishment). */
|
|
29
|
+
clearSessionToken() {
|
|
30
|
+
this.sessionTokenId = null;
|
|
31
|
+
}
|
|
32
|
+
/** Registers a callback invoked whenever a 429 rate-limit response is received. */
|
|
33
|
+
setOnRateLimited(cb) {
|
|
34
|
+
this.onRateLimitedCb = cb;
|
|
35
|
+
}
|
|
19
36
|
/**
|
|
20
37
|
* Generate text from messages using AI.
|
|
21
38
|
* @param messages The messages to generate text from.
|
|
@@ -78,13 +95,14 @@ export class AIModule {
|
|
|
78
95
|
*/
|
|
79
96
|
getVoice(text_1) {
|
|
80
97
|
return __awaiter(this, arguments, void 0, function* (text, voice = 'alloy', speed = 1, language, cache = false) {
|
|
98
|
+
var _a;
|
|
81
99
|
return yield fetch(`${this.backendUrl}/voice/tts`, {
|
|
82
100
|
method: 'POST',
|
|
83
101
|
headers: {
|
|
84
102
|
'Content-Type': 'application/json',
|
|
85
103
|
Authorization: `Bearer ${this.getToken()}`,
|
|
86
104
|
},
|
|
87
|
-
body: JSON.stringify({ input: text, voice, speed, language, cache }),
|
|
105
|
+
body: JSON.stringify({ input: text, voice, speed, language, cache, session_token_id: (_a = this.sessionTokenId) !== null && _a !== void 0 ? _a : undefined }),
|
|
88
106
|
}).then((r) => r.blob());
|
|
89
107
|
});
|
|
90
108
|
}
|
|
@@ -101,6 +119,9 @@ export class AIModule {
|
|
|
101
119
|
if (language) {
|
|
102
120
|
formData.append('language', language.code);
|
|
103
121
|
}
|
|
122
|
+
if (this.sessionTokenId) {
|
|
123
|
+
formData.append('session_token_id', this.sessionTokenId);
|
|
124
|
+
}
|
|
104
125
|
return yield fetch(`${this.backendUrl}/voice/stt`, {
|
|
105
126
|
method: 'POST',
|
|
106
127
|
headers: { Authorization: `Bearer ${this.getToken()}` },
|
|
@@ -172,6 +193,7 @@ export class AIModule {
|
|
|
172
193
|
}
|
|
173
194
|
streamObject(params) {
|
|
174
195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
var _a, _b, _c, _d;
|
|
175
197
|
const { messages, responseSchema, onResult = () => null, cache = false, tools = [], model = undefined, knowledgeId, } = params;
|
|
176
198
|
const chatMessages = messages.map((message, index) => (Object.assign(Object.assign({}, message), { id: `${index + 1}` })));
|
|
177
199
|
const response = yield fetch(`${this.backendUrl}/ai/llm`, {
|
|
@@ -183,11 +205,18 @@ export class AIModule {
|
|
|
183
205
|
messages: chatMessages,
|
|
184
206
|
model,
|
|
185
207
|
knowledge_id: knowledgeId,
|
|
208
|
+
session_token_id: (_a = this.sessionTokenId) !== null && _a !== void 0 ? _a : undefined,
|
|
186
209
|
}),
|
|
187
210
|
method: 'POST',
|
|
188
211
|
headers: { Authorization: `Bearer ${this.getToken()}`, 'Content-Type': 'application/json' },
|
|
189
212
|
});
|
|
190
213
|
if (!response.ok) {
|
|
214
|
+
if (response.status === 429) {
|
|
215
|
+
const body = yield response.json().catch(() => ({}));
|
|
216
|
+
const remaining = (_b = body.exercises_remaining) !== null && _b !== void 0 ? _b : 0;
|
|
217
|
+
(_c = this.onRateLimitedCb) === null || _c === void 0 ? void 0 : _c.call(this, remaining);
|
|
218
|
+
throw new Error(`Rate limit exceeded: ${(_d = body.error) !== null && _d !== void 0 ? _d : 'Daily exercise limit reached'}. exercises_remaining: ${remaining}`);
|
|
219
|
+
}
|
|
191
220
|
throw new Error(`Failed to stream object: ${response.status} ${response.statusText}`);
|
|
192
221
|
}
|
|
193
222
|
if (!response.body) {
|
|
@@ -212,6 +241,19 @@ export class AIModule {
|
|
|
212
241
|
const chunk = decoder.decode(value, { stream: true });
|
|
213
242
|
const lines = chunk.split('\n').filter((line) => line.trim());
|
|
214
243
|
for (const line of lines) {
|
|
244
|
+
// Handle token: line (session token issued by backend on first AI call)
|
|
245
|
+
if (line.startsWith('token:')) {
|
|
246
|
+
try {
|
|
247
|
+
const tokenData = JSON.parse(line.slice(6).trim());
|
|
248
|
+
if (tokenData.token_id) {
|
|
249
|
+
this.sessionTokenId = tokenData.token_id;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch (_e) {
|
|
253
|
+
console.error('Failed to parse token: line', line);
|
|
254
|
+
}
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
215
257
|
const command = line.substring(0, 5);
|
|
216
258
|
const dataStr = line.substring(5).trim();
|
|
217
259
|
if (dataStr === '[DONE]') {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MainPanelAction, SidebarAction } from '../../fromRimori/PluginTypes';
|
|
2
2
|
import { AccomplishmentPayload } from '../../controller/AccomplishmentController';
|
|
3
3
|
import { EventBusMessage, EventHandler, EventPayload, EventListener } from '../../fromRimori/EventBus';
|
|
4
|
+
import { AIModule } from './AIModule';
|
|
4
5
|
/**
|
|
5
6
|
* Event module for plugin event bus operations.
|
|
6
7
|
* Provides methods for emitting, listening to, and responding to events.
|
|
@@ -8,7 +9,10 @@ import { EventBusMessage, EventHandler, EventPayload, EventListener } from '../.
|
|
|
8
9
|
export declare class EventModule {
|
|
9
10
|
private pluginId;
|
|
10
11
|
private accomplishmentController;
|
|
11
|
-
|
|
12
|
+
private aiModule;
|
|
13
|
+
private backendUrl;
|
|
14
|
+
private getToken;
|
|
15
|
+
constructor(pluginId: string, backendUrl: string, getToken: () => string, aiModule: AIModule);
|
|
12
16
|
getGlobalEventTopic(preliminaryTopic: string): string;
|
|
13
17
|
/**
|
|
14
18
|
* Emit an event to Rimori or a plugin.
|
|
@@ -51,7 +55,7 @@ export declare class EventModule {
|
|
|
51
55
|
* Emit an accomplishment.
|
|
52
56
|
* @param payload The payload to emit.
|
|
53
57
|
*/
|
|
54
|
-
emitAccomplishment(payload: AccomplishmentPayload): void
|
|
58
|
+
emitAccomplishment(payload: AccomplishmentPayload): Promise<void>;
|
|
55
59
|
/**
|
|
56
60
|
* Subscribe to an accomplishment.
|
|
57
61
|
* @param accomplishmentTopic The topic to subscribe to.
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { AccomplishmentController } from '../../controller/AccomplishmentController';
|
|
2
11
|
import { EventBus } from '../../fromRimori/EventBus';
|
|
3
12
|
/**
|
|
@@ -5,8 +14,11 @@ import { EventBus } from '../../fromRimori/EventBus';
|
|
|
5
14
|
* Provides methods for emitting, listening to, and responding to events.
|
|
6
15
|
*/
|
|
7
16
|
export class EventModule {
|
|
8
|
-
constructor(pluginId) {
|
|
17
|
+
constructor(pluginId, backendUrl, getToken, aiModule) {
|
|
9
18
|
this.pluginId = pluginId;
|
|
19
|
+
this.backendUrl = backendUrl;
|
|
20
|
+
this.getToken = getToken;
|
|
21
|
+
this.aiModule = aiModule;
|
|
10
22
|
this.accomplishmentController = new AccomplishmentController(pluginId);
|
|
11
23
|
}
|
|
12
24
|
getGlobalEventTopic(preliminaryTopic) {
|
|
@@ -86,7 +98,24 @@ export class EventModule {
|
|
|
86
98
|
* @param payload The payload to emit.
|
|
87
99
|
*/
|
|
88
100
|
emitAccomplishment(payload) {
|
|
89
|
-
this
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
if (payload.type === 'macro') {
|
|
103
|
+
const sessionId = this.aiModule.getSessionTokenId();
|
|
104
|
+
if (sessionId) {
|
|
105
|
+
try {
|
|
106
|
+
yield fetch(`${this.backendUrl}/ai/session/${sessionId}/complete`, {
|
|
107
|
+
method: 'PATCH',
|
|
108
|
+
headers: { Authorization: `Bearer ${this.getToken()}` },
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
catch (_a) {
|
|
112
|
+
// non-fatal — session will expire naturally
|
|
113
|
+
}
|
|
114
|
+
this.aiModule.clearSessionToken();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
this.accomplishmentController.emitAccomplishment(payload);
|
|
118
|
+
});
|
|
90
119
|
}
|
|
91
120
|
/**
|
|
92
121
|
* Subscribe to an accomplishment.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AIModule } from './AIModule';
|
|
2
|
+
import { SupabaseClient } from '../CommunicationHandler';
|
|
3
|
+
import { LanguageLevel } from '../../utils/difficultyConverter';
|
|
3
4
|
import { Translator } from '../../controller/TranslationController';
|
|
4
5
|
import { ActivePlugin, Plugin } from '../../fromRimori/PluginTypes';
|
|
5
|
-
import {
|
|
6
|
-
import { AIModule } from './AIModule';
|
|
6
|
+
import { RimoriCommunicationHandler, RimoriInfo } from '../CommunicationHandler';
|
|
7
7
|
export type Theme = 'light' | 'dark' | 'system';
|
|
8
8
|
export type ApplicationMode = 'main' | 'sidebar' | 'settings';
|
|
9
9
|
/**
|
|
@@ -11,11 +11,11 @@ export type ApplicationMode = 'main' | 'sidebar' | 'settings';
|
|
|
11
11
|
* Provides access to plugin settings, user info, and plugin information.
|
|
12
12
|
*/
|
|
13
13
|
export declare class PluginModule {
|
|
14
|
-
private settingsController;
|
|
15
|
-
private communicationHandler;
|
|
16
|
-
private translator;
|
|
17
|
-
private rimoriInfo;
|
|
18
14
|
pluginId: string;
|
|
15
|
+
private rimoriInfo;
|
|
16
|
+
private translator;
|
|
17
|
+
private supabase;
|
|
18
|
+
private communicationHandler;
|
|
19
19
|
/**
|
|
20
20
|
* The release channel of this plugin installation.
|
|
21
21
|
* Determines which database schema is used for plugin tables.
|
|
@@ -25,8 +25,18 @@ export declare class PluginModule {
|
|
|
25
25
|
theme: Theme;
|
|
26
26
|
constructor(supabase: SupabaseClient, communicationHandler: RimoriCommunicationHandler, info: RimoriInfo, ai: AIModule);
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
28
|
+
* Fetches settings based on guild configuration.
|
|
29
|
+
* If guild doesn't allow user settings, fetches guild-level settings.
|
|
30
|
+
* Otherwise, fetches user-specific settings.
|
|
31
|
+
* @returns The settings object or null if not found.
|
|
32
|
+
*/
|
|
33
|
+
private fetchSettings;
|
|
34
|
+
/**
|
|
35
|
+
* Sets settings for the plugin.
|
|
36
|
+
* Automatically saves as guild settings if guild doesn't allow user settings,
|
|
37
|
+
* otherwise saves as user-specific settings.
|
|
38
|
+
* @param settings - The settings object to save.
|
|
39
|
+
* @throws {Error} if RLS blocks the operation.
|
|
30
40
|
*/
|
|
31
41
|
setSettings(settings: any): Promise<void>;
|
|
32
42
|
/**
|
|
@@ -34,7 +44,7 @@ export declare class PluginModule {
|
|
|
34
44
|
* @param defaultSettings The default settings to use if no settings are found.
|
|
35
45
|
* @returns The settings for the plugin.
|
|
36
46
|
*/
|
|
37
|
-
getSettings<T
|
|
47
|
+
getSettings<T>(defaultSettings: ExplicitUndefined<T>): Promise<ExplicitUndefined<T>>;
|
|
38
48
|
/**
|
|
39
49
|
* Get the current user info.
|
|
40
50
|
* Note: For reactive updates in React components, use the userInfo from useRimori() hook instead.
|
|
@@ -79,3 +89,69 @@ export declare class PluginModule {
|
|
|
79
89
|
*/
|
|
80
90
|
getTranslator(): Promise<Translator>;
|
|
81
91
|
}
|
|
92
|
+
export interface Buddy {
|
|
93
|
+
id: string;
|
|
94
|
+
name: string;
|
|
95
|
+
description: string;
|
|
96
|
+
avatarUrl: string;
|
|
97
|
+
voiceId: string;
|
|
98
|
+
aiPersonality: string;
|
|
99
|
+
}
|
|
100
|
+
export interface Language {
|
|
101
|
+
code: string;
|
|
102
|
+
name: string;
|
|
103
|
+
native: string;
|
|
104
|
+
capitalized: string;
|
|
105
|
+
uppercase: string;
|
|
106
|
+
}
|
|
107
|
+
export type UserRole = 'user' | 'plugin_moderator' | 'lang_moderator' | 'admin';
|
|
108
|
+
export declare const LEARNING_REASONS: readonly ["work", "partner", "friends", "study", "living", "culture", "growth", "citizenship", "other"];
|
|
109
|
+
export type LearningReason = (typeof LEARNING_REASONS)[number];
|
|
110
|
+
export type ExplicitUndefined<T> = {
|
|
111
|
+
[K in keyof T]-?: T[K] | undefined;
|
|
112
|
+
};
|
|
113
|
+
export interface UserInfo {
|
|
114
|
+
/**
|
|
115
|
+
* The user's unique ID
|
|
116
|
+
*/
|
|
117
|
+
user_id: string;
|
|
118
|
+
skill_level_reading: LanguageLevel;
|
|
119
|
+
skill_level_writing: LanguageLevel;
|
|
120
|
+
skill_level_grammar: LanguageLevel;
|
|
121
|
+
skill_level_speaking: LanguageLevel;
|
|
122
|
+
skill_level_listening: LanguageLevel;
|
|
123
|
+
skill_level_understanding: LanguageLevel;
|
|
124
|
+
study_buddy: Buddy;
|
|
125
|
+
study_duration: number;
|
|
126
|
+
/**
|
|
127
|
+
* The language the user speaks natively.
|
|
128
|
+
*/
|
|
129
|
+
mother_tongue: Language;
|
|
130
|
+
/**
|
|
131
|
+
* The language the user targets to learn.
|
|
132
|
+
*/
|
|
133
|
+
target_language: Language;
|
|
134
|
+
/**
|
|
135
|
+
* Why the user is learning the language
|
|
136
|
+
*/
|
|
137
|
+
learning_reason: LearningReason;
|
|
138
|
+
/**
|
|
139
|
+
* Free-text personal interests
|
|
140
|
+
*/
|
|
141
|
+
personal_interests: string;
|
|
142
|
+
onboarding_completed: boolean;
|
|
143
|
+
context_menu_on_select: boolean;
|
|
144
|
+
user_name?: string;
|
|
145
|
+
/**
|
|
146
|
+
* ISO 3166-1 alpha-2 country code of user's target location (exposed to plugins)
|
|
147
|
+
*/
|
|
148
|
+
target_country: string;
|
|
149
|
+
/**
|
|
150
|
+
* Optional: nearest big city (>100,000) near user's location
|
|
151
|
+
*/
|
|
152
|
+
target_city?: string;
|
|
153
|
+
/**
|
|
154
|
+
* The user's role: 'user', 'plugin_moderator', 'lang_moderator', or 'admin'
|
|
155
|
+
*/
|
|
156
|
+
user_role: UserRole;
|
|
157
|
+
}
|
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { SettingsController } from '../../controller/SettingsController';
|
|
11
10
|
import { Translator } from '../../controller/TranslationController';
|
|
12
11
|
/**
|
|
13
12
|
* Controller for plugin-related operations.
|
|
@@ -16,10 +15,10 @@ import { Translator } from '../../controller/TranslationController';
|
|
|
16
15
|
export class PluginModule {
|
|
17
16
|
constructor(supabase, communicationHandler, info, ai) {
|
|
18
17
|
this.rimoriInfo = info;
|
|
19
|
-
this.
|
|
18
|
+
this.supabase = supabase;
|
|
20
19
|
this.pluginId = info.pluginId;
|
|
21
20
|
this.releaseChannel = info.releaseChannel;
|
|
22
|
-
this.
|
|
21
|
+
this.communicationHandler = communicationHandler;
|
|
23
22
|
const currentPlugin = info.installedPlugins.find((plugin) => plugin.id === info.pluginId);
|
|
24
23
|
this.translator = new Translator(info.interfaceLanguage, (currentPlugin === null || currentPlugin === void 0 ? void 0 : currentPlugin.endpoint) || '', ai);
|
|
25
24
|
this.communicationHandler.onUpdate((updatedInfo) => (this.rimoriInfo = updatedInfo));
|
|
@@ -27,12 +26,84 @@ export class PluginModule {
|
|
|
27
26
|
this.theme = this.communicationHandler.getQueryParam('rm_theme') || 'light';
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* Fetches settings based on guild configuration.
|
|
30
|
+
* If guild doesn't allow user settings, fetches guild-level settings.
|
|
31
|
+
* Otherwise, fetches user-specific settings.
|
|
32
|
+
* @returns The settings object or null if not found.
|
|
33
|
+
*/
|
|
34
|
+
fetchSettings() {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
var _a;
|
|
37
|
+
const isGuildSetting = !this.rimoriInfo.guild.allowUserPluginSettings;
|
|
38
|
+
const { data } = yield this.supabase
|
|
39
|
+
.schema('public')
|
|
40
|
+
.from('plugin_settings')
|
|
41
|
+
.select('*')
|
|
42
|
+
.eq('plugin_id', this.pluginId)
|
|
43
|
+
.eq('guild_id', this.rimoriInfo.guild.id)
|
|
44
|
+
.eq('is_guild_setting', isGuildSetting)
|
|
45
|
+
.maybeSingle();
|
|
46
|
+
return (_a = data === null || data === void 0 ? void 0 : data.settings) !== null && _a !== void 0 ? _a : null;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sets settings for the plugin.
|
|
51
|
+
* Automatically saves as guild settings if guild doesn't allow user settings,
|
|
52
|
+
* otherwise saves as user-specific settings.
|
|
53
|
+
* @param settings - The settings object to save.
|
|
54
|
+
* @throws {Error} if RLS blocks the operation.
|
|
32
55
|
*/
|
|
33
56
|
setSettings(settings) {
|
|
34
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
|
|
58
|
+
var _a;
|
|
59
|
+
const isGuildSetting = !this.rimoriInfo.guild.allowUserPluginSettings;
|
|
60
|
+
const payload = {
|
|
61
|
+
plugin_id: this.pluginId,
|
|
62
|
+
settings,
|
|
63
|
+
guild_id: this.rimoriInfo.guild.id,
|
|
64
|
+
is_guild_setting: isGuildSetting,
|
|
65
|
+
};
|
|
66
|
+
if (isGuildSetting) {
|
|
67
|
+
payload.user_id = null;
|
|
68
|
+
}
|
|
69
|
+
// Try UPDATE first (safe with RLS). If nothing updated, INSERT.
|
|
70
|
+
const updateQuery = this.supabase
|
|
71
|
+
.schema('public')
|
|
72
|
+
.from('plugin_settings')
|
|
73
|
+
.update({ settings })
|
|
74
|
+
.eq('plugin_id', this.pluginId)
|
|
75
|
+
.eq('guild_id', this.rimoriInfo.guild.id)
|
|
76
|
+
.eq('is_guild_setting', isGuildSetting);
|
|
77
|
+
const { data: updatedRows, error: updateError } = yield (isGuildSetting
|
|
78
|
+
? updateQuery.is('user_id', null).select()
|
|
79
|
+
: updateQuery.select());
|
|
80
|
+
if (updateError) {
|
|
81
|
+
if (updateError.code === '42501' || ((_a = updateError.message) === null || _a === void 0 ? void 0 : _a.includes('policy'))) {
|
|
82
|
+
throw new Error(`Cannot set ${isGuildSetting ? 'guild' : 'user'} settings: Permission denied.`);
|
|
83
|
+
}
|
|
84
|
+
// proceed to try insert in case of other issues
|
|
85
|
+
}
|
|
86
|
+
if (updatedRows && updatedRows.length > 0) {
|
|
87
|
+
return; // updated successfully
|
|
88
|
+
}
|
|
89
|
+
// No row updated -> INSERT
|
|
90
|
+
const { error: insertError } = yield this.supabase.schema('public').from('plugin_settings').insert(payload);
|
|
91
|
+
if (insertError) {
|
|
92
|
+
// In case of race condition (duplicate), try one more UPDATE
|
|
93
|
+
if (insertError.code === '23505' /* unique_violation */) {
|
|
94
|
+
const retry = this.supabase
|
|
95
|
+
.schema('public')
|
|
96
|
+
.from('plugin_settings')
|
|
97
|
+
.update({ settings })
|
|
98
|
+
.eq('plugin_id', this.pluginId)
|
|
99
|
+
.eq('guild_id', this.rimoriInfo.guild.id)
|
|
100
|
+
.eq('is_guild_setting', isGuildSetting);
|
|
101
|
+
const { error: retryError } = yield (isGuildSetting ? retry.is('user_id', null) : retry);
|
|
102
|
+
if (!retryError)
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
throw insertError;
|
|
106
|
+
}
|
|
36
107
|
});
|
|
37
108
|
}
|
|
38
109
|
/**
|
|
@@ -42,7 +113,21 @@ export class PluginModule {
|
|
|
42
113
|
*/
|
|
43
114
|
getSettings(defaultSettings) {
|
|
44
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
|
|
116
|
+
const storedSettings = yield this.fetchSettings();
|
|
117
|
+
if (!storedSettings) {
|
|
118
|
+
yield this.setSettings(defaultSettings);
|
|
119
|
+
return defaultSettings;
|
|
120
|
+
}
|
|
121
|
+
// Handle settings migration
|
|
122
|
+
const storedKeys = Object.keys(storedSettings);
|
|
123
|
+
const defaultKeys = Object.keys(defaultSettings);
|
|
124
|
+
if (storedKeys.length !== defaultKeys.length) {
|
|
125
|
+
const validStoredSettings = Object.fromEntries(Object.entries(storedSettings).filter(([key]) => defaultKeys.includes(key)));
|
|
126
|
+
const mergedSettings = Object.assign(Object.assign({}, defaultSettings), validStoredSettings);
|
|
127
|
+
yield this.setSettings(mergedSettings);
|
|
128
|
+
return mergedSettings;
|
|
129
|
+
}
|
|
130
|
+
return storedSettings;
|
|
46
131
|
});
|
|
47
132
|
}
|
|
48
133
|
/**
|
|
@@ -93,3 +178,14 @@ export class PluginModule {
|
|
|
93
178
|
});
|
|
94
179
|
}
|
|
95
180
|
}
|
|
181
|
+
export const LEARNING_REASONS = [
|
|
182
|
+
'work',
|
|
183
|
+
'partner',
|
|
184
|
+
'friends',
|
|
185
|
+
'study',
|
|
186
|
+
'living',
|
|
187
|
+
'culture',
|
|
188
|
+
'growth',
|
|
189
|
+
'citizenship',
|
|
190
|
+
'other',
|
|
191
|
+
];
|
package/package.json
CHANGED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { SupabaseClient } from '../plugin/CommunicationHandler';
|
|
2
|
-
import { LanguageLevel } from '../utils/difficultyConverter';
|
|
3
|
-
import { Guild } from '../plugin/CommunicationHandler';
|
|
4
|
-
export interface Buddy {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
description: string;
|
|
8
|
-
avatarUrl: string;
|
|
9
|
-
voiceId: string;
|
|
10
|
-
aiPersonality: string;
|
|
11
|
-
}
|
|
12
|
-
export interface Language {
|
|
13
|
-
code: string;
|
|
14
|
-
name: string;
|
|
15
|
-
native: string;
|
|
16
|
-
capitalized: string;
|
|
17
|
-
uppercase: string;
|
|
18
|
-
}
|
|
19
|
-
export type UserRole = 'user' | 'plugin_moderator' | 'lang_moderator' | 'admin';
|
|
20
|
-
export declare const LEARNING_REASONS: readonly ["work", "partner", "friends", "study", "living", "culture", "growth", "citizenship", "other"];
|
|
21
|
-
export type LearningReason = (typeof LEARNING_REASONS)[number];
|
|
22
|
-
export interface UserInfo {
|
|
23
|
-
/**
|
|
24
|
-
* The user's unique ID
|
|
25
|
-
*/
|
|
26
|
-
user_id: string;
|
|
27
|
-
skill_level_reading: LanguageLevel;
|
|
28
|
-
skill_level_writing: LanguageLevel;
|
|
29
|
-
skill_level_grammar: LanguageLevel;
|
|
30
|
-
skill_level_speaking: LanguageLevel;
|
|
31
|
-
skill_level_listening: LanguageLevel;
|
|
32
|
-
skill_level_understanding: LanguageLevel;
|
|
33
|
-
study_buddy: Buddy;
|
|
34
|
-
study_duration: number;
|
|
35
|
-
/**
|
|
36
|
-
* The language the user speaks natively.
|
|
37
|
-
*/
|
|
38
|
-
mother_tongue: Language;
|
|
39
|
-
/**
|
|
40
|
-
* The language the user targets to learn.
|
|
41
|
-
*/
|
|
42
|
-
target_language: Language;
|
|
43
|
-
/**
|
|
44
|
-
* Why the user is learning the language
|
|
45
|
-
*/
|
|
46
|
-
learning_reason: LearningReason;
|
|
47
|
-
/**
|
|
48
|
-
* Free-text personal interests
|
|
49
|
-
*/
|
|
50
|
-
personal_interests: string;
|
|
51
|
-
onboarding_completed: boolean;
|
|
52
|
-
context_menu_on_select: boolean;
|
|
53
|
-
user_name?: string;
|
|
54
|
-
/**
|
|
55
|
-
* ISO 3166-1 alpha-2 country code of user's target location (exposed to plugins)
|
|
56
|
-
*/
|
|
57
|
-
target_country: string;
|
|
58
|
-
/**
|
|
59
|
-
* Optional: nearest big city (>100,000) near user's location
|
|
60
|
-
*/
|
|
61
|
-
target_city?: string;
|
|
62
|
-
/**
|
|
63
|
-
* The user's role: 'user', 'plugin_moderator', 'lang_moderator', or 'admin'
|
|
64
|
-
*/
|
|
65
|
-
user_role: UserRole;
|
|
66
|
-
}
|
|
67
|
-
export declare class SettingsController {
|
|
68
|
-
private pluginId;
|
|
69
|
-
private supabase;
|
|
70
|
-
private guild;
|
|
71
|
-
constructor(supabase: SupabaseClient, pluginId: string, guild: Guild);
|
|
72
|
-
/**
|
|
73
|
-
* Fetches settings based on guild configuration.
|
|
74
|
-
* If guild doesn't allow user settings, fetches guild-level settings.
|
|
75
|
-
* Otherwise, fetches user-specific settings.
|
|
76
|
-
* @returns The settings object or null if not found.
|
|
77
|
-
*/
|
|
78
|
-
private fetchSettings;
|
|
79
|
-
/**
|
|
80
|
-
* Sets settings for the plugin.
|
|
81
|
-
* Automatically saves as guild settings if guild doesn't allow user settings,
|
|
82
|
-
* otherwise saves as user-specific settings.
|
|
83
|
-
* @param settings - The settings object to save.
|
|
84
|
-
* @throws {Error} if RLS blocks the operation.
|
|
85
|
-
*/
|
|
86
|
-
setSettings(settings: any): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Get the settings for the plugin. T can be any type of settings, UserSettings or SystemSettings.
|
|
89
|
-
* @param defaultSettings The default settings to use if no settings are found.
|
|
90
|
-
* @returns The settings for the plugin.
|
|
91
|
-
*/
|
|
92
|
-
getSettings<T extends object>(defaultSettings: T): Promise<T>;
|
|
93
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const LEARNING_REASONS = [
|
|
11
|
-
'work',
|
|
12
|
-
'partner',
|
|
13
|
-
'friends',
|
|
14
|
-
'study',
|
|
15
|
-
'living',
|
|
16
|
-
'culture',
|
|
17
|
-
'growth',
|
|
18
|
-
'citizenship',
|
|
19
|
-
'other',
|
|
20
|
-
];
|
|
21
|
-
export class SettingsController {
|
|
22
|
-
constructor(supabase, pluginId, guild) {
|
|
23
|
-
this.supabase = supabase;
|
|
24
|
-
this.pluginId = pluginId;
|
|
25
|
-
this.guild = guild;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Fetches settings based on guild configuration.
|
|
29
|
-
* If guild doesn't allow user settings, fetches guild-level settings.
|
|
30
|
-
* Otherwise, fetches user-specific settings.
|
|
31
|
-
* @returns The settings object or null if not found.
|
|
32
|
-
*/
|
|
33
|
-
fetchSettings() {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
var _a;
|
|
36
|
-
const isGuildSetting = !this.guild.allowUserPluginSettings;
|
|
37
|
-
const { data } = yield this.supabase
|
|
38
|
-
.schema('public')
|
|
39
|
-
.from('plugin_settings')
|
|
40
|
-
.select('*')
|
|
41
|
-
.eq('plugin_id', this.pluginId)
|
|
42
|
-
.eq('guild_id', this.guild.id)
|
|
43
|
-
.eq('is_guild_setting', isGuildSetting)
|
|
44
|
-
.maybeSingle();
|
|
45
|
-
return (_a = data === null || data === void 0 ? void 0 : data.settings) !== null && _a !== void 0 ? _a : null;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Sets settings for the plugin.
|
|
50
|
-
* Automatically saves as guild settings if guild doesn't allow user settings,
|
|
51
|
-
* otherwise saves as user-specific settings.
|
|
52
|
-
* @param settings - The settings object to save.
|
|
53
|
-
* @throws {Error} if RLS blocks the operation.
|
|
54
|
-
*/
|
|
55
|
-
setSettings(settings) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
var _a;
|
|
58
|
-
const isGuildSetting = !this.guild.allowUserPluginSettings;
|
|
59
|
-
const payload = {
|
|
60
|
-
plugin_id: this.pluginId,
|
|
61
|
-
settings,
|
|
62
|
-
guild_id: this.guild.id,
|
|
63
|
-
is_guild_setting: isGuildSetting,
|
|
64
|
-
};
|
|
65
|
-
if (isGuildSetting) {
|
|
66
|
-
payload.user_id = null;
|
|
67
|
-
}
|
|
68
|
-
// Try UPDATE first (safe with RLS). If nothing updated, INSERT.
|
|
69
|
-
const updateQuery = this.supabase
|
|
70
|
-
.schema('public')
|
|
71
|
-
.from('plugin_settings')
|
|
72
|
-
.update({ settings })
|
|
73
|
-
.eq('plugin_id', this.pluginId)
|
|
74
|
-
.eq('guild_id', this.guild.id)
|
|
75
|
-
.eq('is_guild_setting', isGuildSetting);
|
|
76
|
-
const { data: updatedRows, error: updateError } = yield (isGuildSetting
|
|
77
|
-
? updateQuery.is('user_id', null).select()
|
|
78
|
-
: updateQuery.select());
|
|
79
|
-
if (updateError) {
|
|
80
|
-
if (updateError.code === '42501' || ((_a = updateError.message) === null || _a === void 0 ? void 0 : _a.includes('policy'))) {
|
|
81
|
-
throw new Error(`Cannot set ${isGuildSetting ? 'guild' : 'user'} settings: Permission denied.`);
|
|
82
|
-
}
|
|
83
|
-
// proceed to try insert in case of other issues
|
|
84
|
-
}
|
|
85
|
-
if (updatedRows && updatedRows.length > 0) {
|
|
86
|
-
return; // updated successfully
|
|
87
|
-
}
|
|
88
|
-
// No row updated -> INSERT
|
|
89
|
-
const { error: insertError } = yield this.supabase.schema('public').from('plugin_settings').insert(payload);
|
|
90
|
-
if (insertError) {
|
|
91
|
-
// In case of race condition (duplicate), try one more UPDATE
|
|
92
|
-
if (insertError.code === '23505' /* unique_violation */) {
|
|
93
|
-
const retry = this.supabase
|
|
94
|
-
.schema('public')
|
|
95
|
-
.from('plugin_settings')
|
|
96
|
-
.update({ settings })
|
|
97
|
-
.eq('plugin_id', this.pluginId)
|
|
98
|
-
.eq('guild_id', this.guild.id)
|
|
99
|
-
.eq('is_guild_setting', isGuildSetting);
|
|
100
|
-
const { error: retryError } = yield (isGuildSetting ? retry.is('user_id', null) : retry);
|
|
101
|
-
if (!retryError)
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
throw insertError;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Get the settings for the plugin. T can be any type of settings, UserSettings or SystemSettings.
|
|
110
|
-
* @param defaultSettings The default settings to use if no settings are found.
|
|
111
|
-
* @returns The settings for the plugin.
|
|
112
|
-
*/
|
|
113
|
-
getSettings(defaultSettings) {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const storedSettings = (yield this.fetchSettings());
|
|
116
|
-
if (!storedSettings) {
|
|
117
|
-
yield this.setSettings(defaultSettings);
|
|
118
|
-
return defaultSettings;
|
|
119
|
-
}
|
|
120
|
-
// Handle settings migration
|
|
121
|
-
const storedKeys = Object.keys(storedSettings);
|
|
122
|
-
const defaultKeys = Object.keys(defaultSettings);
|
|
123
|
-
if (storedKeys.length !== defaultKeys.length) {
|
|
124
|
-
const validStoredSettings = Object.fromEntries(Object.entries(storedSettings).filter(([key]) => defaultKeys.includes(key)));
|
|
125
|
-
const mergedSettings = Object.assign(Object.assign({}, defaultSettings), validStoredSettings);
|
|
126
|
-
yield this.setSettings(mergedSettings);
|
|
127
|
-
return mergedSettings;
|
|
128
|
-
}
|
|
129
|
-
return storedSettings;
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|