@syra.fm/sdk 0.3.0 → 0.5.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.
- package/lib/commonjs/client.js +268 -0
- package/lib/commonjs/client.js.map +1 -0
- package/lib/commonjs/errors.js +22 -0
- package/lib/commonjs/errors.js.map +1 -0
- package/lib/commonjs/index.js +63 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.native.js +28 -0
- package/lib/commonjs/index.native.js.map +1 -0
- package/lib/commonjs/live/assets/icons/spaces-icon.js +42 -0
- package/lib/commonjs/live/assets/icons/spaces-icon.js.map +1 -0
- package/lib/commonjs/live/assets/icons/syra-icon.js +43 -0
- package/lib/commonjs/live/assets/icons/syra-icon.js.map +1 -0
- package/lib/commonjs/live/components/AnimatedPulse.js +38 -0
- package/lib/commonjs/live/components/AnimatedPulse.js.map +1 -0
- package/lib/commonjs/live/components/AnimatedSpeakerRing.js +90 -0
- package/lib/commonjs/live/components/AnimatedSpeakerRing.js.map +1 -0
- package/lib/commonjs/live/components/CreateRoomSheet.js +688 -0
- package/lib/commonjs/live/components/CreateRoomSheet.js.map +1 -0
- package/lib/commonjs/live/components/InsightsPanel.js +333 -0
- package/lib/commonjs/live/components/InsightsPanel.js.map +1 -0
- package/lib/commonjs/live/components/LiveRoomSheet.js +1195 -0
- package/lib/commonjs/live/components/LiveRoomSheet.js.map +1 -0
- package/lib/commonjs/live/components/MiniRoomBar.js +161 -0
- package/lib/commonjs/live/components/MiniRoomBar.js.map +1 -0
- package/lib/commonjs/live/components/PanelHeader.js +57 -0
- package/lib/commonjs/live/components/PanelHeader.js.map +1 -0
- package/lib/commonjs/live/components/PodcastStreamPicker.js +1190 -0
- package/lib/commonjs/live/components/PodcastStreamPicker.js.map +1 -0
- package/lib/commonjs/live/components/RecordingCard.js +192 -0
- package/lib/commonjs/live/components/RecordingCard.js.map +1 -0
- package/lib/commonjs/live/components/RecordingsPanel.js +304 -0
- package/lib/commonjs/live/components/RecordingsPanel.js.map +1 -0
- package/lib/commonjs/live/components/RoomCard.js +553 -0
- package/lib/commonjs/live/components/RoomCard.js.map +1 -0
- package/lib/commonjs/live/components/StreamConfigModal.js +656 -0
- package/lib/commonjs/live/components/StreamConfigModal.js.map +1 -0
- package/lib/commonjs/live/components/StreamConfigPanel.js +822 -0
- package/lib/commonjs/live/components/StreamConfigPanel.js.map +1 -0
- package/lib/commonjs/live/context/LiveConfigContext.js +46 -0
- package/lib/commonjs/live/context/LiveConfigContext.js.map +1 -0
- package/lib/commonjs/live/context/LiveRoomContext.js +195 -0
- package/lib/commonjs/live/context/LiveRoomContext.js.map +1 -0
- package/lib/commonjs/live/hooks/useActiveSpeakers.js +35 -0
- package/lib/commonjs/live/hooks/useActiveSpeakers.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomAudio.js +129 -0
- package/lib/commonjs/live/hooks/useRoomAudio.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomConnection.js +177 -0
- package/lib/commonjs/live/hooks/useRoomConnection.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomManager.js +37 -0
- package/lib/commonjs/live/hooks/useRoomManager.js.map +1 -0
- package/lib/commonjs/live/hooks/useRoomUsers.js +52 -0
- package/lib/commonjs/live/hooks/useRoomUsers.js.map +1 -0
- package/lib/commonjs/live/index.js +310 -0
- package/lib/commonjs/live/index.js.map +1 -0
- package/lib/commonjs/live/services/livekitService.js +20 -0
- package/lib/commonjs/live/services/livekitService.js.map +1 -0
- package/lib/commonjs/live/services/spaceSocketService.js +181 -0
- package/lib/commonjs/live/services/spaceSocketService.js.map +1 -0
- package/lib/commonjs/live/services/spacesService.js +642 -0
- package/lib/commonjs/live/services/spacesService.js.map +1 -0
- package/lib/commonjs/live/types.js +6 -0
- package/lib/commonjs/live/types.js.map +1 -0
- package/lib/commonjs/live/validation.js +238 -0
- package/lib/commonjs/live/validation.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/schema.js +102 -0
- package/lib/commonjs/schema.js.map +1 -0
- package/lib/module/client.js +264 -0
- package/lib/module/client.js.map +1 -0
- package/lib/module/errors.js +17 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.native.js +5 -0
- package/lib/module/index.native.js.map +1 -0
- package/lib/module/live/assets/icons/spaces-icon.js +34 -0
- package/lib/module/live/assets/icons/spaces-icon.js.map +1 -0
- package/lib/module/live/assets/icons/syra-icon.js +36 -0
- package/lib/module/live/assets/icons/syra-icon.js.map +1 -0
- package/lib/module/live/components/AnimatedPulse.js +33 -0
- package/lib/module/live/components/AnimatedPulse.js.map +1 -0
- package/lib/module/live/components/AnimatedSpeakerRing.js +85 -0
- package/lib/module/live/components/AnimatedSpeakerRing.js.map +1 -0
- package/lib/module/live/components/CreateRoomSheet.js +682 -0
- package/lib/module/live/components/CreateRoomSheet.js.map +1 -0
- package/lib/module/live/components/InsightsPanel.js +327 -0
- package/lib/module/live/components/InsightsPanel.js.map +1 -0
- package/lib/module/live/components/LiveRoomSheet.js +1189 -0
- package/lib/module/live/components/LiveRoomSheet.js.map +1 -0
- package/lib/module/live/components/MiniRoomBar.js +154 -0
- package/lib/module/live/components/MiniRoomBar.js.map +1 -0
- package/lib/module/live/components/PanelHeader.js +52 -0
- package/lib/module/live/components/PanelHeader.js.map +1 -0
- package/lib/module/live/components/PodcastStreamPicker.js +1183 -0
- package/lib/module/live/components/PodcastStreamPicker.js.map +1 -0
- package/lib/module/live/components/RecordingCard.js +187 -0
- package/lib/module/live/components/RecordingCard.js.map +1 -0
- package/lib/module/live/components/RecordingsPanel.js +298 -0
- package/lib/module/live/components/RecordingsPanel.js.map +1 -0
- package/lib/module/live/components/RoomCard.js +548 -0
- package/lib/module/live/components/RoomCard.js.map +1 -0
- package/lib/module/live/components/StreamConfigModal.js +650 -0
- package/lib/module/live/components/StreamConfigModal.js.map +1 -0
- package/lib/module/live/components/StreamConfigPanel.js +816 -0
- package/lib/module/live/components/StreamConfigPanel.js.map +1 -0
- package/lib/module/live/context/LiveConfigContext.js +40 -0
- package/lib/module/live/context/LiveConfigContext.js.map +1 -0
- package/lib/module/live/context/LiveRoomContext.js +189 -0
- package/lib/module/live/context/LiveRoomContext.js.map +1 -0
- package/lib/module/live/hooks/useActiveSpeakers.js +31 -0
- package/lib/module/live/hooks/useActiveSpeakers.js.map +1 -0
- package/lib/module/live/hooks/useRoomAudio.js +125 -0
- package/lib/module/live/hooks/useRoomAudio.js.map +1 -0
- package/lib/module/live/hooks/useRoomConnection.js +173 -0
- package/lib/module/live/hooks/useRoomConnection.js.map +1 -0
- package/lib/module/live/hooks/useRoomManager.js +32 -0
- package/lib/module/live/hooks/useRoomManager.js.map +1 -0
- package/lib/module/live/hooks/useRoomUsers.js +46 -0
- package/lib/module/live/hooks/useRoomUsers.js.map +1 -0
- package/lib/module/live/index.js +38 -0
- package/lib/module/live/index.js.map +1 -0
- package/lib/module/live/services/livekitService.js +16 -0
- package/lib/module/live/services/livekitService.js.map +1 -0
- package/lib/module/live/services/spaceSocketService.js +176 -0
- package/lib/module/live/services/spaceSocketService.js.map +1 -0
- package/lib/module/live/services/spacesService.js +639 -0
- package/lib/module/live/services/spacesService.js.map +1 -0
- package/lib/module/live/types.js +4 -0
- package/lib/module/live/types.js.map +1 -0
- package/lib/module/live/validation.js +229 -0
- package/lib/module/live/validation.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/schema.js +99 -0
- package/lib/module/schema.js.map +1 -0
- package/{dist/types → lib/typescript/commonjs}/client.d.ts +36 -1
- package/lib/typescript/commonjs/client.d.ts.map +1 -0
- package/{dist/types → lib/typescript/commonjs}/errors.d.ts +1 -0
- package/lib/typescript/commonjs/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +6 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.native.d.ts +3 -0
- package/lib/typescript/commonjs/index.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/assets/icons/spaces-icon.d.ts +13 -0
- package/lib/typescript/commonjs/live/assets/icons/spaces-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/assets/icons/syra-icon.d.ts +13 -0
- package/lib/typescript/commonjs/live/assets/icons/syra-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/AnimatedPulse.d.ts +8 -0
- package/lib/typescript/commonjs/live/components/AnimatedPulse.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/AnimatedSpeakerRing.d.ts +10 -0
- package/lib/typescript/commonjs/live/components/AnimatedSpeakerRing.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/CreateRoomSheet.d.ts +26 -0
- package/lib/typescript/commonjs/live/components/CreateRoomSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/InsightsPanel.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/InsightsPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/LiveRoomSheet.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/LiveRoomSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/MiniRoomBar.d.ts +15 -0
- package/lib/typescript/commonjs/live/components/MiniRoomBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/PanelHeader.d.ts +10 -0
- package/lib/typescript/commonjs/live/components/PanelHeader.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/PodcastStreamPicker.d.ts +54 -0
- package/lib/typescript/commonjs/live/components/PodcastStreamPicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/RecordingCard.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/RecordingCard.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/RecordingsPanel.d.ts +12 -0
- package/lib/typescript/commonjs/live/components/RecordingsPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/RoomCard.d.ts +38 -0
- package/lib/typescript/commonjs/live/components/RoomCard.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/StreamConfigModal.d.ts +11 -0
- package/lib/typescript/commonjs/live/components/StreamConfigModal.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/components/StreamConfigPanel.d.ts +13 -0
- package/lib/typescript/commonjs/live/components/StreamConfigPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/context/LiveConfigContext.d.ts +78 -0
- package/lib/typescript/commonjs/live/context/LiveConfigContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/context/LiveRoomContext.d.ts +12 -0
- package/lib/typescript/commonjs/live/context/LiveRoomContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useActiveSpeakers.d.ts +3 -0
- package/lib/typescript/commonjs/live/hooks/useActiveSpeakers.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts +16 -0
- package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts +29 -0
- package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomManager.d.ts +11 -0
- package/lib/typescript/commonjs/live/hooks/useRoomManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/hooks/useRoomUsers.d.ts +5 -0
- package/lib/typescript/commonjs/live/hooks/useRoomUsers.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/index.d.ts +24 -0
- package/lib/typescript/commonjs/live/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/services/livekitService.d.ts +7 -0
- package/lib/typescript/commonjs/live/services/livekitService.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/services/spaceSocketService.d.ts +69 -0
- package/lib/typescript/commonjs/live/services/spaceSocketService.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/services/spacesService.d.ts +181 -0
- package/lib/typescript/commonjs/live/services/spacesService.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/types.d.ts +100 -0
- package/lib/typescript/commonjs/live/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/live/validation.d.ts +658 -0
- package/lib/typescript/commonjs/live/validation.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/{dist/types → lib/typescript/commonjs}/schema.d.ts +305 -0
- package/lib/typescript/commonjs/schema.d.ts.map +1 -0
- package/lib/typescript/module/client.d.ts +141 -0
- package/lib/typescript/module/client.d.ts.map +1 -0
- package/lib/typescript/module/errors.d.ts +9 -0
- package/lib/typescript/module/errors.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +6 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/index.native.d.ts +3 -0
- package/lib/typescript/module/index.native.d.ts.map +1 -0
- package/lib/typescript/module/live/assets/icons/spaces-icon.d.ts +13 -0
- package/lib/typescript/module/live/assets/icons/spaces-icon.d.ts.map +1 -0
- package/lib/typescript/module/live/assets/icons/syra-icon.d.ts +13 -0
- package/lib/typescript/module/live/assets/icons/syra-icon.d.ts.map +1 -0
- package/lib/typescript/module/live/components/AnimatedPulse.d.ts +8 -0
- package/lib/typescript/module/live/components/AnimatedPulse.d.ts.map +1 -0
- package/lib/typescript/module/live/components/AnimatedSpeakerRing.d.ts +10 -0
- package/lib/typescript/module/live/components/AnimatedSpeakerRing.d.ts.map +1 -0
- package/lib/typescript/module/live/components/CreateRoomSheet.d.ts +26 -0
- package/lib/typescript/module/live/components/CreateRoomSheet.d.ts.map +1 -0
- package/lib/typescript/module/live/components/InsightsPanel.d.ts +11 -0
- package/lib/typescript/module/live/components/InsightsPanel.d.ts.map +1 -0
- package/lib/typescript/module/live/components/LiveRoomSheet.d.ts +11 -0
- package/lib/typescript/module/live/components/LiveRoomSheet.d.ts.map +1 -0
- package/lib/typescript/module/live/components/MiniRoomBar.d.ts +15 -0
- package/lib/typescript/module/live/components/MiniRoomBar.d.ts.map +1 -0
- package/lib/typescript/module/live/components/PanelHeader.d.ts +10 -0
- package/lib/typescript/module/live/components/PanelHeader.d.ts.map +1 -0
- package/lib/typescript/module/live/components/PodcastStreamPicker.d.ts +54 -0
- package/lib/typescript/module/live/components/PodcastStreamPicker.d.ts.map +1 -0
- package/lib/typescript/module/live/components/RecordingCard.d.ts +11 -0
- package/lib/typescript/module/live/components/RecordingCard.d.ts.map +1 -0
- package/lib/typescript/module/live/components/RecordingsPanel.d.ts +12 -0
- package/lib/typescript/module/live/components/RecordingsPanel.d.ts.map +1 -0
- package/lib/typescript/module/live/components/RoomCard.d.ts +38 -0
- package/lib/typescript/module/live/components/RoomCard.d.ts.map +1 -0
- package/lib/typescript/module/live/components/StreamConfigModal.d.ts +11 -0
- package/lib/typescript/module/live/components/StreamConfigModal.d.ts.map +1 -0
- package/lib/typescript/module/live/components/StreamConfigPanel.d.ts +13 -0
- package/lib/typescript/module/live/components/StreamConfigPanel.d.ts.map +1 -0
- package/lib/typescript/module/live/context/LiveConfigContext.d.ts +78 -0
- package/lib/typescript/module/live/context/LiveConfigContext.d.ts.map +1 -0
- package/lib/typescript/module/live/context/LiveRoomContext.d.ts +12 -0
- package/lib/typescript/module/live/context/LiveRoomContext.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useActiveSpeakers.d.ts +3 -0
- package/lib/typescript/module/live/hooks/useActiveSpeakers.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomAudio.d.ts +16 -0
- package/lib/typescript/module/live/hooks/useRoomAudio.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomConnection.d.ts +29 -0
- package/lib/typescript/module/live/hooks/useRoomConnection.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomManager.d.ts +11 -0
- package/lib/typescript/module/live/hooks/useRoomManager.d.ts.map +1 -0
- package/lib/typescript/module/live/hooks/useRoomUsers.d.ts +5 -0
- package/lib/typescript/module/live/hooks/useRoomUsers.d.ts.map +1 -0
- package/lib/typescript/module/live/index.d.ts +24 -0
- package/lib/typescript/module/live/index.d.ts.map +1 -0
- package/lib/typescript/module/live/services/livekitService.d.ts +7 -0
- package/lib/typescript/module/live/services/livekitService.d.ts.map +1 -0
- package/lib/typescript/module/live/services/spaceSocketService.d.ts +69 -0
- package/lib/typescript/module/live/services/spaceSocketService.d.ts.map +1 -0
- package/lib/typescript/module/live/services/spacesService.d.ts +181 -0
- package/lib/typescript/module/live/services/spacesService.d.ts.map +1 -0
- package/lib/typescript/module/live/types.d.ts +100 -0
- package/lib/typescript/module/live/types.d.ts.map +1 -0
- package/lib/typescript/module/live/validation.d.ts +658 -0
- package/lib/typescript/module/live/validation.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/schema.d.ts +1072 -0
- package/lib/typescript/module/schema.d.ts.map +1 -0
- package/package.json +133 -21
- package/src/client.test.ts +185 -0
- package/src/client.ts +125 -0
- package/src/index.native.ts +2 -0
- package/src/index.ts +4 -0
- package/src/live/assets/icons/spaces-icon.tsx +15 -0
- package/src/live/assets/icons/syra-icon.tsx +13 -0
- package/src/live/assets/sounds/intro.mp3 +0 -0
- package/src/live/components/AnimatedPulse.tsx +52 -0
- package/src/live/components/AnimatedSpeakerRing.tsx +101 -0
- package/src/live/components/CreateRoomSheet.tsx +654 -0
- package/src/live/components/InsightsPanel.tsx +202 -0
- package/src/live/components/LiveRoomSheet.tsx +969 -0
- package/src/live/components/MiniRoomBar.tsx +166 -0
- package/src/live/components/PanelHeader.tsx +36 -0
- package/src/live/components/PodcastStreamPicker.tsx +1155 -0
- package/src/live/components/RecordingCard.tsx +154 -0
- package/src/live/components/RecordingsPanel.tsx +251 -0
- package/src/live/components/RoomCard.tsx +494 -0
- package/src/live/components/StreamConfigModal.tsx +600 -0
- package/src/live/components/StreamConfigPanel.tsx +729 -0
- package/src/live/context/LiveConfigContext.tsx +96 -0
- package/src/live/context/LiveRoomContext.tsx +235 -0
- package/src/live/hooks/useActiveSpeakers.ts +39 -0
- package/src/live/hooks/useRoomAudio.ts +103 -0
- package/src/live/hooks/useRoomConnection.ts +162 -0
- package/src/live/hooks/useRoomManager.ts +17 -0
- package/src/live/hooks/useRoomUsers.ts +52 -0
- package/src/live/index.ts +92 -0
- package/src/live/services/livekitService.ts +11 -0
- package/src/live/services/spaceSocketService.ts +136 -0
- package/src/live/services/spacesService.ts +692 -0
- package/src/live/types.ts +119 -0
- package/src/live/validation.ts +279 -0
- package/src/schema.ts +34 -0
- package/dist/cjs/client.js +0 -185
- package/dist/cjs/errors.js +0 -16
- package/dist/cjs/index.js +0 -14
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/schema.js +0 -62
- package/dist/esm/client.js +0 -181
- package/dist/esm/errors.js +0 -12
- package/dist/esm/index.js +0 -3
- package/dist/esm/package.json +0 -3
- package/dist/esm/schema.js +0 -59
- package/dist/types/index.d.ts +0 -5
package/dist/cjs/schema.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.podcastSummarySchema = exports.trackSummarySchema = exports.coverArtSizesSchema = exports.coverArtVariantSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
/**
|
|
6
|
-
* Minimal, self-contained schemas for the public Syra API response shapes this
|
|
7
|
-
* SDK consumes. Intentionally NOT shared with the Syra backend's internal
|
|
8
|
-
* types — the SDK validates only the fields it returns, and tolerantly strips
|
|
9
|
-
* everything else (Zod object schemas drop unknown keys by default), so the API
|
|
10
|
-
* can evolve without breaking external consumers.
|
|
11
|
-
*/
|
|
12
|
-
/** A single artwork variant. The backend serializes `url` as `/api/images/:id`. */
|
|
13
|
-
exports.coverArtVariantSchema = zod_1.z.object({
|
|
14
|
-
id: zod_1.z.string().optional(),
|
|
15
|
-
url: zod_1.z.string(),
|
|
16
|
-
width: zod_1.z.number().optional(),
|
|
17
|
-
height: zod_1.z.number().optional(),
|
|
18
|
-
});
|
|
19
|
-
/** Named artwork variants keyed by size. */
|
|
20
|
-
exports.coverArtSizesSchema = zod_1.z.object({
|
|
21
|
-
small: exports.coverArtVariantSchema.optional(),
|
|
22
|
-
medium: exports.coverArtVariantSchema.optional(),
|
|
23
|
-
large: exports.coverArtVariantSchema.optional(),
|
|
24
|
-
xlarge: exports.coverArtVariantSchema.optional(),
|
|
25
|
-
xxlarge: exports.coverArtVariantSchema.optional(),
|
|
26
|
-
original: exports.coverArtVariantSchema.optional(),
|
|
27
|
-
});
|
|
28
|
-
/**
|
|
29
|
-
* The summary view of a track returned by the public catalog endpoints — just
|
|
30
|
-
* enough to render a song row and play its preview.
|
|
31
|
-
*/
|
|
32
|
-
exports.trackSummarySchema = zod_1.z.object({
|
|
33
|
-
id: zod_1.z.string(),
|
|
34
|
-
title: zod_1.z.string(),
|
|
35
|
-
artistId: zod_1.z.string().optional(),
|
|
36
|
-
artistName: zod_1.z.string(),
|
|
37
|
-
albumId: zod_1.z.string().optional(),
|
|
38
|
-
albumName: zod_1.z.string().optional(),
|
|
39
|
-
duration: zod_1.z.number(),
|
|
40
|
-
coverArt: zod_1.z.string().optional(),
|
|
41
|
-
coverArtSizes: exports.coverArtSizesSchema.optional(),
|
|
42
|
-
previewAvailable: zod_1.z.boolean().optional(),
|
|
43
|
-
});
|
|
44
|
-
/**
|
|
45
|
-
* The summary view of a podcast SHOW returned by the public podcast endpoints
|
|
46
|
-
* (`GET /api/podcasts/search`, `GET /api/podcasts/:id`) — just enough to render
|
|
47
|
-
* a show card and deep-link into the Syra app.
|
|
48
|
-
*
|
|
49
|
-
* Artwork mirrors tracks: `image` is the re-hosted Syra image id (resolved via
|
|
50
|
-
* `/api/images/:id`); `imageSizes` is the multi-resolution variant set (each
|
|
51
|
-
* variant `url` is `/api/images/:id`); `imageSourceUrl` keeps the original
|
|
52
|
-
* external artwork URL as an absolute fallback when re-hosting has not run yet.
|
|
53
|
-
*/
|
|
54
|
-
exports.podcastSummarySchema = zod_1.z.object({
|
|
55
|
-
id: zod_1.z.string(),
|
|
56
|
-
title: zod_1.z.string(),
|
|
57
|
-
author: zod_1.z.string().optional(),
|
|
58
|
-
description: zod_1.z.string().optional(),
|
|
59
|
-
image: zod_1.z.string().optional(),
|
|
60
|
-
imageSizes: exports.coverArtSizesSchema.optional(),
|
|
61
|
-
imageSourceUrl: zod_1.z.string().optional(),
|
|
62
|
-
});
|
package/dist/esm/client.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { trackSummarySchema, podcastSummarySchema, } from './schema.js';
|
|
2
|
-
import { SyraApiError } from './errors.js';
|
|
3
|
-
/** Default base URL of the public Syra API. */
|
|
4
|
-
export const DEFAULT_SYRA_BASE_URL = 'https://api.syra.fm';
|
|
5
|
-
/** Default base URL of the Syra web app, used for deep links. */
|
|
6
|
-
export const DEFAULT_SYRA_WEB_BASE_URL = 'https://syra.fm';
|
|
7
|
-
/** Order used to pick the best available artwork variant when none is named. */
|
|
8
|
-
const ARTWORK_FALLBACK_ORDER = [
|
|
9
|
-
'original',
|
|
10
|
-
'xxlarge',
|
|
11
|
-
'xlarge',
|
|
12
|
-
'large',
|
|
13
|
-
'medium',
|
|
14
|
-
'small',
|
|
15
|
-
];
|
|
16
|
-
const OBJECT_ID_PATTERN = /^[a-f\d]{24}$/i;
|
|
17
|
-
/** Read a finite number from an unknown response field, else a fallback. */
|
|
18
|
-
function numberOr(value, fallback) {
|
|
19
|
-
return typeof value === 'number' && Number.isFinite(value) ? value : fallback;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Create a headless client for the public Syra API. Public reads only — there
|
|
23
|
-
* is no authentication in this version.
|
|
24
|
-
*/
|
|
25
|
-
export function createSyraClient(options = {}) {
|
|
26
|
-
const baseURL = (options.baseURL ?? DEFAULT_SYRA_BASE_URL).replace(/\/+$/, '');
|
|
27
|
-
const webBaseURL = (options.webBaseURL ?? DEFAULT_SYRA_WEB_BASE_URL).replace(/\/+$/, '');
|
|
28
|
-
function resolveFetch() {
|
|
29
|
-
if (options.fetch) {
|
|
30
|
-
return options.fetch;
|
|
31
|
-
}
|
|
32
|
-
const globalFetch = globalThis.fetch;
|
|
33
|
-
if (typeof globalFetch === 'function') {
|
|
34
|
-
return globalFetch.bind(globalThis);
|
|
35
|
-
}
|
|
36
|
-
throw new Error('@syra.fm/sdk: no global fetch is available. Pass `fetch` in createSyraClient options, ' +
|
|
37
|
-
'or run on Node 18+, a browser, or React Native.');
|
|
38
|
-
}
|
|
39
|
-
async function getJson(path) {
|
|
40
|
-
const doFetch = resolveFetch();
|
|
41
|
-
const response = await doFetch(`${baseURL}${path}`, {
|
|
42
|
-
headers: { Accept: 'application/json' },
|
|
43
|
-
});
|
|
44
|
-
if (!response.ok) {
|
|
45
|
-
throw new SyraApiError(response.status, `Syra API request failed: ${response.status} ${response.statusText} (${path})`);
|
|
46
|
-
}
|
|
47
|
-
return response.json();
|
|
48
|
-
}
|
|
49
|
-
function resolveImageRef(ref) {
|
|
50
|
-
if (!ref) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
if (/^https?:\/\//i.test(ref)) {
|
|
54
|
-
return ref;
|
|
55
|
-
}
|
|
56
|
-
if (ref.startsWith('/api/images/')) {
|
|
57
|
-
return `${baseURL}${ref}`;
|
|
58
|
-
}
|
|
59
|
-
if (OBJECT_ID_PATTERN.test(ref)) {
|
|
60
|
-
return `${baseURL}/api/images/${ref}`;
|
|
61
|
-
}
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
async searchTracks(query, searchOptions = {}) {
|
|
66
|
-
const params = new URLSearchParams({ q: query, category: 'tracks' });
|
|
67
|
-
if (typeof searchOptions.limit === 'number') {
|
|
68
|
-
params.set('limit', String(searchOptions.limit));
|
|
69
|
-
}
|
|
70
|
-
if (typeof searchOptions.offset === 'number') {
|
|
71
|
-
params.set('offset', String(searchOptions.offset));
|
|
72
|
-
}
|
|
73
|
-
const json = (await getJson(`/api/search?${params.toString()}`));
|
|
74
|
-
const rawTracks = Array.isArray(json?.results?.tracks) ? json.results.tracks : [];
|
|
75
|
-
const items = [];
|
|
76
|
-
for (const raw of rawTracks) {
|
|
77
|
-
// A single malformed catalog row must not fail the whole search.
|
|
78
|
-
const parsed = trackSummarySchema.safeParse(raw);
|
|
79
|
-
if (parsed.success && parsed.data.previewAvailable === true) {
|
|
80
|
-
items.push(parsed.data);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
items,
|
|
85
|
-
// `hasMore` is sourced from the backend's pagination over the FULL result
|
|
86
|
-
// set; the client-side preview filter above may shrink `items` below
|
|
87
|
-
// `limit`, but must NOT corrupt `hasMore` (else a page whose tail was
|
|
88
|
-
// filtered out would falsely report the end of the catalog).
|
|
89
|
-
hasMore: json?.hasMore === true,
|
|
90
|
-
limit: numberOr(json?.limit, searchOptions.limit ?? rawTracks.length),
|
|
91
|
-
offset: numberOr(json?.offset, searchOptions.offset ?? 0),
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
async getTrack(id) {
|
|
95
|
-
const json = await getJson(`/api/tracks/${encodeURIComponent(id)}`);
|
|
96
|
-
return trackSummarySchema.parse(json);
|
|
97
|
-
},
|
|
98
|
-
previewUrl(id, startSec = 0) {
|
|
99
|
-
const safeStart = Number.isFinite(startSec) ? Math.max(0, Math.trunc(startSec)) : 0;
|
|
100
|
-
return `${baseURL}/api/preview/${encodeURIComponent(id)}.mp3?start=${safeStart}`;
|
|
101
|
-
},
|
|
102
|
-
artworkUrl(source, size) {
|
|
103
|
-
if (typeof source === 'string') {
|
|
104
|
-
return resolveImageRef(source);
|
|
105
|
-
}
|
|
106
|
-
if (size && source.coverArtSizes) {
|
|
107
|
-
const resolved = resolveImageRef(source.coverArtSizes[size]?.url);
|
|
108
|
-
if (resolved) {
|
|
109
|
-
return resolved;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const fromCoverArt = resolveImageRef(source.coverArt);
|
|
113
|
-
if (fromCoverArt) {
|
|
114
|
-
return fromCoverArt;
|
|
115
|
-
}
|
|
116
|
-
if (source.coverArtSizes) {
|
|
117
|
-
for (const key of ARTWORK_FALLBACK_ORDER) {
|
|
118
|
-
const resolved = resolveImageRef(source.coverArtSizes[key]?.url);
|
|
119
|
-
if (resolved) {
|
|
120
|
-
return resolved;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return undefined;
|
|
125
|
-
},
|
|
126
|
-
async searchPodcasts(query, searchOptions = {}) {
|
|
127
|
-
const params = new URLSearchParams({ q: query });
|
|
128
|
-
if (typeof searchOptions.limit === 'number') {
|
|
129
|
-
params.set('limit', String(searchOptions.limit));
|
|
130
|
-
}
|
|
131
|
-
if (typeof searchOptions.offset === 'number') {
|
|
132
|
-
params.set('offset', String(searchOptions.offset));
|
|
133
|
-
}
|
|
134
|
-
const json = (await getJson(`/api/podcasts/search?${params.toString()}`));
|
|
135
|
-
const rawPodcasts = Array.isArray(json?.data) ? json.data : [];
|
|
136
|
-
const items = [];
|
|
137
|
-
for (const raw of rawPodcasts) {
|
|
138
|
-
// A single malformed catalog row must not fail the whole search.
|
|
139
|
-
const parsed = podcastSummarySchema.safeParse(raw);
|
|
140
|
-
if (parsed.success) {
|
|
141
|
-
items.push(parsed.data);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return {
|
|
145
|
-
items,
|
|
146
|
-
// `hasMore` reflects the backend's pagination over the full result set.
|
|
147
|
-
hasMore: json?.hasMore === true,
|
|
148
|
-
limit: numberOr(json?.limit, searchOptions.limit ?? rawPodcasts.length),
|
|
149
|
-
offset: numberOr(json?.offset, searchOptions.offset ?? 0),
|
|
150
|
-
};
|
|
151
|
-
},
|
|
152
|
-
async getPodcast(id) {
|
|
153
|
-
const json = (await getJson(`/api/podcasts/${encodeURIComponent(id)}`));
|
|
154
|
-
return podcastSummarySchema.parse(json?.data?.podcast);
|
|
155
|
-
},
|
|
156
|
-
podcastUrl(id) {
|
|
157
|
-
return `${webBaseURL}/podcasts/${encodeURIComponent(id)}`;
|
|
158
|
-
},
|
|
159
|
-
podcastArtworkUrl(source, size) {
|
|
160
|
-
if (size && source.imageSizes) {
|
|
161
|
-
const resolved = resolveImageRef(source.imageSizes[size]?.url);
|
|
162
|
-
if (resolved) {
|
|
163
|
-
return resolved;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
const fromImage = resolveImageRef(source.image);
|
|
167
|
-
if (fromImage) {
|
|
168
|
-
return fromImage;
|
|
169
|
-
}
|
|
170
|
-
if (source.imageSizes) {
|
|
171
|
-
for (const key of ARTWORK_FALLBACK_ORDER) {
|
|
172
|
-
const resolved = resolveImageRef(source.imageSizes[key]?.url);
|
|
173
|
-
if (resolved) {
|
|
174
|
-
return resolved;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return resolveImageRef(source.imageSourceUrl);
|
|
179
|
-
},
|
|
180
|
-
};
|
|
181
|
-
}
|
package/dist/esm/errors.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error thrown when the Syra API returns a non-2xx response.
|
|
3
|
-
*/
|
|
4
|
-
export class SyraApiError extends Error {
|
|
5
|
-
constructor(status, message) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.name = 'SyraApiError';
|
|
8
|
-
this.status = status;
|
|
9
|
-
// Restore the prototype chain when targeting ES5-ish runtimes.
|
|
10
|
-
Object.setPrototypeOf(this, SyraApiError.prototype);
|
|
11
|
-
}
|
|
12
|
-
}
|
package/dist/esm/index.js
DELETED
package/dist/esm/package.json
DELETED
package/dist/esm/schema.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Minimal, self-contained schemas for the public Syra API response shapes this
|
|
4
|
-
* SDK consumes. Intentionally NOT shared with the Syra backend's internal
|
|
5
|
-
* types — the SDK validates only the fields it returns, and tolerantly strips
|
|
6
|
-
* everything else (Zod object schemas drop unknown keys by default), so the API
|
|
7
|
-
* can evolve without breaking external consumers.
|
|
8
|
-
*/
|
|
9
|
-
/** A single artwork variant. The backend serializes `url` as `/api/images/:id`. */
|
|
10
|
-
export const coverArtVariantSchema = z.object({
|
|
11
|
-
id: z.string().optional(),
|
|
12
|
-
url: z.string(),
|
|
13
|
-
width: z.number().optional(),
|
|
14
|
-
height: z.number().optional(),
|
|
15
|
-
});
|
|
16
|
-
/** Named artwork variants keyed by size. */
|
|
17
|
-
export const coverArtSizesSchema = z.object({
|
|
18
|
-
small: coverArtVariantSchema.optional(),
|
|
19
|
-
medium: coverArtVariantSchema.optional(),
|
|
20
|
-
large: coverArtVariantSchema.optional(),
|
|
21
|
-
xlarge: coverArtVariantSchema.optional(),
|
|
22
|
-
xxlarge: coverArtVariantSchema.optional(),
|
|
23
|
-
original: coverArtVariantSchema.optional(),
|
|
24
|
-
});
|
|
25
|
-
/**
|
|
26
|
-
* The summary view of a track returned by the public catalog endpoints — just
|
|
27
|
-
* enough to render a song row and play its preview.
|
|
28
|
-
*/
|
|
29
|
-
export const trackSummarySchema = z.object({
|
|
30
|
-
id: z.string(),
|
|
31
|
-
title: z.string(),
|
|
32
|
-
artistId: z.string().optional(),
|
|
33
|
-
artistName: z.string(),
|
|
34
|
-
albumId: z.string().optional(),
|
|
35
|
-
albumName: z.string().optional(),
|
|
36
|
-
duration: z.number(),
|
|
37
|
-
coverArt: z.string().optional(),
|
|
38
|
-
coverArtSizes: coverArtSizesSchema.optional(),
|
|
39
|
-
previewAvailable: z.boolean().optional(),
|
|
40
|
-
});
|
|
41
|
-
/**
|
|
42
|
-
* The summary view of a podcast SHOW returned by the public podcast endpoints
|
|
43
|
-
* (`GET /api/podcasts/search`, `GET /api/podcasts/:id`) — just enough to render
|
|
44
|
-
* a show card and deep-link into the Syra app.
|
|
45
|
-
*
|
|
46
|
-
* Artwork mirrors tracks: `image` is the re-hosted Syra image id (resolved via
|
|
47
|
-
* `/api/images/:id`); `imageSizes` is the multi-resolution variant set (each
|
|
48
|
-
* variant `url` is `/api/images/:id`); `imageSourceUrl` keeps the original
|
|
49
|
-
* external artwork URL as an absolute fallback when re-hosting has not run yet.
|
|
50
|
-
*/
|
|
51
|
-
export const podcastSummarySchema = z.object({
|
|
52
|
-
id: z.string(),
|
|
53
|
-
title: z.string(),
|
|
54
|
-
author: z.string().optional(),
|
|
55
|
-
description: z.string().optional(),
|
|
56
|
-
image: z.string().optional(),
|
|
57
|
-
imageSizes: coverArtSizesSchema.optional(),
|
|
58
|
-
imageSourceUrl: z.string().optional(),
|
|
59
|
-
});
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { createSyraClient, DEFAULT_SYRA_BASE_URL, DEFAULT_SYRA_WEB_BASE_URL, } from './client';
|
|
2
|
-
export type { SyraClient, SyraClientOptions, SearchTracksOptions, SearchPodcastsOptions, SearchPage, ArtworkSource, PodcastArtworkSource, } from './client';
|
|
3
|
-
export { trackSummarySchema, podcastSummarySchema, coverArtSizesSchema, coverArtVariantSchema, } from './schema';
|
|
4
|
-
export type { TrackSummary, PodcastSummary, CoverArtSizes, CoverArtVariant, ArtworkSize, } from './schema';
|
|
5
|
-
export { SyraApiError } from './errors';
|