@rimori/client 1.1.5 → 1.1.7
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/README.md +1 -1
- package/dist/controller/SharedContentController.d.ts +3 -1
- package/dist/controller/SharedContentController.js +1 -1
- package/dist/plugin/RimoriClient.d.ts +4 -4
- package/dist/plugin/RimoriClient.js +5 -5
- package/dist/plugin/StandaloneClient.js +2 -1
- package/package.json +1 -1
- package/src/controller/SharedContentController.ts +4 -1
- package/src/plugin/RimoriClient.ts +6 -6
- package/src/plugin/StandaloneClient.ts +2 -1
package/README.md
CHANGED
|
@@ -576,7 +576,7 @@ community.sharedContent.getList<T>(contentType: string, filter?: SharedContentFi
|
|
|
576
576
|
community.sharedContent.getNew<T>(contentType: string, instructions: SharedContentObjectRequest, filter?: SharedContentFilter, privateTopic?: boolean): Promise<BasicAssignment<T>>
|
|
577
577
|
community.sharedContent.create<T>(content: SharedContent<T>): Promise<BasicAssignment<T>>
|
|
578
578
|
community.sharedContent.update<T>(id: string, content: Partial<SharedContent<T>>): Promise<BasicAssignment<T>>
|
|
579
|
-
community.sharedContent.
|
|
579
|
+
community.sharedContent.remove(id: string): Promise<BasicAssignment<any>>
|
|
580
580
|
community.sharedContent.complete(contentType: string, assignmentId: string): Promise<void>
|
|
581
581
|
```
|
|
582
582
|
|
|
@@ -65,13 +65,15 @@ export declare class SharedContentController {
|
|
|
65
65
|
* @returns The deleted shared content record.
|
|
66
66
|
* @throws {Error} if deletion fails or content not found.
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
removeSharedContent(id: string): Promise<BasicAssignment<any>>;
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Interface representing shared content in the system.
|
|
72
72
|
* @template T The type of data stored in the content
|
|
73
73
|
*/
|
|
74
74
|
export interface SharedContent<T> {
|
|
75
|
+
/** The id of the content */
|
|
76
|
+
id: string;
|
|
75
77
|
/** The type/category of the content (e.g. 'grammar_exercises', 'flashcards', etc.) */
|
|
76
78
|
contentType: string;
|
|
77
79
|
/** The human readable title/topic of the content */
|
|
@@ -196,7 +196,7 @@ export class SharedContentController {
|
|
|
196
196
|
* @returns The deleted shared content record.
|
|
197
197
|
* @throws {Error} if deletion fails or content not found.
|
|
198
198
|
*/
|
|
199
|
-
|
|
199
|
+
removeSharedContent(id) {
|
|
200
200
|
return __awaiter(this, void 0, void 0, function* () {
|
|
201
201
|
const { data: deletedContent, error } = yield this.supabase
|
|
202
202
|
.from("shared_content")
|
|
@@ -173,11 +173,11 @@ export declare class RimoriClient {
|
|
|
173
173
|
*/
|
|
174
174
|
complete: (contentType: string, assignmentId: string) => Promise<void>;
|
|
175
175
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @param id The id of the shared content item to
|
|
178
|
-
* @returns The
|
|
176
|
+
* Remove a shared content item.
|
|
177
|
+
* @param id The id of the shared content item to remove.
|
|
178
|
+
* @returns The removed shared content item.
|
|
179
179
|
*/
|
|
180
|
-
|
|
180
|
+
remove: (id: string) => Promise<BasicAssignment<any>>;
|
|
181
181
|
};
|
|
182
182
|
};
|
|
183
183
|
}
|
|
@@ -178,12 +178,12 @@ export class RimoriClient {
|
|
|
178
178
|
return yield this.sharedContentController.completeSharedContent(contentType, assignmentId);
|
|
179
179
|
}),
|
|
180
180
|
/**
|
|
181
|
-
*
|
|
182
|
-
* @param id The id of the shared content item to
|
|
183
|
-
* @returns The
|
|
181
|
+
* Remove a shared content item.
|
|
182
|
+
* @param id The id of the shared content item to remove.
|
|
183
|
+
* @returns The removed shared content item.
|
|
184
184
|
*/
|
|
185
|
-
|
|
186
|
-
return yield this.sharedContentController.
|
|
185
|
+
remove: (id) => __awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
return yield this.sharedContentController.removeSharedContent(id);
|
|
187
187
|
})
|
|
188
188
|
}
|
|
189
189
|
};
|
|
@@ -18,12 +18,13 @@ export class StandaloneClient {
|
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
if (!StandaloneClient.instance) {
|
|
20
20
|
const config = yield fetch("http://localhost:3000/config.json").then(res => res.json()).catch(err => {
|
|
21
|
-
console.
|
|
21
|
+
console.warn("Error fetching config.json, using default values", err);
|
|
22
22
|
return {
|
|
23
23
|
SUPABASE_URL: "https://pheptqdoqsdnadgoihvr.supabase.co",
|
|
24
24
|
SUPABASE_ANON_KEY: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBoZXB0cWRvcXNkbmFkZ29paHZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzE2OTY2ODcsImV4cCI6MjA0NzI3MjY4N30.4GPFAXTF8685FaXISdAPNCIM-H3RGLo8GbyhQpu1mP0",
|
|
25
25
|
};
|
|
26
26
|
});
|
|
27
|
+
console.log("config", config);
|
|
27
28
|
StandaloneClient.instance = new StandaloneClient({ url: config.SUPABASE_URL, key: config.SUPABASE_ANON_KEY });
|
|
28
29
|
}
|
|
29
30
|
return StandaloneClient.instance;
|
package/package.json
CHANGED
|
@@ -230,7 +230,7 @@ export class SharedContentController {
|
|
|
230
230
|
* @returns The deleted shared content record.
|
|
231
231
|
* @throws {Error} if deletion fails or content not found.
|
|
232
232
|
*/
|
|
233
|
-
public async
|
|
233
|
+
public async removeSharedContent(id: string): Promise<BasicAssignment<any>> {
|
|
234
234
|
const { data: deletedContent, error } = await this.supabase
|
|
235
235
|
.from("shared_content")
|
|
236
236
|
.update({ deleted_at: new Date().toISOString() })
|
|
@@ -255,6 +255,9 @@ export class SharedContentController {
|
|
|
255
255
|
* @template T The type of data stored in the content
|
|
256
256
|
*/
|
|
257
257
|
export interface SharedContent<T> {
|
|
258
|
+
/** The id of the content */
|
|
259
|
+
id: string;
|
|
260
|
+
|
|
258
261
|
/** The type/category of the content (e.g. 'grammar_exercises', 'flashcards', etc.) */
|
|
259
262
|
contentType: string;
|
|
260
263
|
|
|
@@ -25,7 +25,7 @@ interface Db {
|
|
|
25
25
|
<ViewName extends string & keyof GenericSchema['Views'], View extends GenericSchema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<GenericSchema, View, ViewName>;
|
|
26
26
|
};
|
|
27
27
|
storage: SupabaseClient["storage"];
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
// functions: SupabaseClient["functions"];
|
|
30
30
|
/**
|
|
31
31
|
* The table prefix for of database tables of the plugin.
|
|
@@ -295,12 +295,12 @@ export class RimoriClient {
|
|
|
295
295
|
return await this.sharedContentController.completeSharedContent(contentType, assignmentId);
|
|
296
296
|
},
|
|
297
297
|
/**
|
|
298
|
-
*
|
|
299
|
-
* @param id The id of the shared content item to
|
|
300
|
-
* @returns The
|
|
298
|
+
* Remove a shared content item.
|
|
299
|
+
* @param id The id of the shared content item to remove.
|
|
300
|
+
* @returns The removed shared content item.
|
|
301
301
|
*/
|
|
302
|
-
|
|
303
|
-
return await this.sharedContentController.
|
|
302
|
+
remove: async (id: string): Promise<BasicAssignment<any>> => {
|
|
303
|
+
return await this.sharedContentController.removeSharedContent(id);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
}
|
|
@@ -19,12 +19,13 @@ export class StandaloneClient {
|
|
|
19
19
|
public static async getInstance(): Promise<StandaloneClient> {
|
|
20
20
|
if (!StandaloneClient.instance) {
|
|
21
21
|
const config = await fetch("http://localhost:3000/config.json").then(res => res.json()).catch(err => {
|
|
22
|
-
console.
|
|
22
|
+
console.warn("Error fetching config.json, using default values", err);
|
|
23
23
|
return {
|
|
24
24
|
SUPABASE_URL: "https://pheptqdoqsdnadgoihvr.supabase.co",
|
|
25
25
|
SUPABASE_ANON_KEY: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBoZXB0cWRvcXNkbmFkZ29paHZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzE2OTY2ODcsImV4cCI6MjA0NzI3MjY4N30.4GPFAXTF8685FaXISdAPNCIM-H3RGLo8GbyhQpu1mP0",
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
+
console.log("config", config);
|
|
28
29
|
StandaloneClient.instance = new StandaloneClient({ url: config.SUPABASE_URL, key: config.SUPABASE_ANON_KEY });
|
|
29
30
|
}
|
|
30
31
|
return StandaloneClient.instance;
|