@rimori/client 2.5.6 → 2.5.7-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.
@@ -89,8 +89,8 @@ export interface DbNormalTableDefinition {
89
89
  * Shared content table schema definition.
90
90
  * Defines the structure for community-shared content tables with automatic columns and verification.
91
91
  * Table naming: {pluginId}_sc_{table_name}
92
- * Automatic columns: title (text), keywords (text[]), verified (boolean), embedding (vector)
93
- * Hardcoded permissions: read ALL public+own, insert/update/delete OWN
92
+ * Automatic columns: title (text), keywords (text[]), content_status (text: featured/community/unverified), embedding (vector)
93
+ * Hardcoded permissions: read ALL public verified (community/featured) + own, insert/update/delete OWN
94
94
  */
95
95
  export interface DbSharedContentTableDefinition {
96
96
  /** Type discriminator for shared content tables */
@@ -101,7 +101,7 @@ export interface DbSharedContentTableDefinition {
101
101
  description: string;
102
102
  /** AI prompt for generating content. Supports placeholders like {{topic}}, {{level}}, etc. */
103
103
  instructions: string;
104
- /** Optional AI prompt to verify content quality before marking as verified */
104
+ /** Optional AI prompt to verify content quality and set content_status to 'community' */
105
105
  verification_prompt: string;
106
106
  /** Column definitions for the table (excluding auto-generated columns) */
107
107
  columns: {
@@ -18,6 +18,10 @@ export interface Language {
18
18
  }
19
19
  export type UserRole = 'user' | 'plugin_moderator' | 'lang_moderator' | 'admin';
20
20
  export interface UserInfo {
21
+ /**
22
+ * The user's unique ID
23
+ */
24
+ user_id: string;
21
25
  skill_level_reading: LanguageLevel;
22
26
  skill_level_writing: LanguageLevel;
23
27
  skill_level_grammar: LanguageLevel;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { setupWorker } from './worker/WorkerSetup';
9
9
  export { AudioController } from './controller/AudioController';
10
10
  export { Translator } from './controller/TranslationController';
11
11
  export type { TOptions } from 'i18next';
12
- export type { SharedContent, BasicSharedContent } from './plugin/module/SharedContentController';
12
+ export type { SharedContent, BasicSharedContent, ContentStatus } from './plugin/module/SharedContentController';
13
13
  export type { Exercise } from './plugin/module/ExerciseModule';
14
14
  export type { UserInfo, Language, UserRole } from './controller/SettingsController';
15
15
  export type { Message, ToolInvocation } from './controller/AIController';
@@ -2,11 +2,12 @@ import { ObjectTool } from '../../fromRimori/PluginTypes';
2
2
  import { SupabaseClient } from '../CommunicationHandler';
3
3
  import { RimoriClient } from '../RimoriClient';
4
4
  export type SharedContent<T> = BasicSharedContent & T;
5
+ export type ContentStatus = 'featured' | 'community' | 'unverified';
5
6
  export interface BasicSharedContent {
6
7
  id: string;
7
8
  title: string;
8
9
  keywords: string[];
9
- verified: boolean;
10
+ content_status: ContentStatus;
10
11
  created_by: string;
11
12
  created_at: string;
12
13
  guild_id: string | null;
@@ -38,6 +39,7 @@ export declare class SharedContentController {
38
39
  * @param params.customFields - Custom field values for AI-generated content (e.g., {topic_category: "history"})
39
40
  * @param params.skipDbSave - If true, don't save generated content to database
40
41
  * @param params.isPrivate - If true, content is guild-specific
42
+ * @param params.ignoreSkillLevel - If true, don't filter by skill level or add skill level guidance to AI instructions
41
43
  * @returns Existing or newly generated shared content item
42
44
  */
43
45
  getNew<T>(params: {
@@ -52,6 +54,7 @@ export declare class SharedContentController {
52
54
  tool?: ObjectTool;
53
55
  skipDbSave?: boolean;
54
56
  isPrivate?: boolean;
57
+ ignoreSkillLevel?: boolean;
55
58
  }): Promise<SharedContent<T>>;
56
59
  /**
57
60
  * Search for shared content by topic using RAG (semantic similarity).
@@ -116,6 +119,13 @@ export declare class SharedContentController {
116
119
  * @returns The shared content item
117
120
  */
118
121
  get<T = any>(tableName: string, contentId: string): Promise<SharedContent<T>>;
122
+ /**
123
+ * Fetch all shared content items.
124
+ * @param tableName - Name of the shared content table
125
+ * @param limit - Maximum number of results (default: 100)
126
+ * @returns Array of all shared content items
127
+ */
128
+ getAll<T = any>(tableName: string, limit?: number): Promise<SharedContent<T>[]>;
119
129
  /**
120
130
  * Create new shared content manually.
121
131
  * @param tableName - Name of the shared content table
@@ -26,6 +26,7 @@ export class SharedContentController {
26
26
  * @param params.customFields - Custom field values for AI-generated content (e.g., {topic_category: "history"})
27
27
  * @param params.skipDbSave - If true, don't save generated content to database
28
28
  * @param params.isPrivate - If true, content is guild-specific
29
+ * @param params.ignoreSkillLevel - If true, don't filter by skill level or add skill level guidance to AI instructions
29
30
  * @returns Existing or newly generated shared content item
30
31
  */
31
32
  getNew(params) {
@@ -44,6 +45,7 @@ export class SharedContentController {
44
45
  options: {
45
46
  skipDbSave: params.skipDbSave,
46
47
  isPrivate: params.isPrivate,
48
+ ignoreSkillLevel: params.ignoreSkillLevel,
47
49
  },
48
50
  }),
49
51
  });
@@ -246,6 +248,23 @@ export class SharedContentController {
246
248
  return data;
247
249
  });
248
250
  }
251
+ /**
252
+ * Fetch all shared content items.
253
+ * @param tableName - Name of the shared content table
254
+ * @param limit - Maximum number of results (default: 100)
255
+ * @returns Array of all shared content items
256
+ */
257
+ getAll(tableName_1) {
258
+ return __awaiter(this, arguments, void 0, function* (tableName, limit = 100) {
259
+ const fullTableName = this.getTableName(tableName);
260
+ const { data, error } = yield this.supabase.from(fullTableName).select('*').limit(limit);
261
+ if (error) {
262
+ console.error('Error fetching all shared content:', error);
263
+ throw new Error('Error fetching all shared content');
264
+ }
265
+ return (data || []);
266
+ });
267
+ }
249
268
  /**
250
269
  * Create new shared content manually.
251
270
  * @param tableName - Name of the shared content table
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.5.6",
3
+ "version": "2.5.7-next.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {