@rool-dev/svelte 0.3.0 → 0.3.1-dev.07199fc
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 +20 -5
- package/dist/channel.svelte.d.ts +5 -0
- package/dist/channel.svelte.d.ts.map +1 -1
- package/dist/channel.svelte.js +44 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/rool.svelte.d.ts +35 -3
- package/dist/rool.svelte.d.ts.map +1 -1
- package/dist/rool.svelte.js +48 -2
- package/package.json +5 -5
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({
|
|
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
|
-
|
|
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: {
|
|
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({
|
|
324
|
+
await channel.findObjects({ collection: 'note' })
|
|
320
325
|
|
|
321
326
|
// AI
|
|
322
327
|
await channel.prompt('Summarize everything')
|
|
@@ -362,13 +367,17 @@ import type { Rool, ReactiveChannel, ReactiveObject, ReactiveWatch, WatchOptions
|
|
|
362
367
|
|
|
363
368
|
// Re-exported from @rool-dev/sdk
|
|
364
369
|
import type {
|
|
370
|
+
RoolClient,
|
|
371
|
+
RoolClientConfig,
|
|
365
372
|
RoolChannel,
|
|
366
373
|
RoolSpace,
|
|
367
374
|
RoolSpaceInfo,
|
|
368
375
|
RoolObject,
|
|
376
|
+
RoolObjectStat,
|
|
369
377
|
RoolUserRole,
|
|
370
378
|
ConnectionState,
|
|
371
379
|
ChannelInfo,
|
|
380
|
+
CurrentUser,
|
|
372
381
|
Interaction,
|
|
373
382
|
FindObjectsOptions,
|
|
374
383
|
PromptOptions,
|
|
@@ -378,6 +387,12 @@ import type {
|
|
|
378
387
|
FieldDef,
|
|
379
388
|
CollectionDef,
|
|
380
389
|
SpaceSchema,
|
|
390
|
+
SpaceMember,
|
|
391
|
+
UserResult,
|
|
392
|
+
PublishedAppInfo,
|
|
393
|
+
PublishAppOptions,
|
|
394
|
+
AppManifest,
|
|
395
|
+
FindAppsOptions,
|
|
381
396
|
} from '@rool-dev/svelte';
|
|
382
397
|
```
|
|
383
398
|
|
package/dist/channel.svelte.d.ts
CHANGED
|
@@ -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
|
-
{"version":3,"file":"channel.svelte.d.ts","sourceRoot":"","sources":["../src/channel.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAsB,WAAW,EAAE,MAAM,eAAe,CAAC;AAEvH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAGD;;GAEG;AACH,cAAM,iBAAiB;;IAOrB,OAAO,eAA4B;IACnC,OAAO,UAAgB;gBAEX,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"channel.svelte.d.ts","sourceRoot":"","sources":["../src/channel.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAsB,WAAW,EAAE,MAAM,eAAe,CAAC;AAEvH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,gGAAgG;IAChG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAGD;;GAEG;AACH,cAAM,iBAAiB;;IAOrB,OAAO,eAA4B;IACnC,OAAO,UAAgB;gBAEX,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,YA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W,CAAC,IAAI,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAI3C;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc;IAKxC;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,aAAa;CAK5C;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,eAAe,CAEjE;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAElD;;GAEG;AACH,cAAM,uBAAuB;;IAM3B,IAAI,gBAA6B;IACjC,OAAO,UAAgB;gBAEX,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM;IAmC/C;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAU9B;;OAEG;IACH,KAAK,IAAI,IAAI;CAId;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAE1F;AAED,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,CAAC"}
|
package/dist/channel.svelte.js
CHANGED
|
@@ -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
|
-
//
|
|
40
|
-
|
|
41
|
-
this.#
|
|
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,9 +97,10 @@ 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
|
-
ephemeral: true, // Don't pollute
|
|
103
|
+
ephemeral: true, // Don't pollute interaction history
|
|
87
104
|
};
|
|
88
105
|
const { objects } = await this.#channel.findObjects(findOptions);
|
|
89
106
|
this.objects = objects;
|
|
@@ -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, PublishedAppInfo, PublishAppOptions, AppManifest, FindAppsOptions, } from '@rool-dev/sdk';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAC"}
|
package/dist/rool.svelte.d.ts
CHANGED
|
@@ -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, type FindAppsOptions, type PublishedAppInfo, type PublishAppOptions } 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.
|
|
@@ -78,13 +83,40 @@ declare class RoolImpl {
|
|
|
78
83
|
*/
|
|
79
84
|
getCurrentUser(): Promise<CurrentUser>;
|
|
80
85
|
/**
|
|
81
|
-
* Rename a channel
|
|
86
|
+
* Rename a channel in a space.
|
|
82
87
|
*/
|
|
83
88
|
renameChannel(spaceId: string, channelId: string, name: string): Promise<void>;
|
|
84
89
|
/**
|
|
85
|
-
* Delete a channel
|
|
90
|
+
* Delete a channel from a space.
|
|
86
91
|
*/
|
|
87
92
|
deleteChannel(spaceId: string, channelId: string): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Search for public apps. With a query, performs semantic search.
|
|
95
|
+
* Without a query, returns all public apps sorted by most recently updated.
|
|
96
|
+
*/
|
|
97
|
+
findApps(options?: FindAppsOptions): Promise<PublishedAppInfo[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Install an app into a space.
|
|
100
|
+
* Creates/updates a channel with the app's manifest settings.
|
|
101
|
+
* Returns the channel ID.
|
|
102
|
+
*/
|
|
103
|
+
installApp(spaceId: string, appId: string, channelId?: string): Promise<string>;
|
|
104
|
+
/**
|
|
105
|
+
* Publish or update an app.
|
|
106
|
+
*/
|
|
107
|
+
publishApp(appId: string, options: PublishAppOptions): Promise<PublishedAppInfo>;
|
|
108
|
+
/**
|
|
109
|
+
* Unpublish an app.
|
|
110
|
+
*/
|
|
111
|
+
unpublishApp(appId: string): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* List the current user's published apps.
|
|
114
|
+
*/
|
|
115
|
+
listApps(): Promise<PublishedAppInfo[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Get info for a specific published app.
|
|
118
|
+
*/
|
|
119
|
+
getAppInfo(appId: string): Promise<PublishedAppInfo | null>;
|
|
88
120
|
/**
|
|
89
121
|
* Create a reactive channel list for a space.
|
|
90
122
|
* Auto-updates when channels are created, renamed, or deleted.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rool.svelte.d.ts","sourceRoot":"","sources":["../src/rool.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"rool.svelte.d.ts","sourceRoot":"","sources":["../src/rool.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACnN,OAAO,EAAkC,KAAK,eAAe,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAErH;;;;;;;;GAQG;AACH,cAAM,QAAQ;;IAMZ,aAAa,iBAAgC;IAC7C,MAAM,8BAAkD;IACxD,aAAa,UAAiB;IAC9B,WAAW,eAA8B;IACzC,eAAe,kBAA2C;IAC1D,WAAW,0BAAuC;IAClD,WAAW,qBAAoC;gBAEnC,MAAM,CAAC,EAAE,gBAAgB;IAKrC;;;OAGG;IACH,IAAI,MAAM,IAAI,UAAU,CAEvB;IAwDD;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IAW9B;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAA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H,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIhF;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIvC;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAI3D;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB;IAI9C;;OAEG;IACH,OAAO,IAAI,IAAI;CAahB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAE1D;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC"}
|
package/dist/rool.svelte.js
CHANGED
|
@@ -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;
|
|
@@ -176,17 +183,56 @@ class RoolImpl {
|
|
|
176
183
|
return this.#client.getCurrentUser();
|
|
177
184
|
}
|
|
178
185
|
/**
|
|
179
|
-
* Rename a channel
|
|
186
|
+
* Rename a channel in a space.
|
|
180
187
|
*/
|
|
181
188
|
renameChannel(spaceId, channelId, name) {
|
|
182
189
|
return this.#client.renameChannel(spaceId, channelId, name);
|
|
183
190
|
}
|
|
184
191
|
/**
|
|
185
|
-
* Delete a channel
|
|
192
|
+
* Delete a channel from a space.
|
|
186
193
|
*/
|
|
187
194
|
deleteChannel(spaceId, channelId) {
|
|
188
195
|
return this.#client.deleteChannel(spaceId, channelId);
|
|
189
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Search for public apps. With a query, performs semantic search.
|
|
199
|
+
* Without a query, returns all public apps sorted by most recently updated.
|
|
200
|
+
*/
|
|
201
|
+
findApps(options) {
|
|
202
|
+
return this.#client.findApps(options);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Install an app into a space.
|
|
206
|
+
* Creates/updates a channel with the app's manifest settings.
|
|
207
|
+
* Returns the channel ID.
|
|
208
|
+
*/
|
|
209
|
+
installApp(spaceId, appId, channelId) {
|
|
210
|
+
return this.#client.installApp(spaceId, appId, channelId);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Publish or update an app.
|
|
214
|
+
*/
|
|
215
|
+
publishApp(appId, options) {
|
|
216
|
+
return this.#client.publishApp(appId, options);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Unpublish an app.
|
|
220
|
+
*/
|
|
221
|
+
unpublishApp(appId) {
|
|
222
|
+
return this.#client.unpublishApp(appId);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* List the current user's published apps.
|
|
226
|
+
*/
|
|
227
|
+
listApps() {
|
|
228
|
+
return this.#client.listApps();
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get info for a specific published app.
|
|
232
|
+
*/
|
|
233
|
+
getAppInfo(appId) {
|
|
234
|
+
return this.#client.getAppInfo(appId);
|
|
235
|
+
}
|
|
190
236
|
/**
|
|
191
237
|
* Create a reactive channel list for a space.
|
|
192
238
|
* Auto-updates when channels are created, renamed, or deleted.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rool-dev/svelte",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1-dev.07199fc",
|
|
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.
|
|
44
|
+
"@rool-dev/sdk": "0.3.1-dev.07199fc"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"svelte": "^5.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@sveltejs/package": "^2.
|
|
51
|
-
"svelte": "^5.
|
|
52
|
-
"svelte-check": "^4.
|
|
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": {
|