@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.
Files changed (314) hide show
  1. package/lib/commonjs/client.js +268 -0
  2. package/lib/commonjs/client.js.map +1 -0
  3. package/lib/commonjs/errors.js +22 -0
  4. package/lib/commonjs/errors.js.map +1 -0
  5. package/lib/commonjs/index.js +63 -0
  6. package/lib/commonjs/index.js.map +1 -0
  7. package/lib/commonjs/index.native.js +28 -0
  8. package/lib/commonjs/index.native.js.map +1 -0
  9. package/lib/commonjs/live/assets/icons/spaces-icon.js +42 -0
  10. package/lib/commonjs/live/assets/icons/spaces-icon.js.map +1 -0
  11. package/lib/commonjs/live/assets/icons/syra-icon.js +43 -0
  12. package/lib/commonjs/live/assets/icons/syra-icon.js.map +1 -0
  13. package/lib/commonjs/live/components/AnimatedPulse.js +38 -0
  14. package/lib/commonjs/live/components/AnimatedPulse.js.map +1 -0
  15. package/lib/commonjs/live/components/AnimatedSpeakerRing.js +90 -0
  16. package/lib/commonjs/live/components/AnimatedSpeakerRing.js.map +1 -0
  17. package/lib/commonjs/live/components/CreateRoomSheet.js +688 -0
  18. package/lib/commonjs/live/components/CreateRoomSheet.js.map +1 -0
  19. package/lib/commonjs/live/components/InsightsPanel.js +333 -0
  20. package/lib/commonjs/live/components/InsightsPanel.js.map +1 -0
  21. package/lib/commonjs/live/components/LiveRoomSheet.js +1195 -0
  22. package/lib/commonjs/live/components/LiveRoomSheet.js.map +1 -0
  23. package/lib/commonjs/live/components/MiniRoomBar.js +161 -0
  24. package/lib/commonjs/live/components/MiniRoomBar.js.map +1 -0
  25. package/lib/commonjs/live/components/PanelHeader.js +57 -0
  26. package/lib/commonjs/live/components/PanelHeader.js.map +1 -0
  27. package/lib/commonjs/live/components/PodcastStreamPicker.js +1190 -0
  28. package/lib/commonjs/live/components/PodcastStreamPicker.js.map +1 -0
  29. package/lib/commonjs/live/components/RecordingCard.js +192 -0
  30. package/lib/commonjs/live/components/RecordingCard.js.map +1 -0
  31. package/lib/commonjs/live/components/RecordingsPanel.js +304 -0
  32. package/lib/commonjs/live/components/RecordingsPanel.js.map +1 -0
  33. package/lib/commonjs/live/components/RoomCard.js +553 -0
  34. package/lib/commonjs/live/components/RoomCard.js.map +1 -0
  35. package/lib/commonjs/live/components/StreamConfigModal.js +656 -0
  36. package/lib/commonjs/live/components/StreamConfigModal.js.map +1 -0
  37. package/lib/commonjs/live/components/StreamConfigPanel.js +822 -0
  38. package/lib/commonjs/live/components/StreamConfigPanel.js.map +1 -0
  39. package/lib/commonjs/live/context/LiveConfigContext.js +46 -0
  40. package/lib/commonjs/live/context/LiveConfigContext.js.map +1 -0
  41. package/lib/commonjs/live/context/LiveRoomContext.js +195 -0
  42. package/lib/commonjs/live/context/LiveRoomContext.js.map +1 -0
  43. package/lib/commonjs/live/hooks/useActiveSpeakers.js +35 -0
  44. package/lib/commonjs/live/hooks/useActiveSpeakers.js.map +1 -0
  45. package/lib/commonjs/live/hooks/useRoomAudio.js +129 -0
  46. package/lib/commonjs/live/hooks/useRoomAudio.js.map +1 -0
  47. package/lib/commonjs/live/hooks/useRoomConnection.js +177 -0
  48. package/lib/commonjs/live/hooks/useRoomConnection.js.map +1 -0
  49. package/lib/commonjs/live/hooks/useRoomManager.js +37 -0
  50. package/lib/commonjs/live/hooks/useRoomManager.js.map +1 -0
  51. package/lib/commonjs/live/hooks/useRoomUsers.js +52 -0
  52. package/lib/commonjs/live/hooks/useRoomUsers.js.map +1 -0
  53. package/lib/commonjs/live/index.js +310 -0
  54. package/lib/commonjs/live/index.js.map +1 -0
  55. package/lib/commonjs/live/services/livekitService.js +20 -0
  56. package/lib/commonjs/live/services/livekitService.js.map +1 -0
  57. package/lib/commonjs/live/services/spaceSocketService.js +181 -0
  58. package/lib/commonjs/live/services/spaceSocketService.js.map +1 -0
  59. package/lib/commonjs/live/services/spacesService.js +642 -0
  60. package/lib/commonjs/live/services/spacesService.js.map +1 -0
  61. package/lib/commonjs/live/types.js +6 -0
  62. package/lib/commonjs/live/types.js.map +1 -0
  63. package/lib/commonjs/live/validation.js +238 -0
  64. package/lib/commonjs/live/validation.js.map +1 -0
  65. package/lib/commonjs/package.json +1 -0
  66. package/lib/commonjs/schema.js +102 -0
  67. package/lib/commonjs/schema.js.map +1 -0
  68. package/lib/module/client.js +264 -0
  69. package/lib/module/client.js.map +1 -0
  70. package/lib/module/errors.js +17 -0
  71. package/lib/module/errors.js.map +1 -0
  72. package/lib/module/index.js +6 -0
  73. package/lib/module/index.js.map +1 -0
  74. package/lib/module/index.native.js +5 -0
  75. package/lib/module/index.native.js.map +1 -0
  76. package/lib/module/live/assets/icons/spaces-icon.js +34 -0
  77. package/lib/module/live/assets/icons/spaces-icon.js.map +1 -0
  78. package/lib/module/live/assets/icons/syra-icon.js +36 -0
  79. package/lib/module/live/assets/icons/syra-icon.js.map +1 -0
  80. package/lib/module/live/components/AnimatedPulse.js +33 -0
  81. package/lib/module/live/components/AnimatedPulse.js.map +1 -0
  82. package/lib/module/live/components/AnimatedSpeakerRing.js +85 -0
  83. package/lib/module/live/components/AnimatedSpeakerRing.js.map +1 -0
  84. package/lib/module/live/components/CreateRoomSheet.js +682 -0
  85. package/lib/module/live/components/CreateRoomSheet.js.map +1 -0
  86. package/lib/module/live/components/InsightsPanel.js +327 -0
  87. package/lib/module/live/components/InsightsPanel.js.map +1 -0
  88. package/lib/module/live/components/LiveRoomSheet.js +1189 -0
  89. package/lib/module/live/components/LiveRoomSheet.js.map +1 -0
  90. package/lib/module/live/components/MiniRoomBar.js +154 -0
  91. package/lib/module/live/components/MiniRoomBar.js.map +1 -0
  92. package/lib/module/live/components/PanelHeader.js +52 -0
  93. package/lib/module/live/components/PanelHeader.js.map +1 -0
  94. package/lib/module/live/components/PodcastStreamPicker.js +1183 -0
  95. package/lib/module/live/components/PodcastStreamPicker.js.map +1 -0
  96. package/lib/module/live/components/RecordingCard.js +187 -0
  97. package/lib/module/live/components/RecordingCard.js.map +1 -0
  98. package/lib/module/live/components/RecordingsPanel.js +298 -0
  99. package/lib/module/live/components/RecordingsPanel.js.map +1 -0
  100. package/lib/module/live/components/RoomCard.js +548 -0
  101. package/lib/module/live/components/RoomCard.js.map +1 -0
  102. package/lib/module/live/components/StreamConfigModal.js +650 -0
  103. package/lib/module/live/components/StreamConfigModal.js.map +1 -0
  104. package/lib/module/live/components/StreamConfigPanel.js +816 -0
  105. package/lib/module/live/components/StreamConfigPanel.js.map +1 -0
  106. package/lib/module/live/context/LiveConfigContext.js +40 -0
  107. package/lib/module/live/context/LiveConfigContext.js.map +1 -0
  108. package/lib/module/live/context/LiveRoomContext.js +189 -0
  109. package/lib/module/live/context/LiveRoomContext.js.map +1 -0
  110. package/lib/module/live/hooks/useActiveSpeakers.js +31 -0
  111. package/lib/module/live/hooks/useActiveSpeakers.js.map +1 -0
  112. package/lib/module/live/hooks/useRoomAudio.js +125 -0
  113. package/lib/module/live/hooks/useRoomAudio.js.map +1 -0
  114. package/lib/module/live/hooks/useRoomConnection.js +173 -0
  115. package/lib/module/live/hooks/useRoomConnection.js.map +1 -0
  116. package/lib/module/live/hooks/useRoomManager.js +32 -0
  117. package/lib/module/live/hooks/useRoomManager.js.map +1 -0
  118. package/lib/module/live/hooks/useRoomUsers.js +46 -0
  119. package/lib/module/live/hooks/useRoomUsers.js.map +1 -0
  120. package/lib/module/live/index.js +38 -0
  121. package/lib/module/live/index.js.map +1 -0
  122. package/lib/module/live/services/livekitService.js +16 -0
  123. package/lib/module/live/services/livekitService.js.map +1 -0
  124. package/lib/module/live/services/spaceSocketService.js +176 -0
  125. package/lib/module/live/services/spaceSocketService.js.map +1 -0
  126. package/lib/module/live/services/spacesService.js +639 -0
  127. package/lib/module/live/services/spacesService.js.map +1 -0
  128. package/lib/module/live/types.js +4 -0
  129. package/lib/module/live/types.js.map +1 -0
  130. package/lib/module/live/validation.js +229 -0
  131. package/lib/module/live/validation.js.map +1 -0
  132. package/lib/module/package.json +1 -0
  133. package/lib/module/schema.js +99 -0
  134. package/lib/module/schema.js.map +1 -0
  135. package/{dist/types → lib/typescript/commonjs}/client.d.ts +36 -1
  136. package/lib/typescript/commonjs/client.d.ts.map +1 -0
  137. package/{dist/types → lib/typescript/commonjs}/errors.d.ts +1 -0
  138. package/lib/typescript/commonjs/errors.d.ts.map +1 -0
  139. package/lib/typescript/commonjs/index.d.ts +6 -0
  140. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/index.native.d.ts +3 -0
  142. package/lib/typescript/commonjs/index.native.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/live/assets/icons/spaces-icon.d.ts +13 -0
  144. package/lib/typescript/commonjs/live/assets/icons/spaces-icon.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/live/assets/icons/syra-icon.d.ts +13 -0
  146. package/lib/typescript/commonjs/live/assets/icons/syra-icon.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/live/components/AnimatedPulse.d.ts +8 -0
  148. package/lib/typescript/commonjs/live/components/AnimatedPulse.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/live/components/AnimatedSpeakerRing.d.ts +10 -0
  150. package/lib/typescript/commonjs/live/components/AnimatedSpeakerRing.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/live/components/CreateRoomSheet.d.ts +26 -0
  152. package/lib/typescript/commonjs/live/components/CreateRoomSheet.d.ts.map +1 -0
  153. package/lib/typescript/commonjs/live/components/InsightsPanel.d.ts +11 -0
  154. package/lib/typescript/commonjs/live/components/InsightsPanel.d.ts.map +1 -0
  155. package/lib/typescript/commonjs/live/components/LiveRoomSheet.d.ts +11 -0
  156. package/lib/typescript/commonjs/live/components/LiveRoomSheet.d.ts.map +1 -0
  157. package/lib/typescript/commonjs/live/components/MiniRoomBar.d.ts +15 -0
  158. package/lib/typescript/commonjs/live/components/MiniRoomBar.d.ts.map +1 -0
  159. package/lib/typescript/commonjs/live/components/PanelHeader.d.ts +10 -0
  160. package/lib/typescript/commonjs/live/components/PanelHeader.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/live/components/PodcastStreamPicker.d.ts +54 -0
  162. package/lib/typescript/commonjs/live/components/PodcastStreamPicker.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/live/components/RecordingCard.d.ts +11 -0
  164. package/lib/typescript/commonjs/live/components/RecordingCard.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/live/components/RecordingsPanel.d.ts +12 -0
  166. package/lib/typescript/commonjs/live/components/RecordingsPanel.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/live/components/RoomCard.d.ts +38 -0
  168. package/lib/typescript/commonjs/live/components/RoomCard.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/live/components/StreamConfigModal.d.ts +11 -0
  170. package/lib/typescript/commonjs/live/components/StreamConfigModal.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/live/components/StreamConfigPanel.d.ts +13 -0
  172. package/lib/typescript/commonjs/live/components/StreamConfigPanel.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/live/context/LiveConfigContext.d.ts +78 -0
  174. package/lib/typescript/commonjs/live/context/LiveConfigContext.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/live/context/LiveRoomContext.d.ts +12 -0
  176. package/lib/typescript/commonjs/live/context/LiveRoomContext.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/live/hooks/useActiveSpeakers.d.ts +3 -0
  178. package/lib/typescript/commonjs/live/hooks/useActiveSpeakers.d.ts.map +1 -0
  179. package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts +16 -0
  180. package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts.map +1 -0
  181. package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts +29 -0
  182. package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/live/hooks/useRoomManager.d.ts +11 -0
  184. package/lib/typescript/commonjs/live/hooks/useRoomManager.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/live/hooks/useRoomUsers.d.ts +5 -0
  186. package/lib/typescript/commonjs/live/hooks/useRoomUsers.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/live/index.d.ts +24 -0
  188. package/lib/typescript/commonjs/live/index.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/live/services/livekitService.d.ts +7 -0
  190. package/lib/typescript/commonjs/live/services/livekitService.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/live/services/spaceSocketService.d.ts +69 -0
  192. package/lib/typescript/commonjs/live/services/spaceSocketService.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/live/services/spacesService.d.ts +181 -0
  194. package/lib/typescript/commonjs/live/services/spacesService.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/live/types.d.ts +100 -0
  196. package/lib/typescript/commonjs/live/types.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/live/validation.d.ts +658 -0
  198. package/lib/typescript/commonjs/live/validation.d.ts.map +1 -0
  199. package/lib/typescript/commonjs/package.json +1 -0
  200. package/{dist/types → lib/typescript/commonjs}/schema.d.ts +305 -0
  201. package/lib/typescript/commonjs/schema.d.ts.map +1 -0
  202. package/lib/typescript/module/client.d.ts +141 -0
  203. package/lib/typescript/module/client.d.ts.map +1 -0
  204. package/lib/typescript/module/errors.d.ts +9 -0
  205. package/lib/typescript/module/errors.d.ts.map +1 -0
  206. package/lib/typescript/module/index.d.ts +6 -0
  207. package/lib/typescript/module/index.d.ts.map +1 -0
  208. package/lib/typescript/module/index.native.d.ts +3 -0
  209. package/lib/typescript/module/index.native.d.ts.map +1 -0
  210. package/lib/typescript/module/live/assets/icons/spaces-icon.d.ts +13 -0
  211. package/lib/typescript/module/live/assets/icons/spaces-icon.d.ts.map +1 -0
  212. package/lib/typescript/module/live/assets/icons/syra-icon.d.ts +13 -0
  213. package/lib/typescript/module/live/assets/icons/syra-icon.d.ts.map +1 -0
  214. package/lib/typescript/module/live/components/AnimatedPulse.d.ts +8 -0
  215. package/lib/typescript/module/live/components/AnimatedPulse.d.ts.map +1 -0
  216. package/lib/typescript/module/live/components/AnimatedSpeakerRing.d.ts +10 -0
  217. package/lib/typescript/module/live/components/AnimatedSpeakerRing.d.ts.map +1 -0
  218. package/lib/typescript/module/live/components/CreateRoomSheet.d.ts +26 -0
  219. package/lib/typescript/module/live/components/CreateRoomSheet.d.ts.map +1 -0
  220. package/lib/typescript/module/live/components/InsightsPanel.d.ts +11 -0
  221. package/lib/typescript/module/live/components/InsightsPanel.d.ts.map +1 -0
  222. package/lib/typescript/module/live/components/LiveRoomSheet.d.ts +11 -0
  223. package/lib/typescript/module/live/components/LiveRoomSheet.d.ts.map +1 -0
  224. package/lib/typescript/module/live/components/MiniRoomBar.d.ts +15 -0
  225. package/lib/typescript/module/live/components/MiniRoomBar.d.ts.map +1 -0
  226. package/lib/typescript/module/live/components/PanelHeader.d.ts +10 -0
  227. package/lib/typescript/module/live/components/PanelHeader.d.ts.map +1 -0
  228. package/lib/typescript/module/live/components/PodcastStreamPicker.d.ts +54 -0
  229. package/lib/typescript/module/live/components/PodcastStreamPicker.d.ts.map +1 -0
  230. package/lib/typescript/module/live/components/RecordingCard.d.ts +11 -0
  231. package/lib/typescript/module/live/components/RecordingCard.d.ts.map +1 -0
  232. package/lib/typescript/module/live/components/RecordingsPanel.d.ts +12 -0
  233. package/lib/typescript/module/live/components/RecordingsPanel.d.ts.map +1 -0
  234. package/lib/typescript/module/live/components/RoomCard.d.ts +38 -0
  235. package/lib/typescript/module/live/components/RoomCard.d.ts.map +1 -0
  236. package/lib/typescript/module/live/components/StreamConfigModal.d.ts +11 -0
  237. package/lib/typescript/module/live/components/StreamConfigModal.d.ts.map +1 -0
  238. package/lib/typescript/module/live/components/StreamConfigPanel.d.ts +13 -0
  239. package/lib/typescript/module/live/components/StreamConfigPanel.d.ts.map +1 -0
  240. package/lib/typescript/module/live/context/LiveConfigContext.d.ts +78 -0
  241. package/lib/typescript/module/live/context/LiveConfigContext.d.ts.map +1 -0
  242. package/lib/typescript/module/live/context/LiveRoomContext.d.ts +12 -0
  243. package/lib/typescript/module/live/context/LiveRoomContext.d.ts.map +1 -0
  244. package/lib/typescript/module/live/hooks/useActiveSpeakers.d.ts +3 -0
  245. package/lib/typescript/module/live/hooks/useActiveSpeakers.d.ts.map +1 -0
  246. package/lib/typescript/module/live/hooks/useRoomAudio.d.ts +16 -0
  247. package/lib/typescript/module/live/hooks/useRoomAudio.d.ts.map +1 -0
  248. package/lib/typescript/module/live/hooks/useRoomConnection.d.ts +29 -0
  249. package/lib/typescript/module/live/hooks/useRoomConnection.d.ts.map +1 -0
  250. package/lib/typescript/module/live/hooks/useRoomManager.d.ts +11 -0
  251. package/lib/typescript/module/live/hooks/useRoomManager.d.ts.map +1 -0
  252. package/lib/typescript/module/live/hooks/useRoomUsers.d.ts +5 -0
  253. package/lib/typescript/module/live/hooks/useRoomUsers.d.ts.map +1 -0
  254. package/lib/typescript/module/live/index.d.ts +24 -0
  255. package/lib/typescript/module/live/index.d.ts.map +1 -0
  256. package/lib/typescript/module/live/services/livekitService.d.ts +7 -0
  257. package/lib/typescript/module/live/services/livekitService.d.ts.map +1 -0
  258. package/lib/typescript/module/live/services/spaceSocketService.d.ts +69 -0
  259. package/lib/typescript/module/live/services/spaceSocketService.d.ts.map +1 -0
  260. package/lib/typescript/module/live/services/spacesService.d.ts +181 -0
  261. package/lib/typescript/module/live/services/spacesService.d.ts.map +1 -0
  262. package/lib/typescript/module/live/types.d.ts +100 -0
  263. package/lib/typescript/module/live/types.d.ts.map +1 -0
  264. package/lib/typescript/module/live/validation.d.ts +658 -0
  265. package/lib/typescript/module/live/validation.d.ts.map +1 -0
  266. package/lib/typescript/module/package.json +1 -0
  267. package/lib/typescript/module/schema.d.ts +1072 -0
  268. package/lib/typescript/module/schema.d.ts.map +1 -0
  269. package/package.json +133 -21
  270. package/src/client.test.ts +185 -0
  271. package/src/client.ts +125 -0
  272. package/src/index.native.ts +2 -0
  273. package/src/index.ts +4 -0
  274. package/src/live/assets/icons/spaces-icon.tsx +15 -0
  275. package/src/live/assets/icons/syra-icon.tsx +13 -0
  276. package/src/live/assets/sounds/intro.mp3 +0 -0
  277. package/src/live/components/AnimatedPulse.tsx +52 -0
  278. package/src/live/components/AnimatedSpeakerRing.tsx +101 -0
  279. package/src/live/components/CreateRoomSheet.tsx +654 -0
  280. package/src/live/components/InsightsPanel.tsx +202 -0
  281. package/src/live/components/LiveRoomSheet.tsx +969 -0
  282. package/src/live/components/MiniRoomBar.tsx +166 -0
  283. package/src/live/components/PanelHeader.tsx +36 -0
  284. package/src/live/components/PodcastStreamPicker.tsx +1155 -0
  285. package/src/live/components/RecordingCard.tsx +154 -0
  286. package/src/live/components/RecordingsPanel.tsx +251 -0
  287. package/src/live/components/RoomCard.tsx +494 -0
  288. package/src/live/components/StreamConfigModal.tsx +600 -0
  289. package/src/live/components/StreamConfigPanel.tsx +729 -0
  290. package/src/live/context/LiveConfigContext.tsx +96 -0
  291. package/src/live/context/LiveRoomContext.tsx +235 -0
  292. package/src/live/hooks/useActiveSpeakers.ts +39 -0
  293. package/src/live/hooks/useRoomAudio.ts +103 -0
  294. package/src/live/hooks/useRoomConnection.ts +162 -0
  295. package/src/live/hooks/useRoomManager.ts +17 -0
  296. package/src/live/hooks/useRoomUsers.ts +52 -0
  297. package/src/live/index.ts +92 -0
  298. package/src/live/services/livekitService.ts +11 -0
  299. package/src/live/services/spaceSocketService.ts +136 -0
  300. package/src/live/services/spacesService.ts +692 -0
  301. package/src/live/types.ts +119 -0
  302. package/src/live/validation.ts +279 -0
  303. package/src/schema.ts +34 -0
  304. package/dist/cjs/client.js +0 -185
  305. package/dist/cjs/errors.js +0 -16
  306. package/dist/cjs/index.js +0 -14
  307. package/dist/cjs/package.json +0 -3
  308. package/dist/cjs/schema.js +0 -62
  309. package/dist/esm/client.js +0 -181
  310. package/dist/esm/errors.js +0 -12
  311. package/dist/esm/index.js +0 -3
  312. package/dist/esm/package.json +0 -3
  313. package/dist/esm/schema.js +0 -59
  314. package/dist/types/index.d.ts +0 -5
@@ -0,0 +1,119 @@
1
+ import type { RoomParticipant } from './validation';
2
+
3
+ export type {
4
+ Room,
5
+ RoomParticipant,
6
+ Recording,
7
+ House,
8
+ HouseMember,
9
+ Series,
10
+ SeriesEpisode,
11
+ Recurrence,
12
+ RoomTemplate,
13
+ RoomAttachment,
14
+ } from './validation';
15
+
16
+ /**
17
+ * The "now playing" stream surfaced in the live room. Derived from the
18
+ * `room:stream:started` socket payload (and the room's persisted stream fields);
19
+ * it is NOT parsed through zod, so it stays a plain structural type rather than
20
+ * `z.infer<typeof ZStreamInfo>`. `startedAt` / `durationSec` are present for
21
+ * length-known streams (e.g. a podcast episode) and drive the progress bar;
22
+ * manual URL/RTMP streams omit them and render no progress UI.
23
+ */
24
+ export interface StreamInfo {
25
+ title?: string;
26
+ image?: string;
27
+ description?: string;
28
+ /** ISO timestamp when the current stream began. */
29
+ startedAt?: string;
30
+ /** Total length of the current stream in seconds, when known. */
31
+ durationSec?: number;
32
+ }
33
+
34
+ export interface ParticipantsUpdateData {
35
+ roomId: string;
36
+ participants: RoomParticipant[];
37
+ count: number;
38
+ timestamp: string;
39
+ }
40
+
41
+ export interface MuteUpdateData {
42
+ userId: string;
43
+ isMuted: boolean;
44
+ timestamp: string;
45
+ }
46
+
47
+ export interface SpeakerRequestData {
48
+ roomId: string;
49
+ userId: string;
50
+ timestamp: string;
51
+ }
52
+
53
+ export interface RecordingStateData {
54
+ roomId: string;
55
+ recordingId: string;
56
+ reason?: 'manual' | 'max_duration' | 'room_ended' | 'room_stopped';
57
+ timestamp: string;
58
+ }
59
+
60
+ export interface RoomAttachmentData {
61
+ roomId: string;
62
+ title: string;
63
+ status?: 'scheduled' | 'live' | 'ended';
64
+ type?: 'talk' | 'stage' | 'broadcast';
65
+ topic?: string;
66
+ host?: string;
67
+ }
68
+
69
+ export interface UserEntity {
70
+ id: string;
71
+ username?: string;
72
+ name?: { displayName?: string; full?: string; first?: string; last?: string } | string;
73
+ handle?: string;
74
+ // Adapts the Oxy SDK `User.avatar` (`string | null`): the API projects avatar
75
+ // from a nullable column, so `null` is a legitimate value at this boundary.
76
+ avatar?: string | null;
77
+ verified?: boolean;
78
+ bio?: string;
79
+ displayName?: string;
80
+ createdAt?: string;
81
+ [key: string]: unknown;
82
+ }
83
+
84
+ export interface LiveTheme {
85
+ isDark?: boolean;
86
+ colors: {
87
+ text: string;
88
+ textSecondary: string;
89
+ background: string;
90
+ backgroundSecondary: string;
91
+ card: string;
92
+ border: string;
93
+ primary: string;
94
+ [key: string]: string;
95
+ };
96
+ }
97
+
98
+ export interface HttpRequestConfig {
99
+ params?: Record<string, string | number | boolean | undefined>;
100
+ [key: string]: unknown;
101
+ }
102
+
103
+ /**
104
+ * The HTTP client the engine consumes. Deliberately shaped to match an Oxy
105
+ * `oxyServices.createLinkedClient(...).client` as-is: every method resolves to
106
+ * the PARSED RESPONSE BODY directly (not a `{ data }` envelope). Consumers pass
107
+ * that Oxy client straight through — no per-app adapter.
108
+ */
109
+ export interface HttpClient {
110
+ get: (url: string, config?: HttpRequestConfig) => Promise<Record<string, unknown>>;
111
+ post: (url: string, data?: Record<string, unknown> | FormData, config?: HttpRequestConfig) => Promise<Record<string, unknown>>;
112
+ patch: (url: string, data?: Record<string, unknown>, config?: HttpRequestConfig) => Promise<Record<string, unknown>>;
113
+ delete: (url: string, config?: HttpRequestConfig) => Promise<Record<string, unknown>>;
114
+ }
115
+
116
+ export interface FileDownloadService {
117
+ getFileDownloadUrl?(fileId: string, variant?: string, expiresIn?: number): string;
118
+ getFileDownloadUrlAsync?(fileId: string, variant?: string, expiresIn?: number): Promise<string>;
119
+ }
@@ -0,0 +1,279 @@
1
+ import { z } from 'zod';
2
+
3
+ // --- Podcast queue ---
4
+
5
+ /**
6
+ * One podcast episode queued behind the current stream. `episodeId` is the
7
+ * opaque Syra episode handle; `syraPodcastId` (when present) identifies its show.
8
+ * The playable audio URL is never carried here — it is resolved server-side at
9
+ * play-time.
10
+ */
11
+ export const ZPodcastQueueItem = z.object({
12
+ syraPodcastId: z.string().optional(),
13
+ episodeId: z.string(),
14
+ }).passthrough();
15
+
16
+ export type PodcastQueueItem = z.infer<typeof ZPodcastQueueItem>;
17
+
18
+ // --- Room (replaces Space) ---
19
+
20
+ export const ZRoom = z.object({
21
+ _id: z.string(),
22
+ id: z.string().optional(),
23
+ title: z.string(),
24
+ description: z.string().nullish(),
25
+
26
+ // Ownership
27
+ ownerType: z.enum(['profile', 'house', 'agora']).default('profile'),
28
+ host: z.string(),
29
+ houseId: z.string().optional().nullable(),
30
+ createdByAdmin: z.string().optional().nullable(),
31
+
32
+ // Classification
33
+ type: z.enum(['talk', 'stage', 'broadcast']).default('talk'),
34
+ broadcastKind: z.enum(['user', 'agora']).optional().nullable(),
35
+
36
+ // Lifecycle
37
+ status: z.enum(['scheduled', 'live', 'ended']),
38
+ scheduledStart: z.string().nullish(),
39
+ startedAt: z.string().nullish(),
40
+ endedAt: z.string().nullish(),
41
+
42
+ // Participation
43
+ speakerPermission: z.enum(['everyone', 'followers', 'invited']).nullish(),
44
+ participants: z.array(z.string()).default([]),
45
+ speakers: z.array(z.string()).default([]),
46
+ maxParticipants: z.number().default(100),
47
+
48
+ // Content
49
+ topic: z.string().nullish(),
50
+ tags: z.array(z.string()).optional(),
51
+ archived: z.boolean().optional().default(false),
52
+ seriesId: z.string().nullish(),
53
+
54
+ // Stats
55
+ stats: z.object({
56
+ peakListeners: z.number(),
57
+ totalJoined: z.number(),
58
+ }).optional(),
59
+
60
+ // Streaming
61
+ activeIngressId: z.string().nullish(),
62
+ activeStreamUrl: z.string().nullish(),
63
+ streamTitle: z.string().nullish(),
64
+ streamImage: z.string().nullish(),
65
+ streamDescription: z.string().nullish(),
66
+ rtmpUrl: z.string().nullish(),
67
+ rtmpStreamKey: z.string().nullish(),
68
+ // Stream progress + podcast lifecycle (shared contract with the backend).
69
+ // `streamStartedAt` is an ISO timestamp; `streamDurationSec` is the current
70
+ // stream's total length in seconds when known (e.g. a podcast episode);
71
+ // `podcastQueue` holds the episodes queued behind the current one.
72
+ streamStartedAt: z.string().nullish(),
73
+ streamDurationSec: z.number().nullish(),
74
+ podcastQueue: z.array(ZPodcastQueueItem).nullish(),
75
+
76
+ // Recording
77
+ recordingEnabled: z.boolean().optional().default(true),
78
+ recordingEgressId: z.string().nullish(),
79
+
80
+ createdAt: z.string(),
81
+ }).passthrough();
82
+
83
+ export type Room = z.infer<typeof ZRoom>;
84
+
85
+ // --- Room Participant ---
86
+
87
+ export const ZRoomParticipant = z.object({
88
+ userId: z.string(),
89
+ role: z.enum(['host', 'speaker', 'listener']),
90
+ isMuted: z.boolean(),
91
+ joinedAt: z.string(),
92
+ }).passthrough();
93
+
94
+ export type RoomParticipant = z.infer<typeof ZRoomParticipant>;
95
+
96
+ // --- House ---
97
+
98
+ export const ZHouseMember = z.object({
99
+ userId: z.string(),
100
+ role: z.enum(['owner', 'admin', 'host', 'member']),
101
+ joinedAt: z.string(),
102
+ }).passthrough();
103
+
104
+ export type HouseMember = z.infer<typeof ZHouseMember>;
105
+
106
+ export const ZHouse = z.object({
107
+ _id: z.string(),
108
+ id: z.string().optional(),
109
+ name: z.string(),
110
+ description: z.string().optional(),
111
+ avatar: z.string().optional().nullable(),
112
+ coverImage: z.string().optional().nullable(),
113
+ members: z.array(ZHouseMember).default([]),
114
+ createdBy: z.string(),
115
+ isPublic: z.boolean().default(true),
116
+ tags: z.array(z.string()).optional(),
117
+ createdAt: z.string(),
118
+ }).passthrough();
119
+
120
+ export type House = z.infer<typeof ZHouse>;
121
+
122
+ // --- Series ---
123
+
124
+ export const ZRecurrence = z.object({
125
+ type: z.enum(['daily', 'weekly', 'biweekly', 'monthly']),
126
+ dayOfWeek: z.number().min(0).max(6).optional(),
127
+ dayOfMonth: z.number().min(1).max(31).optional(),
128
+ time: z.string().regex(/^\d{2}:\d{2}$/),
129
+ timezone: z.string().default('UTC'),
130
+ }).passthrough();
131
+
132
+ export type Recurrence = z.infer<typeof ZRecurrence>;
133
+
134
+ export const ZRoomTemplate = z.object({
135
+ titlePattern: z.string(),
136
+ type: z.enum(['talk', 'stage', 'broadcast']).default('talk'),
137
+ description: z.string().optional(),
138
+ maxParticipants: z.number().default(100),
139
+ speakerPermission: z.enum(['everyone', 'followers', 'invited']).default('invited'),
140
+ tags: z.array(z.string()).optional(),
141
+ }).passthrough();
142
+
143
+ export type RoomTemplate = z.infer<typeof ZRoomTemplate>;
144
+
145
+ export const ZSeriesEpisode = z.object({
146
+ roomId: z.string(),
147
+ scheduledStart: z.string(),
148
+ episodeNumber: z.number(),
149
+ }).passthrough();
150
+
151
+ export type SeriesEpisode = z.infer<typeof ZSeriesEpisode>;
152
+
153
+ export const ZSeries = z.object({
154
+ _id: z.string(),
155
+ id: z.string().optional(),
156
+ title: z.string(),
157
+ description: z.string().optional(),
158
+ coverImage: z.string().optional().nullable(),
159
+ houseId: z.string().optional().nullable(),
160
+ createdBy: z.string(),
161
+ recurrence: ZRecurrence,
162
+ roomTemplate: ZRoomTemplate,
163
+ episodes: z.array(ZSeriesEpisode).default([]),
164
+ nextEpisodeNumber: z.number().default(1),
165
+ isActive: z.boolean().default(true),
166
+ createdAt: z.string(),
167
+ }).passthrough();
168
+
169
+ export type Series = z.infer<typeof ZSeries>;
170
+
171
+ // --- Recording ---
172
+
173
+ export const ZRecording = z.object({
174
+ _id: z.string(),
175
+ roomId: z.string(),
176
+ roomTitle: z.string(),
177
+ host: z.string(),
178
+ status: z.enum(['recording', 'processing', 'ready', 'failed', 'deleted']),
179
+ egressId: z.string(),
180
+ objectKey: z.string(),
181
+ fileSize: z.number().nullish(),
182
+ durationMs: z.number().nullish(),
183
+ startedAt: z.string(),
184
+ stoppedAt: z.string().nullish(),
185
+ access: z.enum(['public', 'participants']).default('public'),
186
+ participantIds: z.array(z.string()).default([]),
187
+ expiresAt: z.string(),
188
+ createdAt: z.string(),
189
+ }).passthrough();
190
+
191
+ export type Recording = z.infer<typeof ZRecording>;
192
+
193
+ // --- Stream responses ---
194
+
195
+ export const ZStartStreamResponse = z.object({
196
+ ingressId: z.string(),
197
+ url: z.string(),
198
+ }).passthrough();
199
+
200
+ export const ZGenerateStreamKeyResponse = z.object({
201
+ rtmpUrl: z.string(),
202
+ streamKey: z.string(),
203
+ }).passthrough();
204
+
205
+ export const ZStreamInfo = z.object({
206
+ title: z.string().optional(),
207
+ image: z.string().optional(),
208
+ description: z.string().optional(),
209
+ }).passthrough();
210
+
211
+ export type StreamInfo = z.infer<typeof ZStreamInfo>;
212
+
213
+ // --- Room attachment for posts ---
214
+
215
+ export const ZRoomAttachment = z.object({
216
+ roomId: z.string(),
217
+ title: z.string(),
218
+ status: z.enum(['scheduled', 'live', 'ended']).optional(),
219
+ type: z.enum(['talk', 'stage', 'broadcast']).optional(),
220
+ topic: z.string().optional(),
221
+ host: z.string().optional(),
222
+ }).passthrough();
223
+
224
+ export type RoomAttachment = z.infer<typeof ZRoomAttachment>;
225
+
226
+ // --- Validators ---
227
+
228
+ export function validateRoom(data: unknown): Room | null {
229
+ const result = ZRoom.safeParse(data);
230
+ if (result.success) return result.data;
231
+ console.warn('[live] Invalid Room:', result.error.issues[0]);
232
+ return null;
233
+ }
234
+
235
+ export function validateRooms(items: unknown[]): Room[] {
236
+ if (!Array.isArray(items)) return [];
237
+ const valid: Room[] = [];
238
+ for (const item of items) {
239
+ const parsed = ZRoom.safeParse(item);
240
+ if (parsed.success) {
241
+ valid.push(parsed.data);
242
+ } else {
243
+ console.warn('[live] Dropping invalid room:', parsed.error.issues[0]);
244
+ }
245
+ }
246
+ return valid;
247
+ }
248
+
249
+ export function validateHouse(data: unknown): House | null {
250
+ const result = ZHouse.safeParse(data);
251
+ if (result.success) return result.data;
252
+ console.warn('[live] Invalid House:', result.error.issues[0]);
253
+ return null;
254
+ }
255
+
256
+ export function validateRecording(data: unknown): Recording | null {
257
+ const result = ZRecording.safeParse(data);
258
+ if (result.success) return result.data;
259
+ console.warn('[live] Invalid Recording:', result.error.issues[0]);
260
+ return null;
261
+ }
262
+
263
+ export function validateRecordings(items: unknown[]): Recording[] {
264
+ if (!Array.isArray(items)) return [];
265
+ const valid: Recording[] = [];
266
+ for (const item of items) {
267
+ const parsed = ZRecording.safeParse(item);
268
+ if (parsed.success) valid.push(parsed.data);
269
+ }
270
+ return valid;
271
+ }
272
+
273
+ export function validateSeries(data: unknown): Series | null {
274
+ const result = ZSeries.safeParse(data);
275
+ if (result.success) return result.data;
276
+ console.warn('[live] Invalid Series:', result.error.issues[0]);
277
+ return null;
278
+ }
279
+
package/src/schema.ts CHANGED
@@ -69,3 +69,37 @@ export const podcastSummarySchema = z.object({
69
69
  imageSourceUrl: z.string().optional(),
70
70
  });
71
71
  export type PodcastSummary = z.infer<typeof podcastSummarySchema>;
72
+
73
+ /**
74
+ * The summary view of a podcast EPISODE returned by the public podcast endpoints
75
+ * (`GET /api/podcasts/:id/episodes`, `GET /api/episodes/:id`) — just enough to
76
+ * list an episode and stream its audio.
77
+ *
78
+ * `enclosureUrl` is the direct audio file URL (e.g.
79
+ * `https://api.fastcast.ai/audio/<guid>.mp3`) and is REQUIRED: an episode with
80
+ * no enclosure is unplayable, so a row missing it is treated as malformed and
81
+ * dropped rather than surfaced as a dead entry. `enclosureType` /
82
+ * `enclosureLength` describe that file (MIME type and byte length); `duration`
83
+ * is the runtime in seconds and `pubDate` the ISO publish timestamp.
84
+ *
85
+ * Artwork mirrors the podcast SHOW: `image` is the re-hosted Syra image id
86
+ * (resolved via `/api/images/:id`); `imageSizes` is the multi-resolution variant
87
+ * set (each variant `url` is `/api/images/:id`); `imageSourceUrl` keeps the
88
+ * original external artwork URL as an absolute fallback when re-hosting has not
89
+ * run yet.
90
+ */
91
+ export const episodeSummarySchema = z.object({
92
+ id: z.string(),
93
+ podcastId: z.string(),
94
+ title: z.string(),
95
+ description: z.string().optional(),
96
+ enclosureUrl: z.string(),
97
+ enclosureType: z.string().optional(),
98
+ enclosureLength: z.number().optional(),
99
+ duration: z.number().optional(),
100
+ pubDate: z.string().optional(),
101
+ image: z.string().optional(),
102
+ imageSizes: coverArtSizesSchema.optional(),
103
+ imageSourceUrl: z.string().optional(),
104
+ });
105
+ export type EpisodeSummary = z.infer<typeof episodeSummarySchema>;
@@ -1,185 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_SYRA_WEB_BASE_URL = exports.DEFAULT_SYRA_BASE_URL = void 0;
4
- exports.createSyraClient = createSyraClient;
5
- const schema_1 = require("./schema");
6
- const errors_1 = require("./errors");
7
- /** Default base URL of the public Syra API. */
8
- exports.DEFAULT_SYRA_BASE_URL = 'https://api.syra.fm';
9
- /** Default base URL of the Syra web app, used for deep links. */
10
- exports.DEFAULT_SYRA_WEB_BASE_URL = 'https://syra.fm';
11
- /** Order used to pick the best available artwork variant when none is named. */
12
- const ARTWORK_FALLBACK_ORDER = [
13
- 'original',
14
- 'xxlarge',
15
- 'xlarge',
16
- 'large',
17
- 'medium',
18
- 'small',
19
- ];
20
- const OBJECT_ID_PATTERN = /^[a-f\d]{24}$/i;
21
- /** Read a finite number from an unknown response field, else a fallback. */
22
- function numberOr(value, fallback) {
23
- return typeof value === 'number' && Number.isFinite(value) ? value : fallback;
24
- }
25
- /**
26
- * Create a headless client for the public Syra API. Public reads only — there
27
- * is no authentication in this version.
28
- */
29
- function createSyraClient(options = {}) {
30
- const baseURL = (options.baseURL ?? exports.DEFAULT_SYRA_BASE_URL).replace(/\/+$/, '');
31
- const webBaseURL = (options.webBaseURL ?? exports.DEFAULT_SYRA_WEB_BASE_URL).replace(/\/+$/, '');
32
- function resolveFetch() {
33
- if (options.fetch) {
34
- return options.fetch;
35
- }
36
- const globalFetch = globalThis.fetch;
37
- if (typeof globalFetch === 'function') {
38
- return globalFetch.bind(globalThis);
39
- }
40
- throw new Error('@syra.fm/sdk: no global fetch is available. Pass `fetch` in createSyraClient options, ' +
41
- 'or run on Node 18+, a browser, or React Native.');
42
- }
43
- async function getJson(path) {
44
- const doFetch = resolveFetch();
45
- const response = await doFetch(`${baseURL}${path}`, {
46
- headers: { Accept: 'application/json' },
47
- });
48
- if (!response.ok) {
49
- throw new errors_1.SyraApiError(response.status, `Syra API request failed: ${response.status} ${response.statusText} (${path})`);
50
- }
51
- return response.json();
52
- }
53
- function resolveImageRef(ref) {
54
- if (!ref) {
55
- return undefined;
56
- }
57
- if (/^https?:\/\//i.test(ref)) {
58
- return ref;
59
- }
60
- if (ref.startsWith('/api/images/')) {
61
- return `${baseURL}${ref}`;
62
- }
63
- if (OBJECT_ID_PATTERN.test(ref)) {
64
- return `${baseURL}/api/images/${ref}`;
65
- }
66
- return undefined;
67
- }
68
- return {
69
- async searchTracks(query, searchOptions = {}) {
70
- const params = new URLSearchParams({ q: query, category: 'tracks' });
71
- if (typeof searchOptions.limit === 'number') {
72
- params.set('limit', String(searchOptions.limit));
73
- }
74
- if (typeof searchOptions.offset === 'number') {
75
- params.set('offset', String(searchOptions.offset));
76
- }
77
- const json = (await getJson(`/api/search?${params.toString()}`));
78
- const rawTracks = Array.isArray(json?.results?.tracks) ? json.results.tracks : [];
79
- const items = [];
80
- for (const raw of rawTracks) {
81
- // A single malformed catalog row must not fail the whole search.
82
- const parsed = schema_1.trackSummarySchema.safeParse(raw);
83
- if (parsed.success && parsed.data.previewAvailable === true) {
84
- items.push(parsed.data);
85
- }
86
- }
87
- return {
88
- items,
89
- // `hasMore` is sourced from the backend's pagination over the FULL result
90
- // set; the client-side preview filter above may shrink `items` below
91
- // `limit`, but must NOT corrupt `hasMore` (else a page whose tail was
92
- // filtered out would falsely report the end of the catalog).
93
- hasMore: json?.hasMore === true,
94
- limit: numberOr(json?.limit, searchOptions.limit ?? rawTracks.length),
95
- offset: numberOr(json?.offset, searchOptions.offset ?? 0),
96
- };
97
- },
98
- async getTrack(id) {
99
- const json = await getJson(`/api/tracks/${encodeURIComponent(id)}`);
100
- return schema_1.trackSummarySchema.parse(json);
101
- },
102
- previewUrl(id, startSec = 0) {
103
- const safeStart = Number.isFinite(startSec) ? Math.max(0, Math.trunc(startSec)) : 0;
104
- return `${baseURL}/api/preview/${encodeURIComponent(id)}.mp3?start=${safeStart}`;
105
- },
106
- artworkUrl(source, size) {
107
- if (typeof source === 'string') {
108
- return resolveImageRef(source);
109
- }
110
- if (size && source.coverArtSizes) {
111
- const resolved = resolveImageRef(source.coverArtSizes[size]?.url);
112
- if (resolved) {
113
- return resolved;
114
- }
115
- }
116
- const fromCoverArt = resolveImageRef(source.coverArt);
117
- if (fromCoverArt) {
118
- return fromCoverArt;
119
- }
120
- if (source.coverArtSizes) {
121
- for (const key of ARTWORK_FALLBACK_ORDER) {
122
- const resolved = resolveImageRef(source.coverArtSizes[key]?.url);
123
- if (resolved) {
124
- return resolved;
125
- }
126
- }
127
- }
128
- return undefined;
129
- },
130
- async searchPodcasts(query, searchOptions = {}) {
131
- const params = new URLSearchParams({ q: query });
132
- if (typeof searchOptions.limit === 'number') {
133
- params.set('limit', String(searchOptions.limit));
134
- }
135
- if (typeof searchOptions.offset === 'number') {
136
- params.set('offset', String(searchOptions.offset));
137
- }
138
- const json = (await getJson(`/api/podcasts/search?${params.toString()}`));
139
- const rawPodcasts = Array.isArray(json?.data) ? json.data : [];
140
- const items = [];
141
- for (const raw of rawPodcasts) {
142
- // A single malformed catalog row must not fail the whole search.
143
- const parsed = schema_1.podcastSummarySchema.safeParse(raw);
144
- if (parsed.success) {
145
- items.push(parsed.data);
146
- }
147
- }
148
- return {
149
- items,
150
- // `hasMore` reflects the backend's pagination over the full result set.
151
- hasMore: json?.hasMore === true,
152
- limit: numberOr(json?.limit, searchOptions.limit ?? rawPodcasts.length),
153
- offset: numberOr(json?.offset, searchOptions.offset ?? 0),
154
- };
155
- },
156
- async getPodcast(id) {
157
- const json = (await getJson(`/api/podcasts/${encodeURIComponent(id)}`));
158
- return schema_1.podcastSummarySchema.parse(json?.data?.podcast);
159
- },
160
- podcastUrl(id) {
161
- return `${webBaseURL}/podcasts/${encodeURIComponent(id)}`;
162
- },
163
- podcastArtworkUrl(source, size) {
164
- if (size && source.imageSizes) {
165
- const resolved = resolveImageRef(source.imageSizes[size]?.url);
166
- if (resolved) {
167
- return resolved;
168
- }
169
- }
170
- const fromImage = resolveImageRef(source.image);
171
- if (fromImage) {
172
- return fromImage;
173
- }
174
- if (source.imageSizes) {
175
- for (const key of ARTWORK_FALLBACK_ORDER) {
176
- const resolved = resolveImageRef(source.imageSizes[key]?.url);
177
- if (resolved) {
178
- return resolved;
179
- }
180
- }
181
- }
182
- return resolveImageRef(source.imageSourceUrl);
183
- },
184
- };
185
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SyraApiError = void 0;
4
- /**
5
- * Error thrown when the Syra API returns a non-2xx response.
6
- */
7
- class SyraApiError extends Error {
8
- constructor(status, message) {
9
- super(message);
10
- this.name = 'SyraApiError';
11
- this.status = status;
12
- // Restore the prototype chain when targeting ES5-ish runtimes.
13
- Object.setPrototypeOf(this, SyraApiError.prototype);
14
- }
15
- }
16
- exports.SyraApiError = SyraApiError;
package/dist/cjs/index.js DELETED
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SyraApiError = exports.coverArtVariantSchema = exports.coverArtSizesSchema = exports.podcastSummarySchema = exports.trackSummarySchema = exports.DEFAULT_SYRA_WEB_BASE_URL = exports.DEFAULT_SYRA_BASE_URL = exports.createSyraClient = void 0;
4
- var client_1 = require("./client");
5
- Object.defineProperty(exports, "createSyraClient", { enumerable: true, get: function () { return client_1.createSyraClient; } });
6
- Object.defineProperty(exports, "DEFAULT_SYRA_BASE_URL", { enumerable: true, get: function () { return client_1.DEFAULT_SYRA_BASE_URL; } });
7
- Object.defineProperty(exports, "DEFAULT_SYRA_WEB_BASE_URL", { enumerable: true, get: function () { return client_1.DEFAULT_SYRA_WEB_BASE_URL; } });
8
- var schema_1 = require("./schema");
9
- Object.defineProperty(exports, "trackSummarySchema", { enumerable: true, get: function () { return schema_1.trackSummarySchema; } });
10
- Object.defineProperty(exports, "podcastSummarySchema", { enumerable: true, get: function () { return schema_1.podcastSummarySchema; } });
11
- Object.defineProperty(exports, "coverArtSizesSchema", { enumerable: true, get: function () { return schema_1.coverArtSizesSchema; } });
12
- Object.defineProperty(exports, "coverArtVariantSchema", { enumerable: true, get: function () { return schema_1.coverArtVariantSchema; } });
13
- var errors_1 = require("./errors");
14
- Object.defineProperty(exports, "SyraApiError", { enumerable: true, get: function () { return errors_1.SyraApiError; } });
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }