@audd/sdk 1.5.8 → 1.5.10
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 +4 -4
- package/dist/index.cjs +3 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -30
- package/dist/index.js.map +1 -1
- package/dist/longpoll.cjs +2 -15
- package/dist/longpoll.cjs.map +1 -1
- package/dist/longpoll.d.cts +1 -1
- package/dist/longpoll.d.ts +1 -1
- package/dist/longpoll.js +2 -15
- package/dist/longpoll.js.map +1 -1
- package/dist/{longpollCore-DMBdcGSM.d.cts → longpollCore-BRyps2P4.d.cts} +19 -19
- package/dist/{longpollCore-DMBdcGSM.d.ts → longpollCore-BRyps2P4.d.ts} +19 -19
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { c as StreamCallbackMatch, d as StreamCallbackNotification, H as HttpClient, S as Stream, L as LongpollPoll, b as LyricsResult, F as FetchLike, R as RecognitionResult, a as EnterpriseMatch } from './longpollCore-BRyps2P4.cjs';
|
|
2
|
+
export { E as EnterpriseChunkResult, e as StreamCallbackSong, f as StreamingProvider } from './longpollCore-BRyps2P4.cjs';
|
|
3
3
|
|
|
4
4
|
declare const VERSION = "1.5.8";
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { c as StreamCallbackMatch, d as StreamCallbackNotification, H as HttpClient, S as Stream, L as LongpollPoll, b as LyricsResult, F as FetchLike, R as RecognitionResult, a as EnterpriseMatch } from './longpollCore-BRyps2P4.js';
|
|
2
|
+
export { E as EnterpriseChunkResult, e as StreamCallbackSong, f as StreamingProvider } from './longpollCore-BRyps2P4.js';
|
|
3
3
|
|
|
4
4
|
declare const VERSION = "1.5.8";
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -344,9 +344,6 @@ var RECOGNITION_KEYS = [
|
|
|
344
344
|
function parseRecognitionResult(raw) {
|
|
345
345
|
const r = requireObject(raw, "RecognitionResult");
|
|
346
346
|
const timecode = asString(r.timecode);
|
|
347
|
-
if (timecode === void 0) {
|
|
348
|
-
throw new TypeError("RecognitionResult: timecode missing or not string");
|
|
349
|
-
}
|
|
350
347
|
const audioId = asNumber(r.audio_id);
|
|
351
348
|
const artist = asString(r.artist);
|
|
352
349
|
const title = asString(r.title);
|
|
@@ -421,8 +418,6 @@ function parseEnterpriseMatch(raw) {
|
|
|
421
418
|
const r = requireObject(raw, "EnterpriseMatch");
|
|
422
419
|
const score = asNumber(r.score);
|
|
423
420
|
const timecode = asString(r.timecode);
|
|
424
|
-
if (score === void 0) throw new TypeError("EnterpriseMatch: score not number");
|
|
425
|
-
if (timecode === void 0) throw new TypeError("EnterpriseMatch: timecode not string");
|
|
426
421
|
const songLink = asString(r.song_link);
|
|
427
422
|
return {
|
|
428
423
|
score,
|
|
@@ -469,12 +464,8 @@ function parseEnterpriseMatch(raw) {
|
|
|
469
464
|
var ENTERPRISE_CHUNK_KEYS = ["songs", "offset"];
|
|
470
465
|
function parseEnterpriseChunkResult(raw) {
|
|
471
466
|
const r = requireObject(raw, "EnterpriseChunkResult");
|
|
472
|
-
const songsRaw = r.songs;
|
|
473
|
-
if (!Array.isArray(songsRaw)) {
|
|
474
|
-
throw new TypeError("EnterpriseChunkResult: songs not array");
|
|
475
|
-
}
|
|
467
|
+
const songsRaw = Array.isArray(r.songs) ? r.songs : [];
|
|
476
468
|
const offset = asString(r.offset);
|
|
477
|
-
if (offset === void 0) throw new TypeError("EnterpriseChunkResult: offset not string");
|
|
478
469
|
return {
|
|
479
470
|
songs: songsRaw.map(parseEnterpriseMatch),
|
|
480
471
|
offset,
|
|
@@ -488,9 +479,6 @@ function parseStream(raw) {
|
|
|
488
479
|
const radioId = asNumber(r.radio_id);
|
|
489
480
|
const url = asString(r.url);
|
|
490
481
|
const streamRunning = asBoolean(r.stream_running);
|
|
491
|
-
if (radioId === void 0) throw new TypeError("Stream: radio_id not number");
|
|
492
|
-
if (url === void 0) throw new TypeError("Stream: url not string");
|
|
493
|
-
if (streamRunning === void 0) throw new TypeError("Stream: stream_running not boolean");
|
|
494
482
|
return {
|
|
495
483
|
radioId,
|
|
496
484
|
url,
|
|
@@ -521,9 +509,6 @@ function parseStreamCallbackSong(raw) {
|
|
|
521
509
|
const artist = asString(r.artist);
|
|
522
510
|
const title = asString(r.title);
|
|
523
511
|
const score = asNumber(r.score);
|
|
524
|
-
if (artist === void 0) throw new TypeError("StreamCallbackSong: artist not string");
|
|
525
|
-
if (title === void 0) throw new TypeError("StreamCallbackSong: title not string");
|
|
526
|
-
if (score === void 0) throw new TypeError("StreamCallbackSong: score not number");
|
|
527
512
|
const musicbrainz = Array.isArray(r.musicbrainz) ? r.musicbrainz.filter((x) => asObject(x) !== void 0) : void 0;
|
|
528
513
|
return {
|
|
529
514
|
artist,
|
|
@@ -552,13 +537,9 @@ var STREAM_CALLBACK_MATCH_KEYS = [
|
|
|
552
537
|
function parseStreamCallbackMatch(raw) {
|
|
553
538
|
const r = requireObject(raw, "StreamCallbackMatch");
|
|
554
539
|
const radioId = asNumber(r.radio_id);
|
|
555
|
-
|
|
556
|
-
const
|
|
557
|
-
if (!Array.isArray(resultsRaw)) throw new TypeError("StreamCallbackMatch: results not array");
|
|
558
|
-
if (resultsRaw.length === 0) throw new TypeError("StreamCallbackMatch: results is empty");
|
|
559
|
-
const songs = resultsRaw.map(parseStreamCallbackSong);
|
|
540
|
+
const resultsRaw = Array.isArray(r.results) ? r.results : [];
|
|
541
|
+
const songs = resultsRaw.filter((x) => asObject(x) !== void 0).map(parseStreamCallbackSong);
|
|
560
542
|
const [first, ...rest] = songs;
|
|
561
|
-
if (first === void 0) throw new TypeError("StreamCallbackMatch: results is empty");
|
|
562
543
|
return {
|
|
563
544
|
radioId,
|
|
564
545
|
timestamp: asString(r.timestamp),
|
|
@@ -578,14 +559,8 @@ var STREAM_CALLBACK_NOTIFICATION_KEYS = [
|
|
|
578
559
|
function parseStreamCallbackNotification(raw) {
|
|
579
560
|
const r = requireObject(raw, "StreamCallbackNotification");
|
|
580
561
|
const radioId = asNumber(r.radio_id);
|
|
581
|
-
if (radioId === void 0)
|
|
582
|
-
throw new TypeError("StreamCallbackNotification: radio_id not number");
|
|
583
562
|
const code = asNumber(r.notification_code);
|
|
584
|
-
if (code === void 0)
|
|
585
|
-
throw new TypeError("StreamCallbackNotification: notification_code not number");
|
|
586
563
|
const message = asString(r.notification_message);
|
|
587
|
-
if (message === void 0)
|
|
588
|
-
throw new TypeError("StreamCallbackNotification: notification_message not string");
|
|
589
564
|
return {
|
|
590
565
|
radioId,
|
|
591
566
|
streamRunning: asBoolean(r.stream_running),
|
|
@@ -609,8 +584,6 @@ function parseLyricsResult(raw) {
|
|
|
609
584
|
const r = requireObject(raw, "LyricsResult");
|
|
610
585
|
const artist = asString(r.artist);
|
|
611
586
|
const title = asString(r.title);
|
|
612
|
-
if (artist === void 0) throw new TypeError("LyricsResult: artist not string");
|
|
613
|
-
if (title === void 0) throw new TypeError("LyricsResult: title not string");
|
|
614
587
|
return {
|
|
615
588
|
artist,
|
|
616
589
|
title,
|