@syra.fm/sdk 0.7.0 → 0.9.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 (57) hide show
  1. package/lib/commonjs/index.js.map +1 -1
  2. package/lib/commonjs/index.native.js.map +1 -1
  3. package/lib/commonjs/live/hooks/useRoomAudio.js +6 -2
  4. package/lib/commonjs/live/hooks/useRoomAudio.js.map +1 -1
  5. package/lib/commonjs/live/hooks/useRoomConnection.js +3 -1
  6. package/lib/commonjs/live/hooks/useRoomConnection.js.map +1 -1
  7. package/lib/commonjs/live/services/spaceSocketService.js +1 -1
  8. package/lib/commonjs/live/services/spacesService.js +2 -2
  9. package/lib/commonjs/live/services/spacesService.js.map +1 -1
  10. package/lib/commonjs/live/validation.js +20 -2
  11. package/lib/commonjs/live/validation.js.map +1 -1
  12. package/lib/module/index.js +5 -0
  13. package/lib/module/index.js.map +1 -1
  14. package/lib/module/index.native.js +6 -0
  15. package/lib/module/index.native.js.map +1 -1
  16. package/lib/module/live/hooks/useRoomAudio.js +6 -2
  17. package/lib/module/live/hooks/useRoomAudio.js.map +1 -1
  18. package/lib/module/live/hooks/useRoomConnection.js +3 -1
  19. package/lib/module/live/hooks/useRoomConnection.js.map +1 -1
  20. package/lib/module/live/services/spaceSocketService.js +1 -1
  21. package/lib/module/live/services/spacesService.js +2 -2
  22. package/lib/module/live/services/spacesService.js.map +1 -1
  23. package/lib/module/live/validation.js +19 -1
  24. package/lib/module/live/validation.js.map +1 -1
  25. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/index.native.d.ts.map +1 -1
  27. package/lib/typescript/commonjs/live/hooks/useRoomAudio.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/live/hooks/useRoomConnection.d.ts.map +1 -1
  29. package/lib/typescript/commonjs/live/services/spacesService.d.ts +4 -4
  30. package/lib/typescript/commonjs/live/services/spacesService.d.ts.map +1 -1
  31. package/lib/typescript/commonjs/live/types.d.ts +1 -1
  32. package/lib/typescript/commonjs/live/types.d.ts.map +1 -1
  33. package/lib/typescript/commonjs/live/validation.d.ts +157 -510
  34. package/lib/typescript/commonjs/live/validation.d.ts.map +1 -1
  35. package/lib/typescript/commonjs/schema.d.ts +32 -864
  36. package/lib/typescript/commonjs/schema.d.ts.map +1 -1
  37. package/lib/typescript/module/index.d.ts.map +1 -1
  38. package/lib/typescript/module/index.native.d.ts.map +1 -1
  39. package/lib/typescript/module/live/hooks/useRoomAudio.d.ts.map +1 -1
  40. package/lib/typescript/module/live/hooks/useRoomConnection.d.ts.map +1 -1
  41. package/lib/typescript/module/live/services/spacesService.d.ts +4 -4
  42. package/lib/typescript/module/live/services/spacesService.d.ts.map +1 -1
  43. package/lib/typescript/module/live/types.d.ts +1 -1
  44. package/lib/typescript/module/live/types.d.ts.map +1 -1
  45. package/lib/typescript/module/live/validation.d.ts +157 -510
  46. package/lib/typescript/module/live/validation.d.ts.map +1 -1
  47. package/lib/typescript/module/schema.d.ts +32 -864
  48. package/lib/typescript/module/schema.d.ts.map +1 -1
  49. package/package.json +5 -4
  50. package/src/index.native.ts +6 -0
  51. package/src/index.ts +5 -0
  52. package/src/live/hooks/useRoomAudio.ts +8 -2
  53. package/src/live/hooks/useRoomConnection.ts +6 -1
  54. package/src/live/services/spaceSocketService.ts +1 -1
  55. package/src/live/services/spacesService.ts +4 -4
  56. package/src/live/types.ts +1 -0
  57. package/src/live/validation.ts +18 -1
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AAEH,mFAAmF;AACnF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAKhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,4CAA4C;AAC5C,eAAO,M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CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQ/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAa/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syra.fm/sdk",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Syra SDK — headless, isomorphic catalog client (Node/React-free, public reads + 30s previews) that also ships the Syra live-rooms engine (audio rooms over LiveKit) on React Native and web.",
5
5
  "source": "src/index.ts",
6
6
  "main": "lib/commonjs/index.js",
@@ -51,6 +51,7 @@
51
51
  },
52
52
  "scripts": {
53
53
  "build": "bob build",
54
+ "prepare": "bun run build",
54
55
  "clean": "rm -rf lib",
55
56
  "typecheck": "tsc --noEmit -p tsconfig.build.json",
56
57
  "test": "bun test src",
@@ -82,14 +83,14 @@
82
83
  ]
83
84
  },
84
85
  "dependencies": {
85
- "zod": "^3.25.76"
86
+ "zod": "^4.4.3"
86
87
  },
87
88
  "peerDependencies": {
88
89
  "react": "^19.2.3",
89
90
  "react-native": "^0.85.3",
90
91
  "react-native-reanimated": "^4.3.1",
91
92
  "react-native-safe-area-context": "^5.7.0",
92
- "@oxyhq/services": "^15.0.0",
93
+ "@oxyhq/services": "^22.13.1 || ^23.0.0 || ^24.0.0 || ^25.0.0 || ^26.0.0",
93
94
  "livekit-client": "^2.20.0",
94
95
  "@livekit/react-native": "^2.11.1",
95
96
  "expo-audio": "~56.0.12",
@@ -150,7 +151,7 @@
150
151
  "react-native": "^0.85.3",
151
152
  "react-native-reanimated": "^4.3.1",
152
153
  "react-native-safe-area-context": "^5.7.0",
153
- "@oxyhq/services": "^15.0.0",
154
+ "@oxyhq/services": "^25.0.1",
154
155
  "livekit-client": "^2.20.0",
155
156
  "@livekit/react-native": "^2.11.1",
156
157
  "expo-audio": "~56.0.12",
@@ -1,2 +1,8 @@
1
+ // Native/web-app entrypoint. The package `exports` map routes the `react-native`
2
+ // and `browser` conditions HERE, so Expo/RN consumers get the live-rooms engine on
3
+ // top of the base SDK. Plain Node resolution (`import`/`require`/`default`) lands on
4
+ // `./index`, which deliberately omits `./live` — the engine needs react-native peers
5
+ // that cannot load off-device. Exposure of live is therefore a property of the
6
+ // CONSUMER's resolution conditions, not of `@syra.fm/sdk`.
1
7
  export * from './index';
2
8
  export * from './live';
package/src/index.ts CHANGED
@@ -1,3 +1,8 @@
1
+ // Base entrypoint: the platform-agnostic API client + schemas. The live-rooms
2
+ // engine is intentionally NOT re-exported here — it needs react-native peers, so it
3
+ // ships from `./index.native`, which the `exports` map serves to the `react-native`
4
+ // and `browser` conditions. A Node consumer resolving `@syra.fm/sdk` gets THIS file
5
+ // and will not find the live exports; that is by design, not a missing export.
1
6
  export {
2
7
  createSyraClient,
3
8
  DEFAULT_SYRA_BASE_URL,
@@ -6,7 +6,11 @@ import { useLiveConfig } from '../context/LiveConfigContext';
6
6
 
7
7
  let AudioSession: { startAudioSession: () => void; stopAudioSession: () => void } | null = null;
8
8
  if (Platform.OS !== 'web') {
9
- try { AudioSession = require('@livekit/react-native').AudioSession; } catch {}
9
+ try {
10
+ AudioSession = require('@livekit/react-native').AudioSession;
11
+ } catch (err) {
12
+ console.warn('[RoomAudio] @livekit/react-native AudioSession unavailable; continuing without explicit audio session management:', err);
13
+ }
10
14
  }
11
15
 
12
16
  interface UseRoomAudioOptions {
@@ -37,7 +41,9 @@ export function useRoomAudio({ roomId, isSpeaker, isMuted, isConnected }: UseRoo
37
41
  (async () => {
38
42
  try {
39
43
  await setAudioModeAsync({ shouldPlayInBackground: true, playsInSilentMode: true, interruptionMode: 'duckOthers' });
40
- } catch {}
44
+ } catch (err) {
45
+ console.warn('[RoomAudio] Failed to set audio mode:', err);
46
+ }
41
47
  if (AudioSession) AudioSession.startAudioSession();
42
48
  })();
43
49
  return () => { if (AudioSession) AudioSession.stopAudioSession(); };
@@ -112,7 +112,12 @@ export function useRoomConnection({
112
112
  setParticipants(res.participants);
113
113
  hasJoined.current = true;
114
114
  if (introSound) {
115
- try { const player = createAudioPlayer(introSound); player.play(); } catch {}
115
+ try {
116
+ const player = createAudioPlayer(introSound);
117
+ player.play();
118
+ } catch (err) {
119
+ console.warn('[RoomConnection] Failed to play intro sound:', err);
120
+ }
116
121
  }
117
122
  }
118
123
  });
@@ -26,7 +26,7 @@ export class RoomSocketService {
26
26
  this.socket = null;
27
27
  }
28
28
 
29
- const baseUrl = this.socketUrl || 'ws://localhost:3000';
29
+ const baseUrl = this.socketUrl || 'ws://localhost:4120';
30
30
 
31
31
  this.socket = io(`${baseUrl}/rooms`, {
32
32
  transports: ['websocket', 'polling'],
@@ -1,4 +1,4 @@
1
- import type { Room, Recording, House, HttpClient } from '../types';
1
+ import type { Room, Recording, House, HouseVisibility, HttpClient } from '../types';
2
2
  import { validateRooms, validateRoom, validateRecordings, validateRecording, validateHouse, ZStartStreamResponse, ZGenerateStreamKeyResponse } from '../validation';
3
3
 
4
4
  export interface CreateRoomData {
@@ -45,8 +45,8 @@ export interface EpisodeListItem {
45
45
  /**
46
46
  * A single Syra music track row for the listening-party picker. Like the podcast
47
47
  * rows it carries NO audio URL — the playable source (presigned original /
48
- * tokenized HLS / Audius passthrough) stays server-owned and is resolved at
49
- * stream-start by the backend from the opaque `trackId` alone.
48
+ * tokenized HLS) stays server-owned and is resolved at stream-start by the
49
+ * backend from the opaque `trackId` alone.
50
50
  */
51
51
  export interface MusicTrackResult {
52
52
  trackId: string;
@@ -630,7 +630,7 @@ export function createRoomsService(httpClient: HttpClient) {
630
630
 
631
631
  // --- Houses ---
632
632
 
633
- async createHouse(data: { name: string; description?: string; tags?: string[]; isPublic?: boolean }): Promise<House | null> {
633
+ async createHouse(data: { name: string; description?: string; tags?: string[]; visibility?: Partial<HouseVisibility> }): Promise<House | null> {
634
634
  try {
635
635
  const res = await httpClient.post("/houses", data);
636
636
  const raw = res.house || res.data || res || null;
package/src/live/types.ts CHANGED
@@ -6,6 +6,7 @@ export type {
6
6
  Recording,
7
7
  House,
8
8
  HouseMember,
9
+ HouseVisibility,
9
10
  Series,
10
11
  SeriesEpisode,
11
12
  Recurrence,
@@ -103,6 +103,20 @@ export const ZHouseMember = z.object({
103
103
 
104
104
  export type HouseMember = z.infer<typeof ZHouseMember>;
105
105
 
106
+ /**
107
+ * House visibility as three orthogonal axes — mirrors the backend `House`
108
+ * model. `discovery` (who can find it), `rooms` (who can see/enter its rooms),
109
+ * `join` (how one becomes a member). See the backend model for the full
110
+ * contract.
111
+ */
112
+ export const ZHouseVisibility = z.object({
113
+ discovery: z.enum(['listed', 'unlisted', 'hidden']).default('listed'),
114
+ rooms: z.enum(['anyone', 'members']).default('anyone'),
115
+ join: z.enum(['anyone', 'invite']).default('invite'),
116
+ }).passthrough();
117
+
118
+ export type HouseVisibility = z.infer<typeof ZHouseVisibility>;
119
+
106
120
  export const ZHouse = z.object({
107
121
  _id: z.string(),
108
122
  id: z.string().optional(),
@@ -110,9 +124,12 @@ export const ZHouse = z.object({
110
124
  description: z.string().optional(),
111
125
  avatar: z.string().optional().nullable(),
112
126
  coverImage: z.string().optional().nullable(),
127
+ // Withheld from non-members of a `rooms: members` house; `memberCount` is sent
128
+ // in its place. Both survive `.passthrough()`.
113
129
  members: z.array(ZHouseMember).default([]),
130
+ memberCount: z.number().optional(),
114
131
  createdBy: z.string(),
115
- isPublic: z.boolean().default(true),
132
+ visibility: ZHouseVisibility.default({ discovery: 'listed', rooms: 'anyone', join: 'invite' }),
116
133
  tags: z.array(z.string()).optional(),
117
134
  createdAt: z.string(),
118
135
  }).passthrough();