@rimori/client 2.5.5-next.1 → 2.5.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.
@@ -28,36 +28,34 @@ export class SharedContentController {
28
28
  //this filter is there if the content should be filtered additionally by a column and value
29
29
  filter, options) {
30
30
  return __awaiter(this, void 0, void 0, function* () {
31
- var _a, _b, _c, _d, _e;
32
31
  // The db cache of the shared content is temporary disabled until the new shared content implementation is completed
33
- if (true) {
34
- let query = this.supabase
35
- .schema('public')
36
- .from('shared_content')
37
- .select('*, scc:shared_content_completed(id, state)')
38
- .eq('content_type', contentType)
39
- .not('scc.state', 'in', '("completed","ongoing","hidden")')
40
- .is('deleted_at', null);
41
- if ((_b = (_a = options === null || options === void 0 ? void 0 : options.excludeIds) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) {
42
- const excludeIds = (_d = (_c = options === null || options === void 0 ? void 0 : options.excludeIds) === null || _c === void 0 ? void 0 : _c.filter((id) => !id.startsWith('internal-temp-id-'))) !== null && _d !== void 0 ? _d : [];
43
- // Supabase expects raw PostgREST syntax like '("id1","id2")'.
44
- const excludeList = `(${(_e = excludeIds === null || excludeIds === void 0 ? void 0 : excludeIds.map((id) => `"${id}"`).join(',')) !== null && _e !== void 0 ? _e : ''})`;
45
- query = query.not('id', 'in', excludeList);
46
- }
47
- if (filter) {
48
- query.contains('data', filter);
49
- }
50
- const { data: newAssignments, error } = yield query.limit(30);
51
- if (error) {
52
- console.error('error fetching new assignments:', error);
53
- throw new Error('error fetching new assignments');
54
- }
55
- // console.log('newAssignments:', newAssignments);
56
- if (!(options === null || options === void 0 ? void 0 : options.alwaysGenerateNew) && newAssignments.length > 0) {
57
- const index = Math.floor(Math.random() * newAssignments.length);
58
- return newAssignments[index];
59
- }
60
- }
32
+ // if (false) {
33
+ // let query = this.supabase
34
+ // .from('shared_content')
35
+ // .select('*, scc:shared_content_completed(id, state)')
36
+ // .eq('content_type', contentType)
37
+ // .not('scc.state', 'in', '("completed","ongoing","hidden")')
38
+ // .is('deleted_at', null);
39
+ // if (options?.excludeIds?.length ?? 0 > 0) {
40
+ // const excludeIds = options.excludeIds.filter((id) => !id.startsWith('internal-temp-id-'));
41
+ // // Supabase expects raw PostgREST syntax like '("id1","id2")'.
42
+ // const excludeList = `(${excludeIds.map((id) => `"${id}"`).join(',')})`;
43
+ // query = query.not('id', 'in', excludeList);
44
+ // }
45
+ // if (filter) {
46
+ // query.contains('data', filter);
47
+ // }
48
+ // const { data: newAssignments, error } = await query.limit(30);
49
+ // if (error) {
50
+ // console.error('error fetching new assignments:', error);
51
+ // throw new Error('error fetching new assignments');
52
+ // }
53
+ // // console.log('newAssignments:', newAssignments);
54
+ // if (!options?.alwaysGenerateNew && newAssignments.length > 0) {
55
+ // const index = Math.floor(Math.random() * newAssignments.length);
56
+ // return newAssignments[index];
57
+ // }
58
+ // }
61
59
  const instructions = yield this.generateNewAssignment(contentType, generatorInstructions, filter);
62
60
  console.log('instructions:', instructions);
63
61
  //create the shared content object
@@ -101,7 +99,6 @@ export class SharedContentController {
101
99
  getCompletedTopics(contentType, filter) {
102
100
  return __awaiter(this, void 0, void 0, function* () {
103
101
  const query = this.supabase
104
- .schema('public')
105
102
  .from('shared_content')
106
103
  .select('title, keywords, scc:shared_content_completed(id)')
107
104
  .eq('content_type', contentType)
@@ -121,7 +118,6 @@ export class SharedContentController {
121
118
  getSharedContent(contentType, id) {
122
119
  return __awaiter(this, void 0, void 0, function* () {
123
120
  const { data, error } = yield this.supabase
124
- .schema('public')
125
121
  .from('shared_content')
126
122
  .select()
127
123
  .eq('content_type', contentType)
@@ -139,7 +135,6 @@ export class SharedContentController {
139
135
  return __awaiter(this, void 0, void 0, function* () {
140
136
  // Idempotent completion: upsert on (id, user_id) so repeated calls don't fail
141
137
  const { error } = yield this.supabase
142
- .schema('public')
143
138
  .from('shared_content_completed')
144
139
  .upsert({ content_type: contentType, id: assignmentId }, { onConflict: 'id' });
145
140
  if (error) {
@@ -169,10 +164,7 @@ export class SharedContentController {
169
164
  if (bookmarked !== undefined)
170
165
  payload.bookmarked = bookmarked;
171
166
  // Prefer upsert, fall back to insert/update if upsert not allowed
172
- const { error } = yield this.supabase
173
- .schema('public')
174
- .from('shared_content_completed')
175
- .upsert(payload, { onConflict: 'id' });
167
+ const { error } = yield this.supabase.from('shared_content_completed').upsert(payload, { onConflict: 'id' });
176
168
  if (error) {
177
169
  console.error('error updating shared content state:', error);
178
170
  throw new Error('error updating shared content state');
@@ -189,7 +181,6 @@ export class SharedContentController {
189
181
  getSharedContentList(contentType, filter, limit) {
190
182
  return __awaiter(this, void 0, void 0, function* () {
191
183
  const query = this.supabase
192
- .schema('public')
193
184
  .from('shared_content')
194
185
  .select('*')
195
186
  .eq('content_type', contentType)
@@ -220,7 +211,6 @@ export class SharedContentController {
220
211
  createSharedContent(_a) {
221
212
  return __awaiter(this, arguments, void 0, function* ({ contentType, title, keywords, data, privateTopic, }) {
222
213
  const { data: newContent, error } = yield this.supabase
223
- .schema('public')
224
214
  .from('shared_content')
225
215
  .insert({
226
216
  private: privateTopic,
@@ -258,7 +248,6 @@ export class SharedContentController {
258
248
  if (updates.privateTopic !== undefined)
259
249
  updateData.private = updates.privateTopic;
260
250
  const { data: updatedContent, error } = yield this.supabase
261
- .schema('public')
262
251
  .from('shared_content')
263
252
  .update(updateData)
264
253
  .eq('id', id)
@@ -282,7 +271,6 @@ export class SharedContentController {
282
271
  removeSharedContent(id) {
283
272
  return __awaiter(this, void 0, void 0, function* () {
284
273
  const { data: deletedContent, error } = yield this.supabase
285
- .schema('public')
286
274
  .from('shared_content')
287
275
  .update({ deleted_at: new Date().toISOString() })
288
276
  .eq('id', id)
@@ -32,7 +32,6 @@ export interface MenuEntry {
32
32
  action_key: string;
33
33
  text: string;
34
34
  iconUrl?: string;
35
- args?: Record<string, unknown>;
36
35
  }
37
36
  export type MainPanelAction = {
38
37
  plugin_id: string;
@@ -42,7 +41,6 @@ export interface ContextMenuAction {
42
41
  text: string;
43
42
  plugin_id: string;
44
43
  action_key: string;
45
- args?: Record<string, unknown>;
46
44
  }
47
45
  /**
48
46
  * Rimori plugin structure representing the complete configuration
@@ -81,7 +79,7 @@ export interface RimoriPluginConfig<T extends object = object> {
81
79
  /**
82
80
  * Context menu actions that the plugin registers to appear in right-click menus throughout the application.
83
81
  */
84
- context_menu_actions: Omit<MenuEntry, 'plugin_id' | 'args'>[];
82
+ context_menu_actions: Omit<MenuEntry, 'plugin_id'>[];
85
83
  /**
86
84
  * Documentation paths for different types of plugin documentation.
87
85
  */
@@ -64,7 +64,7 @@ export declare class EventModule {
64
64
  * @param actionKey The key of the action to trigger.
65
65
  * @param text Optional text to be used for the action like for example text that the translator would look up.
66
66
  */
67
- emitSidebarAction(pluginId: string, actionKey: string, text?: string, args?: Record<string, unknown>): void;
67
+ emitSidebarAction(pluginId: string, actionKey: string, text?: string): void;
68
68
  /**
69
69
  * Subscribe to main panel actions triggered by the user from the dashboard.
70
70
  * @param callback Handler function that receives the action data when a matching action is triggered.
@@ -102,8 +102,8 @@ export class EventModule {
102
102
  * @param actionKey The key of the action to trigger.
103
103
  * @param text Optional text to be used for the action like for example text that the translator would look up.
104
104
  */
105
- emitSidebarAction(pluginId, actionKey, text, args) {
106
- this.emit('global.sidebar.triggerAction', { plugin_id: pluginId, action_key: actionKey, text, args });
105
+ emitSidebarAction(pluginId, actionKey, text) {
106
+ this.emit('global.sidebar.triggerAction', { plugin_id: pluginId, action_key: actionKey, text });
107
107
  }
108
108
  /**
109
109
  * Subscribe to main panel actions triggered by the user from the dashboard.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.5.5-next.1",
3
+ "version": "2.5.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {