@rool-dev/svelte 0.3.0-dev.c36df33 → 0.3.1-dev.05537f7

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
@@ -2,6 +2,8 @@
2
2
 
3
3
  Svelte 5 bindings for Rool Spaces. Adds reactive state to the SDK using `$state` runes.
4
4
 
5
+ > **Building a new Rool app?** Start with [`@rool-dev/app`](/app/) — it includes a reactive channel and handles hosting for you. This package is for integrating Rool into an existing Svelte application that manages its own auth, routing, and build setup.
6
+
5
7
  **Requires Svelte 5.** For core concepts (objects, references, AI placeholders, undo/redo), see the [SDK documentation](../sdk/README.md).
6
8
 
7
9
  ## Installation
@@ -51,6 +53,8 @@ The Svelte wrapper adds reactive state on top of the SDK:
51
53
  | `rool.connectionState` | SSE connection state |
52
54
  | `rool.userStorage` | User storage (cross-device preferences) |
53
55
  | `channel.interactions` | Channel interactions (auto-updates) |
56
+ | `channel.objectIds` | All object IDs in the space (auto-updates on create/delete) |
57
+ | `channel.collections` | Collection names from the schema (auto-updates) |
54
58
  | `watch.objects` | Objects matching a filter (auto-updates) |
55
59
  | `watch.loading` | Whether watch is loading |
56
60
 
@@ -145,7 +149,7 @@ channel.close();
145
149
 
146
150
  ### ReactiveChannel
147
151
 
148
- `openChannel` returns a `ReactiveChannel` — the SDK's `RoolChannel` with reactive `interactions`:
152
+ `openChannel` returns a `ReactiveChannel` — the SDK's `RoolChannel` with reactive `interactions` and `objectIds`:
149
153
 
150
154
  ```svelte
151
155
  <script>
@@ -219,7 +223,7 @@ Create auto-updating watches of objects filtered by field values:
219
223
  async function open(spaceId) {
220
224
  channel = await rool.openChannel(spaceId, 'main');
221
225
  // Create a reactive watch of all objects where type === 'article'
222
- articles = channel.watch({ where: { type: 'article' } });
226
+ articles = channel.watch({ collection: 'article' });
223
227
  }
224
228
  </script>
225
229
 
@@ -241,7 +245,8 @@ Watches automatically re-fetch when objects matching the filter are created, upd
241
245
  ```typescript
242
246
  // Watch options (same as findObjects, but no AI prompt)
243
247
  const articles = channel.watch({
244
- where: { type: 'article', status: 'published' },
248
+ collection: 'article',
249
+ where: { status: 'published' },
245
250
  order: 'desc', // by modifiedAt (default)
246
251
  limit: 20,
247
252
  });
@@ -313,10 +318,10 @@ channel.channelId
313
318
 
314
319
  // Object operations
315
320
  await channel.getObject(id)
316
- await channel.createObject({ data: { type: 'note', text: 'Hello' } })
321
+ await channel.createObject({ data: { text: 'Hello' } })
317
322
  await channel.updateObject(id, { data: { text: 'Updated' } })
318
323
  await channel.deleteObjects([id])
319
- await channel.findObjects({ where: { type: 'note' } })
324
+ await channel.findObjects({ collection: 'note' })
320
325
 
321
326
  // AI
322
327
  await channel.prompt('Summarize everything')
@@ -366,6 +371,7 @@ import type {
366
371
  RoolSpace,
367
372
  RoolSpaceInfo,
368
373
  RoolObject,
374
+ RoolObjectStat,
369
375
  RoolUserRole,
370
376
  ConnectionState,
371
377
  ChannelInfo,
@@ -6,6 +6,8 @@ import type { RoolChannel, RoolClient, Interaction, RoolObject, ChannelInfo } fr
6
6
  export interface WatchOptions {
7
7
  /** Field requirements for exact matching */
8
8
  where?: Record<string, unknown>;
9
+ /** Filter by collection name. Only returns objects whose shape matches the named collection. */
10
+ collection?: string;
9
11
  /** Maximum number of objects */
10
12
  limit?: number;
11
13
  /** Sort order by modifiedAt: 'asc' or 'desc' (default: 'desc') */
@@ -54,12 +56,15 @@ export type ReactiveObject = ReactiveObjectImpl;
54
56
  declare class ReactiveChannelImpl {
55
57
  #private;
56
58
  interactions: Interaction[];
59
+ objectIds: string[];
60
+ collections: string[];
57
61
  constructor(channel: RoolChannel);
58
62
  get id(): string;
59
63
  get name(): string;
60
64
  get role(): import("@rool-dev/sdk").RoolUserRole;
61
65
  get userId(): string;
62
66
  get channelId(): string;
67
+ get channelName(): string | null;
63
68
  get isReadOnly(): boolean;
64
69
  get linkAccess(): import("@rool-dev/sdk").LinkAccess;
65
70
  close(): void;
@@ -1 +1 @@
1
-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B,CAAC"}
@@ -29,16 +29,29 @@ class ReactiveWatchImpl {
29
29
  const wasInCollection = this.#currentIds.has(objectId);
30
30
  const nowMatches = this.#matches(object);
31
31
  if (wasInCollection && nowMatches) {
32
- // Update in place
32
+ // Update in place (merge to preserve fields from partial optimistic updates)
33
33
  const index = this.objects.findIndex((o) => o.id === objectId);
34
34
  if (index !== -1) {
35
- this.objects[index] = object;
35
+ this.objects[index] = { ...this.objects[index], ...object };
36
36
  }
37
37
  }
38
38
  else if (wasInCollection && !nowMatches) {
39
- // Remove from collection
40
- this.objects = this.objects.filter((o) => o.id !== objectId);
41
- this.#currentIds.delete(objectId);
39
+ // Check if the mismatch is due to missing keys (partial optimistic update)
40
+ // vs. genuinely changed values that no longer satisfy the filter.
41
+ const where = this.#options.where;
42
+ const isPartialUpdate = where && Object.keys(where).some((key) => !(key in object));
43
+ if (isPartialUpdate) {
44
+ // Partial update — merge onto existing object instead of removing
45
+ const index = this.objects.findIndex((o) => o.id === objectId);
46
+ if (index !== -1) {
47
+ this.objects[index] = { ...this.objects[index], ...object };
48
+ }
49
+ }
50
+ else {
51
+ // Genuine mismatch — remove from collection
52
+ this.objects = this.objects.filter((o) => o.id !== objectId);
53
+ this.#currentIds.delete(objectId);
54
+ }
42
55
  }
43
56
  else if (!wasInCollection && nowMatches) {
44
57
  // Add to collection (re-fetch to respect limit/order)
@@ -64,6 +77,9 @@ class ReactiveWatchImpl {
64
77
  * Check if an object matches the `where` filter.
65
78
  */
66
79
  #matches(object) {
80
+ // Collection membership is shape-based and resolved server-side — can't match locally
81
+ if (this.#options.collection)
82
+ return true;
67
83
  const where = this.#options.where;
68
84
  if (!where)
69
85
  return true;
@@ -81,6 +97,7 @@ class ReactiveWatchImpl {
81
97
  try {
82
98
  const findOptions = {
83
99
  where: this.#options.where,
100
+ collection: this.#options.collection,
84
101
  limit: this.#options.limit,
85
102
  order: this.#options.order,
86
103
  ephemeral: true, // Don't pollute interaction history
@@ -180,17 +197,37 @@ class ReactiveChannelImpl {
180
197
  #closed = false;
181
198
  // Reactive state
182
199
  interactions = $state([]);
200
+ objectIds = $state([]);
201
+ collections = $state([]);
183
202
  constructor(channel) {
184
203
  this.#channel = channel;
185
204
  this.interactions = channel.getInteractions();
205
+ this.objectIds = channel.getObjectIds();
206
+ this.collections = Object.keys(channel.getSchema());
186
207
  // Subscribe to channel updates
187
208
  const onChannelUpdated = () => {
188
209
  this.interactions = channel.getInteractions();
189
210
  };
190
211
  channel.on('channelUpdated', onChannelUpdated);
191
212
  this.#unsubscribers.push(() => channel.off('channelUpdated', onChannelUpdated));
213
+ // Subscribe to object events for objectIds
214
+ const refreshObjectIds = () => {
215
+ this.objectIds = channel.getObjectIds();
216
+ };
217
+ channel.on('objectCreated', refreshObjectIds);
218
+ this.#unsubscribers.push(() => channel.off('objectCreated', refreshObjectIds));
219
+ channel.on('objectDeleted', refreshObjectIds);
220
+ this.#unsubscribers.push(() => channel.off('objectDeleted', refreshObjectIds));
221
+ // Subscribe to schema updates for collections
222
+ const onSchemaUpdated = () => {
223
+ this.collections = Object.keys(channel.getSchema());
224
+ };
225
+ channel.on('schemaUpdated', onSchemaUpdated);
226
+ this.#unsubscribers.push(() => channel.off('schemaUpdated', onSchemaUpdated));
192
227
  const onReset = () => {
193
228
  this.interactions = channel.getInteractions();
229
+ this.objectIds = channel.getObjectIds();
230
+ this.collections = Object.keys(channel.getSchema());
194
231
  };
195
232
  channel.on('reset', onReset);
196
233
  this.#unsubscribers.push(() => channel.off('reset', onReset));
@@ -201,6 +238,7 @@ class ReactiveChannelImpl {
201
238
  get role() { return this.#channel.role; }
202
239
  get userId() { return this.#channel.userId; }
203
240
  get channelId() { return this.#channel.channelId; }
241
+ get channelName() { return this.#channel.channelName; }
204
242
  get isReadOnly() { return this.#channel.isReadOnly; }
205
243
  get linkAccess() { return this.#channel.linkAccess; }
206
244
  // Proxy all methods
package/dist/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export { createRool, generateId } from './rool.svelte.js';
2
2
  export { wrapChannel } from './channel.svelte.js';
3
3
  export type { Rool } from './rool.svelte.js';
4
4
  export type { ReactiveChannel, ReactiveObject, ReactiveWatch, ReactiveChannelList, WatchOptions } from './channel.svelte.js';
5
- export type { RoolClientConfig, RoolChannel, RoolSpace, RoolSpaceInfo, RoolObject, RoolUserRole, ConnectionState, ChannelInfo, CurrentUser, Interaction, FindObjectsOptions, PromptOptions, CreateObjectOptions, UpdateObjectOptions, FieldType, FieldDef, CollectionDef, SpaceSchema, } from '@rool-dev/sdk';
5
+ export type { RoolClientConfig, RoolChannel, RoolSpace, RoolSpaceInfo, RoolObject, RoolObjectStat, RoolUserRole, ConnectionState, ChannelInfo, CurrentUser, Interaction, FindObjectsOptions, PromptOptions, CreateObjectOptions, UpdateObjectOptions, FieldType, FieldDef, CollectionDef, SpaceSchema, SpaceMember, UserResult, RoolClient, } from '@rool-dev/sdk';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAG7H,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,aAAa,EACb,UAAU,EACV,YAAY,EACZ,eAAe,EACf,WAAW,EACX,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,aAAa,EACb,WAAW,GACZ,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAG7H,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,YAAY,EACZ,eAAe,EACf,WAAW,EACX,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,GACX,MAAM,eAAe,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type RoolSpace, type RoolSpaceInfo, type ConnectionState, type RoolClientConfig, type CurrentUser } from '@rool-dev/sdk';
1
+ import { RoolClient, type RoolSpace, type RoolSpaceInfo, type ConnectionState, type RoolClientConfig, type CurrentUser } from '@rool-dev/sdk';
2
2
  import { type ReactiveChannel, type ReactiveChannelList } from './channel.svelte.js';
3
3
  /**
4
4
  * Rool client with reactive state for Svelte 5.
@@ -19,6 +19,11 @@ declare class RoolImpl {
19
19
  userStorage: Record<string, unknown>;
20
20
  currentUser: CurrentUser | null;
21
21
  constructor(config?: RoolClientConfig);
22
+ /**
23
+ * Access the underlying RoolClient for low-level API calls
24
+ * (e.g., graphql(), fetch()) not covered by the reactive wrapper.
25
+ */
26
+ get client(): RoolClient;
22
27
  /**
23
28
  * Initialize the client. Call on app startup.
24
29
  * Returns true if authenticated, false otherwise.
@@ -1 +1 @@
1
- {"version":3,"file":"rool.svelte.d.ts","sourceRoot":"","sources":["../src/rool.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS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I,GAAG,QAAQ,CAAC"}
@@ -25,6 +25,13 @@ class RoolImpl {
25
25
  this.#client = new RoolClient(config);
26
26
  this.#setupEventListeners();
27
27
  }
28
+ /**
29
+ * Access the underlying RoolClient for low-level API calls
30
+ * (e.g., graphql(), fetch()) not covered by the reactive wrapper.
31
+ */
32
+ get client() {
33
+ return this.#client;
34
+ }
28
35
  #setupEventListeners() {
29
36
  const onAuthStateChanged = (auth) => {
30
37
  this.authenticated = auth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rool-dev/svelte",
3
- "version": "0.3.0-dev.c36df33",
3
+ "version": "0.3.1-dev.05537f7",
4
4
  "description": "Svelte 5 runes for Rool Spaces",
5
5
  "type": "module",
6
6
  "svelte": "./dist/index.js",
@@ -41,15 +41,15 @@
41
41
  },
42
42
  "license": "MIT",
43
43
  "dependencies": {
44
- "@rool-dev/sdk": "0.3.0-dev.c36df33"
44
+ "@rool-dev/sdk": "0.3.1-dev.05537f7"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "svelte": "^5.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@sveltejs/package": "^2.0.0",
51
- "svelte": "^5.0.0",
52
- "svelte-check": "^4.0.0",
50
+ "@sveltejs/package": "^2.5.7",
51
+ "svelte": "^5.54.0",
52
+ "svelte-check": "^4.4.5",
53
53
  "typescript": "^5.9.3"
54
54
  },
55
55
  "scripts": {