Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@nuclearplayer/plugin-sdk

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuclearplayer/plugin-sdk - npm Package Compare versions

Comparing version
1.1.0
to
1.2.0
+19
-0
dist/index.d.ts

@@ -189,2 +189,19 @@ export declare type Album = {

export declare class LoggerAPI {
private host;
constructor(host?: LoggerHost);
trace(message: string): void;
debug(message: string): void;
info(message: string): void;
warn(message: string): void;
error(message: string): void;
log(level: LogLevel, message: string): void;
}
export declare type LoggerHost = {
log: (level: LogLevel, message: string) => void;
};
export declare type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';
declare class MetadataAPI {

@@ -239,2 +256,3 @@ #private;

readonly Favorites: FavoritesAPI;
readonly Logger: LoggerAPI;
constructor(opts?: {

@@ -249,2 +267,3 @@ settingsHost?: SettingsHost;

favoritesHost?: FavoritesHost;
loggerHost?: LoggerHost;
});

@@ -251,0 +270,0 @@ }

+91
-61

@@ -1,2 +0,2 @@

import { useState as l, useEffect as f, useMemo as g } from "react";
import { useState as l, useEffect as g, useMemo as f } from "react";
class b {

@@ -53,21 +53,21 @@ #e;

}
const m = (s) => {
if (s instanceof Headers) {
const m = (r) => {
if (r instanceof Headers) {
const t = {};
return s.forEach((e, r) => {
t[r] = e;
return r.forEach((e, s) => {
t[s] = e;
}), t;
}
return Array.isArray(s) ? Object.fromEntries(s) : s;
return Array.isArray(r) ? Object.fromEntries(r) : r;
};
function A(s) {
function A(r) {
return async (t, e) => {
const r = String(t instanceof Request ? t.url : t), a = e?.headers ? m(e.headers) : void 0, n = typeof e?.body == "string" ? e.body : void 0, u = await s.fetch(r, {
const s = String(t instanceof Request ? t.url : t), u = e?.headers ? m(e.headers) : void 0, n = typeof e?.body == "string" ? e.body : void 0, a = await r.fetch(s, {
method: e?.method,
headers: a,
headers: u,
body: n
});
return new Response(u.body, {
status: u.status,
headers: new Headers(u.headers)
return new Response(a.body, {
status: a.status,
headers: new Headers(a.headers)
});

@@ -89,3 +89,31 @@ };

}
class T {
const T = {
log: () => {
}
};
class p {
host;
constructor(t) {
this.host = t ?? T;
}
trace(t) {
this.host.log("trace", t);
}
debug(t) {
this.host.log("debug", t);
}
info(t) {
this.host.log("info", t);
}
warn(t) {
this.host.log("warn", t);
}
error(t) {
this.host.log("error", t);
}
log(t, e) {
this.host.log(t, e);
}
}
class I {
#e;

@@ -102,23 +130,23 @@ constructor(t) {

search(t, e) {
return this.#t((r) => r.search(t, e));
return this.#t((s) => s.search(t, e));
}
fetchArtistDetails(t, e) {
return this.#t((r) => r.fetchArtistDetails(t, e));
return this.#t((s) => s.fetchArtistDetails(t, e));
}
fetchArtistAlbums(t, e) {
return this.#t((r) => r.fetchArtistAlbums(t, e));
return this.#t((s) => s.fetchArtistAlbums(t, e));
}
fetchArtistTopTracks(t, e) {
return this.#t((r) => r.fetchArtistTopTracks(t, e));
return this.#t((s) => s.fetchArtistTopTracks(t, e));
}
fetchArtistRelatedArtists(t, e) {
return this.#t(
(r) => r.fetchArtistRelatedArtists(t, e)
(s) => s.fetchArtistRelatedArtists(t, e)
);
}
fetchAlbumDetails(t, e) {
return this.#t((r) => r.fetchAlbumDetails(t, e));
return this.#t((s) => s.fetchAlbumDetails(t, e));
}
}
class p {
class H {
#e;

@@ -147,3 +175,3 @@ constructor(t) {

}
class I {
class y {
#e;

@@ -172,3 +200,3 @@ constructor(t) {

addAt(t, e) {
return this.#t((r) => r.addAt(t, e));
return this.#t((s) => s.addAt(t, e));
}

@@ -185,6 +213,6 @@ removeByIds(t) {

reorder(t, e) {
return this.#t((r) => r.reorder(t, e));
return this.#t((s) => s.reorder(t, e));
}
updateItemState(t, e) {
return this.#t((r) => r.updateItemState(t, e));
return this.#t((s) => s.updateItemState(t, e));
}

@@ -216,3 +244,3 @@ goToNext() {

}
class H {
class S {
#e;

@@ -235,9 +263,9 @@ constructor(t) {

set(t, e) {
return this.#t((r) => r.set(t, e));
return this.#t((s) => s.set(t, e));
}
subscribe(t, e) {
return this.#t((r) => r.subscribe(t, e));
return this.#t((s) => s.subscribe(t, e));
}
}
class y {
class F {
#e;

@@ -260,3 +288,3 @@ constructor(t) {

}
class S {
class P {
host;

@@ -280,3 +308,3 @@ constructor(t) {

}
class F {
class E {
Settings;

@@ -290,9 +318,10 @@ Providers;

Favorites;
Logger;
constructor(t) {
this.Settings = new H(t?.settingsHost), this.Providers = new p(t?.providersHost), this.Queue = new I(t?.queueHost), this.Streaming = new y(t?.streamingHost), this.Metadata = new T(t?.metadataHost), this.Http = new w(t?.httpHost), this.Ytdlp = new S(t?.ytdlpHost), this.Favorites = new b(t?.favoritesHost);
this.Settings = new S(t?.settingsHost), this.Providers = new H(t?.providersHost), this.Queue = new y(t?.queueHost), this.Streaming = new F(t?.streamingHost), this.Metadata = new I(t?.metadataHost), this.Http = new w(t?.httpHost), this.Ytdlp = new P(t?.ytdlpHost), this.Favorites = new b(t?.favoritesHost), this.Logger = new p(t?.loggerHost);
}
}
class P extends F {
class C extends E {
}
class M extends Error {
class R extends Error {
constructor(t) {

@@ -302,32 +331,32 @@ super(`Missing capability: ${t}`), this.name = "MissingCapabilityError";

}
const C = (s, t) => {
const [e, r] = l(void 0);
f(() => {
if (!s)
const k = (r, t) => {
const [e, s] = l(void 0);
g(() => {
if (!r)
return;
let n = !0, u = !1;
const i = s.subscribe(t, (o) => {
n && (u = !0, r(o));
let n = !0, a = !1;
const i = r.subscribe(t, (o) => {
n && (a = !0, s(o));
});
return s.get(t).then((o) => {
n && (u || r(o));
return r.get(t).then((o) => {
n && (a || s(o));
}), () => {
n = !1, i && i();
};
}, [t, s]);
const a = g(
}, [t, r]);
const u = f(
() => (n) => {
s && s.set(t, n);
r && r.set(t, n);
},
[t, s]
[t, r]
);
return [e, a];
return [e, u];
};
function R(s, t, e) {
if (!s?.items?.length)
function Q(r, t, e) {
if (!r?.items?.length)
return;
const r = s.items.filter((i) => !(i.purpose && i.purpose !== t || !i.url));
if (!r.length)
return s.items[0];
const a = (i) => !i.width || !i.height ? 1 : i.width / i.height, u = ((i) => {
const s = r.items.filter((i) => !(i.purpose && i.purpose !== t || !i.url));
if (!s.length)
return r.items[0];
const u = (i) => !i.width || !i.height ? 1 : i.width / i.height, a = ((i) => {
switch (i) {

@@ -345,4 +374,4 @@ case "avatar":

})(t);
return r.map((i) => {
const o = Math.min(i.width || 0, i.height || 0), h = Math.abs(a(i) - u), c = Math.abs(o - e), d = o < e ? e / o : 1;
return s.map((i) => {
const o = Math.min(i.width || 0, i.height || 0), h = Math.abs(u(i) - a), c = Math.abs(o - e), d = o < e ? e / o : 1;
return {

@@ -357,8 +386,9 @@ artwork: i,

w as HttpAPI,
M as MissingCapabilityError,
F as NuclearAPI,
P as NuclearPluginAPI,
S as YtdlpAPI,
R as pickArtwork,
C as useSetting
p as LoggerAPI,
R as MissingCapabilityError,
E as NuclearAPI,
C as NuclearPluginAPI,
P as YtdlpAPI,
Q as pickArtwork,
k as useSetting
};
{
"name": "@nuclearplayer/plugin-sdk",
"version": "1.1.0",
"version": "1.2.0",
"description": "Plugin SDK for Nuclear music player",

@@ -5,0 +5,0 @@ "type": "module",