@nuclearplayer/plugin-sdk 2.0.0 → 2.1.1

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.
package/README.md CHANGED
@@ -100,6 +100,22 @@ export default {
100
100
  };
101
101
  ```
102
102
 
103
+ ## Domain APIs
104
+
105
+ The `api` object passed to lifecycle hooks provides access to these domain APIs:
106
+
107
+ | API | Description |
108
+ |-----|-------------|
109
+ | `api.Settings` | Define, read, and persist plugin settings |
110
+ | `api.Queue` | Read and manipulate the playback queue |
111
+ | `api.Favorites` | Manage the user's favorite tracks |
112
+ | `api.Providers` | Register and unregister providers |
113
+ | `api.Streaming` | Resolve audio stream URLs for tracks |
114
+ | `api.Metadata` | Search and fetch artist/album/track details |
115
+ | `api.Dashboard` | Fetch dashboard content (top tracks, new releases, etc.) |
116
+
117
+ See the [full documentation](https://docs.nuclearplayer.com/nuclear-xrd) for detailed guides on each API.
118
+
103
119
  ## Permissions
104
120
 
105
121
  Declare what your plugin does in the `permissions` array. Permissions are currently informational. Future versions might show UI for this.
package/dist/index.d.ts CHANGED
@@ -73,6 +73,13 @@ export declare type ArtworkSet = {
73
73
  items: Artwork[];
74
74
  };
75
75
 
76
+ export declare type AttributedResult<T> = {
77
+ providerId: string;
78
+ metadataProviderId?: string;
79
+ providerName: string;
80
+ items: T[];
81
+ };
82
+
76
83
  export declare type BooleanSettingDefinition = {
77
84
  id: string;
78
85
  title: string;
@@ -89,6 +96,36 @@ export declare type BooleanWidget = {
89
96
  type: 'toggle';
90
97
  };
91
98
 
99
+ export declare class DashboardAPI {
100
+ #private;
101
+ constructor(host?: DashboardHost);
102
+ fetchTopTracks(providerId?: string): Promise<AttributedResult<Track>[]>;
103
+ fetchTopArtists(providerId?: string): Promise<AttributedResult<ArtistRef>[]>;
104
+ fetchTopAlbums(providerId?: string): Promise<AttributedResult<AlbumRef>[]>;
105
+ fetchEditorialPlaylists(providerId?: string): Promise<AttributedResult<PlaylistRef>[]>;
106
+ fetchNewReleases(providerId?: string): Promise<AttributedResult<AlbumRef>[]>;
107
+ }
108
+
109
+ export declare type DashboardCapability = 'topTracks' | 'topArtists' | 'topAlbums' | 'editorialPlaylists' | 'newReleases';
110
+
111
+ export declare type DashboardHost = {
112
+ fetchTopTracks: (providerId?: string) => Promise<AttributedResult<Track>[]>;
113
+ fetchTopArtists: (providerId?: string) => Promise<AttributedResult<ArtistRef>[]>;
114
+ fetchTopAlbums: (providerId?: string) => Promise<AttributedResult<AlbumRef>[]>;
115
+ fetchEditorialPlaylists: (providerId?: string) => Promise<AttributedResult<PlaylistRef>[]>;
116
+ fetchNewReleases: (providerId?: string) => Promise<AttributedResult<AlbumRef>[]>;
117
+ };
118
+
119
+ export declare type DashboardProvider = ProviderDescriptor<'dashboard'> & {
120
+ metadataProviderId?: string;
121
+ capabilities: DashboardCapability[];
122
+ fetchTopTracks?: () => Promise<Track[]>;
123
+ fetchTopArtists?: () => Promise<ArtistRef[]>;
124
+ fetchTopAlbums?: () => Promise<AlbumRef[]>;
125
+ fetchEditorialPlaylists?: () => Promise<PlaylistRef[]>;
126
+ fetchNewReleases?: () => Promise<AlbumRef[]>;
127
+ };
128
+
92
129
  export declare type EnumOption = {
93
130
  value: string;
94
131
  label: string;
@@ -260,7 +297,7 @@ export declare type MetadataProvider = ProviderDescriptor<'metadata'> & {
260
297
  };
261
298
 
262
299
  export declare class MissingCapabilityError extends Error {
263
- constructor(capability: string);
300
+ constructor(capability: string, providerName: string);
264
301
  }
265
302
 
266
303
  export declare class NuclearAPI {
@@ -273,6 +310,7 @@ export declare class NuclearAPI {
273
310
  readonly Ytdlp: YtdlpAPI;
274
311
  readonly Favorites: FavoritesAPI;
275
312
  readonly Logger: LoggerAPI;
313
+ readonly Dashboard: DashboardAPI;
276
314
  constructor(opts?: {
277
315
  settingsHost?: SettingsHost;
278
316
  providersHost?: ProvidersHost;
@@ -283,6 +321,7 @@ export declare class NuclearAPI {
283
321
  ytdlpHost?: YtdlpHost;
284
322
  favoritesHost?: FavoritesHost;
285
323
  loggerHost?: LoggerHost;
324
+ dashboardHost?: DashboardHost;
286
325
  });
287
326
  }
288
327
 
@@ -1027,7 +1066,7 @@ export declare type ProviderDescriptor<K extends ProviderKind = ProviderKind> =
1027
1066
  pluginId?: string;
1028
1067
  };
1029
1068
 
1030
- export declare type ProviderKind = 'metadata' | 'streaming' | 'lyrics' | (string & {});
1069
+ export declare type ProviderKind = 'metadata' | 'streaming' | 'lyrics' | 'dashboard' | (string & {});
1031
1070
 
1032
1071
  export declare type ProviderRef = {
1033
1072
  provider: string;
@@ -1041,14 +1080,14 @@ declare class Providers {
1041
1080
  register<T extends ProviderDescriptor>(p: T): string;
1042
1081
  unregister(id: string): boolean;
1043
1082
  list<K extends ProviderKind = ProviderKind>(kind?: K): ProviderDescriptor<K>[];
1044
- get<T extends ProviderDescriptor>(id: string): T | undefined;
1083
+ get<T extends ProviderDescriptor>(id: string, kind: ProviderKind): T | undefined;
1045
1084
  }
1046
1085
 
1047
1086
  export declare type ProvidersHost = {
1048
1087
  register<T extends ProviderDescriptor>(provider: T): string;
1049
1088
  unregister(providerId: string): boolean;
1050
1089
  list<K extends ProviderKind = ProviderKind>(kind?: K): ProviderDescriptor<K>[];
1051
- get<T extends ProviderDescriptor>(providerId: string): T | undefined;
1090
+ get<T extends ProviderDescriptor>(providerId: string, kind: ProviderKind): T | undefined;
1052
1091
  clear(): void;
1053
1092
  };
1054
1093
 
package/dist/index.js CHANGED
@@ -1,5 +1,32 @@
1
1
  import { useState as Se, useEffect as Ce, useMemo as Ie } from "react";
2
2
  class Ne {
3
+ #t;
4
+ constructor(e) {
5
+ this.#t = e;
6
+ }
7
+ #e(e) {
8
+ const t = this.#t;
9
+ if (!t)
10
+ throw new Error("Dashboard host not available");
11
+ return e(t);
12
+ }
13
+ fetchTopTracks(e) {
14
+ return this.#e((t) => t.fetchTopTracks(e));
15
+ }
16
+ fetchTopArtists(e) {
17
+ return this.#e((t) => t.fetchTopArtists(e));
18
+ }
19
+ fetchTopAlbums(e) {
20
+ return this.#e((t) => t.fetchTopAlbums(e));
21
+ }
22
+ fetchEditorialPlaylists(e) {
23
+ return this.#e((t) => t.fetchEditorialPlaylists(e));
24
+ }
25
+ fetchNewReleases(e) {
26
+ return this.#e((t) => t.fetchNewReleases(e));
27
+ }
28
+ }
29
+ class Oe {
3
30
  #t;
4
31
  constructor(e) {
5
32
  this.#t = e;
@@ -50,7 +77,7 @@ class Ne {
50
77
  return this.#e((t) => t.subscribe(e));
51
78
  }
52
79
  }
53
- const Oe = (r) => {
80
+ const Re = (r) => {
54
81
  if (r instanceof Headers) {
55
82
  const e = {};
56
83
  return r.forEach((t, s) => {
@@ -59,9 +86,9 @@ const Oe = (r) => {
59
86
  }
60
87
  return Array.isArray(r) ? Object.fromEntries(r) : r;
61
88
  };
62
- function Re(r) {
89
+ function Ze(r) {
63
90
  return async (e, t) => {
64
- const s = String(e instanceof Request ? e.url : e), a = t?.headers ? Oe(t.headers) : void 0, n = typeof t?.body == "string" ? t.body : void 0, i = await r.fetch(s, {
91
+ const s = String(e instanceof Request ? e.url : e), a = t?.headers ? Re(t.headers) : void 0, n = typeof t?.body == "string" ? t.body : void 0, i = await r.fetch(s, {
65
92
  method: t?.method,
66
93
  headers: a,
67
94
  body: n
@@ -72,27 +99,27 @@ function Re(r) {
72
99
  });
73
100
  };
74
101
  }
75
- const Ze = {
102
+ const Ee = {
76
103
  fetch: async () => ({
77
104
  status: 501,
78
105
  headers: {},
79
106
  body: "HTTP host not configured"
80
107
  })
81
108
  };
82
- class Ee {
109
+ class je {
83
110
  fetch;
84
111
  constructor(e) {
85
- this.fetch = Re(e ?? Ze);
112
+ this.fetch = Ze(e ?? Ee);
86
113
  }
87
114
  }
88
- const je = {
115
+ const $e = {
89
116
  log: () => {
90
117
  }
91
118
  };
92
- class $e {
119
+ class Me {
93
120
  host;
94
121
  constructor(e) {
95
- this.host = e ?? je;
122
+ this.host = e ?? $e;
96
123
  }
97
124
  trace(e) {
98
125
  this.host.log("trace", e);
@@ -113,7 +140,7 @@ class $e {
113
140
  this.host.log(e, t);
114
141
  }
115
142
  }
116
- class Me {
143
+ class Pe {
117
144
  #t;
118
145
  constructor(e) {
119
146
  this.#t = e;
@@ -153,7 +180,7 @@ class Me {
153
180
  return this.#e((s) => s.fetchAlbumDetails(e, t));
154
181
  }
155
182
  }
156
- class Pe {
183
+ class Ve {
157
184
  #t;
158
185
  constructor(e) {
159
186
  this.#t = e;
@@ -173,11 +200,11 @@ class Pe {
173
200
  list(e) {
174
201
  return this.#e((t) => t.list(e));
175
202
  }
176
- get(e) {
177
- return this.#e((t) => t.get(e));
203
+ get(e, t) {
204
+ return this.#e((s) => s.get(e, t));
178
205
  }
179
206
  }
180
- class Ve {
207
+ class Le {
181
208
  #t;
182
209
  constructor(e) {
183
210
  this.#t = e;
@@ -243,7 +270,7 @@ class Ve {
243
270
  return this.#e((t) => t.subscribeToCurrentItem(e));
244
271
  }
245
272
  }
246
- class Le {
273
+ class ze {
247
274
  #t;
248
275
  constructor(e) {
249
276
  this.#t = e;
@@ -267,7 +294,7 @@ class Le {
267
294
  return this.#e((s) => s.subscribe(e, t));
268
295
  }
269
296
  }
270
- class ze {
297
+ class De {
271
298
  #t;
272
299
  constructor(e) {
273
300
  this.#t = e;
@@ -285,7 +312,7 @@ class ze {
285
312
  return this.#e((t) => t.resolveStreamForCandidate(e));
286
313
  }
287
314
  }
288
- class De {
315
+ class Fe {
289
316
  host;
290
317
  constructor(e) {
291
318
  this.host = e;
@@ -304,7 +331,7 @@ class De {
304
331
  return this.host.getStream(e);
305
332
  }
306
333
  }
307
- class Fe {
334
+ class Be {
308
335
  Settings;
309
336
  Providers;
310
337
  Queue;
@@ -314,18 +341,21 @@ class Fe {
314
341
  Ytdlp;
315
342
  Favorites;
316
343
  Logger;
344
+ Dashboard;
317
345
  constructor(e) {
318
- this.Settings = new Le(e?.settingsHost), this.Providers = new Pe(e?.providersHost), this.Queue = new Ve(e?.queueHost), this.Streaming = new ze(e?.streamingHost), this.Metadata = new Me(e?.metadataHost), this.Http = new Ee(e?.httpHost), this.Ytdlp = new De(e?.ytdlpHost), this.Favorites = new Ne(e?.favoritesHost), this.Logger = new $e(e?.loggerHost);
346
+ this.Settings = new ze(e?.settingsHost), this.Providers = new Ve(e?.providersHost), this.Queue = new Le(e?.queueHost), this.Streaming = new De(e?.streamingHost), this.Metadata = new Pe(e?.metadataHost), this.Http = new je(e?.httpHost), this.Ytdlp = new Fe(e?.ytdlpHost), this.Favorites = new Oe(e?.favoritesHost), this.Logger = new Me(e?.loggerHost), this.Dashboard = new Ne(e?.dashboardHost);
319
347
  }
320
348
  }
321
- class bt extends Fe {
349
+ class wt extends Be {
322
350
  }
323
- class wt extends Error {
324
- constructor(e) {
325
- super(`Missing capability: ${e}`), this.name = "MissingCapabilityError";
351
+ class At extends Error {
352
+ constructor(e, t) {
353
+ super(
354
+ `Missing capability: Provider "${t}" declared capability "${e}" but does not implement it`
355
+ ), this.name = "MissingCapabilityError";
326
356
  }
327
357
  }
328
- const At = (r, e) => {
358
+ const Tt = (r, e) => {
329
359
  const [t, s] = Se(void 0);
330
360
  Ce(() => {
331
361
  if (!r)
@@ -348,7 +378,7 @@ const At = (r, e) => {
348
378
  );
349
379
  return [t, a];
350
380
  };
351
- function Tt(r, e, t) {
381
+ function St(r, e, t) {
352
382
  if (!r?.items?.length)
353
383
  return;
354
384
  const s = r.items.filter((o) => !(o.purpose && o.purpose !== e || !o.url));
@@ -600,11 +630,11 @@ const X = (r, e) => {
600
630
  }
601
631
  return { message: t };
602
632
  };
603
- let Be = X;
604
- function Ue() {
605
- return Be;
633
+ let Ue = X;
634
+ function He() {
635
+ return Ue;
606
636
  }
607
- const He = (r) => {
637
+ const We = (r) => {
608
638
  const { data: e, path: t, errorMaps: s, issueData: a } = r, n = [...t, ...a.path || []], i = {
609
639
  ...a,
610
640
  path: n
@@ -626,7 +656,7 @@ const He = (r) => {
626
656
  };
627
657
  };
628
658
  function c(r, e) {
629
- const t = Ue(), s = He({
659
+ const t = He(), s = We({
630
660
  issueData: e,
631
661
  data: r.data,
632
662
  path: r.path,
@@ -908,7 +938,7 @@ class v {
908
938
  });
909
939
  }
910
940
  brand() {
911
- return new mt({
941
+ return new pt({
912
942
  typeName: p.ZodBranded,
913
943
  type: this,
914
944
  ...g(this._def)
@@ -943,28 +973,28 @@ class v {
943
973
  return this.safeParse(null).success;
944
974
  }
945
975
  }
946
- const We = /^c[^\s-]{8,}$/i, qe = /^[0-9a-z]+$/, Qe = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ye = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Je = /^[a-z0-9_-]{21}$/i, Ge = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Xe = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ke = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, et = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
976
+ const qe = /^c[^\s-]{8,}$/i, Qe = /^[0-9a-z]+$/, Ye = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Je = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Ge = /^[a-z0-9_-]{21}$/i, Xe = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ke = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, et = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, tt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
947
977
  let G;
948
- const tt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, st = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, rt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, at = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, nt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, it = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, xe = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", ot = new RegExp(`^${xe}$`);
978
+ const st = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, rt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, at = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, nt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, it = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ot = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, xe = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", dt = new RegExp(`^${xe}$`);
949
979
  function ke(r) {
950
980
  let e = "[0-5]\\d";
951
981
  r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
952
982
  const t = r.precision ? "+" : "?";
953
983
  return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
954
984
  }
955
- function dt(r) {
985
+ function ct(r) {
956
986
  return new RegExp(`^${ke(r)}$`);
957
987
  }
958
- function ct(r) {
988
+ function ut(r) {
959
989
  let e = `${xe}T${ke(r)}`;
960
990
  const t = [];
961
991
  return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
962
992
  }
963
- function ut(r, e) {
964
- return !!((e === "v4" || !e) && tt.test(r) || (e === "v6" || !e) && rt.test(r));
965
- }
966
993
  function lt(r, e) {
967
- if (!Ge.test(r))
994
+ return !!((e === "v4" || !e) && st.test(r) || (e === "v6" || !e) && at.test(r));
995
+ }
996
+ function ht(r, e) {
997
+ if (!Xe.test(r))
968
998
  return !1;
969
999
  try {
970
1000
  const [t] = r.split(".");
@@ -976,8 +1006,8 @@ function lt(r, e) {
976
1006
  return !1;
977
1007
  }
978
1008
  }
979
- function ht(r, e) {
980
- return !!((e === "v4" || !e) && st.test(r) || (e === "v6" || !e) && at.test(r));
1009
+ function ft(r, e) {
1010
+ return !!((e === "v4" || !e) && rt.test(r) || (e === "v6" || !e) && nt.test(r));
981
1011
  }
982
1012
  class C extends v {
983
1013
  _parse(e) {
@@ -1028,43 +1058,43 @@ class C extends v {
1028
1058
  message: n.message
1029
1059
  }), s.dirty());
1030
1060
  } else if (n.kind === "email")
1031
- Ke.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1061
+ et.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1032
1062
  validation: "email",
1033
1063
  code: d.invalid_string,
1034
1064
  message: n.message
1035
1065
  }), s.dirty());
1036
1066
  else if (n.kind === "emoji")
1037
- G || (G = new RegExp(et, "u")), G.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1067
+ G || (G = new RegExp(tt, "u")), G.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1038
1068
  validation: "emoji",
1039
1069
  code: d.invalid_string,
1040
1070
  message: n.message
1041
1071
  }), s.dirty());
1042
1072
  else if (n.kind === "uuid")
1043
- Ye.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1073
+ Je.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1044
1074
  validation: "uuid",
1045
1075
  code: d.invalid_string,
1046
1076
  message: n.message
1047
1077
  }), s.dirty());
1048
1078
  else if (n.kind === "nanoid")
1049
- Je.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1079
+ Ge.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1050
1080
  validation: "nanoid",
1051
1081
  code: d.invalid_string,
1052
1082
  message: n.message
1053
1083
  }), s.dirty());
1054
1084
  else if (n.kind === "cuid")
1055
- We.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1085
+ qe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1056
1086
  validation: "cuid",
1057
1087
  code: d.invalid_string,
1058
1088
  message: n.message
1059
1089
  }), s.dirty());
1060
1090
  else if (n.kind === "cuid2")
1061
- qe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1091
+ Qe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1062
1092
  validation: "cuid2",
1063
1093
  code: d.invalid_string,
1064
1094
  message: n.message
1065
1095
  }), s.dirty());
1066
1096
  else if (n.kind === "ulid")
1067
- Qe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1097
+ Ye.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1068
1098
  validation: "ulid",
1069
1099
  code: d.invalid_string,
1070
1100
  message: n.message
@@ -1095,39 +1125,39 @@ class C extends v {
1095
1125
  code: d.invalid_string,
1096
1126
  validation: { endsWith: n.value },
1097
1127
  message: n.message
1098
- }), s.dirty()) : n.kind === "datetime" ? ct(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1128
+ }), s.dirty()) : n.kind === "datetime" ? ut(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1099
1129
  code: d.invalid_string,
1100
1130
  validation: "datetime",
1101
1131
  message: n.message
1102
- }), s.dirty()) : n.kind === "date" ? ot.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1132
+ }), s.dirty()) : n.kind === "date" ? dt.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1103
1133
  code: d.invalid_string,
1104
1134
  validation: "date",
1105
1135
  message: n.message
1106
- }), s.dirty()) : n.kind === "time" ? dt(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1136
+ }), s.dirty()) : n.kind === "time" ? ct(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1107
1137
  code: d.invalid_string,
1108
1138
  validation: "time",
1109
1139
  message: n.message
1110
- }), s.dirty()) : n.kind === "duration" ? Xe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1140
+ }), s.dirty()) : n.kind === "duration" ? Ke.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1111
1141
  validation: "duration",
1112
1142
  code: d.invalid_string,
1113
1143
  message: n.message
1114
- }), s.dirty()) : n.kind === "ip" ? ut(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
1144
+ }), s.dirty()) : n.kind === "ip" ? lt(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
1115
1145
  validation: "ip",
1116
1146
  code: d.invalid_string,
1117
1147
  message: n.message
1118
- }), s.dirty()) : n.kind === "jwt" ? lt(e.data, n.alg) || (a = this._getOrReturnCtx(e, a), c(a, {
1148
+ }), s.dirty()) : n.kind === "jwt" ? ht(e.data, n.alg) || (a = this._getOrReturnCtx(e, a), c(a, {
1119
1149
  validation: "jwt",
1120
1150
  code: d.invalid_string,
1121
1151
  message: n.message
1122
- }), s.dirty()) : n.kind === "cidr" ? ht(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
1152
+ }), s.dirty()) : n.kind === "cidr" ? ft(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
1123
1153
  validation: "cidr",
1124
1154
  code: d.invalid_string,
1125
1155
  message: n.message
1126
- }), s.dirty()) : n.kind === "base64" ? nt.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1156
+ }), s.dirty()) : n.kind === "base64" ? it.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1127
1157
  validation: "base64",
1128
1158
  code: d.invalid_string,
1129
1159
  message: n.message
1130
- }), s.dirty()) : n.kind === "base64url" ? it.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1160
+ }), s.dirty()) : n.kind === "base64url" ? ot.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1131
1161
  validation: "base64url",
1132
1162
  code: d.invalid_string,
1133
1163
  message: n.message
@@ -1362,7 +1392,7 @@ C.create = (r) => new C({
1362
1392
  coerce: r?.coerce ?? !1,
1363
1393
  ...g(r)
1364
1394
  });
1365
- function ft(r, e) {
1395
+ function mt(r, e) {
1366
1396
  const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, a = t > s ? t : s, n = Number.parseInt(r.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
1367
1397
  return n % i / 10 ** a;
1368
1398
  }
@@ -1401,7 +1431,7 @@ class M extends v {
1401
1431
  inclusive: n.inclusive,
1402
1432
  exact: !1,
1403
1433
  message: n.message
1404
- }), a.dirty()) : n.kind === "multipleOf" ? ft(e.data, n.value) !== 0 && (s = this._getOrReturnCtx(e, s), c(s, {
1434
+ }), a.dirty()) : n.kind === "multipleOf" ? mt(e.data, n.value) !== 0 && (s = this._getOrReturnCtx(e, s), c(s, {
1405
1435
  code: d.not_multiple_of,
1406
1436
  multipleOf: n.value,
1407
1437
  message: n.message
@@ -2897,7 +2927,7 @@ _e.create = (r) => new _e({
2897
2927
  typeName: p.ZodNaN,
2898
2928
  ...g(r)
2899
2929
  });
2900
- class mt extends v {
2930
+ class pt extends v {
2901
2931
  _parse(e) {
2902
2932
  const { ctx: t } = this._processInputParams(e), s = t.data;
2903
2933
  return this._def.type._parse({
@@ -2974,7 +3004,7 @@ const z = A.create, R = k.create;
2974
3004
  q.create;
2975
3005
  Q.create;
2976
3006
  E.create;
2977
- const pt = P.create;
3007
+ const gt = P.create;
2978
3008
  Y.create;
2979
3009
  I.create;
2980
3010
  L.create;
@@ -2982,29 +3012,29 @@ const J = R({
2982
3012
  provider: x(),
2983
3013
  id: x(),
2984
3014
  url: x().optional()
2985
- }), gt = R({
3015
+ }), yt = R({
2986
3016
  url: x(),
2987
3017
  width: U().optional(),
2988
3018
  height: U().optional(),
2989
- purpose: pt(["avatar", "cover", "background", "thumbnail"]).optional(),
3019
+ purpose: gt(["avatar", "cover", "background", "thumbnail"]).optional(),
2990
3020
  source: J.optional()
2991
3021
  }), Ae = R({
2992
- items: z(gt)
2993
- }), yt = R({
3022
+ items: z(yt)
3023
+ }), vt = R({
2994
3024
  name: x(),
2995
3025
  roles: z(x()),
2996
3026
  source: J.optional()
2997
- }), vt = R({
3027
+ }), _t = R({
2998
3028
  title: x(),
2999
- artists: z(yt),
3029
+ artists: z(vt),
3000
3030
  durationMs: U().optional(),
3001
3031
  source: J
3002
- }).passthrough(), _t = R({
3032
+ }).passthrough(), xt = R({
3003
3033
  id: x(),
3004
- track: vt,
3034
+ track: _t,
3005
3035
  note: x().optional(),
3006
3036
  addedAtIso: x()
3007
- }), St = R({
3037
+ }), Ct = R({
3008
3038
  id: x(),
3009
3039
  name: x(),
3010
3040
  description: x().optional(),
@@ -3015,8 +3045,8 @@ const J = R({
3015
3045
  origin: J.optional(),
3016
3046
  isReadOnly: we(),
3017
3047
  parentId: x().optional(),
3018
- items: z(_t)
3019
- }), xt = R({
3048
+ items: z(xt)
3049
+ }), kt = R({
3020
3050
  id: x(),
3021
3051
  name: x(),
3022
3052
  createdAtIso: x(),
@@ -3025,18 +3055,19 @@ const J = R({
3025
3055
  artwork: Ae.optional(),
3026
3056
  itemCount: U(),
3027
3057
  totalDurationMs: U()
3028
- }), Ct = z(xt);
3058
+ }), It = z(kt);
3029
3059
  export {
3030
- Ne as FavoritesAPI,
3031
- Ee as HttpAPI,
3032
- $e as LoggerAPI,
3033
- wt as MissingCapabilityError,
3034
- Fe as NuclearAPI,
3035
- bt as NuclearPluginAPI,
3036
- De as YtdlpAPI,
3037
- Tt as pickArtwork,
3038
- xt as playlistIndexEntrySchema,
3039
- Ct as playlistIndexSchema,
3040
- St as playlistSchema,
3041
- At as useSetting
3060
+ Ne as DashboardAPI,
3061
+ Oe as FavoritesAPI,
3062
+ je as HttpAPI,
3063
+ Me as LoggerAPI,
3064
+ At as MissingCapabilityError,
3065
+ Be as NuclearAPI,
3066
+ wt as NuclearPluginAPI,
3067
+ Fe as YtdlpAPI,
3068
+ St as pickArtwork,
3069
+ kt as playlistIndexEntrySchema,
3070
+ It as playlistIndexSchema,
3071
+ Ct as playlistSchema,
3072
+ Tt as useSetting
3042
3073
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuclearplayer/plugin-sdk",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "Plugin SDK for Nuclear music player",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",