@rool-dev/client 0.3.1-dev.ff91c85 → 0.4.0-dev.22f8ef0
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 +189 -84
- package/dist/client.d.ts +29 -26
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +90 -88
- package/dist/client.js.map +1 -1
- package/dist/graphql.d.ts +16 -16
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +71 -90
- package/dist/graphql.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/media.d.ts +7 -7
- package/dist/media.js +14 -14
- package/dist/space.d.ts +256 -0
- package/dist/space.d.ts.map +1 -0
- package/dist/space.js +730 -0
- package/dist/space.js.map +1 -0
- package/dist/subscription.d.ts +2 -2
- package/dist/subscription.d.ts.map +1 -1
- package/dist/subscription.js +14 -17
- package/dist/subscription.js.map +1 -1
- package/dist/types.d.ts +101 -57
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/dist/graph.d.ts +0 -242
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js +0 -592
- package/dist/graph.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Rool Client
|
|
2
2
|
|
|
3
|
-
TypeScript client
|
|
3
|
+
The TypeScript client for Rool Spaces, a persistent and collaborative environment for organizing objects and their relationships.
|
|
4
|
+
|
|
5
|
+
Rool Spaces enables you to build applications where AI operates on a structured world model rather than a text conversation. The context for all AI operations is the full object graph, allowing the system to reason about, update, and expand the state of your application directly.
|
|
6
|
+
|
|
7
|
+
Use Rool to programmatically instruct agents to generate content, research topics, or reorganize data. The client manages authentication, real-time synchronization, and media storage, supporting both single-user and multi-user workflows.
|
|
4
8
|
|
|
5
9
|
## Installation
|
|
6
10
|
|
|
@@ -13,33 +17,47 @@ npm install @rool-dev/client
|
|
|
13
17
|
```typescript
|
|
14
18
|
import { RoolClient } from '@rool-dev/client';
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
client
|
|
20
|
+
// Initialize client
|
|
21
|
+
const client = new RoolClient({
|
|
22
|
+
baseUrl: 'https://api.rool.dev',
|
|
23
|
+
});
|
|
18
24
|
|
|
19
25
|
if (!client.isAuthenticated()) {
|
|
20
26
|
client.login(); // Redirects to auth page
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
//
|
|
24
|
-
await client.
|
|
29
|
+
// Open an existing space
|
|
30
|
+
const space = await client.openSpace('abc1234');
|
|
31
|
+
|
|
32
|
+
// Create a new space
|
|
33
|
+
const newSpace = await client.createSpace('My New Space');
|
|
25
34
|
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
graph.subscribe(); // Listen for real-time updates
|
|
35
|
+
// Subscribe to real-time updates
|
|
36
|
+
space.subscribe();
|
|
29
37
|
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
// Listen for space changes
|
|
39
|
+
space.on('objectCreated', ({ object }) => {
|
|
40
|
+
console.log('New object:', object);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
space.on('linked', ({ sourceId, targetId }) => {
|
|
44
|
+
console.log('New link:', sourceId, '->', targetId);
|
|
45
|
+
});
|
|
33
46
|
|
|
34
|
-
//
|
|
35
|
-
|
|
47
|
+
// Make changes (automatically synced)
|
|
48
|
+
await space.createObject({
|
|
49
|
+
data: { type: 'note', text: 'Hello World' }
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Create a link between objects
|
|
53
|
+
await space.link('id', 'object2', 'connection');
|
|
36
54
|
|
|
37
55
|
// Undo/redo support
|
|
38
|
-
await
|
|
39
|
-
await
|
|
56
|
+
await space.undo();
|
|
57
|
+
await space.redo();
|
|
40
58
|
|
|
41
59
|
// Clean up
|
|
42
|
-
|
|
60
|
+
space.close();
|
|
43
61
|
```
|
|
44
62
|
|
|
45
63
|
## Configuration
|
|
@@ -118,24 +136,24 @@ const client = new RoolClient({
|
|
|
118
136
|
| `login(): void` | Redirect to login page |
|
|
119
137
|
| `logout(): void` | Clear tokens and state |
|
|
120
138
|
| `isAuthenticated(): boolean` | Check auth status |
|
|
121
|
-
| `getToken(): Promise<string
|
|
139
|
+
| `getToken(): Promise<string | undefined>` | Get current access token |
|
|
122
140
|
| `getUser(): UserInfo` | Get user info from JWT (`{ email, name }`) |
|
|
123
141
|
|
|
124
|
-
###
|
|
142
|
+
### Space Lifecycle
|
|
125
143
|
|
|
126
144
|
| Method | Description |
|
|
127
145
|
|--------|-------------|
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
146
|
+
| `listSpaces(): Promise<RoolSpaceInfo[]>` | List available spaces |
|
|
147
|
+
| `openSpace(id): Promise<RoolSpace>` | Open a space for editing |
|
|
148
|
+
| `createSpace(name?): Promise<RoolSpace>` | Create a new space |
|
|
149
|
+
| `deleteSpace(id): Promise<void>` | Delete a space |
|
|
132
150
|
|
|
133
151
|
### Account & Users
|
|
134
152
|
|
|
135
153
|
| Method | Description |
|
|
136
154
|
|--------|-------------|
|
|
137
155
|
| `getAccount(): Promise<Account>` | Get account info (plan, credits) |
|
|
138
|
-
| `searchUser(email): Promise<UserResult
|
|
156
|
+
| `searchUser(email): Promise<UserResult | null>` | Search user by email |
|
|
139
157
|
|
|
140
158
|
### Subscriptions
|
|
141
159
|
|
|
@@ -158,26 +176,26 @@ const client = new RoolClient({
|
|
|
158
176
|
|
|
159
177
|
```typescript
|
|
160
178
|
client.on('authStateChanged', (authenticated: boolean) => void)
|
|
161
|
-
client.on('
|
|
162
|
-
client.on('
|
|
163
|
-
client.on('
|
|
179
|
+
client.on('spaceCreated', (spaceId: string) => void)
|
|
180
|
+
client.on('spaceDeleted', (spaceId: string) => void)
|
|
181
|
+
client.on('spaceRenamed', (spaceId: string, newName: string) => void)
|
|
164
182
|
client.on('connectionStateChanged', (state: 'connected' | 'disconnected' | 'reconnecting') => void)
|
|
165
183
|
client.on('error', (error: Error, context?: string) => void)
|
|
166
184
|
```
|
|
167
185
|
|
|
168
186
|
---
|
|
169
187
|
|
|
170
|
-
##
|
|
188
|
+
## RoolSpace API
|
|
171
189
|
|
|
172
|
-
|
|
190
|
+
Spaces are first-class objects with built-in undo/redo, event emission, and real-time sync.
|
|
173
191
|
|
|
174
192
|
### Properties
|
|
175
193
|
|
|
176
194
|
| Property | Description |
|
|
177
195
|
|----------|-------------|
|
|
178
|
-
| `id: string` |
|
|
179
|
-
| `name: string` |
|
|
180
|
-
| `role:
|
|
196
|
+
| `id: string` | Space ID |
|
|
197
|
+
| `name: string` | Space name |
|
|
198
|
+
| `role: RoolUserRole` | User's role (`'owner' | 'editor' | 'viewer'`) |
|
|
181
199
|
| `isReadOnly(): boolean` | True if viewer role |
|
|
182
200
|
| `isSubscribed(): boolean` | True if receiving real-time updates |
|
|
183
201
|
|
|
@@ -188,7 +206,7 @@ Graphs are first-class objects with built-in undo/redo, event emission, and real
|
|
|
188
206
|
| `subscribe(): void` | Call after opening. Start receiving real-time updates from other clients. |
|
|
189
207
|
| `unsubscribe(): void` | Stop real-time updates |
|
|
190
208
|
| `close(): void` | Clean up and unsubscribe |
|
|
191
|
-
| `rename(newName): Promise<void>` | Rename the
|
|
209
|
+
| `rename(newName): Promise<void>` | Rename the space |
|
|
192
210
|
|
|
193
211
|
### Undo/Redo
|
|
194
212
|
|
|
@@ -201,34 +219,71 @@ Graphs are first-class objects with built-in undo/redo, event emission, and real
|
|
|
201
219
|
| `redo(): Promise<boolean>` | Redo undone action |
|
|
202
220
|
| `clearHistory(): void` | Clear undo/redo stack |
|
|
203
221
|
|
|
204
|
-
###
|
|
222
|
+
### Object Operations
|
|
205
223
|
|
|
206
224
|
| Method | Description |
|
|
207
225
|
|--------|-------------|
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
226
|
+
| `getObject(objectId): RoolObject` | Get object data. Throws if not found. |
|
|
227
|
+
| `getObjectOrUndefined(objectId): RoolObject | undefined` | Get object data, or undefined if not found. |
|
|
228
|
+
| `queryObjects(where): RoolObject[]` | Query objects by field values (e.g., `{type: 'article', status: 'draft'}`). |
|
|
229
|
+
| `getObjectIds(): string[]` | Get all object IDs in the space. |
|
|
230
|
+
| `getObjectMeta(objectId): Record<string, unknown>` | Get object metadata (position, UI state, etc.) Hidden from AI. |
|
|
231
|
+
| `createObject(options): Promise<{ id, message }>` | Create a new object. Returns the generated ID and AI message. |
|
|
232
|
+
| `updateObject(objectId, options): Promise<string>` | Update an existing object. Returns AI message. |
|
|
233
|
+
| `deleteObjects(objectIds): Promise<void>` | Delete objects. Outbound links are removed automatically. |
|
|
234
|
+
|
|
235
|
+
#### createObject / updateObject Options
|
|
236
|
+
|
|
237
|
+
Both methods accept an options object:
|
|
238
|
+
|
|
239
|
+
| Option | Description |
|
|
240
|
+
|--------|-------------|
|
|
241
|
+
| `data` | Object data fields (any key-value pairs). Use `{{placeholder}}` for AI-generated content. Required for `createObject`, optional for `updateObject`. |
|
|
242
|
+
| `meta` | Client-private metadata (e.g., position). Hidden from AI operations. |
|
|
243
|
+
| `prompt` | Natural language instruction for AI to generate or modify content. |
|
|
244
|
+
|
|
245
|
+
**Note**: Objects are free-form JSON. While `type` is a common convention (e.g., `{type: 'article'}`), it's not required by the framework.
|
|
246
|
+
|
|
247
|
+
**AI Placeholder Pattern**: Use `{{description}}` in field values to have AI generate content:
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
// Create with AI-generated content
|
|
251
|
+
await space.createObject({
|
|
252
|
+
data: {
|
|
253
|
+
type: 'article',
|
|
254
|
+
headline: '{{catchy headline about coffee}}',
|
|
255
|
+
body: '{{informative paragraph}}'
|
|
256
|
+
},
|
|
257
|
+
prompt: 'Write about specialty coffee brewing'
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// Update existing content with AI
|
|
261
|
+
await space.updateObject('abc123', {
|
|
262
|
+
prompt: 'Make the body shorter and more casual'
|
|
263
|
+
});
|
|
215
264
|
|
|
216
|
-
|
|
265
|
+
// Add new AI-generated field to existing object
|
|
266
|
+
await space.updateObject('abc123', {
|
|
267
|
+
data: { summary: '{{one-sentence summary}}' }
|
|
268
|
+
});
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Link Operations
|
|
272
|
+
|
|
273
|
+
Links connect objects directionally. They are stored on the source object and identified by `sourceId + linkType + targetId`.
|
|
217
274
|
|
|
218
275
|
| Method | Description |
|
|
219
276
|
|--------|-------------|
|
|
220
|
-
| `
|
|
221
|
-
| `
|
|
222
|
-
| `getParents(
|
|
223
|
-
| `getChildren(
|
|
224
|
-
| `getEdge(edgeId): RoolEdge \| undefined` | Get edge by ID |
|
|
225
|
-
| `getEdgeIds(): string[]` | Get all edge IDs |
|
|
277
|
+
| `link(sourceId, targetId, linkType): Promise<void>` | Create a link from source to target with the given type. |
|
|
278
|
+
| `unlink(sourceId, targetId, linkType?): Promise<boolean>` | Remove link(s). If `linkType` provided, removes only that type; otherwise removes all links between the objects. |
|
|
279
|
+
| `getParents(objectId, linkType?): string[]` | Get IDs of objects that link TO this object. |
|
|
280
|
+
| `getChildren(objectId, linkType?): string[]` | Get IDs of objects this object links TO. |
|
|
226
281
|
|
|
227
282
|
### Metadata
|
|
228
283
|
|
|
229
284
|
| Method | Description |
|
|
230
285
|
|--------|-------------|
|
|
231
|
-
| `setMetadata(key, value): void` | Set metadata (hidden from AI) |
|
|
286
|
+
| `setMetadata(key, value): void` | Set space-level metadata (hidden from AI) |
|
|
232
287
|
| `getMetadata(key): unknown` | Get metadata value |
|
|
233
288
|
| `getAllMetadata(): Record<string, unknown>` | Get all metadata |
|
|
234
289
|
|
|
@@ -236,15 +291,41 @@ Graphs are first-class objects with built-in undo/redo, event emission, and real
|
|
|
236
291
|
|
|
237
292
|
| Method | Description |
|
|
238
293
|
|--------|-------------|
|
|
239
|
-
| `prompt(prompt, options?): Promise<string
|
|
294
|
+
| `prompt(prompt, options?): Promise<string | null>` | AI space manipulation |
|
|
295
|
+
|
|
296
|
+
The `prompt` method lets you invoke the AI agent to manipulate the space, perform research, or query information.
|
|
297
|
+
|
|
298
|
+
**Capabilities:**
|
|
299
|
+
- **Creation**: "Create 3 markdown nodes with haikus about nature"
|
|
300
|
+
- **Modification**: "Make the selected node's text more formal"
|
|
301
|
+
- **Research**: "Create a knowledge graph about the exoplanets orbiting PSR B1257+12" (Agent will search Wikipedia)
|
|
302
|
+
- **Structure**: "Connect the topic node to all created child nodes"
|
|
303
|
+
|
|
304
|
+
**Options:**
|
|
305
|
+
- `objectIds`: Limit context to specific objects ("Update *these* objects")
|
|
306
|
+
- `responseSchema`: Request a structured JSON response instead of a text summary
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
// Example: Research and expansion
|
|
310
|
+
await space.prompt(
|
|
311
|
+
"Create a topic node for the solar system, then child nodes for each planet.",
|
|
312
|
+
{ responseSchema: null } // Returns a text summary
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
// Example: Focused update
|
|
316
|
+
await space.prompt(
|
|
317
|
+
"Summarize this article in the 'summary' field",
|
|
318
|
+
{ objectIds: ['article-node-id'] }
|
|
319
|
+
);
|
|
320
|
+
```
|
|
240
321
|
|
|
241
322
|
### Collaboration
|
|
242
323
|
|
|
243
324
|
| Method | Description |
|
|
244
325
|
|--------|-------------|
|
|
245
|
-
| `listUsers(): Promise<
|
|
246
|
-
| `addUser(userId, role): Promise<void>` | Add user to
|
|
247
|
-
| `removeUser(userId): Promise<void>` | Remove user from
|
|
326
|
+
| `listUsers(): Promise<RoolUser[]>` | List users with access |
|
|
327
|
+
| `addUser(userId, role): Promise<void>` | Add user to space |
|
|
328
|
+
| `removeUser(userId): Promise<void>` | Remove user from space |
|
|
248
329
|
|
|
249
330
|
### Media
|
|
250
331
|
|
|
@@ -260,73 +341,97 @@ Graphs are first-class objects with built-in undo/redo, event emission, and real
|
|
|
260
341
|
|
|
261
342
|
| Method | Description |
|
|
262
343
|
|--------|-------------|
|
|
263
|
-
| `getData():
|
|
344
|
+
| `getData(): RoolSpaceData` | Get full space data (internal format) |
|
|
345
|
+
|
|
346
|
+
### Space Events
|
|
264
347
|
|
|
265
|
-
|
|
348
|
+
Semantic events describe what changed. Events fire for both local changes and remote changes.
|
|
266
349
|
|
|
267
350
|
```typescript
|
|
268
|
-
//
|
|
269
|
-
//
|
|
270
|
-
|
|
351
|
+
// source indicates origin:
|
|
352
|
+
// - 'local_user': This client made the change
|
|
353
|
+
// - 'remote_user': Another user/client made the change
|
|
354
|
+
// - 'remote_agent': AI agent made the change
|
|
355
|
+
// - 'system': Resync after error
|
|
356
|
+
|
|
357
|
+
// Object events
|
|
358
|
+
space.on('objectCreated', ({ objectId, object, source }) => void)
|
|
359
|
+
space.on('objectUpdated', ({ objectId, object, source }) => void)
|
|
360
|
+
space.on('objectDeleted', ({ objectId, source }) => void)
|
|
361
|
+
|
|
362
|
+
// Link events
|
|
363
|
+
space.on('linked', ({ sourceId, targetId, linkType, source }) => void)
|
|
364
|
+
space.on('unlinked', ({ sourceId, targetId, linkType, source }) => void)
|
|
365
|
+
|
|
366
|
+
// Space metadata
|
|
367
|
+
space.on('metaUpdated', ({ meta, source }) => void)
|
|
271
368
|
|
|
272
369
|
// Full state replacement (undo/redo, resync after error)
|
|
273
|
-
|
|
370
|
+
space.on('reset', ({ source }) => void)
|
|
274
371
|
|
|
275
|
-
// Sync error occurred,
|
|
276
|
-
|
|
372
|
+
// Sync error occurred, space resynced from server
|
|
373
|
+
space.on('syncError', (error: Error) => void)
|
|
277
374
|
```
|
|
278
375
|
|
|
279
|
-
**Usage
|
|
280
|
-
|
|
281
|
-
|
|
376
|
+
**Usage pattern:**
|
|
377
|
+
```typescript
|
|
378
|
+
// All UI updates happen in one place, regardless of change source
|
|
379
|
+
space.on('objectUpdated', ({ objectId, object, source }) => {
|
|
380
|
+
renderObject(objectId, object);
|
|
381
|
+
if (source === 'remote_agent') {
|
|
382
|
+
doLayout(); // AI might have added content
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
// Caller just makes the change - event handler does the UI work
|
|
387
|
+
space.updateObject(objectId, { prompt: 'expand this' });
|
|
388
|
+
```
|
|
282
389
|
|
|
283
390
|
---
|
|
284
391
|
|
|
285
392
|
## Types
|
|
286
393
|
|
|
287
|
-
###
|
|
394
|
+
### Space Data
|
|
288
395
|
|
|
289
396
|
```typescript
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
edges: Record<string, RoolEdge>;
|
|
293
|
-
_meta: Record<string, unknown>; // Hidden from AI
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
interface RoolNode {
|
|
397
|
+
// RoolObject represents the object data you work with
|
|
398
|
+
interface RoolObject {
|
|
297
399
|
type: string;
|
|
298
|
-
_meta: Record<string, unknown>;
|
|
299
400
|
[key: string]: unknown;
|
|
300
401
|
}
|
|
301
402
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
403
|
+
// Internal space data structure
|
|
404
|
+
interface RoolSpaceData {
|
|
405
|
+
objects: Record<string, ObjectEntry>;
|
|
406
|
+
meta: Record<string, unknown>; // Space-level metadata, hidden from AI
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Internal: Full stored object structure (you typically don't use this directly)
|
|
410
|
+
interface ObjectEntry {
|
|
411
|
+
meta: Record<string, unknown>; // Object-level metadata
|
|
412
|
+
links: Record<string, Record<string, Record<string, unknown>>>; // linkType -> targetId -> linkData
|
|
413
|
+
data: RoolObject; // The actual object data
|
|
308
414
|
}
|
|
309
415
|
```
|
|
310
416
|
|
|
311
417
|
### Info Types
|
|
312
418
|
|
|
313
419
|
```typescript
|
|
314
|
-
type
|
|
420
|
+
type RoolUserRole = 'owner' | 'editor' | 'viewer';
|
|
315
421
|
|
|
316
|
-
interface
|
|
317
|
-
interface
|
|
422
|
+
interface RoolSpaceInfo { id: string; name: string; role: RoolUserRole; }
|
|
423
|
+
interface RoolUser { id: string; email: string; role: RoolUserRole; }
|
|
318
424
|
interface UserResult { id: string; email: string; }
|
|
319
425
|
interface Account { id: string; email: string; plan: string; creditsBalance: number; }
|
|
320
426
|
interface MediaItem { uuid: string; url: string; contentType: string; size: number; }
|
|
321
|
-
type
|
|
427
|
+
type ChangeSource = 'local_user' | 'remote_user' | 'remote_agent' | 'system';
|
|
322
428
|
```
|
|
323
429
|
|
|
324
430
|
### Prompt Options
|
|
325
431
|
|
|
326
432
|
```typescript
|
|
327
433
|
interface PromptOptions {
|
|
328
|
-
|
|
329
|
-
edgeIds?: string[]; // Scope to specific edges
|
|
434
|
+
objectIds?: string[]; // Scope to specific objects
|
|
330
435
|
responseSchema?: Record<string, unknown>;
|
|
331
436
|
}
|
|
332
437
|
```
|
package/dist/client.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { EventEmitter } from './event-emitter.js';
|
|
2
|
-
import {
|
|
3
|
-
import type { RoolClientConfig, RoolClientEvents,
|
|
2
|
+
import { RoolSpace } from './space.js';
|
|
3
|
+
import type { RoolClientConfig, RoolClientEvents, RoolSpaceInfo, Account, UserResult, UserInfo } from './types.js';
|
|
4
4
|
/**
|
|
5
|
-
* Rool Client - Manages authentication,
|
|
5
|
+
* Rool Client - Manages authentication, space lifecycle, and shared infrastructure.
|
|
6
6
|
*
|
|
7
|
-
* The client is lightweight - most
|
|
8
|
-
* obtained via openGraph() or createGraph().
|
|
7
|
+
* The client is lightweight - most operations happen on Space instances
|
|
9
8
|
*
|
|
10
9
|
* Features:
|
|
11
10
|
* - Authentication (login, logout, token management)
|
|
12
|
-
* -
|
|
11
|
+
* - Spaces lifecycle (list, open, create, delete)
|
|
13
12
|
* - Shared SSE subscription with event routing
|
|
14
13
|
* - Media operations
|
|
15
|
-
* - AI operations (
|
|
14
|
+
* - AI operations (prompt, image generation)
|
|
16
15
|
*/
|
|
17
16
|
export declare class RoolClient extends EventEmitter<RoolClientEvents> {
|
|
18
17
|
private urls;
|
|
@@ -20,7 +19,7 @@ export declare class RoolClient extends EventEmitter<RoolClientEvents> {
|
|
|
20
19
|
private graphqlClient;
|
|
21
20
|
private subscriptionManager;
|
|
22
21
|
private connectionId;
|
|
23
|
-
private
|
|
22
|
+
private subscribedSpaces;
|
|
24
23
|
constructor(config: RoolClientConfig);
|
|
25
24
|
/**
|
|
26
25
|
* Initialize the client - should be called on app startup.
|
|
@@ -59,24 +58,24 @@ export declare class RoolClient extends EventEmitter<RoolClientEvents> {
|
|
|
59
58
|
*/
|
|
60
59
|
getUser(): UserInfo;
|
|
61
60
|
/**
|
|
62
|
-
* List all
|
|
61
|
+
* List all spaces accessible to the user.
|
|
63
62
|
*/
|
|
64
|
-
|
|
63
|
+
listSpaces(): Promise<RoolSpaceInfo[]>;
|
|
65
64
|
/**
|
|
66
|
-
* Open an existing
|
|
67
|
-
* Loads the
|
|
65
|
+
* Open an existing space.
|
|
66
|
+
* Loads the space data from the server and returns a Space instance.
|
|
68
67
|
*/
|
|
69
|
-
|
|
68
|
+
openSpace(spaceId: string): Promise<RoolSpace>;
|
|
70
69
|
/**
|
|
71
|
-
* Create a new
|
|
72
|
-
* Creates on server and returns a
|
|
70
|
+
* Create a new space.
|
|
71
|
+
* Creates on server and returns a Space instance.
|
|
73
72
|
*/
|
|
74
|
-
|
|
73
|
+
createSpace(name?: string): Promise<RoolSpace>;
|
|
75
74
|
/**
|
|
76
|
-
* Delete a
|
|
77
|
-
* Note: This does not affect any open
|
|
75
|
+
* Delete a space.
|
|
76
|
+
* Note: This does not affect any open Space instances - they become stale.
|
|
78
77
|
*/
|
|
79
|
-
|
|
78
|
+
deleteSpace(spaceId: string): Promise<void>;
|
|
80
79
|
/**
|
|
81
80
|
* Get account info from server (plan, credits, etc).
|
|
82
81
|
*/
|
|
@@ -88,8 +87,8 @@ export declare class RoolClient extends EventEmitter<RoolClientEvents> {
|
|
|
88
87
|
private get mediaClient();
|
|
89
88
|
/**
|
|
90
89
|
* Subscribe to real-time events.
|
|
91
|
-
* Client receives
|
|
92
|
-
* to subscribed
|
|
90
|
+
* Client receives lifecycle events; space-level events are routed
|
|
91
|
+
* to subscribed Space instances.
|
|
93
92
|
*/
|
|
94
93
|
subscribe(): Promise<void>;
|
|
95
94
|
/**
|
|
@@ -117,13 +116,17 @@ export declare class RoolClient extends EventEmitter<RoolClientEvents> {
|
|
|
117
116
|
*
|
|
118
117
|
* @example
|
|
119
118
|
* const result = await client.graphql<{ lastMessages: Message[] }>(
|
|
120
|
-
* `query
|
|
121
|
-
* {
|
|
119
|
+
* `query trace($spaceId: String!) { trace(spaceId: $spaceId) }`,
|
|
120
|
+
* { spaceId: 'abc123' }
|
|
122
121
|
* );
|
|
123
122
|
*/
|
|
124
123
|
graphql<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
|
|
125
|
-
private
|
|
126
|
-
private
|
|
127
|
-
|
|
124
|
+
private registerSpaceForEvents;
|
|
125
|
+
private unregisterSpaceFromEvents;
|
|
126
|
+
/**
|
|
127
|
+
* Handle a raw event message from the subscription manager.
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
private handleEvent;
|
|
128
131
|
}
|
|
129
132
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKlD,OAAO,EAAE,SAAS,EAAoB,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EAGb,OAAO,EACP,UAAU,EACV,QAAQ,EAET,MAA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