@rocksky/sdk 0.3.0 → 0.4.0

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.
Files changed (51) hide show
  1. package/README.md +44 -254
  2. package/dist/agent.d.ts +77 -0
  3. package/dist/agent.d.ts.map +1 -0
  4. package/dist/client.d.ts +26 -113
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/dedup.d.ts +38 -0
  7. package/dist/dedup.d.ts.map +1 -0
  8. package/dist/errors.d.ts +3 -23
  9. package/dist/errors.d.ts.map +1 -1
  10. package/dist/generated/types.d.ts +106 -8
  11. package/dist/generated/types.d.ts.map +1 -1
  12. package/dist/hash.d.ts +7 -0
  13. package/dist/hash.d.ts.map +1 -0
  14. package/dist/index.d.ts +16 -17
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +6648 -1288
  17. package/dist/jetstream.d.ts +17 -0
  18. package/dist/jetstream.d.ts.map +1 -0
  19. package/package.json +15 -11
  20. package/src/agent.ts +232 -0
  21. package/src/client.ts +82 -226
  22. package/src/dedup.ts +207 -0
  23. package/src/errors.ts +6 -43
  24. package/src/generated/types.ts +115 -8
  25. package/src/hash.ts +22 -0
  26. package/src/index.ts +16 -86
  27. package/src/jetstream.ts +122 -0
  28. package/src/http.ts +0 -195
  29. package/src/namespaces/_helpers.ts +0 -27
  30. package/src/namespaces/actor.ts +0 -93
  31. package/src/namespaces/album.ts +0 -34
  32. package/src/namespaces/apikey.ts +0 -50
  33. package/src/namespaces/artist.ts +0 -68
  34. package/src/namespaces/charts.ts +0 -38
  35. package/src/namespaces/dropbox.ts +0 -53
  36. package/src/namespaces/feed.ts +0 -112
  37. package/src/namespaces/googledrive.ts +0 -41
  38. package/src/namespaces/graph.ts +0 -62
  39. package/src/namespaces/like.ts +0 -46
  40. package/src/namespaces/mirror.ts +0 -27
  41. package/src/namespaces/player.ts +0 -125
  42. package/src/namespaces/playlist.ts +0 -95
  43. package/src/namespaces/scrobble.ts +0 -41
  44. package/src/namespaces/shout.ts +0 -99
  45. package/src/namespaces/song.ts +0 -60
  46. package/src/namespaces/spotify.ts +0 -56
  47. package/src/namespaces/stats.ts +0 -27
  48. package/src/paginate.ts +0 -90
  49. package/src/pipe.ts +0 -146
  50. package/src/realtime.ts +0 -408
  51. package/src/types.ts +0 -41
package/README.md CHANGED
@@ -1,284 +1,74 @@
1
1
  # @rocksky/sdk
2
2
 
3
- A TypeScript SDK for the [Rocksky](https://rocksky.app) XRPC API.
4
-
5
- - **Type-safe** every endpoint and parameter is statically typed.
6
- - **Builder-friendly** fluent `RockskyClient.builder()` for ergonomic setup.
7
- - **Pipe-friendly** — composable async operators (`pipe`, `withRetry`, `withTimeout`, `map`, `tap`, `withFallback`, `catchError`).
8
- - **Zero-dependency** — only uses the platform `fetch` and the standard library. Works on Bun, Node 18+, Deno, browsers, Cloudflare Workers.
3
+ Official TypeScript SDK for [Rocksky](https://rocksky.app) a music scrobbling &
4
+ discovery platform on the AT Protocol. Built on
5
+ [atcute](https://github.com/mary-ext/atcute): `RockskyClient` does unauthenticated
6
+ AppView reads, and `Agent` logs in with an app password and writes
7
+ `app.rocksky.*` records to the user's PDS.
9
8
 
10
9
  ## Install
11
10
 
12
- ```bash
13
- bun add @rocksky/sdk
14
- # or
15
- npm i @rocksky/sdk
16
- ```
17
-
18
- ## Quick start
19
-
20
- ```ts
21
- import { createClient } from "@rocksky/sdk";
22
-
23
- const client = createClient();
24
-
25
- const profile = await client.actor.getProfile({ did: "did:plc:7vdlgi2bflelz7mmuxoqjfcr" });
26
- const topTracks = await client.charts.getTopTracks({ limit: 5 });
11
+ ```sh
12
+ npm install @rocksky/sdk # or: bun add @rocksky/sdk
27
13
  ```
28
14
 
29
- ## Authentication
30
-
31
- The SDK accepts a bearer token either as a string or as a (sync/async) function:
15
+ ## Quickstart
32
16
 
33
17
  ```ts
34
- import { createClient } from "@rocksky/sdk";
35
-
36
- const client = createClient({ auth: process.env.ROCKSKY_TOKEN });
37
-
38
- // or refresh on every call
39
- const client = createClient({
40
- auth: async () => loadTokenFromKeychain(),
18
+ import { RockskyClient, Agent } from "@rocksky/sdk";
19
+
20
+ // Reads unauthenticated. new RockskyClient() uses https://api.rocksky.app.
21
+ const rk = new RockskyClient();
22
+ const stats = await rk.globalStats();
23
+ const top = await rk.topTracks(10, 0);
24
+
25
+ // Writes — log in with an app password (resolves the PDS automatically).
26
+ const agent = await Agent.login("alice.bsky.social", "app-password");
27
+ const uri = await agent.scrobble({
28
+ title: "Chaser", artist: "Calibro 35",
29
+ album: "Jazzploitation", albumArtist: "Calibro 35", duration: 182320,
41
30
  });
42
31
  ```
43
32
 
44
- Endpoints that require auth throw `RockskyAuthError` when no token is configured.
45
-
46
- ## Builder
47
-
48
- ```ts
49
- import { RockskyClient } from "@rocksky/sdk";
50
-
51
- const client = RockskyClient.builder()
52
- .baseUrl("https://api.rocksky.app")
53
- .bearer(process.env.ROCKSKY_TOKEN!)
54
- .userAgent("my-app/1.0")
55
- .timeout(10_000)
56
- .retries(3)
57
- .retryDelay(200)
58
- .header("x-trace-id", crypto.randomUUID())
59
- .build();
60
- ```
61
-
62
- `withAuth(token)` and `withBaseUrl(url)` return a new client without mutating the original — handy for per-request overrides.
63
-
64
- ## Pipe-style composition
65
-
66
- ```ts
67
- import {
68
- createClient,
69
- map,
70
- pipe,
71
- tap,
72
- withFallback,
73
- withRetry,
74
- withTimeout,
75
- } from "@rocksky/sdk";
76
-
77
- const client = createClient();
78
-
79
- // Pass a thunk so withRetry can re-invoke the network call.
80
- const handle = await pipe(
81
- () => client.actor.getProfile({ did: "did:plc:7vdlgi2bflelz7mmuxoqjfcr" }),
82
- withRetry(3, { delayMs: 200 }),
83
- withTimeout(5_000),
84
- tap((p) => console.log("loaded", p.handle)),
85
- map((p) => p.displayName ?? p.handle),
86
- withFallback("anonymous"),
87
- );
88
- ```
89
-
90
- `pipe` accepts either a thunk `() => Promise<T>` (preferred — `withRetry` re-runs it) or a bare `Promise<T>` for one-shot composition.
91
-
92
- | Operator | Description |
93
- | --- | --- |
94
- | `map(fn)` | Transform the resolved value. |
95
- | `tap(fn)` | Run a side-effect; pass the value through. |
96
- | `withRetry(n, { delayMs, factor, shouldRetry })` | Retry on rejection with exponential backoff. |
97
- | `withTimeout(ms)` | Reject with `RockskyTimeoutError` if it exceeds `ms`. |
98
- | `withFallback(value \| fn)` | Recover from any error with a default. |
99
- | `catchError(fn)` | Map a thrown error to a value. |
100
-
101
- ## Namespaces
102
-
103
- ```
104
- client.actor getProfile, getActorAlbums, getActorArtists, getActorSongs,
105
- getActorScrobbles, getActorLovedSongs, getActorPlaylists,
106
- getActorNeighbours, getActorCompatibility
107
- client.album getAlbum, getAlbums, getAlbumTracks
108
- client.apikey getApikeys, createApikey, updateApikey, removeApikey
109
- client.artist getArtist, getArtists, getArtistAlbums, getArtistTracks,
110
- getArtistListeners, getArtistRecentListeners
111
- client.charts getScrobblesChart, getTopArtists, getTopTracks
112
- client.dropbox getFiles, getMetadata, getTemporaryLink, downloadFile
113
- client.feed search, getFeed, getFeedGenerators, getFeedGenerator,
114
- describeFeedGenerator, getFeedSkeleton,
115
- getRecommendations, getArtistRecommendations,
116
- getAlbumRecommendations, getStories
117
- client.googledrive getFile, getFiles, downloadFile
118
- client.graph followAccount, unfollowAccount, getFollowers, getFollows,
119
- getKnownFollowers
120
- client.like likeSong, dislikeSong, likeShout, dislikeShout
121
- client.mirror getMirrorSources, putMirrorSource
122
- client.player getCurrentlyPlaying, getPlaybackQueue, play, pause, next,
123
- previous, seek, playFile, playDirectory, addItemsToQueue,
124
- addDirectoryToQueue
125
- client.playlist getPlaylists, getPlaylist, createPlaylist, removePlaylist,
126
- startPlaylist, insertDirectory, insertFiles, removeTrack
127
- client.scrobble createScrobble, getScrobble, getScrobbles
128
- client.shout createShout, replyShout, reportShout, removeShout,
129
- getShoutReplies, getProfileShouts, getTrackShouts,
130
- getArtistShouts, getAlbumShouts
131
- client.song getSong, getSongs, getSongRecentListeners, matchSong,
132
- createSong
133
- client.spotify getCurrentlyPlaying, play, pause, next, previous, seek
134
- client.stats getStats, getWrapped
135
- ```
136
-
137
- Every method takes a typed parameter object and returns `Promise<T>`. Pass a generic to narrow the response type:
138
-
139
- ```ts
140
- type Profile = { handle: string; did: string; displayName?: string };
141
- const me = await client.actor.getProfile<Profile>({ did: "alice.bsky.social" });
142
- ```
143
-
144
- ## Escape hatch
145
-
146
- For endpoints not yet wrapped, call `xrpc` directly:
147
-
148
- ```ts
149
- const result = await client.xrpc<MyType>(
150
- "app.rocksky.something.notWrappedYet",
151
- "GET",
152
- { params: { foo: "bar" } },
153
- );
154
- ```
155
-
156
- ## Error handling
157
-
158
- The SDK throws four error classes — all extending `RockskyError`:
33
+ ## API
159
34
 
160
- - `RockskyHttpError` non-2xx response. Exposes `.status`, `.statusText`, `.url`, `.body`.
161
- - `RockskyTimeoutError` request exceeded `timeoutMs`.
162
- - `RockskyAuthError` — endpoint requires auth but no token was provided.
163
- - `RockskyError` — base class.
35
+ **Reads`RockskyClient`**: `profile`, `scrobbles`, `songs`, `albums`,
36
+ `artists`, `topTracks`, `topArtists`, `search`, `globalStats`.
164
37
 
165
- ```ts
166
- import { RockskyHttpError } from "@rocksky/sdk";
38
+ **Writes — `Agent`**: `scrobble`, `createSong`/`createAlbum`/`createArtist`,
39
+ `like`, `follow`, `shout`/`replyShout`, `setNowPlaying`/`clearNowPlaying`,
40
+ `delete`. Records are the generated types from `./generated/types`.
167
41
 
168
- try {
169
- await client.scrobble.getScrobble({ uri: "at://x" });
170
- } catch (err) {
171
- if (err instanceof RockskyHttpError && err.status === 404) {
172
- console.log("not found");
173
- } else {
174
- throw err;
175
- }
176
- }
177
- ```
42
+ **Identity hashes**: `songHash`, `albumHash`, `artistHash` — lowercase-hex
43
+ SHA-256, identical to the server and every other Rocksky SDK.
178
44
 
179
- ## Pagination
45
+ ## Duplicate prevention + real-time sync
180
46
 
181
- `paginate()` (and `client.paginate()`) gives you a typed async iterable over any `{ limit, offset }` or `{ cursor }` endpoint.
47
+ An optional local index (embedded [classic-level](https://github.com/Level/classic-level)
48
+ LevelDB) prevents duplicate writes and stays live off the firehose:
182
49
 
183
50
  ```ts
184
- import { createClient, paginate } from "@rocksky/sdk";
51
+ import { RockskyIndex } from "@rocksky/sdk";
185
52
 
186
- const client = createClient();
53
+ const idx = new RockskyIndex("./dedup");
54
+ await idx.open();
55
+ agent.useIndex(idx);
187
56
 
188
- // Offset/limit fetcher returns the items array, helper handles offset.
189
- for await (const s of paginate({
190
- fetch: ({ limit, offset }) =>
191
- client.actor.getActorScrobbles({ did, limit, offset }).then((p) => p.scrobbles ?? []),
192
- pageSize: 50,
193
- maxItems: 200,
194
- })) {
195
- console.log(s.track.title);
196
- }
197
-
198
- // Cursor-based — fetcher returns { items, cursor }.
199
- const followers = await client
200
- .paginate({
201
- fetch: async ({ limit, cursor }) => {
202
- const page = await client.graph.getFollowers({ actor, limit, cursor });
203
- return { items: page.followers, cursor: page.cursor };
204
- },
205
- pageSize: 100,
206
- })
207
- .toArray();
57
+ const stats = await agent.syncRepo(); // backfill from the repo CAR (com.atproto.sync.getRepo)
58
+ agent.hydrateFromJetstream(); // keep it live from Jetstream (all 4 servers)
208
59
  ```
209
60
 
210
- Options: `pageSize`, `maxItems`, `signal` (AbortSignal). The helper stops on an empty page, a short page (offset mode), or a missing cursor (cursor mode).
211
-
212
- ## Realtime (WebSocket)
213
-
214
- The Rocksky API exposes a WebSocket endpoint at `/ws` for now-playing events and device control. The SDK ships a typed client with reconnect, ping, and a fluent builder.
215
-
216
- ```ts
217
- import { RealtimeClient, createClient } from "@rocksky/sdk";
218
-
219
- // Builder style.
220
- const rt = RealtimeClient.builder()
221
- .baseUrl("https://api.rocksky.app")
222
- .token(process.env.ROCKSKY_TOKEN!)
223
- .clientName("my-app")
224
- .pingInterval(20_000)
225
- .reconnect({ backoffMs: 1000, maxBackoffMs: 60_000 })
226
- .build();
61
+ With an index attached, the write verbs skip records that already exist (return
62
+ the existing URI) and a same-second scrobble of the same track isn't duplicated.
227
63
 
228
- // Or inherit baseUrl from a RockskyClient.
229
- const client = createClient({ baseUrl: "https://api.rocksky.app" });
230
- const rt2 = client.realtime({ token: process.env.ROCKSKY_TOKEN!, clientName: "my-app" });
231
-
232
- rt.on("open", () => console.log("connected"));
233
- rt.on("registered", ({ deviceId }) => console.log("device id:", deviceId));
234
- rt.on("message", ({ data, device_id }) => console.log(device_id, data));
235
- rt.on("control", (c) => console.log("control:", c));
236
- rt.on("close", ({ code, reason }) => console.log("closed", code, reason));
237
- rt.on("error", (err) => console.error(err));
238
-
239
- await rt.connect();
240
-
241
- // Broadcast a now-playing update to your devices.
242
- await rt.sendMessage({
243
- type: "track",
244
- title: "Heart of Glass",
245
- artist: "Blondie",
246
- });
247
-
248
- // Control a target device (or all of them).
249
- await rt.sendControl({ action: "play", target: "device-id-123" });
250
-
251
- await rt.close();
252
- ```
253
-
254
- Events: `open`, `close`, `error`, `registered`, `deviceRegistered`, `message`, `control`, `raw`.
255
-
256
- For tests, pass a fake `WebSocket` constructor via `.webSocket(FakeWebSocket)`.
257
-
258
- ## Types
259
-
260
- Public model types are derived from the [Rocksky lexicons](https://tangled.org/rocksky.app/rocksky/tree/main/apps/api/lexicons) and live in `src/generated/types.ts`. They are regenerated from `apps/api/lexicons/**/*.json` by running `bun run lexgen:types` at the repo root.
261
-
262
-
263
- ## Development
264
-
265
- ```bash
266
- bun install
267
- bun test
268
- bun run typecheck
269
- bun run build
270
- ```
64
+ Node 22 (global `WebSocket`/`fetch`) or Bun.
271
65
 
272
- Run individual examples:
66
+ ## Example
273
67
 
274
- ```bash
275
- bun run example:quickstart
276
- bun run example:builder
277
- bun run example:pipe
278
- bun run example:scrobble
279
- bun run example:pagination
68
+ ```sh
69
+ bun run examples/native.ts
280
70
  ```
281
71
 
282
72
  ## License
283
73
 
284
- [MIT](LICENSE) © Tsiry Sandratraina.
74
+ MIT.
@@ -0,0 +1,77 @@
1
+ import { PasswordSession } from "@atcute/password-session";
2
+ import type { AlbumRecord, ArtistRecord, ActorTrackView, ScrobbleRecord, SongRecord } from "./generated/types.js";
3
+ import type { IndexStats, RockskyIndex } from "./dedup.js";
4
+ import { type JetstreamOptions } from "./jetstream.js";
5
+ /** Input for {@link Agent.scrobble} (createdAt defaults to now). */
6
+ export type ScrobbleInput = Omit<ScrobbleRecord, "createdAt"> & {
7
+ createdAt?: string;
8
+ };
9
+ /** Input for {@link Agent.createSong}. */
10
+ export type SongInput = Omit<SongRecord, "createdAt"> & {
11
+ createdAt?: string;
12
+ };
13
+ /** Input for {@link Agent.createAlbum} (`artist` is the album artist). */
14
+ export type AlbumInput = Omit<AlbumRecord, "createdAt"> & {
15
+ createdAt?: string;
16
+ };
17
+ /** Input for {@link Agent.createArtist}. */
18
+ export type ArtistInput = Omit<ArtistRecord, "createdAt"> & {
19
+ createdAt?: string;
20
+ };
21
+ /**
22
+ * Authenticated Rocksky client: logs in with an app password and writes
23
+ * app.rocksky.* records to the user's PDS (via atcute). Attach a
24
+ * {@link RockskyIndex} with {@link Agent.useIndex} for duplicate prevention.
25
+ */
26
+ export declare class Agent {
27
+ private rpc;
28
+ readonly did: string;
29
+ readonly session: PasswordSession;
30
+ private pds;
31
+ private idx?;
32
+ private constructor();
33
+ /**
34
+ * Resolve the account's PDS, authenticate with an app password, and return an
35
+ * Agent. `identifier` is a handle or DID.
36
+ */
37
+ static login(identifier: string, password: string): Promise<Agent>;
38
+ /** Attach a local dedup index — write verbs then skip records that already exist. */
39
+ useIndex(idx: RockskyIndex): void;
40
+ /**
41
+ * Download the caller's full repository and (re)build the dedup index. Requires
42
+ * an attached index ({@link Agent.useIndex}). Full backfill; keep it current
43
+ * with {@link Agent.hydrateFromJetstream}.
44
+ */
45
+ syncRepo(): Promise<IndexStats>;
46
+ /**
47
+ * Keep the dedup index live from the Bluesky Jetstream firehose (all four
48
+ * servers at once, filtered to this DID + app.rocksky.*). Resolves when the
49
+ * options' AbortSignal fires. Requires an attached index.
50
+ */
51
+ hydrateFromJetstream(opts?: JetstreamOptions): Promise<void>;
52
+ private create;
53
+ private putRecord;
54
+ /** Delete a record by collection + rkey. */
55
+ delete(collection: string, rkey: string): Promise<void>;
56
+ /** Scrobble a play (app.rocksky.scrobble). createdAt defaults to now. */
57
+ scrobble(rec: ScrobbleInput): Promise<string>;
58
+ /** Create a canonical track record (app.rocksky.song). */
59
+ createSong(rec: SongInput): Promise<string>;
60
+ /** Create an album record (app.rocksky.album). `artist` is the album artist. */
61
+ createAlbum(rec: AlbumInput): Promise<string>;
62
+ /** Create an artist record (app.rocksky.artist). */
63
+ createArtist(rec: ArtistInput): Promise<string>;
64
+ /** Like a record by strong reference (uri + cid). Returns the like URI. */
65
+ like(uri: string, cid: string): Promise<string>;
66
+ /** Follow an account by DID. Returns the follow URI. */
67
+ follow(did: string): Promise<string>;
68
+ /** Post a shout on a subject. Returns the shout URI. */
69
+ shout(subjectUri: string, subjectCid: string, message: string): Promise<string>;
70
+ /** Reply to a shout, with a parent strong-ref. */
71
+ replyShout(subjectUri: string, subjectCid: string, parentUri: string, parentCid: string, message: string): Promise<string>;
72
+ /** Upsert the actor's now-playing status singleton (rkey "self"). */
73
+ setNowPlaying(track: ActorTrackView): Promise<string>;
74
+ /** Delete the actor's now-playing status singleton. */
75
+ clearNowPlaying(): Promise<void>;
76
+ }
77
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,UAAU,EACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA+BrE,oEAAoE;AACpE,MAAM,MAAM,a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AM,CAAC;IAenD,0DAA0D;IACpD,UAAU,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAWjD,gFAAgF;IAC1E,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAWnD,oDAAoD;IAC9C,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAWrD,2EAA2E;IAC3E,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/C,wDAAwD;IACxD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIpC,wDAAwD;IACxD,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/E,kDAAkD;IAClD,UAAU,CACR,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC;IASlB,qEAAqE;IACrE,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrD,uDAAuD;IACvD,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAGjC"}
package/dist/client.d.ts CHANGED
@@ -1,116 +1,29 @@
1
- import { type HttpClientConfig } from "./http.js";
2
- import { type PaginateArgs } from "./paginate.js";
3
- import { RealtimeClient, type RealtimeOptions } from "./realtime.js";
4
- import { ActorNamespace } from "./namespaces/actor.js";
5
- import { AlbumNamespace } from "./namespaces/album.js";
6
- import { ApikeyNamespace } from "./namespaces/apikey.js";
7
- import { ArtistNamespace } from "./namespaces/artist.js";
8
- import { ChartsNamespace } from "./namespaces/charts.js";
9
- import { DropboxNamespace } from "./namespaces/dropbox.js";
10
- import { FeedNamespace } from "./namespaces/feed.js";
11
- import { GoogleDriveNamespace } from "./namespaces/googledrive.js";
12
- import { GraphNamespace } from "./namespaces/graph.js";
13
- import { LikeNamespace } from "./namespaces/like.js";
14
- import { MirrorNamespace } from "./namespaces/mirror.js";
15
- import { PlayerNamespace } from "./namespaces/player.js";
16
- import { PlaylistNamespace } from "./namespaces/playlist.js";
17
- import { ScrobbleNamespace } from "./namespaces/scrobble.js";
18
- import { ShoutNamespace } from "./namespaces/shout.js";
19
- import { SongNamespace } from "./namespaces/song.js";
20
- import { SpotifyNamespace } from "./namespaces/spotify.js";
21
- import { StatsNamespace } from "./namespaces/stats.js";
22
- import type { Endpoints } from "./generated/types.js";
23
- import type { AuthProvider, ClientOptions, FetchLike, RequestOptions } from "./types.js";
24
- type XrpcOpts = {
25
- params?: Record<string, unknown>;
26
- body?: unknown;
27
- requireAuth?: boolean;
28
- } & RequestOptions;
1
+ import type { ActorProfileViewDetailed, AlbumViewBasic, ArtistViewBasic, FeedSearchResultsView, ScrobbleViewBasic, SongViewBasic, StatsGlobalStatsView } from "./generated/types.js";
2
+ /** The default public Rocksky AppView base URL. */
3
+ export declare const DEFAULT_APPVIEW = "https://api.rocksky.app";
4
+ /** Unauthenticated read client over the public Rocksky AppView XRPC. */
29
5
  export declare class RockskyClient {
30
- readonly config: HttpClientConfig;
31
- readonly actor: ActorNamespace;
32
- readonly album: AlbumNamespace;
33
- readonly apikey: ApikeyNamespace;
34
- readonly artist: ArtistNamespace;
35
- readonly charts: ChartsNamespace;
36
- readonly dropbox: DropboxNamespace;
37
- readonly feed: FeedNamespace;
38
- readonly googledrive: GoogleDriveNamespace;
39
- readonly graph: GraphNamespace;
40
- readonly like: LikeNamespace;
41
- readonly mirror: MirrorNamespace;
42
- readonly player: PlayerNamespace;
43
- readonly playlist: PlaylistNamespace;
44
- readonly scrobble: ScrobbleNamespace;
45
- readonly shout: ShoutNamespace;
46
- readonly song: SongNamespace;
47
- readonly spotify: SpotifyNamespace;
48
- readonly stats: StatsNamespace;
49
- constructor(options?: ClientOptions);
50
- /** Build a one-off authenticated copy without mutating this client. */
51
- withAuth(auth: AuthProvider): RockskyClient;
52
- /** Build a copy with an overridden base URL. */
53
- withBaseUrl(baseUrl: string): RockskyClient;
54
- /**
55
- * Open a realtime WebSocket connection to /ws.
56
- *
57
- * const rt = client.realtime({ token, clientName: "my-app" });
58
- * rt.on("message", m => console.log(m));
59
- * await rt.connect();
60
- *
61
- * Defaults `baseUrl` to this client's base URL. Override anything by
62
- * passing the option, or use `RealtimeClient.builder()` for full control.
63
- */
64
- realtime(options: Omit<RealtimeOptions, "baseUrl"> & Partial<Pick<RealtimeOptions, "baseUrl">>): RealtimeClient;
65
- /**
66
- * Page through any limit/offset or cursor-based endpoint as an async iterable.
67
- *
68
- * for await (const s of client.paginate({
69
- * fetch: ({ limit, offset }) =>
70
- * client.actor.getActorScrobbles({ did, limit, offset }),
71
- * pageSize: 50,
72
- * })) { ... }
73
- */
74
- paginate<T>(args: PaginateArgs<T>): AsyncIterable<T> & {
75
- toArray(): Promise<T[]>;
76
- };
77
- /**
78
- * Direct escape hatch — call any XRPC endpoint by NSID.
79
- *
80
- * Known NSIDs (string literals) are typed via the generated `Endpoints`
81
- * map; arbitrary strings fall back to `unknown` (override with `<T>`).
82
- */
83
- xrpc<K extends keyof Endpoints>(nsid: K, method?: "GET" | "POST", opts?: XrpcOpts): Promise<Endpoints[K]>;
84
- xrpc<T = unknown>(nsid: string, method?: "GET" | "POST", opts?: XrpcOpts): Promise<T>;
85
- static builder(): RockskyClientBuilder;
86
- private optionsSnapshot;
6
+ private rpc;
7
+ /** Build a read client against an AppView base URL (defaults to {@link DEFAULT_APPVIEW}). */
8
+ constructor(appview?: string);
9
+ private query;
10
+ /** An actor's detailed profile. `actor` is a handle or DID. */
11
+ profile(actor: string): Promise<ActorProfileViewDetailed>;
12
+ /** An actor's scrobbles, newest first. */
13
+ scrobbles(actor: string, limit?: number, offset?: number): Promise<ScrobbleViewBasic[]>;
14
+ /** An actor's most-played songs. */
15
+ songs(actor: string, limit?: number, offset?: number): Promise<SongViewBasic[]>;
16
+ /** An actor's most-played albums. */
17
+ albums(actor: string, limit?: number, offset?: number): Promise<AlbumViewBasic[]>;
18
+ /** An actor's most-played artists. */
19
+ artists(actor: string, limit?: number, offset?: number): Promise<ArtistViewBasic[]>;
20
+ /** The platform-wide top tracks chart. */
21
+ topTracks(limit?: number, offset?: number): Promise<SongViewBasic[]>;
22
+ /** The platform-wide top artists chart. */
23
+ topArtists(limit?: number, offset?: number): Promise<ArtistViewBasic[]>;
24
+ /** Full-text search across songs, albums, artists, playlists, actors. */
25
+ search(query: string): Promise<FeedSearchResultsView>;
26
+ /** Platform-wide totals. */
27
+ globalStats(): Promise<StatsGlobalStatsView>;
87
28
  }
88
- /**
89
- * Fluent builder.
90
- *
91
- * const client = RockskyClient.builder()
92
- * .baseUrl("https://api.rocksky.app")
93
- * .auth(() => loadToken())
94
- * .timeout(10_000)
95
- * .retries(3)
96
- * .userAgent("my-app/1.0")
97
- * .build();
98
- */
99
- export declare class RockskyClientBuilder {
100
- private readonly opts;
101
- baseUrl(url: string): this;
102
- auth(auth: AuthProvider): this;
103
- bearer(token: string): this;
104
- fetch(impl: FetchLike): this;
105
- header(key: string, value: string): this;
106
- headers(headers: Record<string, string>): this;
107
- userAgent(ua: string): this;
108
- timeout(ms: number): this;
109
- retries(n: number): this;
110
- retryDelay(ms: number): this;
111
- build(): RockskyClient;
112
- }
113
- /** Convenience factory — equivalent to `new RockskyClient(options)`. */
114
- export declare function createClient(options?: ClientOptions): RockskyClient;
115
- export {};
116
29
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,gBAAgB,EAAY,MAAM,WAAW,CAAC;AAEzE,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,eAAe,CAAC;AACvB,O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IAKpE,yEAAyE;IACzE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIrD,4BAA4B;IAC5B,WAAW,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAG7C"}
@@ -0,0 +1,38 @@
1
+ /** What an {@link RockskyIndex.indexCar} pass added. */
2
+ export interface IndexStats {
3
+ artists: number;
4
+ albums: number;
5
+ songs: number;
6
+ scrobbles: number;
7
+ }
8
+ export declare function totalIndexed(s: IndexStats): number;
9
+ /**
10
+ * Local duplicate-prevention mirror of a user's repo, keyed by Rocksky's
11
+ * identity hashes, backed by an embedded LevelDB (classic-level). Built from the
12
+ * repo CAR by {@link Agent.syncRepo} and kept live by {@link Agent.hydrateFromJetstream}.
13
+ */
14
+ export declare class RockskyIndex {
15
+ private db;
16
+ constructor(path: string);
17
+ /** Open the database (call before use). */
18
+ open(): Promise<void>;
19
+ /** Close the database. */
20
+ close(): Promise<void>;
21
+ private get;
22
+ songUri(did: string, title: string, artist: string, album: string): Promise<string | undefined>;
23
+ albumUri(did: string, album: string, albumArtist: string): Promise<string | undefined>;
24
+ artistUri(did: string, albumArtist: string): Promise<string | undefined>;
25
+ scrobbleUri(did: string, title: string, artist: string, album: string, secs: number): Promise<string | undefined>;
26
+ private putPrimary;
27
+ recordSong(did: string, title: string, artist: string, album: string, uri: string): Promise<void>;
28
+ recordAlbum(did: string, album: string, albumArtist: string, uri: string): Promise<void>;
29
+ recordArtist(did: string, albumArtist: string, uri: string): Promise<void>;
30
+ recordScrobble(did: string, title: string, artist: string, album: string, secs: number, uri: string): Promise<void>;
31
+ cursor(did: string): Promise<number>;
32
+ setCursor(did: string, timeUS: number): Promise<void>;
33
+ /** Ingest a full repo CAR for `did`, indexing song/album/artist/scrobble. */
34
+ indexCar(did: string, car: Uint8Array): Promise<IndexStats>;
35
+ /** Apply a single Jetstream commit event to the index. */
36
+ applyCommit(did: string, col: string, operation: string, rkey: string, record: Record<string, unknown> | undefined): Promise<void>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AAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGjG,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGxF,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG1E,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAG9B,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,6EAA6E;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAoCjE,0DAA0D;IACpD,WAAW,CACf,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,OAAO,CAAC,IAAI,CAAC;CAiBjB"}
package/dist/errors.d.ts CHANGED
@@ -1,26 +1,6 @@
1
+ /** Error thrown when a Rocksky XRPC call returns a non-2xx `{ error, message }`. */
1
2
  export declare class RockskyError extends Error {
2
- readonly cause?: unknown;
3
- constructor(message: string, options?: {
4
- cause?: unknown;
5
- });
6
- }
7
- export declare class RockskyHttpError extends RockskyError {
8
- readonly status: number;
9
- readonly statusText: string;
10
- readonly url: string;
11
- readonly body: unknown;
12
- constructor(args: {
13
- status: number;
14
- statusText: string;
15
- url: string;
16
- body: unknown;
17
- message?: string;
18
- });
19
- }
20
- export declare class RockskyTimeoutError extends RockskyError {
21
- constructor(ms: number);
22
- }
23
- export declare class RockskyAuthError extends RockskyError {
24
- constructor(message?: string);
3
+ readonly kind?: string;
4
+ constructor(payload: unknown);
25
5
  }
26
6
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBACb,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAK3D;AAED,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,IAAI,EAAE;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,OAAO,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;CAWF;AAED,qBAAa,mBAAoB,SAAQ,YAAY;gBACvC,EAAE,EAAE,MAAM;CAIvB;AAED,qBAAa,gBAAiB,SAAQ,YAAY;gBACpC,OAAO,SAA4B;CAIhD"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBACX,OAAO,EAAE,OAAO;CAM7B"}