@rool-dev/client 0.3.1-dev.5742de4 → 0.3.1-dev.5aaae9e
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 +168 -89
- 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 +69 -88
- 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/{graph.d.ts → space.d.ts} +75 -70
- package/dist/space.d.ts.map +1 -0
- package/dist/space.js +728 -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 +72 -70
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js +0 -658
- 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,48 @@ 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');
|
|
25
31
|
|
|
26
|
-
//
|
|
27
|
-
const
|
|
28
|
-
graph.subscribe(); // Listen for real-time updates
|
|
32
|
+
// Create a new space
|
|
33
|
+
const newSpace = await client.createSpace('My New Space');
|
|
29
34
|
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
const nodeId = graph.createNode({ type: 'text', fields: { content: 'Hello' } });
|
|
35
|
+
// Subscribe to real-time updates
|
|
36
|
+
space.subscribe();
|
|
33
37
|
|
|
34
|
-
//
|
|
35
|
-
|
|
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
|
+
});
|
|
46
|
+
|
|
47
|
+
// Make changes (automatically synced)
|
|
48
|
+
await space.createObject({
|
|
49
|
+
type: 'note',
|
|
50
|
+
fields: { text: 'Hello World' }
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Create a link between objects
|
|
54
|
+
await space.link('id', 'object2', 'connection');
|
|
36
55
|
|
|
37
56
|
// Undo/redo support
|
|
38
|
-
await
|
|
39
|
-
await
|
|
57
|
+
await space.undo();
|
|
58
|
+
await space.redo();
|
|
40
59
|
|
|
41
60
|
// Clean up
|
|
42
|
-
|
|
61
|
+
space.close();
|
|
43
62
|
```
|
|
44
63
|
|
|
45
64
|
## Configuration
|
|
@@ -118,24 +137,24 @@ const client = new RoolClient({
|
|
|
118
137
|
| `login(): void` | Redirect to login page |
|
|
119
138
|
| `logout(): void` | Clear tokens and state |
|
|
120
139
|
| `isAuthenticated(): boolean` | Check auth status |
|
|
121
|
-
| `getToken(): Promise<string
|
|
140
|
+
| `getToken(): Promise<string | undefined>` | Get current access token |
|
|
122
141
|
| `getUser(): UserInfo` | Get user info from JWT (`{ email, name }`) |
|
|
123
142
|
|
|
124
|
-
###
|
|
143
|
+
### Space Lifecycle
|
|
125
144
|
|
|
126
145
|
| Method | Description |
|
|
127
146
|
|--------|-------------|
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
147
|
+
| `listSpaces(): Promise<RoolSpaceInfo[]>` | List available spaces |
|
|
148
|
+
| `openSpace(id): Promise<RoolSpace>` | Open a space for editing |
|
|
149
|
+
| `createSpace(name?): Promise<RoolSpace>` | Create a new space |
|
|
150
|
+
| `deleteSpace(id): Promise<void>` | Delete a space |
|
|
132
151
|
|
|
133
152
|
### Account & Users
|
|
134
153
|
|
|
135
154
|
| Method | Description |
|
|
136
155
|
|--------|-------------|
|
|
137
156
|
| `getAccount(): Promise<Account>` | Get account info (plan, credits) |
|
|
138
|
-
| `searchUser(email): Promise<UserResult
|
|
157
|
+
| `searchUser(email): Promise<UserResult | null>` | Search user by email |
|
|
139
158
|
|
|
140
159
|
### Subscriptions
|
|
141
160
|
|
|
@@ -158,26 +177,26 @@ const client = new RoolClient({
|
|
|
158
177
|
|
|
159
178
|
```typescript
|
|
160
179
|
client.on('authStateChanged', (authenticated: boolean) => void)
|
|
161
|
-
client.on('
|
|
162
|
-
client.on('
|
|
163
|
-
client.on('
|
|
180
|
+
client.on('spaceCreated', (spaceId: string) => void)
|
|
181
|
+
client.on('spaceDeleted', (spaceId: string) => void)
|
|
182
|
+
client.on('spaceRenamed', (spaceId: string, newName: string) => void)
|
|
164
183
|
client.on('connectionStateChanged', (state: 'connected' | 'disconnected' | 'reconnecting') => void)
|
|
165
184
|
client.on('error', (error: Error, context?: string) => void)
|
|
166
185
|
```
|
|
167
186
|
|
|
168
187
|
---
|
|
169
188
|
|
|
170
|
-
##
|
|
189
|
+
## RoolSpace API
|
|
171
190
|
|
|
172
|
-
|
|
191
|
+
Spaces are first-class objects with built-in undo/redo, event emission, and real-time sync.
|
|
173
192
|
|
|
174
193
|
### Properties
|
|
175
194
|
|
|
176
195
|
| Property | Description |
|
|
177
196
|
|----------|-------------|
|
|
178
|
-
| `id: string` |
|
|
179
|
-
| `name: string` |
|
|
180
|
-
| `role:
|
|
197
|
+
| `id: string` | Space ID |
|
|
198
|
+
| `name: string` | Space name |
|
|
199
|
+
| `role: RoolUserRole` | User's role (`'owner' | 'editor' | 'viewer'`) |
|
|
181
200
|
| `isReadOnly(): boolean` | True if viewer role |
|
|
182
201
|
| `isSubscribed(): boolean` | True if receiving real-time updates |
|
|
183
202
|
|
|
@@ -188,7 +207,7 @@ Graphs are first-class objects with built-in undo/redo, event emission, and real
|
|
|
188
207
|
| `subscribe(): void` | Call after opening. Start receiving real-time updates from other clients. |
|
|
189
208
|
| `unsubscribe(): void` | Stop real-time updates |
|
|
190
209
|
| `close(): void` | Clean up and unsubscribe |
|
|
191
|
-
| `rename(newName): Promise<void>` | Rename the
|
|
210
|
+
| `rename(newName): Promise<void>` | Rename the space |
|
|
192
211
|
|
|
193
212
|
### Undo/Redo
|
|
194
213
|
|
|
@@ -201,34 +220,70 @@ Graphs are first-class objects with built-in undo/redo, event emission, and real
|
|
|
201
220
|
| `redo(): Promise<boolean>` | Redo undone action |
|
|
202
221
|
| `clearHistory(): void` | Clear undo/redo stack |
|
|
203
222
|
|
|
204
|
-
###
|
|
223
|
+
### Object Operations
|
|
205
224
|
|
|
206
225
|
| Method | Description |
|
|
207
226
|
|--------|-------------|
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
227
|
+
| `getObject(objectId): RoolObject` | Get object data. Throws if not found. |
|
|
228
|
+
| `getObjectOrUndefined(objectId): RoolObject | undefined` | Get object data, or undefined if not found. |
|
|
229
|
+
| `getObjectsByType(type): RoolObject[]` | Get all objects matching the given type. |
|
|
230
|
+
| `getObjectIds(): string[]` | Get all object IDs in the space. |
|
|
231
|
+
| `getObjectMeta(objectId): Record<string, unknown>` | Get object metadata (position, UI state, etc.) Hidden from AI. |
|
|
232
|
+
| `createObject(options): Promise<{ id, message }>` | Create a new object. Returns the generated ID and AI message. |
|
|
233
|
+
| `updateObject(objectId, options): Promise<string>` | Update an existing object. Returns AI message. |
|
|
234
|
+
| `deleteObjects(objectIds): Promise<void>` | Delete objects. Outbound links are removed automatically. |
|
|
235
|
+
|
|
236
|
+
#### createObject / updateObject Options
|
|
237
|
+
|
|
238
|
+
Both methods accept an options object:
|
|
239
|
+
|
|
240
|
+
| Option | Description |
|
|
241
|
+
|--------|-------------|
|
|
242
|
+
| `type` | Object type (required for create, optional for update). |
|
|
243
|
+
| `fields` | Key-value pairs for object data. Use `{{placeholder}}` for AI-generated content. |
|
|
244
|
+
| `meta` | Client-private metadata (e.g., position). Hidden from AI operations. |
|
|
245
|
+
| `prompt` | Natural language instruction for AI to generate or modify content. |
|
|
215
246
|
|
|
216
|
-
|
|
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
|
+
type: 'article',
|
|
253
|
+
fields: {
|
|
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
|
+
});
|
|
264
|
+
|
|
265
|
+
// Add new AI-generated field to existing object
|
|
266
|
+
await space.updateObject('abc123', {
|
|
267
|
+
fields: { 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,9 +341,9 @@ 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) |
|
|
264
345
|
|
|
265
|
-
###
|
|
346
|
+
### Space Events
|
|
266
347
|
|
|
267
348
|
Semantic events describe what changed. Events fire for both local changes and remote changes.
|
|
268
349
|
|
|
@@ -273,74 +354,73 @@ Semantic events describe what changed. Events fire for both local changes and re
|
|
|
273
354
|
// - 'remote_agent': AI agent made the change
|
|
274
355
|
// - 'system': Resync after error
|
|
275
356
|
|
|
276
|
-
//
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
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)
|
|
280
361
|
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
|
|
362
|
+
// Link events
|
|
363
|
+
space.on('linked', ({ sourceId, targetId, linkType, source }) => void)
|
|
364
|
+
space.on('unlinked', ({ sourceId, targetId, linkType, source }) => void)
|
|
284
365
|
|
|
285
|
-
//
|
|
286
|
-
|
|
366
|
+
// Space metadata
|
|
367
|
+
space.on('metaUpdated', ({ meta, source }) => void)
|
|
287
368
|
|
|
288
369
|
// Full state replacement (undo/redo, resync after error)
|
|
289
|
-
|
|
370
|
+
space.on('reset', ({ source }) => void)
|
|
290
371
|
|
|
291
|
-
// Sync error occurred,
|
|
292
|
-
|
|
372
|
+
// Sync error occurred, space resynced from server
|
|
373
|
+
space.on('syncError', (error: Error) => void)
|
|
293
374
|
```
|
|
294
375
|
|
|
295
376
|
**Usage pattern:**
|
|
296
377
|
```typescript
|
|
297
378
|
// All UI updates happen in one place, regardless of change source
|
|
298
|
-
|
|
299
|
-
|
|
379
|
+
space.on('objectUpdated', ({ objectId, object, source }) => {
|
|
380
|
+
renderObject(objectId, object);
|
|
300
381
|
if (source === 'remote_agent') {
|
|
301
382
|
doLayout(); // AI might have added content
|
|
302
383
|
}
|
|
303
384
|
});
|
|
304
385
|
|
|
305
386
|
// Caller just makes the change - event handler does the UI work
|
|
306
|
-
|
|
387
|
+
space.updateObject(objectId, { prompt: 'expand this' });
|
|
307
388
|
```
|
|
308
389
|
|
|
309
390
|
---
|
|
310
391
|
|
|
311
392
|
## Types
|
|
312
393
|
|
|
313
|
-
###
|
|
394
|
+
### Space Data
|
|
314
395
|
|
|
315
396
|
```typescript
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
edges: Record<string, RoolEdge>;
|
|
319
|
-
_meta: Record<string, unknown>; // Hidden from AI
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
interface RoolNode {
|
|
397
|
+
// RoolObject represents the object data you work with
|
|
398
|
+
interface RoolObject {
|
|
323
399
|
type: string;
|
|
324
|
-
_meta: Record<string, unknown>;
|
|
325
400
|
[key: string]: unknown;
|
|
326
401
|
}
|
|
327
402
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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
|
|
334
414
|
}
|
|
335
415
|
```
|
|
336
416
|
|
|
337
417
|
### Info Types
|
|
338
418
|
|
|
339
419
|
```typescript
|
|
340
|
-
type
|
|
420
|
+
type RoolUserRole = 'owner' | 'editor' | 'viewer';
|
|
341
421
|
|
|
342
|
-
interface
|
|
343
|
-
interface
|
|
422
|
+
interface RoolSpaceInfo { id: string; name: string; role: RoolUserRole; }
|
|
423
|
+
interface RoolUser { id: string; email: string; role: RoolUserRole; }
|
|
344
424
|
interface UserResult { id: string; email: string; }
|
|
345
425
|
interface Account { id: string; email: string; plan: string; creditsBalance: number; }
|
|
346
426
|
interface MediaItem { uuid: string; url: string; contentType: string; size: number; }
|
|
@@ -351,8 +431,7 @@ type ChangeSource = 'local_user' | 'remote_user' | 'remote_agent' | 'system';
|
|
|
351
431
|
|
|
352
432
|
```typescript
|
|
353
433
|
interface PromptOptions {
|
|
354
|
-
|
|
355
|
-
edgeIds?: string[]; // Scope to specific edges
|
|
434
|
+
objectIds?: string[]; // Scope to specific objects
|
|
356
435
|
responseSchema?: Record<string, unknown>;
|
|
357
436
|
}
|
|
358
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,MAAM,YAAY,CAAC;AAUpB;;;;;;;;;;;GAWG;AACH,qBAAa,UAAW,SAAQ,YAAY,CAAC,gBAAgB,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,mBAAmB,CAAoC;IAC/D,OAAO,CAAC,YAAY,CAAS;IAG7B,OAAO,CAAC,gBAAgB,CAAgC;gBAE5C,MAAM,EAAE,gBAAgB;IA+BpC;;;;OAIG;IACH,UAAU,IAAI,OAAO;IAIrB;;OAEG;IACH,OAAO,IAAI,IAAI;IAiBf;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;IACH,MAAM,IAAI,IAAI;IAWd;;;OAGG;IACH,mBAAmB,IAAI,OAAO;IAI9B;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI7C;;OAEG;IACH,OAAO,IAAI,QAAQ;IAQnB;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAI5C;;;OAGG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAoBpD;;;OAGG;IACG,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAoBpD;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASjD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIpC;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAQ3D,OAAO,KAAK,WAAW,GAKtB;IAMD;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBhC;;OAEG;IACH,WAAW,IAAI,IAAI;IAOnB;;OAEG;IACH,YAAY,IAAI,OAAO;IAQvB;;;OAGG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;OAIG;IACH,MAAM,CAAC,UAAU,IAAI,MAAM;IAI3B;;;;;;;;;OASG;IACG,OAAO,CAAC,CAAC,EACb,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC;IAQb,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,yBAAyB;IAQjC;;;OAGG;IACH,OAAO,CAAC,WAAW;CAwDpB"}
|