@vyla-entertainment/sdk 1.3.0 → 1.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 (2) hide show
  1. package/package.json +2 -1
  2. package/src/sdk.d.ts +123 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyla-entertainment/sdk",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "scripts": {
5
5
  "test": "node test/index.js"
6
6
  },
@@ -18,6 +18,7 @@
18
18
  "type": "module",
19
19
  "description": "Vyla's multi-provider stream scraper SDK",
20
20
  "main": "src/sdk.js",
21
+ "types": "src/sdk.d.ts",
21
22
  "directories": {
22
23
  "test": "test"
23
24
  },
package/src/sdk.d.ts ADDED
@@ -0,0 +1,123 @@
1
+ export interface SourceConfig {
2
+ key: string;
3
+ label: string;
4
+ sourceFile: string;
5
+ proxyParam: string;
6
+ timeout: number;
7
+ jitter: number;
8
+ retries: number;
9
+ multiUrl: boolean;
10
+ skipProxy?: boolean;
11
+ cdnHeaders?: {
12
+ pattern: RegExp;
13
+ headers: {
14
+ Referer: string;
15
+ Origin: string;
16
+ };
17
+ }[];
18
+ skipVerify?: boolean;
19
+ verifyHeaders?: boolean;
20
+ disabled?: boolean;
21
+ sourcesTimeout?: number;
22
+ }
23
+ export interface ProbeResult {
24
+ ok: boolean;
25
+ ms: number | null;
26
+ }
27
+ export interface StreamResult {
28
+ url: string;
29
+ headers: {
30
+ "User-Agent": string;
31
+ Referer: string;
32
+ Origin: string;
33
+ [key: string]: string;
34
+ };
35
+ server: string;
36
+ quality: string;
37
+ type: "mp4" | "hls";
38
+ skipVerify?: boolean;
39
+ skipProxy?: boolean;
40
+ }
41
+
42
+ export interface DownloadResult {
43
+ url: string;
44
+ quality: string;
45
+ size: number | null;
46
+ type: "mkv";
47
+ active: boolean;
48
+ }
49
+ export interface SubtitleResult {
50
+ label: string;
51
+ file: string;
52
+ type: "vtt" | "srt";
53
+ source: string;
54
+ }
55
+
56
+ export type ProbeAllResult = Record<string, ProbeResult>;
57
+
58
+ export interface VylaSDKOptions {
59
+ tmdbApiKey?: string;
60
+ }
61
+
62
+ // Descriptions written with Claude.
63
+ export default class VylaSDK {
64
+ tmdbApiKey?: string;
65
+
66
+ constructor(options?: VylaSDKOptions);
67
+
68
+ /**
69
+ * Get the list of configured sources.
70
+ * @param excludeDisabled If true, filters out disabled sources.
71
+ */
72
+ getSources(excludeDisabled?: boolean): SourceConfig[];
73
+
74
+ /**
75
+ * Probe all active (non-disabled) sources for availability.
76
+ */
77
+ probeAllSources(): Promise<ProbeAllResult>;
78
+
79
+ /**
80
+ * Probe a single source by key.
81
+ */
82
+ probeSource(key: string): Promise<ProbeResult>;
83
+
84
+ /**
85
+ * Get a playable stream for a given source/media id.
86
+ * @param key Source key
87
+ * @param id Media id (e.g. TMDB id)
88
+ * @param s Season number (for TV), or null for movies
89
+ * @param e Episode number (for TV), or null for movies
90
+ * @param clientIP Optional client IP for source-specific logic
91
+ */
92
+ getStream(
93
+ key: string,
94
+ id: string | number,
95
+ s?: number | null,
96
+ e?: number | null,
97
+ clientIP?: string | null
98
+ ): Promise<StreamResult>;
99
+
100
+ /**
101
+ * Get subtitles for a movie or TV episode.
102
+ * @param id Media id
103
+ * @param s Season number (for TV), or null for movies
104
+ * @param e Episode number (for TV), or null for movies
105
+ */
106
+ getSubtitles(
107
+ id: string | number,
108
+ s?: number | null,
109
+ e?: number | null
110
+ ): Promise<SubtitleResult[]>;
111
+
112
+ /**
113
+ * Get download links for a movie or TV episode.
114
+ * @param id Media id
115
+ * @param s Season number (for TV), or null for movies
116
+ * @param e Episode number (for TV), or null for movies
117
+ */
118
+ getDownloads(
119
+ id: string | number,
120
+ s?: number | null,
121
+ e?: number | null
122
+ ): Promise<DownloadResult[]>;
123
+ }