@letsmoe/otter-sdk 0.0.0-stage → 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.
Files changed (48) hide show
  1. package/README.md +184 -2
  2. package/package.json +40 -4
  3. package/src/aes-gcm.ts +189 -0
  4. package/src/client.ts +23 -0
  5. package/src/context.ts +74 -0
  6. package/src/definition.ts +81 -0
  7. package/src/errors.ts +61 -0
  8. package/src/extract.ts +134 -0
  9. package/src/generated/index.ts +79 -0
  10. package/src/generated/runtime/batcher.ts +275 -0
  11. package/src/generated/runtime/createClient.ts +68 -0
  12. package/src/generated/runtime/error.ts +29 -0
  13. package/src/generated/runtime/fetcher.ts +97 -0
  14. package/src/generated/runtime/generateGraphqlOperation.ts +225 -0
  15. package/src/generated/runtime/index.ts +13 -0
  16. package/src/generated/runtime/linkTypeMap.ts +156 -0
  17. package/src/generated/runtime/typeSelection.ts +95 -0
  18. package/src/generated/runtime/types.ts +69 -0
  19. package/src/generated/schema.graphql +657 -0
  20. package/src/generated/schema.ts +1338 -0
  21. package/src/generated/types.ts +1495 -0
  22. package/src/hosters/dead-link.ts +55 -0
  23. package/src/hosters/dood.ts +69 -0
  24. package/src/hosters/filemoon.ts +152 -0
  25. package/src/hosters/generic.ts +63 -0
  26. package/src/hosters/index.ts +14 -0
  27. package/src/hosters/recaptcha.ts +61 -0
  28. package/src/hosters/registry.ts +74 -0
  29. package/src/hosters/streamtape.ts +63 -0
  30. package/src/hosters/vidara.ts +48 -0
  31. package/src/hosters/vinovo.ts +55 -0
  32. package/src/hosters/voe-decoding.ts +131 -0
  33. package/src/hosters/voe-domains.ts +39 -0
  34. package/src/hosters/voe.ts +82 -0
  35. package/src/http-client.ts +295 -0
  36. package/src/http.ts +97 -0
  37. package/src/index.ts +9 -0
  38. package/src/languages.ts +73 -0
  39. package/src/match.ts +120 -0
  40. package/src/model.ts +110 -0
  41. package/src/packer.ts +106 -0
  42. package/src/plugin.ts +4 -0
  43. package/src/run.ts +74 -0
  44. package/src/runtime.ts +254 -0
  45. package/src/testing.ts +120 -0
  46. package/src/timing.ts +11 -0
  47. package/src/types.ts +122 -0
  48. package/src/url.ts +60 -0
@@ -0,0 +1,657 @@
1
+ enum MediaType {
2
+ MOVIE
3
+ SERIES
4
+ EPISODE
5
+ }
6
+
7
+ """A movie or a series."""
8
+ type Title {
9
+ id: ID!
10
+ mediaType: MediaType!
11
+ tmdbId: Int!
12
+ imdbId: String
13
+ title: String!
14
+ originalTitle: String
15
+ overview: String
16
+ tagline: String
17
+
18
+ """Release date of a movie, first air date of a series."""
19
+ releaseDate: String
20
+ year: Int
21
+
22
+ """Minutes; movies only."""
23
+ runtime: Int
24
+ status: String
25
+ voteAverage: Float!
26
+ voteCount: Int!
27
+ popularity: Float!
28
+ posterPath: String
29
+ backdropPath: String
30
+ logoPath: String
31
+
32
+ """YouTube key of the trailer."""
33
+ trailerKey: String
34
+ genres: [String!]!
35
+ keywords: [String!]!
36
+
37
+ """
38
+ False for titles only seen in lists; reading them through Query.title fetches the rest.
39
+ """
40
+ detailFetched: Boolean!
41
+ credits: [Credit!]!
42
+
43
+ """TMDB recommendations first, then other work of the director and leads."""
44
+ related(limit: Int = 20): [Title!]!
45
+
46
+ """Series only."""
47
+ seasons: [Season!]!
48
+
49
+ """
50
+ Series only: regular seasons, without specials. 0 until the detail was fetched.
51
+ """
52
+ seasonCount: Int!
53
+
54
+ """Movies only. Stored links; Subscription.streams finds new ones."""
55
+ streams: [Stream!]!
56
+ progress(profileId: ID!): WatchProgress
57
+ rating(profileId: ID!): Float
58
+ inWatchlist(profileId: ID!): Boolean!
59
+ }
60
+
61
+ type Season {
62
+ id: ID!
63
+ seasonNumber: Int!
64
+ name: String
65
+ overview: String
66
+ airDate: String
67
+ posterPath: String
68
+ episodeCount: Int!
69
+
70
+ """Fetched from TMDB on first read."""
71
+ episodes: [Episode!]!
72
+ }
73
+
74
+ type Episode {
75
+ id: ID!
76
+ tmdbId: Int!
77
+ seasonNumber: Int!
78
+ episodeNumber: Int!
79
+ name: String
80
+ overview: String
81
+ airDate: String
82
+ runtime: Int
83
+ stillPath: String
84
+ voteAverage: Float!
85
+ series: Title!
86
+ streams: [Stream!]!
87
+ progress(profileId: ID!): WatchProgress
88
+
89
+ """The episode after this one, crossing seasons."""
90
+ next: Episode
91
+
92
+ """
93
+ Parts viewers skip (intro, recap, credits, preview), from TheIntroDB; empty when nobody timed them.
94
+ """
95
+ skipSegments: [SkipSegment!]!
96
+ }
97
+
98
+ """A skippable part of an episode."""
99
+ type SkipSegment {
100
+ """intro, recap, credits or preview"""
101
+ kind: String!
102
+ startSeconds: Float!
103
+
104
+ """Null when it runs to the end."""
105
+ endSeconds: Float
106
+ }
107
+
108
+ type Person {
109
+ id: ID!
110
+ tmdbId: Int!
111
+ name: String!
112
+ profilePath: String
113
+ biography: String
114
+ birthday: String
115
+ deathday: String
116
+ placeOfBirth: String
117
+ knownForDepartment: String
118
+
119
+ """
120
+ Titles the person is credited on, newest first; job (e.g. "Director") keeps only those crew credits.
121
+ """
122
+ filmography(job: String): [Title!]!
123
+
124
+ """
125
+ Actors who appear most often alongside this person in their best-known roles.
126
+ """
127
+ coStars(limit: Int = 12): [CoStar!]!
128
+
129
+ """
130
+ This person's titles that fit the profile's taste best, without disliked or finished ones.
131
+ """
132
+ recommendedFor(profileId: ID!, limit: Int = 20): [Title!]!
133
+ }
134
+
135
+ type CoStar {
136
+ person: Person!
137
+
138
+ """How many of this person's titles they share."""
139
+ sharedTitles: Int!
140
+ }
141
+
142
+ type Credit {
143
+ person: Person!
144
+
145
+ """cast or crew"""
146
+ role: String!
147
+ job: String
148
+ character: String
149
+ order: Int!
150
+ }
151
+
152
+ type Stream {
153
+ id: ID!
154
+ plugin: String!
155
+ url: String!
156
+ label: String
157
+ quality: String
158
+ language: String
159
+ format: String
160
+ sizeBytes: Float
161
+ speedBps: Float
162
+
163
+ """Null until someone tried to play it."""
164
+ playable: Boolean
165
+ foundAt: String!
166
+ }
167
+
168
+ type StreamUpdate {
169
+ streams: [Stream!]!
170
+
171
+ """True on the last update of a lookup."""
172
+ done: Boolean!
173
+ }
174
+
175
+ type ResolvedStream {
176
+ """Playable URL, proxied through the backend when the host needs headers."""
177
+ url: String!
178
+ mimeType: String!
179
+ quality: String
180
+
181
+ """The stored link this was resolved from."""
182
+ streamId: ID
183
+ }
184
+
185
+ type WatchProgress {
186
+ mediaId: ID!
187
+ progressSeconds: Float!
188
+ durationSeconds: Float!
189
+ completed: Boolean!
190
+ updatedAt: String!
191
+ }
192
+
193
+ type ContinueItem {
194
+ title: Title!
195
+
196
+ """For series: the episode to continue or the next one."""
197
+ episode: Episode
198
+ progress: WatchProgress
199
+ }
200
+
201
+ type HistoryEntry {
202
+ title: Title!
203
+ episode: Episode
204
+ progress: WatchProgress!
205
+ }
206
+
207
+ type Recommendation {
208
+ title: Title!
209
+
210
+ """Why, e.g. "Because you watched Heat"."""
211
+ reason: String!
212
+ source: String!
213
+ score: Float!
214
+ }
215
+
216
+ """
217
+ Narrows search results; omitted fields don't filter. Runtime is in minutes.
218
+ """
219
+ input TitleFilter {
220
+ minRating: Float
221
+ minRuntime: Int
222
+ maxRuntime: Int
223
+ minSeasons: Int
224
+ maxSeasons: Int
225
+ }
226
+
227
+ """Titles featuring the lead actor of a title the profile rated well."""
228
+ type MoreWithRow {
229
+ person: Person!
230
+ becauseOf: Title!
231
+ items: [Title!]!
232
+ }
233
+
234
+ type RecommendationRow {
235
+ key: String!
236
+ title: String!
237
+ items: [Title!]!
238
+ }
239
+
240
+ type Profile {
241
+ id: ID!
242
+ name: String!
243
+ avatarUrl: String
244
+ hasPin: Boolean!
245
+ isChild: Boolean!
246
+
247
+ """
248
+ Audio languages, most preferred first (ISO 639-1, e.g. de, en). Links in these languages are tried first, dubs before subs.
249
+ """
250
+ languages: [String!]!
251
+
252
+ """Show captions by default"""
253
+ subtitlesEnabled: Boolean!
254
+
255
+ """
256
+ Preferred caption language (ISO 639-1); null = the profile's first language
257
+ """
258
+ subtitleLanguage: String
259
+ subtitleSize: SubtitleSize!
260
+
261
+ """Boost dialogue over music and effects"""
262
+ voiceBoost: Boolean!
263
+ }
264
+
265
+ """
266
+ An external subtitle file for a movie or episode, found by a subtitles plugin.
267
+ """
268
+ type Subtitle {
269
+ id: ID!
270
+
271
+ """ISO 639-1, e.g. de, en"""
272
+ language: String!
273
+
274
+ """Display label, e.g. 'Deutsch' or 'English (SDH)'"""
275
+ label: String!
276
+
277
+ """Release name the file was made for, when the source says"""
278
+ release: String
279
+ hearingImpaired: Boolean!
280
+
281
+ """Plugin that found it"""
282
+ source: String!
283
+
284
+ """
285
+ Path on the backend, e.g. /api/subtitles/<id>.vtt; clients prefix their backend origin
286
+ """
287
+ vttUrl: String!
288
+
289
+ """Same file as SRT (for DLNA TVs), /api/subtitles/<id>.srt"""
290
+ srtUrl: String!
291
+ }
292
+
293
+ enum SubtitleSize {
294
+ SMALL
295
+ MEDIUM
296
+ LARGE
297
+ }
298
+
299
+ type PinCheck {
300
+ success: Boolean!
301
+
302
+ """After a failure, seconds until the next attempt is allowed."""
303
+ waitSeconds: Int!
304
+ }
305
+
306
+ enum TmdbKeyStatus {
307
+ OK
308
+ MISSING
309
+
310
+ """TMDB rejected the key in use."""
311
+ INVALID
312
+ }
313
+
314
+ type Settings {
315
+ """The user's own key; empty while the built-in one is used."""
316
+ tmdbApiKey: String!
317
+ tmdbLanguage: String!
318
+ tmdbKeyStatus: TmdbKeyStatus!
319
+ usesDefaultTmdbKey: Boolean!
320
+
321
+ """Whether this build has a built-in key to fall back to (in use or not)."""
322
+ hasDefaultTmdbKey: Boolean!
323
+
324
+ """Whether the first-run TMDB key dialog was answered."""
325
+ tmdbKeyPromptSeen: Boolean!
326
+ requireVpn: Boolean!
327
+ disabledPlugins: [String!]!
328
+ }
329
+
330
+ input SettingsInput {
331
+ tmdbApiKey: String
332
+ tmdbLanguage: String
333
+ tmdbKeyPromptSeen: Boolean
334
+ requireVpn: Boolean
335
+ }
336
+
337
+ type PluginSettingField {
338
+ key: String!
339
+ label: String!
340
+ description: String
341
+ type: String!
342
+ required: Boolean!
343
+ default: String
344
+ value: String
345
+ }
346
+
347
+ input PluginSettingInput {
348
+ key: String!
349
+ value: String!
350
+ }
351
+
352
+ type Plugin {
353
+ name: String!
354
+ displayName: String
355
+ description: String
356
+ icon: String
357
+ version: String!
358
+ capabilities: [String!]!
359
+ enabled: Boolean!
360
+
361
+ """
362
+ False when the plugin needs something missing here (e.g. FlareSolverr).
363
+ """
364
+ available: Boolean!
365
+ settings: [PluginSettingField!]!
366
+ }
367
+
368
+ type Status {
369
+ tmdbConfigured: Boolean!
370
+ vpnConnected: Boolean!
371
+ requireVpn: Boolean!
372
+ }
373
+
374
+ enum NotificationKind {
375
+ """A movie on the list got its first stream links."""
376
+ AVAILABLE
377
+
378
+ """A series on the list aired a new episode."""
379
+ NEW_EPISODE
380
+
381
+ """A movie or episode on the list releases soon."""
382
+ COMING_SOON
383
+ }
384
+
385
+ type Notification {
386
+ id: ID!
387
+ kind: NotificationKind!
388
+
389
+ """E.g. "Now available", "Coming 11 February"."""
390
+ heading: String!
391
+ body: String
392
+ createdAt: String!
393
+ read: Boolean!
394
+
395
+ """The movie or series."""
396
+ title: Title!
397
+
398
+ """Set when the notification is about one episode."""
399
+ episode: Episode
400
+ }
401
+
402
+ enum DownloadStatus {
403
+ QUEUED
404
+ DOWNLOADING
405
+ DONE
406
+ FAILED
407
+ }
408
+
409
+ """A movie or episode saved for offline playback."""
410
+ type Download {
411
+ id: ID!
412
+ status: DownloadStatus!
413
+
414
+ """0..1"""
415
+ progress: Float!
416
+
417
+ """Bytes received so far (the full size once done)."""
418
+ sizeBytes: Float!
419
+ error: String
420
+ createdAt: String!
421
+
422
+ """The movie, or the episode's series."""
423
+ title: Title!
424
+ episode: Episode
425
+
426
+ """Local playable URL once done."""
427
+ url: String
428
+ mimeType: String
429
+ }
430
+
431
+ enum TogetherStatus {
432
+ """Hosting, nobody joined yet."""
433
+ WAITING
434
+
435
+ """Joined, looking for the host."""
436
+ CONNECTING
437
+ CONNECTED
438
+
439
+ """The host left."""
440
+ CLOSED
441
+
442
+ """The host could not be reached."""
443
+ FAILED
444
+ }
445
+
446
+ """Someone in a Watch Together room."""
447
+ type TogetherPeer {
448
+ id: ID!
449
+ name: String!
450
+
451
+ """The profile's avatar (e.g. otter:classic)."""
452
+ avatar: String
453
+ }
454
+
455
+ """
456
+ A Watch Together room: peers meet over Nostr relays, then sync peer-to-peer.
457
+ """
458
+ type TogetherRoom {
459
+ """Eight characters; share it so others can join."""
460
+ code: String!
461
+ hosting: Boolean!
462
+ status: TogetherStatus!
463
+ self: TogetherPeer!
464
+
465
+ """Everyone connected, including self."""
466
+ peers: [TogetherPeer!]!
467
+ }
468
+
469
+ """An app payload (JSON) from another participant."""
470
+ type TogetherMessage {
471
+ from: TogetherPeer!
472
+ payload: String!
473
+ }
474
+
475
+ type TogetherUpdate {
476
+ """Null when there is no room."""
477
+ room: TogetherRoom
478
+ message: TogetherMessage
479
+ }
480
+
481
+ enum CatalogSort {
482
+ POPULAR
483
+ TOP_RATED
484
+ }
485
+
486
+ """
487
+ Curated discover rows. Blockbusters are movies only, bingeworthy is series only; the others work for both.
488
+ """
489
+ enum CatalogTheme {
490
+ HIDDEN_GEMS
491
+ BLOCKBUSTERS
492
+ FEEL_GOOD
493
+ BINGEWORTHY
494
+ }
495
+
496
+ type CatalogRow {
497
+ genre: String!
498
+ items: [Title!]!
499
+ }
500
+
501
+ type Query {
502
+ """A movie or series, fetched from TMDB when missing or stale."""
503
+ title(id: ID!): Title
504
+ episode(id: ID!): Episode
505
+
506
+ """
507
+ A person with biography and filmography, fetched when missing or stale.
508
+ """
509
+ person(id: ID!): Person
510
+
511
+ """TMDB search; results are stored as titles."""
512
+ search(query: String!, mediaType: MediaType, limit: Int = 20, filter: TitleFilter): [Title!]!
513
+ trending(mediaType: MediaType): [Title!]!
514
+
515
+ """
516
+ Upcoming releases (soonest first), then recent ones (newest first). Series: currently airing.
517
+ """
518
+ newAndComingSoon(mediaType: MediaType!): [Title!]!
519
+
520
+ """
521
+ Lead actors of the profile's most recently watched titles of one type, the most frequent first; empty before any history.
522
+ """
523
+ watchedActors(profileId: ID!, mediaType: MediaType!, limit: Int = 15): [Person!]!
524
+
525
+ """
526
+ More titles with the lead actor of the profile's latest well-rated title; null before any good rating.
527
+ """
528
+ moreWith(profileId: ID!, mediaType: MediaType!): MoreWithRow
529
+
530
+ """Stored titles of one type, most popular first."""
531
+ browse(mediaType: MediaType!, genre: String, limit: Int = 40, offset: Int = 0): [Title!]!
532
+ genres: [String!]!
533
+
534
+ """
535
+ Popular or top-rated titles straight from TMDB's catalog (stored as titles), to fill Home before the profile has history.
536
+ """
537
+ catalog(mediaType: MediaType!, sort: CatalogSort = POPULAR): [Title!]!
538
+
539
+ """
540
+ One themed row of TMDB's catalog (stored as titles); empty when the theme doesn't fit the media type.
541
+ """
542
+ catalogTheme(mediaType: MediaType!, theme: CatalogTheme!): [Title!]!
543
+
544
+ """
545
+ Up to count genre rows of popular TMDB titles, skipping the genre names in exclude.
546
+ """
547
+ catalogRows(mediaType: MediaType!, count: Int = 6, exclude: [String!]): [CatalogRow!]!
548
+ recommendations(profileId: ID!, mediaType: MediaType, limit: Int = 24, offset: Int = 0, refresh: Boolean = false): [Recommendation!]!
549
+ recommendationRows(profileId: ID!, rows: Int = 8, perRow: Int = 20): [RecommendationRow!]!
550
+ continueWatching(profileId: ID!, limit: Int = 20): [ContinueItem!]!
551
+ history(profileId: ID!, limit: Int = 50): [HistoryEntry!]!
552
+ watchlist(profileId: ID!): [Title!]!
553
+
554
+ """
555
+ Titles the profile rated well (I like this, Love this), latest rating first.
556
+ """
557
+ likedTitles(profileId: ID!, limit: Int = 30): [Title!]!
558
+
559
+ """Newest first."""
560
+ notifications(profileId: ID!, limit: Int = 30): [Notification!]!
561
+ unreadNotificationCount(profileId: ID!): Int!
562
+
563
+ """Newest first."""
564
+ downloads(profileId: ID!): [Download!]!
565
+
566
+ """
567
+ Folder finished downloads are saved to as named video files; null when they are not.
568
+ """
569
+ downloadsFolder: String
570
+
571
+ """The open Watch Together room, if any."""
572
+ togetherRoom: TogetherRoom
573
+
574
+ """
575
+ Subtitle files for a movie or episode (same id as streams/findStreams), best first. Ranked by the profile's caption language, then its other languages; at most 3 per language. Asks subtitles plugins when nothing fresh is stored.
576
+ """
577
+ subtitles(mediaId: ID!, profileId: ID): [Subtitle!]!
578
+ profiles: [Profile!]!
579
+ settings: Settings!
580
+
581
+ """Whether TMDB accepts the key; errors when TMDB can't be reached."""
582
+ checkTmdbKey(key: String!): Boolean!
583
+ plugins: [Plugin!]!
584
+ status: Status!
585
+ }
586
+
587
+ type Mutation {
588
+ """
589
+ Ask every streams plugin again for a movie or episode, in the background.
590
+ """
591
+ findStreams(id: ID!): Boolean!
592
+
593
+ """
594
+ Turn a stored stream into a playable URL; only succeeds when the link really delivers video.
595
+ """
596
+ resolveStream(streamId: ID!): ResolvedStream!
597
+
598
+ """
599
+ Resolves several links at once (most preferred first) and returns the fastest that really delivers video. Fails only when none plays.
600
+ """
601
+ resolveBestStream(streamIds: [ID!]!): ResolvedStream!
602
+ recordProgress(profileId: ID!, mediaId: ID!, progressSeconds: Float!, durationSeconds: Float!): WatchProgress!
603
+ setRating(profileId: ID!, mediaId: ID!, rating: Float!): Boolean!
604
+ clearRating(profileId: ID!, mediaId: ID!): Boolean!
605
+ addToWatchlist(profileId: ID!, mediaId: ID!): Boolean!
606
+ removeFromWatchlist(profileId: ID!, mediaId: ID!): Boolean!
607
+ markNotificationsRead(profileId: ID!): Boolean!
608
+
609
+ """
610
+ Queue a movie or episode for download; a failed one is retried. streamId picks the link, otherwise the best ones are tried.
611
+ """
612
+ startDownload(profileId: ID!, mediaId: ID!, streamId: ID): Download!
613
+
614
+ """Remove a download (stops it when running)."""
615
+ deleteDownload(id: ID!): Boolean!
616
+
617
+ """
618
+ Open the downloads folder in the file manager of the machine the backend runs on.
619
+ """
620
+ openDownloadsFolder: Boolean!
621
+
622
+ """Open a Watch Together room as the profile; replaces any open room."""
623
+ hostTogether(profileId: ID!): TogetherRoom!
624
+
625
+ """Join a room by its code as the profile; replaces any open room."""
626
+ joinTogether(profileId: ID!, code: String!): TogetherRoom!
627
+ leaveTogether: Boolean!
628
+
629
+ """
630
+ Store a link another Watch Together participant plays, so it can be resolved here.
631
+ """
632
+ adoptStream(mediaId: ID!, url: String!, plugin: String!, label: String): Stream!
633
+
634
+ """Send a JSON payload to everyone else in the room."""
635
+ sendTogether(payload: String!): Boolean!
636
+ createProfile(name: String!, avatarUrl: String, pin: String, isChild: Boolean = false, languages: [String!]): Profile!
637
+
638
+ """
639
+ Changes the given fields; omitted fields stay. An empty pin removes the PIN; an empty subtitleLanguage clears it.
640
+ """
641
+ updateProfile(id: ID!, name: String, avatarUrl: String, isChild: Boolean, pin: String, languages: [String!], subtitlesEnabled: Boolean, subtitleLanguage: String, subtitleSize: SubtitleSize, voiceBoost: Boolean): Profile!
642
+ deleteProfile(id: ID!): Boolean!
643
+ verifyPin(profileId: ID!, pin: String!): PinCheck!
644
+ updateSettings(input: SettingsInput!): Settings!
645
+ setPluginEnabled(name: String!, enabled: Boolean!): Plugin!
646
+ setPluginSettings(name: String!, values: [PluginSettingInput!]!): Plugin!
647
+ }
648
+
649
+ type Subscription {
650
+ """
651
+ Stream list of a movie or episode as plugins answer. Starts a lookup when the stored links are stale.
652
+ """
653
+ streams(id: ID!): StreamUpdate!
654
+
655
+ """The Watch Together room as it changes, and messages from the others."""
656
+ together: TogetherUpdate!
657
+ }