@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
@@ -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
- });
@@ -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
- }
@@ -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
@@ -1,3 +0,0 @@
1
- export { createSyraClient, DEFAULT_SYRA_BASE_URL, DEFAULT_SYRA_WEB_BASE_URL, } from './client.js';
2
- export { trackSummarySchema, podcastSummarySchema, coverArtSizesSchema, coverArtVariantSchema, } from './schema.js';
3
- export { SyraApiError } from './errors.js';
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -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
- });
@@ -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';