@syra.fm/sdk 0.1.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.
@@ -0,0 +1,486 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Minimal, self-contained schemas for the public Syra API response shapes this
4
+ * SDK consumes. Intentionally NOT shared with the Syra backend's internal
5
+ * types — the SDK validates only the fields it returns, and tolerantly strips
6
+ * everything else (Zod object schemas drop unknown keys by default), so the API
7
+ * can evolve without breaking external consumers.
8
+ */
9
+ /** A single artwork variant. The backend serializes `url` as `/api/images/:id`. */
10
+ export declare const coverArtVariantSchema: z.ZodObject<{
11
+ id: z.ZodOptional<z.ZodString>;
12
+ url: z.ZodString;
13
+ width: z.ZodOptional<z.ZodNumber>;
14
+ height: z.ZodOptional<z.ZodNumber>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ url: string;
17
+ id?: string | undefined;
18
+ width?: number | undefined;
19
+ height?: number | undefined;
20
+ }, {
21
+ url: string;
22
+ id?: string | undefined;
23
+ width?: number | undefined;
24
+ height?: number | undefined;
25
+ }>;
26
+ export type CoverArtVariant = z.infer<typeof coverArtVariantSchema>;
27
+ /** Named artwork variants keyed by size. */
28
+ export declare const coverArtSizesSchema: z.ZodObject<{
29
+ small: z.ZodOptional<z.ZodObject<{
30
+ id: z.ZodOptional<z.ZodString>;
31
+ url: z.ZodString;
32
+ width: z.ZodOptional<z.ZodNumber>;
33
+ height: z.ZodOptional<z.ZodNumber>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ url: string;
36
+ id?: string | undefined;
37
+ width?: number | undefined;
38
+ height?: number | undefined;
39
+ }, {
40
+ url: string;
41
+ id?: string | undefined;
42
+ width?: number | undefined;
43
+ height?: number | undefined;
44
+ }>>;
45
+ medium: z.ZodOptional<z.ZodObject<{
46
+ id: z.ZodOptional<z.ZodString>;
47
+ url: z.ZodString;
48
+ width: z.ZodOptional<z.ZodNumber>;
49
+ height: z.ZodOptional<z.ZodNumber>;
50
+ }, "strip", z.ZodTypeAny, {
51
+ url: string;
52
+ id?: string | undefined;
53
+ width?: number | undefined;
54
+ height?: number | undefined;
55
+ }, {
56
+ url: string;
57
+ id?: string | undefined;
58
+ width?: number | undefined;
59
+ height?: number | undefined;
60
+ }>>;
61
+ large: z.ZodOptional<z.ZodObject<{
62
+ id: z.ZodOptional<z.ZodString>;
63
+ url: z.ZodString;
64
+ width: z.ZodOptional<z.ZodNumber>;
65
+ height: z.ZodOptional<z.ZodNumber>;
66
+ }, "strip", z.ZodTypeAny, {
67
+ url: string;
68
+ id?: string | undefined;
69
+ width?: number | undefined;
70
+ height?: number | undefined;
71
+ }, {
72
+ url: string;
73
+ id?: string | undefined;
74
+ width?: number | undefined;
75
+ height?: number | undefined;
76
+ }>>;
77
+ xlarge: z.ZodOptional<z.ZodObject<{
78
+ id: z.ZodOptional<z.ZodString>;
79
+ url: z.ZodString;
80
+ width: z.ZodOptional<z.ZodNumber>;
81
+ height: z.ZodOptional<z.ZodNumber>;
82
+ }, "strip", z.ZodTypeAny, {
83
+ url: string;
84
+ id?: string | undefined;
85
+ width?: number | undefined;
86
+ height?: number | undefined;
87
+ }, {
88
+ url: string;
89
+ id?: string | undefined;
90
+ width?: number | undefined;
91
+ height?: number | undefined;
92
+ }>>;
93
+ xxlarge: z.ZodOptional<z.ZodObject<{
94
+ id: z.ZodOptional<z.ZodString>;
95
+ url: z.ZodString;
96
+ width: z.ZodOptional<z.ZodNumber>;
97
+ height: z.ZodOptional<z.ZodNumber>;
98
+ }, "strip", z.ZodTypeAny, {
99
+ url: string;
100
+ id?: string | undefined;
101
+ width?: number | undefined;
102
+ height?: number | undefined;
103
+ }, {
104
+ url: string;
105
+ id?: string | undefined;
106
+ width?: number | undefined;
107
+ height?: number | undefined;
108
+ }>>;
109
+ original: z.ZodOptional<z.ZodObject<{
110
+ id: z.ZodOptional<z.ZodString>;
111
+ url: z.ZodString;
112
+ width: z.ZodOptional<z.ZodNumber>;
113
+ height: z.ZodOptional<z.ZodNumber>;
114
+ }, "strip", z.ZodTypeAny, {
115
+ url: string;
116
+ id?: string | undefined;
117
+ width?: number | undefined;
118
+ height?: number | undefined;
119
+ }, {
120
+ url: string;
121
+ id?: string | undefined;
122
+ width?: number | undefined;
123
+ height?: number | undefined;
124
+ }>>;
125
+ }, "strip", z.ZodTypeAny, {
126
+ small?: {
127
+ url: string;
128
+ id?: string | undefined;
129
+ width?: number | undefined;
130
+ height?: number | undefined;
131
+ } | undefined;
132
+ medium?: {
133
+ url: string;
134
+ id?: string | undefined;
135
+ width?: number | undefined;
136
+ height?: number | undefined;
137
+ } | undefined;
138
+ large?: {
139
+ url: string;
140
+ id?: string | undefined;
141
+ width?: number | undefined;
142
+ height?: number | undefined;
143
+ } | undefined;
144
+ xlarge?: {
145
+ url: string;
146
+ id?: string | undefined;
147
+ width?: number | undefined;
148
+ height?: number | undefined;
149
+ } | undefined;
150
+ xxlarge?: {
151
+ url: string;
152
+ id?: string | undefined;
153
+ width?: number | undefined;
154
+ height?: number | undefined;
155
+ } | undefined;
156
+ original?: {
157
+ url: string;
158
+ id?: string | undefined;
159
+ width?: number | undefined;
160
+ height?: number | undefined;
161
+ } | undefined;
162
+ }, {
163
+ small?: {
164
+ url: string;
165
+ id?: string | undefined;
166
+ width?: number | undefined;
167
+ height?: number | undefined;
168
+ } | undefined;
169
+ medium?: {
170
+ url: string;
171
+ id?: string | undefined;
172
+ width?: number | undefined;
173
+ height?: number | undefined;
174
+ } | undefined;
175
+ large?: {
176
+ url: string;
177
+ id?: string | undefined;
178
+ width?: number | undefined;
179
+ height?: number | undefined;
180
+ } | undefined;
181
+ xlarge?: {
182
+ url: string;
183
+ id?: string | undefined;
184
+ width?: number | undefined;
185
+ height?: number | undefined;
186
+ } | undefined;
187
+ xxlarge?: {
188
+ url: string;
189
+ id?: string | undefined;
190
+ width?: number | undefined;
191
+ height?: number | undefined;
192
+ } | undefined;
193
+ original?: {
194
+ url: string;
195
+ id?: string | undefined;
196
+ width?: number | undefined;
197
+ height?: number | undefined;
198
+ } | undefined;
199
+ }>;
200
+ export type CoverArtSizes = z.infer<typeof coverArtSizesSchema>;
201
+ /** Artwork size name. */
202
+ export type ArtworkSize = keyof CoverArtSizes;
203
+ /**
204
+ * The summary view of a track returned by the public catalog endpoints — just
205
+ * enough to render a song row and play its preview.
206
+ */
207
+ export declare const trackSummarySchema: z.ZodObject<{
208
+ id: z.ZodString;
209
+ title: z.ZodString;
210
+ artistId: z.ZodOptional<z.ZodString>;
211
+ artistName: z.ZodString;
212
+ albumId: z.ZodOptional<z.ZodString>;
213
+ albumName: z.ZodOptional<z.ZodString>;
214
+ duration: z.ZodNumber;
215
+ coverArt: z.ZodOptional<z.ZodString>;
216
+ coverArtSizes: z.ZodOptional<z.ZodObject<{
217
+ small: z.ZodOptional<z.ZodObject<{
218
+ id: z.ZodOptional<z.ZodString>;
219
+ url: z.ZodString;
220
+ width: z.ZodOptional<z.ZodNumber>;
221
+ height: z.ZodOptional<z.ZodNumber>;
222
+ }, "strip", z.ZodTypeAny, {
223
+ url: string;
224
+ id?: string | undefined;
225
+ width?: number | undefined;
226
+ height?: number | undefined;
227
+ }, {
228
+ url: string;
229
+ id?: string | undefined;
230
+ width?: number | undefined;
231
+ height?: number | undefined;
232
+ }>>;
233
+ medium: z.ZodOptional<z.ZodObject<{
234
+ id: z.ZodOptional<z.ZodString>;
235
+ url: z.ZodString;
236
+ width: z.ZodOptional<z.ZodNumber>;
237
+ height: z.ZodOptional<z.ZodNumber>;
238
+ }, "strip", z.ZodTypeAny, {
239
+ url: string;
240
+ id?: string | undefined;
241
+ width?: number | undefined;
242
+ height?: number | undefined;
243
+ }, {
244
+ url: string;
245
+ id?: string | undefined;
246
+ width?: number | undefined;
247
+ height?: number | undefined;
248
+ }>>;
249
+ large: z.ZodOptional<z.ZodObject<{
250
+ id: z.ZodOptional<z.ZodString>;
251
+ url: z.ZodString;
252
+ width: z.ZodOptional<z.ZodNumber>;
253
+ height: z.ZodOptional<z.ZodNumber>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ url: string;
256
+ id?: string | undefined;
257
+ width?: number | undefined;
258
+ height?: number | undefined;
259
+ }, {
260
+ url: string;
261
+ id?: string | undefined;
262
+ width?: number | undefined;
263
+ height?: number | undefined;
264
+ }>>;
265
+ xlarge: z.ZodOptional<z.ZodObject<{
266
+ id: z.ZodOptional<z.ZodString>;
267
+ url: z.ZodString;
268
+ width: z.ZodOptional<z.ZodNumber>;
269
+ height: z.ZodOptional<z.ZodNumber>;
270
+ }, "strip", z.ZodTypeAny, {
271
+ url: string;
272
+ id?: string | undefined;
273
+ width?: number | undefined;
274
+ height?: number | undefined;
275
+ }, {
276
+ url: string;
277
+ id?: string | undefined;
278
+ width?: number | undefined;
279
+ height?: number | undefined;
280
+ }>>;
281
+ xxlarge: z.ZodOptional<z.ZodObject<{
282
+ id: z.ZodOptional<z.ZodString>;
283
+ url: z.ZodString;
284
+ width: z.ZodOptional<z.ZodNumber>;
285
+ height: z.ZodOptional<z.ZodNumber>;
286
+ }, "strip", z.ZodTypeAny, {
287
+ url: string;
288
+ id?: string | undefined;
289
+ width?: number | undefined;
290
+ height?: number | undefined;
291
+ }, {
292
+ url: string;
293
+ id?: string | undefined;
294
+ width?: number | undefined;
295
+ height?: number | undefined;
296
+ }>>;
297
+ original: z.ZodOptional<z.ZodObject<{
298
+ id: z.ZodOptional<z.ZodString>;
299
+ url: z.ZodString;
300
+ width: z.ZodOptional<z.ZodNumber>;
301
+ height: z.ZodOptional<z.ZodNumber>;
302
+ }, "strip", z.ZodTypeAny, {
303
+ url: string;
304
+ id?: string | undefined;
305
+ width?: number | undefined;
306
+ height?: number | undefined;
307
+ }, {
308
+ url: string;
309
+ id?: string | undefined;
310
+ width?: number | undefined;
311
+ height?: number | undefined;
312
+ }>>;
313
+ }, "strip", z.ZodTypeAny, {
314
+ small?: {
315
+ url: string;
316
+ id?: string | undefined;
317
+ width?: number | undefined;
318
+ height?: number | undefined;
319
+ } | undefined;
320
+ medium?: {
321
+ url: string;
322
+ id?: string | undefined;
323
+ width?: number | undefined;
324
+ height?: number | undefined;
325
+ } | undefined;
326
+ large?: {
327
+ url: string;
328
+ id?: string | undefined;
329
+ width?: number | undefined;
330
+ height?: number | undefined;
331
+ } | undefined;
332
+ xlarge?: {
333
+ url: string;
334
+ id?: string | undefined;
335
+ width?: number | undefined;
336
+ height?: number | undefined;
337
+ } | undefined;
338
+ xxlarge?: {
339
+ url: string;
340
+ id?: string | undefined;
341
+ width?: number | undefined;
342
+ height?: number | undefined;
343
+ } | undefined;
344
+ original?: {
345
+ url: string;
346
+ id?: string | undefined;
347
+ width?: number | undefined;
348
+ height?: number | undefined;
349
+ } | undefined;
350
+ }, {
351
+ small?: {
352
+ url: string;
353
+ id?: string | undefined;
354
+ width?: number | undefined;
355
+ height?: number | undefined;
356
+ } | undefined;
357
+ medium?: {
358
+ url: string;
359
+ id?: string | undefined;
360
+ width?: number | undefined;
361
+ height?: number | undefined;
362
+ } | undefined;
363
+ large?: {
364
+ url: string;
365
+ id?: string | undefined;
366
+ width?: number | undefined;
367
+ height?: number | undefined;
368
+ } | undefined;
369
+ xlarge?: {
370
+ url: string;
371
+ id?: string | undefined;
372
+ width?: number | undefined;
373
+ height?: number | undefined;
374
+ } | undefined;
375
+ xxlarge?: {
376
+ url: string;
377
+ id?: string | undefined;
378
+ width?: number | undefined;
379
+ height?: number | undefined;
380
+ } | undefined;
381
+ original?: {
382
+ url: string;
383
+ id?: string | undefined;
384
+ width?: number | undefined;
385
+ height?: number | undefined;
386
+ } | undefined;
387
+ }>>;
388
+ previewAvailable: z.ZodOptional<z.ZodBoolean>;
389
+ }, "strip", z.ZodTypeAny, {
390
+ id: string;
391
+ title: string;
392
+ artistName: string;
393
+ duration: number;
394
+ artistId?: string | undefined;
395
+ albumId?: string | undefined;
396
+ albumName?: string | undefined;
397
+ coverArt?: string | undefined;
398
+ coverArtSizes?: {
399
+ small?: {
400
+ url: string;
401
+ id?: string | undefined;
402
+ width?: number | undefined;
403
+ height?: number | undefined;
404
+ } | undefined;
405
+ medium?: {
406
+ url: string;
407
+ id?: string | undefined;
408
+ width?: number | undefined;
409
+ height?: number | undefined;
410
+ } | undefined;
411
+ large?: {
412
+ url: string;
413
+ id?: string | undefined;
414
+ width?: number | undefined;
415
+ height?: number | undefined;
416
+ } | undefined;
417
+ xlarge?: {
418
+ url: string;
419
+ id?: string | undefined;
420
+ width?: number | undefined;
421
+ height?: number | undefined;
422
+ } | undefined;
423
+ xxlarge?: {
424
+ url: string;
425
+ id?: string | undefined;
426
+ width?: number | undefined;
427
+ height?: number | undefined;
428
+ } | undefined;
429
+ original?: {
430
+ url: string;
431
+ id?: string | undefined;
432
+ width?: number | undefined;
433
+ height?: number | undefined;
434
+ } | undefined;
435
+ } | undefined;
436
+ previewAvailable?: boolean | undefined;
437
+ }, {
438
+ id: string;
439
+ title: string;
440
+ artistName: string;
441
+ duration: number;
442
+ artistId?: string | undefined;
443
+ albumId?: string | undefined;
444
+ albumName?: string | undefined;
445
+ coverArt?: string | undefined;
446
+ coverArtSizes?: {
447
+ small?: {
448
+ url: string;
449
+ id?: string | undefined;
450
+ width?: number | undefined;
451
+ height?: number | undefined;
452
+ } | undefined;
453
+ medium?: {
454
+ url: string;
455
+ id?: string | undefined;
456
+ width?: number | undefined;
457
+ height?: number | undefined;
458
+ } | undefined;
459
+ large?: {
460
+ url: string;
461
+ id?: string | undefined;
462
+ width?: number | undefined;
463
+ height?: number | undefined;
464
+ } | undefined;
465
+ xlarge?: {
466
+ url: string;
467
+ id?: string | undefined;
468
+ width?: number | undefined;
469
+ height?: number | undefined;
470
+ } | undefined;
471
+ xxlarge?: {
472
+ url: string;
473
+ id?: string | undefined;
474
+ width?: number | undefined;
475
+ height?: number | undefined;
476
+ } | undefined;
477
+ original?: {
478
+ url: string;
479
+ id?: string | undefined;
480
+ width?: number | undefined;
481
+ height?: number | undefined;
482
+ } | undefined;
483
+ } | undefined;
484
+ previewAvailable?: boolean | undefined;
485
+ }>;
486
+ export type TrackSummary = z.infer<typeof trackSummarySchema>;
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@syra.fm/sdk",
3
+ "version": "0.1.0",
4
+ "description": "Headless, isomorphic client for the Syra public API — catalog reads and 30s preview clips. No React/RN/DOM dependencies; public reads only.",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "source": "src/index.ts",
9
+ "sideEffects": false,
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "import": {
16
+ "types": "./dist/types/index.d.ts",
17
+ "default": "./dist/esm/index.js"
18
+ },
19
+ "require": {
20
+ "types": "./dist/types/index.d.ts",
21
+ "default": "./dist/cjs/index.js"
22
+ },
23
+ "default": "./dist/esm/index.js"
24
+ },
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "src"
30
+ ],
31
+ "keywords": [
32
+ "syra",
33
+ "sdk",
34
+ "music",
35
+ "api-client",
36
+ "preview"
37
+ ],
38
+ "author": "Syra Team",
39
+ "license": "MIT",
40
+ "engines": {
41
+ "node": ">=18.0.0"
42
+ },
43
+ "scripts": {
44
+ "build": "bun run clean && bun run build:cjs && bun run build:esm && bun run build:types && bun run build:markers",
45
+ "build:cjs": "tsc -p tsconfig.cjs.json",
46
+ "build:esm": "tsc -p tsconfig.esm.json && node scripts/fix-esm-imports.mjs",
47
+ "build:types": "tsc -p tsconfig.types.json",
48
+ "build:markers": "node scripts/write-dist-markers.mjs",
49
+ "clean": "rm -rf dist",
50
+ "typecheck": "tsc -p tsconfig.json",
51
+ "test": "bun test src",
52
+ "prepublishOnly": "bun run build"
53
+ },
54
+ "dependencies": {
55
+ "zod": "^3.25.76"
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "^20.0.0",
59
+ "typescript": "~5.9.2"
60
+ }
61
+ }