@rimori/client 2.2.0-next.2 → 2.2.0-next.3
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
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
The `@rimori/client` package is the framework-agnostic runtime and CLI that powers Rimori plugins. Use it inside plugin iframes, workers, and build scripts to access Rimori platform features such as database access, AI, shared content, and the event bus. All React-specific helpers and UI components are now published separately in `@rimori/react-client`.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
|
+
|
|
6
7
|
- [Overview](#overview)
|
|
7
8
|
- [Installation](#installation)
|
|
8
9
|
- [Relationship to @rimori/react-client](#relationship-to-rimori-react-client)
|
|
@@ -24,6 +25,7 @@ The `@rimori/client` package is the framework-agnostic runtime and CLI that powe
|
|
|
24
25
|
## Overview
|
|
25
26
|
|
|
26
27
|
`@rimori/client` gives you direct, typed access to the Rimori platform:
|
|
28
|
+
|
|
27
29
|
- Bootstrap authenticated plugin sessions and fetch Rimori context.
|
|
28
30
|
- Run Supabase queries against your plugin's dedicated schema.
|
|
29
31
|
- Call AI services for text, structured data, or voice.
|
|
@@ -54,18 +56,15 @@ npm install @rimori/react-client
|
|
|
54
56
|
Instantiate the client once in your application entry point and reuse it everywhere:
|
|
55
57
|
|
|
56
58
|
```ts
|
|
57
|
-
import { RimoriClient } from
|
|
59
|
+
import { RimoriClient } from '@rimori/client';
|
|
58
60
|
|
|
59
61
|
async function bootstrap() {
|
|
60
|
-
const client = await RimoriClient.getInstance(
|
|
62
|
+
const client = await RimoriClient.getInstance('your-plugin-id');
|
|
61
63
|
|
|
62
64
|
const user = client.plugin.getUserInfo();
|
|
63
|
-
const { data } = await client.db
|
|
64
|
-
.from("notes")
|
|
65
|
-
.select("*")
|
|
66
|
-
.eq("user_id", user.profile_id);
|
|
65
|
+
const { data } = await client.db.from('notes').select('*').eq('user_id', user.profile_id);
|
|
67
66
|
|
|
68
|
-
console.log(
|
|
67
|
+
console.log('Loaded notes', data);
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
bootstrap().catch(console.error);
|
|
@@ -127,10 +126,7 @@ Access metadata and settings through `client.plugin`:
|
|
|
127
126
|
`client.db` wraps the Supabase client that is scoped to your plugin tables:
|
|
128
127
|
|
|
129
128
|
```ts
|
|
130
|
-
const { data, error } = await client.db
|
|
131
|
-
.from("study_sessions")
|
|
132
|
-
.select("*")
|
|
133
|
-
.order("completed_at", { ascending: false });
|
|
129
|
+
const { data, error } = await client.db.from('study_sessions').select('*').order('completed_at', { ascending: false });
|
|
134
130
|
```
|
|
135
131
|
|
|
136
132
|
Helpers:
|
|
@@ -196,7 +192,7 @@ Import additional helpers as needed:
|
|
|
196
192
|
All exports are fully typed. You can import the type definitions directly:
|
|
197
193
|
|
|
198
194
|
```ts
|
|
199
|
-
import type { Message, Tool, SharedContent, MacroAccomplishmentPayload } from
|
|
195
|
+
import type { Message, Tool, SharedContent, MacroAccomplishmentPayload } from '@rimori/client';
|
|
200
196
|
```
|
|
201
197
|
|
|
202
198
|
The generated declaration files cover every controller and helper to keep plugins strictly typed.
|
|
@@ -206,7 +202,7 @@ The generated declaration files cover every controller and helper to keep plugin
|
|
|
206
202
|
React users should install `@rimori/react-client` and wrap their app:
|
|
207
203
|
|
|
208
204
|
```tsx
|
|
209
|
-
import { PluginProvider, useRimori, useChat } from
|
|
205
|
+
import { PluginProvider, useRimori, useChat } from '@rimori/react-client';
|
|
210
206
|
|
|
211
207
|
function Dashboard() {
|
|
212
208
|
const client = useRimori();
|
|
@@ -27,6 +27,17 @@ export interface RimoriInfo {
|
|
|
27
27
|
mainPanelPlugin?: ActivePlugin;
|
|
28
28
|
sidePanelPlugin?: ActivePlugin;
|
|
29
29
|
interfaceLanguage: string;
|
|
30
|
+
/**
|
|
31
|
+
* The release channel of the plugin installation.
|
|
32
|
+
*/
|
|
33
|
+
releaseChannel: 'alpha' | 'beta' | 'stable';
|
|
34
|
+
/**
|
|
35
|
+
* The database schema to use for plugin tables.
|
|
36
|
+
* Determined by rimori-main based on release channel:
|
|
37
|
+
* - 'plugins_alpha' for alpha release channel
|
|
38
|
+
* - 'plugins' for beta and stable release channels
|
|
39
|
+
*/
|
|
40
|
+
dbSchema: 'plugins' | 'plugins_alpha';
|
|
30
41
|
}
|
|
31
42
|
export declare class RimoriCommunicationHandler {
|
|
32
43
|
private port;
|
|
@@ -22,6 +22,11 @@ export declare class RimoriClient {
|
|
|
22
22
|
private constructor();
|
|
23
23
|
get plugin(): {
|
|
24
24
|
pluginId: string;
|
|
25
|
+
/**
|
|
26
|
+
* The release channel of this plugin installation.
|
|
27
|
+
* Determines which database schema is used for plugin tables.
|
|
28
|
+
*/
|
|
29
|
+
releaseChannel: "alpha" | "beta" | "stable";
|
|
25
30
|
/**
|
|
26
31
|
* Set the settings for the plugin.
|
|
27
32
|
* @param settings The settings to set.
|
|
@@ -67,6 +72,13 @@ export declare class RimoriClient {
|
|
|
67
72
|
* The table prefix for of database tables of the plugin.
|
|
68
73
|
*/
|
|
69
74
|
tablePrefix: string;
|
|
75
|
+
/**
|
|
76
|
+
* The database schema used for plugin tables.
|
|
77
|
+
* Determined by rimori-main based on release channel:
|
|
78
|
+
* - 'plugins_alpha' for alpha release channel
|
|
79
|
+
* - 'plugins' for beta and stable release channels
|
|
80
|
+
*/
|
|
81
|
+
schema: "plugins" | "plugins_alpha";
|
|
70
82
|
/**
|
|
71
83
|
* Get the table name for a given plugin table.
|
|
72
84
|
* Internally all tables are prefixed with the plugin id. This function is used to get the correct table name for a given public table.
|
|
@@ -287,6 +287,11 @@ export class RimoriClient {
|
|
|
287
287
|
get plugin() {
|
|
288
288
|
return {
|
|
289
289
|
pluginId: this.rimoriInfo.pluginId,
|
|
290
|
+
/**
|
|
291
|
+
* The release channel of this plugin installation.
|
|
292
|
+
* Determines which database schema is used for plugin tables.
|
|
293
|
+
*/
|
|
294
|
+
releaseChannel: this.rimoriInfo.releaseChannel,
|
|
290
295
|
/**
|
|
291
296
|
* Set the settings for the plugin.
|
|
292
297
|
* @param settings The settings to set.
|
|
@@ -340,15 +345,15 @@ export class RimoriClient {
|
|
|
340
345
|
// ): PostgrestQueryBuilder<GenericSchema, View, ViewName>;
|
|
341
346
|
from: (relation) => {
|
|
342
347
|
const tableName = this.db.getTableName(relation);
|
|
343
|
-
// Use
|
|
348
|
+
// Use the schema determined by rimori-main based on release channel
|
|
344
349
|
// Global tables (starting with 'global_') remain in public schema
|
|
345
|
-
// Plugin tables
|
|
350
|
+
// Plugin tables use the schema provided by rimori-main (plugins or plugins_alpha)
|
|
346
351
|
if (relation.startsWith('global_')) {
|
|
347
352
|
// Global tables stay in public schema
|
|
348
353
|
return this.superbase.from(tableName);
|
|
349
354
|
}
|
|
350
|
-
//
|
|
351
|
-
return this.superbase.schema(
|
|
355
|
+
// Plugin tables go to the schema provided by rimori-main
|
|
356
|
+
return this.superbase.schema(this.rimoriInfo.dbSchema).from(tableName);
|
|
352
357
|
},
|
|
353
358
|
// storage: this.superbase.storage,
|
|
354
359
|
// functions: this.superbase.functions,
|
|
@@ -356,6 +361,13 @@ export class RimoriClient {
|
|
|
356
361
|
* The table prefix for of database tables of the plugin.
|
|
357
362
|
*/
|
|
358
363
|
tablePrefix: this.rimoriInfo.tablePrefix,
|
|
364
|
+
/**
|
|
365
|
+
* The database schema used for plugin tables.
|
|
366
|
+
* Determined by rimori-main based on release channel:
|
|
367
|
+
* - 'plugins_alpha' for alpha release channel
|
|
368
|
+
* - 'plugins' for beta and stable release channels
|
|
369
|
+
*/
|
|
370
|
+
schema: this.rimoriInfo.dbSchema,
|
|
359
371
|
/**
|
|
360
372
|
* Get the table name for a given plugin table.
|
|
361
373
|
* Internally all tables are prefixed with the plugin id. This function is used to get the correct table name for a given public table.
|
package/package.json
CHANGED
|
@@ -33,6 +33,17 @@ export interface RimoriInfo {
|
|
|
33
33
|
mainPanelPlugin?: ActivePlugin;
|
|
34
34
|
sidePanelPlugin?: ActivePlugin;
|
|
35
35
|
interfaceLanguage: string;
|
|
36
|
+
/**
|
|
37
|
+
* The release channel of the plugin installation.
|
|
38
|
+
*/
|
|
39
|
+
releaseChannel: 'alpha' | 'beta' | 'stable';
|
|
40
|
+
/**
|
|
41
|
+
* The database schema to use for plugin tables.
|
|
42
|
+
* Determined by rimori-main based on release channel:
|
|
43
|
+
* - 'plugins_alpha' for alpha release channel
|
|
44
|
+
* - 'plugins' for beta and stable release channels
|
|
45
|
+
*/
|
|
46
|
+
dbSchema: 'plugins' | 'plugins_alpha';
|
|
36
47
|
}
|
|
37
48
|
|
|
38
49
|
export class RimoriCommunicationHandler {
|
|
@@ -55,6 +55,11 @@ export class RimoriClient {
|
|
|
55
55
|
public get plugin() {
|
|
56
56
|
return {
|
|
57
57
|
pluginId: this.rimoriInfo.pluginId,
|
|
58
|
+
/**
|
|
59
|
+
* The release channel of this plugin installation.
|
|
60
|
+
* Determines which database schema is used for plugin tables.
|
|
61
|
+
*/
|
|
62
|
+
releaseChannel: this.rimoriInfo.releaseChannel,
|
|
58
63
|
/**
|
|
59
64
|
* Set the settings for the plugin.
|
|
60
65
|
* @param settings The settings to set.
|
|
@@ -124,15 +129,15 @@ export class RimoriClient {
|
|
|
124
129
|
relation: string,
|
|
125
130
|
): PostgrestQueryBuilder<GenericSchema, View, ViewName> => {
|
|
126
131
|
const tableName = this.db.getTableName(relation);
|
|
127
|
-
// Use
|
|
132
|
+
// Use the schema determined by rimori-main based on release channel
|
|
128
133
|
// Global tables (starting with 'global_') remain in public schema
|
|
129
|
-
// Plugin tables
|
|
134
|
+
// Plugin tables use the schema provided by rimori-main (plugins or plugins_alpha)
|
|
130
135
|
if (relation.startsWith('global_')) {
|
|
131
136
|
// Global tables stay in public schema
|
|
132
137
|
return this.superbase.from(tableName);
|
|
133
138
|
}
|
|
134
|
-
//
|
|
135
|
-
return this.superbase.schema(
|
|
139
|
+
// Plugin tables go to the schema provided by rimori-main
|
|
140
|
+
return this.superbase.schema(this.rimoriInfo.dbSchema).from(tableName);
|
|
136
141
|
},
|
|
137
142
|
// storage: this.superbase.storage,
|
|
138
143
|
// functions: this.superbase.functions,
|
|
@@ -140,6 +145,13 @@ export class RimoriClient {
|
|
|
140
145
|
* The table prefix for of database tables of the plugin.
|
|
141
146
|
*/
|
|
142
147
|
tablePrefix: this.rimoriInfo.tablePrefix,
|
|
148
|
+
/**
|
|
149
|
+
* The database schema used for plugin tables.
|
|
150
|
+
* Determined by rimori-main based on release channel:
|
|
151
|
+
* - 'plugins_alpha' for alpha release channel
|
|
152
|
+
* - 'plugins' for beta and stable release channels
|
|
153
|
+
*/
|
|
154
|
+
schema: this.rimoriInfo.dbSchema,
|
|
143
155
|
/**
|
|
144
156
|
* Get the table name for a given plugin table.
|
|
145
157
|
* Internally all tables are prefixed with the plugin id. This function is used to get the correct table name for a given public table.
|