@lelap/sdk 0.0.0-stage → 0.2.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,571 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Lelap add-on protocol v1",
4
+ "$defs": {
5
+ "Manifest": {
6
+ "$id": "#/$defs/Manifest",
7
+ "type": "object",
8
+ "properties": {
9
+ "id": {
10
+ "type": "string",
11
+ "minLength": 3
12
+ },
13
+ "version": {
14
+ "type": "string",
15
+ "pattern": "^\\d+\\.\\d+\\.\\d+"
16
+ },
17
+ "protocol": {
18
+ "type": "number",
19
+ "const": 1
20
+ },
21
+ "name": {
22
+ "type": "string",
23
+ "minLength": 1
24
+ },
25
+ "description": {
26
+ "type": "string"
27
+ },
28
+ "logo": {
29
+ "type": "string",
30
+ "format": "uri"
31
+ },
32
+ "types": {
33
+ "minItems": 1,
34
+ "type": "array",
35
+ "items": {
36
+ "type": "string",
37
+ "enum": [
38
+ "audiobook",
39
+ "podcast",
40
+ "episode"
41
+ ]
42
+ }
43
+ },
44
+ "resources": {
45
+ "minItems": 1,
46
+ "type": "array",
47
+ "items": {
48
+ "anyOf": [
49
+ {
50
+ "type": "string",
51
+ "enum": [
52
+ "catalog",
53
+ "meta",
54
+ "stream"
55
+ ]
56
+ },
57
+ {
58
+ "type": "object",
59
+ "properties": {
60
+ "name": {
61
+ "type": "string",
62
+ "enum": [
63
+ "catalog",
64
+ "meta",
65
+ "stream"
66
+ ]
67
+ },
68
+ "types": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "string",
72
+ "enum": [
73
+ "audiobook",
74
+ "podcast",
75
+ "episode"
76
+ ]
77
+ }
78
+ },
79
+ "idPrefixes": {
80
+ "type": "array",
81
+ "items": {
82
+ "type": "string",
83
+ "minLength": 1
84
+ }
85
+ }
86
+ },
87
+ "required": [
88
+ "name"
89
+ ],
90
+ "additionalProperties": false
91
+ }
92
+ ]
93
+ }
94
+ },
95
+ "idPrefixes": {
96
+ "type": "array",
97
+ "items": {
98
+ "type": "string",
99
+ "minLength": 1
100
+ }
101
+ },
102
+ "catalogs": {
103
+ "type": "array",
104
+ "items": {
105
+ "type": "object",
106
+ "properties": {
107
+ "type": {
108
+ "type": "string",
109
+ "enum": [
110
+ "audiobook",
111
+ "podcast",
112
+ "episode"
113
+ ]
114
+ },
115
+ "id": {
116
+ "type": "string",
117
+ "minLength": 1
118
+ },
119
+ "name": {
120
+ "type": "string",
121
+ "minLength": 1
122
+ },
123
+ "extra": {
124
+ "type": "array",
125
+ "items": {
126
+ "type": "object",
127
+ "properties": {
128
+ "name": {
129
+ "type": "string",
130
+ "minLength": 1
131
+ },
132
+ "isRequired": {
133
+ "type": "boolean"
134
+ },
135
+ "options": {
136
+ "type": "array",
137
+ "items": {
138
+ "type": "string"
139
+ }
140
+ }
141
+ },
142
+ "required": [
143
+ "name"
144
+ ],
145
+ "additionalProperties": false
146
+ }
147
+ }
148
+ },
149
+ "required": [
150
+ "type",
151
+ "id",
152
+ "name"
153
+ ],
154
+ "additionalProperties": false
155
+ }
156
+ },
157
+ "configurable": {
158
+ "type": "boolean"
159
+ }
160
+ },
161
+ "required": [
162
+ "id",
163
+ "version",
164
+ "protocol",
165
+ "name",
166
+ "description",
167
+ "types",
168
+ "resources",
169
+ "catalogs"
170
+ ],
171
+ "additionalProperties": false
172
+ },
173
+ "CatalogResponse": {
174
+ "$id": "#/$defs/CatalogResponse",
175
+ "type": "object",
176
+ "properties": {
177
+ "metas": {
178
+ "type": "array",
179
+ "items": {
180
+ "type": "object",
181
+ "properties": {
182
+ "id": {
183
+ "type": "string",
184
+ "minLength": 3,
185
+ "maxLength": 512,
186
+ "pattern": "^[a-z][a-z0-9_-]*:.+$"
187
+ },
188
+ "type": {
189
+ "type": "string",
190
+ "enum": [
191
+ "audiobook",
192
+ "podcast",
193
+ "episode"
194
+ ]
195
+ },
196
+ "name": {
197
+ "type": "string",
198
+ "minLength": 1
199
+ },
200
+ "author": {
201
+ "type": "string"
202
+ },
203
+ "cover": {
204
+ "type": "string",
205
+ "format": "uri"
206
+ },
207
+ "description": {
208
+ "type": "string"
209
+ },
210
+ "year": {
211
+ "type": "integer",
212
+ "minimum": -9007199254740991,
213
+ "maximum": 9007199254740991
214
+ },
215
+ "durationMs": {
216
+ "type": "integer",
217
+ "minimum": 0,
218
+ "maximum": 9007199254740991
219
+ }
220
+ },
221
+ "required": [
222
+ "id",
223
+ "type",
224
+ "name"
225
+ ],
226
+ "additionalProperties": false
227
+ }
228
+ },
229
+ "cacheMaxAge": {
230
+ "type": "integer",
231
+ "minimum": 0,
232
+ "maximum": 9007199254740991
233
+ }
234
+ },
235
+ "required": [
236
+ "metas"
237
+ ],
238
+ "additionalProperties": false
239
+ },
240
+ "MetaResponse": {
241
+ "$id": "#/$defs/MetaResponse",
242
+ "type": "object",
243
+ "properties": {
244
+ "meta": {
245
+ "type": "object",
246
+ "properties": {
247
+ "id": {
248
+ "type": "string",
249
+ "minLength": 3,
250
+ "maxLength": 512,
251
+ "pattern": "^[a-z][a-z0-9_-]*:.+$"
252
+ },
253
+ "type": {
254
+ "type": "string",
255
+ "enum": [
256
+ "audiobook",
257
+ "podcast",
258
+ "episode"
259
+ ]
260
+ },
261
+ "name": {
262
+ "type": "string",
263
+ "minLength": 1
264
+ },
265
+ "author": {
266
+ "type": "string"
267
+ },
268
+ "cover": {
269
+ "type": "string",
270
+ "format": "uri"
271
+ },
272
+ "description": {
273
+ "type": "string"
274
+ },
275
+ "year": {
276
+ "type": "integer",
277
+ "minimum": -9007199254740991,
278
+ "maximum": 9007199254740991
279
+ },
280
+ "durationMs": {
281
+ "type": "integer",
282
+ "minimum": 0,
283
+ "maximum": 9007199254740991
284
+ },
285
+ "narrators": {
286
+ "type": "array",
287
+ "items": {
288
+ "type": "string"
289
+ }
290
+ },
291
+ "series": {
292
+ "type": "array",
293
+ "items": {
294
+ "type": "object",
295
+ "properties": {
296
+ "name": {
297
+ "type": "string",
298
+ "minLength": 1
299
+ },
300
+ "position": {
301
+ "type": "string"
302
+ }
303
+ },
304
+ "required": [
305
+ "name"
306
+ ],
307
+ "additionalProperties": false
308
+ }
309
+ },
310
+ "language": {
311
+ "type": "string"
312
+ },
313
+ "genres": {
314
+ "type": "array",
315
+ "items": {
316
+ "type": "string"
317
+ }
318
+ },
319
+ "chapters": {
320
+ "type": "array",
321
+ "items": {
322
+ "type": "object",
323
+ "properties": {
324
+ "title": {
325
+ "type": "string"
326
+ },
327
+ "startMs": {
328
+ "type": "integer",
329
+ "minimum": 0,
330
+ "maximum": 9007199254740991
331
+ }
332
+ },
333
+ "required": [
334
+ "title",
335
+ "startMs"
336
+ ],
337
+ "additionalProperties": false
338
+ }
339
+ },
340
+ "externalIds": {
341
+ "type": "object",
342
+ "propertyNames": {
343
+ "type": "string"
344
+ },
345
+ "additionalProperties": {
346
+ "type": "string"
347
+ }
348
+ },
349
+ "episodes": {
350
+ "type": "array",
351
+ "items": {
352
+ "type": "object",
353
+ "properties": {
354
+ "id": {
355
+ "type": "string",
356
+ "minLength": 3,
357
+ "maxLength": 512,
358
+ "pattern": "^[a-z][a-z0-9_-]*:.+$"
359
+ },
360
+ "title": {
361
+ "type": "string"
362
+ },
363
+ "released": {
364
+ "type": "string"
365
+ },
366
+ "durationMs": {
367
+ "type": "integer",
368
+ "minimum": 0,
369
+ "maximum": 9007199254740991
370
+ },
371
+ "description": {
372
+ "type": "string"
373
+ }
374
+ },
375
+ "required": [
376
+ "id",
377
+ "title"
378
+ ],
379
+ "additionalProperties": false
380
+ }
381
+ },
382
+ "link": {
383
+ "type": "string",
384
+ "format": "uri"
385
+ },
386
+ "feed": {
387
+ "type": "string",
388
+ "format": "uri"
389
+ }
390
+ },
391
+ "required": [
392
+ "id",
393
+ "type",
394
+ "name"
395
+ ],
396
+ "additionalProperties": false
397
+ },
398
+ "cacheMaxAge": {
399
+ "type": "integer",
400
+ "minimum": 0,
401
+ "maximum": 9007199254740991
402
+ }
403
+ },
404
+ "required": [
405
+ "meta"
406
+ ],
407
+ "additionalProperties": false
408
+ },
409
+ "StreamResponse": {
410
+ "$id": "#/$defs/StreamResponse",
411
+ "type": "object",
412
+ "properties": {
413
+ "streams": {
414
+ "type": "array",
415
+ "items": {
416
+ "anyOf": [
417
+ {
418
+ "type": "object",
419
+ "properties": {
420
+ "sourceKey": {
421
+ "type": "string",
422
+ "minLength": 1,
423
+ "maxLength": 256
424
+ },
425
+ "name": {
426
+ "type": "string",
427
+ "minLength": 1
428
+ },
429
+ "title": {
430
+ "type": "string"
431
+ },
432
+ "mime": {
433
+ "type": "string"
434
+ },
435
+ "bitrate": {
436
+ "type": "integer",
437
+ "exclusiveMinimum": 0,
438
+ "maximum": 9007199254740991
439
+ },
440
+ "size": {
441
+ "type": "integer",
442
+ "minimum": 0,
443
+ "maximum": 9007199254740991
444
+ },
445
+ "downloadable": {
446
+ "type": "boolean"
447
+ },
448
+ "parts": {
449
+ "minItems": 1,
450
+ "type": "array",
451
+ "items": {
452
+ "type": "object",
453
+ "properties": {
454
+ "url": {
455
+ "type": "string",
456
+ "format": "uri"
457
+ },
458
+ "title": {
459
+ "type": "string"
460
+ },
461
+ "durationMs": {
462
+ "type": "integer",
463
+ "minimum": 0,
464
+ "maximum": 9007199254740991
465
+ },
466
+ "size": {
467
+ "type": "integer",
468
+ "minimum": 0,
469
+ "maximum": 9007199254740991
470
+ }
471
+ },
472
+ "required": [
473
+ "url",
474
+ "durationMs"
475
+ ],
476
+ "additionalProperties": false
477
+ }
478
+ }
479
+ },
480
+ "required": [
481
+ "sourceKey",
482
+ "name",
483
+ "parts"
484
+ ],
485
+ "additionalProperties": false
486
+ },
487
+ {
488
+ "type": "object",
489
+ "properties": {
490
+ "sourceKey": {
491
+ "type": "string",
492
+ "minLength": 1,
493
+ "maxLength": 256
494
+ },
495
+ "name": {
496
+ "type": "string",
497
+ "minLength": 1
498
+ },
499
+ "title": {
500
+ "type": "string"
501
+ },
502
+ "mime": {
503
+ "type": "string"
504
+ },
505
+ "bitrate": {
506
+ "type": "integer",
507
+ "exclusiveMinimum": 0,
508
+ "maximum": 9007199254740991
509
+ },
510
+ "size": {
511
+ "type": "integer",
512
+ "minimum": 0,
513
+ "maximum": 9007199254740991
514
+ },
515
+ "downloadable": {
516
+ "type": "boolean"
517
+ },
518
+ "url": {
519
+ "type": "string",
520
+ "format": "uri"
521
+ },
522
+ "durationMs": {
523
+ "type": "integer",
524
+ "minimum": 0,
525
+ "maximum": 9007199254740991
526
+ },
527
+ "chapters": {
528
+ "type": "array",
529
+ "items": {
530
+ "type": "object",
531
+ "properties": {
532
+ "title": {
533
+ "type": "string"
534
+ },
535
+ "startMs": {
536
+ "type": "integer",
537
+ "minimum": 0,
538
+ "maximum": 9007199254740991
539
+ }
540
+ },
541
+ "required": [
542
+ "title",
543
+ "startMs"
544
+ ],
545
+ "additionalProperties": false
546
+ }
547
+ }
548
+ },
549
+ "required": [
550
+ "sourceKey",
551
+ "name",
552
+ "url"
553
+ ],
554
+ "additionalProperties": false
555
+ }
556
+ ]
557
+ }
558
+ },
559
+ "cacheMaxAge": {
560
+ "type": "integer",
561
+ "minimum": 0,
562
+ "maximum": 9007199254740991
563
+ }
564
+ },
565
+ "required": [
566
+ "streams"
567
+ ],
568
+ "additionalProperties": false
569
+ }
570
+ }
571
+ }
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@lelap/sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Types, schemas and a request handler for Lelap add-ons.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/lelap-app/lelap.git",
10
+ "directory": "packages/sdk"
11
+ },
12
+ "homepage": "https://github.com/lelap-app/lelap/tree/main/packages/sdk#readme",
13
+ "bugs": "https://github.com/lelap-app/lelap/issues",
14
+ "keywords": [
15
+ "lelap",
16
+ "addon",
17
+ "audiobook",
18
+ "podcast",
19
+ "sdk"
20
+ ],
21
+ "sideEffects": false,
22
+ "engines": {
23
+ "node": ">=20"
24
+ },
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js"
29
+ },
30
+ "./protocol.schema.json": "./dist/protocol.schema.json",
31
+ "./package.json": "./package.json"
32
+ },
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "publishConfig": {
37
+ "access": "public",
38
+ "provenance": true
39
+ },
40
+ "dependencies": {
41
+ "zod": "^4.6.7"
42
+ },
43
+ "devDependencies": {
44
+ "typescript": "~6.0.3",
45
+ "vitest": "^5.1.0"
46
+ },
47
+ "scripts": {
48
+ "build": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && node scripts/esm-paths.mjs && node scripts/schema.mjs",
49
+ "check": "tsc --noEmit",
50
+ "test": "vitest run"
51
+ },
52
+ "types": "./dist/index.d.ts"
6
53
  }