Hiyve Components - v1.0.0
    Preparing search index...

    Class HiyveStore

    Index

    Constructors

    Accessors

    Methods

    addStoredRoom admitUser advertiseRoom attachTransport clearActiveRoomsError clearRecordingError clearStoredRooms clearStoredRoomsError clearStreamingError clearUnread clearUserFiles clearUserFilesError closeNoVideoRoom connectActiveRooms connectUserFiles createNoVideoRoom createRoom createUserFolder deleteStoredRoom deleteUserFile deleteUserFolder destroy disableCoaching disconnectActiveRooms disconnectUserFiles dismissHint enableCoaching enrichTranscription fetchActiveRooms fetchStoredRooms fetchUserFiles flushUserFileOps getClient getFolderMigrationState getRoomInfoFromToken getSlice getState getStoredRoom getStreamingUrls getUserFileUrl joinNoVideoRoom joinRoom joinRoomWithToken leaveRoom loadChatHistory lowerAllHands moveUserFile muteRemoteOutput rejectUser remoteMuteAudio remoteMuteVideo removeAdvertisedRoom removeUserFileLocal renameUserFile renameUserFolder resetLightweightClient resetParticipantGain resetParticipantGains sendDataMessage sendMessage setActiveRoom setAiChatMessages setAudioInputDevice setAudioOutputDevice setAudioProfile setDominant setFolderMigrationState setGain setMicrophoneBoost setParticipantGain setVideoDevice shareUserFile startRecording startScreenShare startStreaming startTranscription stopRecording stopScreenShare stopStreaming stopTranscription subscribe subscribeToSlice switchStreamingUser toggleAudio toggleHandRaised toggleOutputMute toggleVideo transcribeRecording updateAdvertisedRoom updateCoachingData updateStoredRoom updateUserFileAppData uploadUserFile upsertUserFileLocal

    Constructors

    Accessors

    • get region(): string | undefined

      The deployment's signaling-region pin, if one was configured.

      Exposed so SECONDARY clients created outside the store (ghost cameras, auxiliary connections) can join the SAME stack as the store's own clients. Without the pin a secondary client latency-probes for the closest region, which selects a stack by proximity rather than by environment — from a production session it can land on a dev stack whose JWT secrets don't match the session's room token, failing every mint.

      Returns string | undefined

    Methods

    • Admit a user from the waiting room (owner only).

      Parameters

      • userId: string

      Returns Promise<void>

    • Attach a broadcast transport. The store routes dominant + hand-raised through it (publish + subscribe). Replaces any previously attached transport. Pass null to detach.

      Parameters

      Returns void

    • Reset stored rooms to initial state (e.g. on user change / logout).

      Returns void

    • Reset user files to initial state (e.g. on user change / logout).

      Returns void

    • Close the current no-video room and disconnect.

      Returns Promise<void>

    • Connect to the active rooms SSE stream for real-time room discovery. The stream delivers snapshot, room-added, room-removed, and room-updated events.

      Parameters

      • getStreamUrl: string | (() => Promise<string>)

      Returns void

    • Connect to the user-files SSE stream for real-time file updates. Delivers snapshot, file-added, file-updated, file-removed, and resync events.

      Parameters

      • getStreamUrl: string | (() => Promise<string>)

      Returns void

    • Create a no-video (offline/signaling-only) room as the owner. Connects via signaling for chat, files, whiteboard, etc. — no WebRTC media.

      Parameters

      • roomName: string
      • userId: string

      Returns Promise<void>

    • Create a new folder at the given location.

      Parameters

      • location: string
      • OptionalroomName: string

      Returns Promise<void>

    • Delete a stored room by roomName.

      Parameters

      • roomName: string
      • userId: string

      Returns Promise<boolean>

    • Delete a user file by ID.

      Parameters

      • fileId: string

      Returns Promise<void>

    • Delete a folder at the given location.

      Parameters

      • location: string

      Returns Promise<void>

    • Disconnect from the active rooms SSE stream (stops any reconnect).

      Returns void

    • Disconnect from the user-files SSE stream (stops any reconnect).

      Returns void

    • Dismiss a coaching hint by ID.

      Parameters

      • hintId: string

      Returns void

    • Fetch active rooms (one-shot query for late joiners).

      Parameters

      • cloudClient: { getActiveRooms(userId?: string): Promise<ActiveRoom[]> }
      • OptionaluserId: string

      Returns Promise<ActiveRoom[]>

    • Fetch all stored rooms for a user.

      Parameters

      • userId: string
      • Optionaloptions: { consumerOnly?: boolean; enabledOnly?: boolean; offlineOnly?: boolean }

      Returns Promise<StoredRoom[]>

    • Fetch all files across all rooms for a user (room owners only).

      Honors the share-patch guard window two ways:

      1. For any file whose ACL was optimistically patched in the last USER_FILES_SHARE_PATCH_GUARD_MS AND that the server still returns, the server's sharedWith / sharing fields are dropped from the fetched record and the local optimistic ACL is kept.
      2. For any guarded file that the server does NOT return, the prior local entry is preserved (re-added after the merge). This covers the recipient flow: when a teacher shares with a student, the student's LessonRoomShell broadcast handler calls upsertUserFileLocal to add the file locally; the student's next fetchUserFiles might race the cloud read replica which hasn't propagated the share yet — without (2) the file would be DROPPED from the student's slice and they'd have to force-refresh to see it. (2) also covers the unshared-and-removed-locally case: removeUserFileLocal sets a guard too, but the file is gone from prev.files so there's no prior to re-add — the guard there just stops a lagged server view from briefly resurrecting the file.

      Without this, the cloud's read replica (which lags the primary write by enough to routinely return the pre-share view) would clobber a fresh share/unshare any time a refetch ran inside the guard window — e.g. the periodic 30s safety-net refetch in lesson rooms, an explicit onRefresh call, or a remount-driven re-fetch. Other fields on the file (rename, move, content updates) are still merged through normally.

      Parameters

      • userId: string
      • Optionalopts: { brandOrgId?: string; hasPublicFilesRole?: boolean }

      Returns Promise<UserFile[]>

    • Apply every buffered op in ARRIVAL ORDER in a single slice update, so a burst costs one re-render instead of one per event. Public so a teardown (or a test) can drain deterministically.

      Returns the slice unchanged when nothing actually differs — updateSlice bails on identity, so a stream of no-op patches costs zero renders.

      Returns void

    • Get the raw Client instance (for advanced usage).

      Returns Client | null

    • Which file-tree model this user's clients should build, plus whether the beta-filesystem toggle may be shown. Server-decided on both counts.

      Parameters

      • OptionaluserId: string

      Returns Promise<{ eligible: boolean; state: "pending" | "complete" }>

    • Get a single stored room by roomName.

      Parameters

      • roomName: string
      • userId: string

      Returns Promise<StoredRoom | null>

    • Get the streaming URLs for the current stream.

      Returns Promise<string | null>

    • Get a presigned URL for a file.

      Parameters

      • fileId: string

        File identifier.

      • Optionaloptions: { stream?: boolean }
        • Optionalstream?: boolean

          When true, returns an inline-streamable URL (no Content-Disposition: attachment header) suitable for <video>, <img>, <iframe>, etc. Default (false) returns a download URL.

      Returns Promise<string>

    • Join an existing no-video (offline/signaling-only) room as a participant. Connects via signaling for chat, files, whiteboard, etc. — no WebRTC media.

      Parameters

      • roomName: string
      • userId: string

      Returns Promise<void>

    • Join an existing room as a participant.

      Parameters

      • roomName: string
      • userId: string

      Returns Promise<void>

    • Load chat history from the server.

      Parameters

      • Optionalcursor: string | null

      Returns Promise<{ hasMore: boolean }>

    • Lower all raised hands in the room (host only).

      Returns Promise<void>

    • Move a user file to a new location/folder.

      Parameters

      • fileId: string
      • newLocation: string

      Returns Promise<void>

    • Mute/unmute a remote participant's audio output locally (owner only).

      Parameters

      • userId: string
      • muted: boolean

      Returns Promise<void>

    • Reject a user from the waiting room (owner only).

      Parameters

      • userId: string

      Returns Promise<void>

    • Remotely mute/unmute a participant's audio (owner only).

      Parameters

      • userId: string
      • muted: boolean

      Returns Promise<void>

    • Remotely mute/unmute a participant's video (owner only).

      Parameters

      • userId: string
      • muted: boolean

      Returns Promise<void>

    • Remove an advertised room from discovery (owner action).

      Parameters

      • cloudClient: { removeAdvertisedRoom(roomName: string): Promise<void> }
      • roomName: string

      Returns Promise<void>

    • Remove a file from the local userFiles slice without going to the server. Companion to upsertUserFileLocal for unshare-style broadcasts: when a peer learns a file is no longer shared with them, they can drop it from local state instantly.

      Parameters

      • fileId: string

      Returns void

    • Rename a user file.

      Parameters

      • fileId: string
      • newFilename: string

      Returns Promise<void>

    • Rename a folder by its stable id — id-model users only (the server answers 403 unless this user's folder migration is 'complete', and refuses system folders, reserved/invalid names and sibling collisions with client-safe messages). The server rewrites location on every row in the subtree, so the refresh afterwards is what makes the new tree appear.

      Parameters

      • folderId: string
      • name: string

      Returns Promise<{ location: string }>

    • Invalidate the cached lightweight client so the next API call generates a fresh room token for the new user. Call this on user change / logout to prevent stale-token data leaks.

      Returns void

    • Back to 0 dB (the direct path) for one participant.

      Parameters

      • userId: string

      Returns void

    • Back to 0 dB for every participant, and forget the remembered gains.

      Returns void

    • Send a data message (arbitrary JSON).

      Parameters

      • data: unknown

      Returns void

    • Send a text chat message.

      Parameters

      • content: string

      Returns void

    • Switch the active room name for file operations on an existing no-video connection. Avoids tearing down and re-establishing the signaling connection.

      Parameters

      • roomName: string

      Returns void

    • Switch to a different microphone.

      Parameters

      • deviceId: string

      Returns Promise<void>

    • Switch to a different speaker.

      Parameters

      • deviceId: string

      Returns Promise<void>

    • Choose how the microphone is captured — see AudioProfile. Takes effect at once on a live microphone; before a room is joined it applies to the first capture. Remembered when persistDeviceChanges is on.

      Parameters

      Returns Promise<void>

    • Set the dominant speaker for video grid layouts (owner only).

      Parameters

      • userId: string | null

      Returns void

    • Flip this user between the path-based and id-based tree models (beta-filesystem role required; the server refuses anyone else, and returns 'complete' only when its own re-read verified the migration — 'pending' with violations means nothing was flipped).

      Parameters

      • enable: boolean
      • OptionaluserId: string

      Returns Promise<
          {
              state: "pending"
              | "complete";
              stats: Record<string, number> | null;
              violations: string[];
          },
      >

    • Set the microphone gain (0-100).

      Parameters

      • value: number

      Returns void

    • Lift a quiet microphone by db decibels (0 = as captured, up to MICROPHONE_BOOST_MAX_DB), before the encoder and behind a limiter. Needs the enableMicrophoneBoost option. Takes effect at once; remembered with the devices when persistDeviceChanges is on.

      Parameters

      • db: number

      Returns void

    • Set how loud a REMOTE participant plays for THIS user, in dB relative to the stream as received (clamped to PARTICIPANT_GAIN_MIN_DB…MAX_DB; the minimum is silence). Local only: nothing is sent, and the recording is unaffected. 0 removes the entry so the tile returns to the direct path. Remembered per remote user id when persistDeviceChanges is on.

      Parameters

      • userId: string
      • db: number

      Returns void

      if db is not a finite number

    • Switch to a different camera.

      Parameters

      • deviceId: string

      Returns Promise<void>

    • Share a user file with other users.

      Patches the local cache in place rather than refetching the full user-files list. The previous "POST /upload/files/all on every share" pattern hit the cloud's per-IP file-ops rate limit (50/min) in cascade-share scenarios — e.g. an assignment with several embedded files, or a clip-composition fanning out to N clip media files. Each individual share triggered a list refetch, easily burning 20+ list-fetches per save.

      When the SSE stream is connected the server's file-updated event arrives shortly and reconciles the cache against server canon. When it isn't (degraded session, before initial connect), we fall back to the full refetch so the cache doesn't drift indefinitely.

      Parameters

      • fileId: string
      • userIds: string[]
      • OptionalsharedRoom: string
      • OptionalallowReshare: boolean

      Returns Promise<void>

    • Start real-time transcription. Returns true if API call succeeded.

      Returns Promise<boolean>

    • Stop the current recording.

      Returns Promise<void>

    • Subscribe to all state changes. Returns unsubscribe function.

      Parameters

      • listener: () => void

      Returns () => void

    • Subscribe to changes in a specific state slice. Returns unsubscribe function.

      Parameters

      Returns () => void

    • Switch the featured user in the stream.

      Parameters

      • userId: string

      Returns Promise<void>

    • Toggle local microphone mute/unmute.

      Returns Promise<void>

    • Toggle the local user's hand raised state.

      Returns Promise<void>

    • Toggle speaker/output mute.

      Returns Promise<void>

    • Toggle local camera on/off.

      Returns Promise<void>

    • Trigger post-recording transcription and analysis on a completed recording. Unlike real-time transcription, this processes an existing recording asynchronously. Poll transcription status to track progress.

      Parameters

      • recordingId: string

      Returns Promise<boolean>

    • Update an advertised room's metadata (owner action).

      Parameters

      • cloudClient: {
            updateAdvertisedRoom(
                roomName: string,
                updates: Partial<AdvertiseRoomOptions>,
            ): Promise<void>;
        }
      • roomName: string
      • updates: Partial<AdvertiseRoomOptions>

      Returns Promise<void>

    • Update coaching data from the coaching endpoint response.

      Parameters

      • data: {
            currentTopic?: string;
            hints?: CoachingHint[];
            talkRatio?: { listening: number; speaking: number };
            topicShifts?: TopicShift[];
        }

      Returns void

    • Update an existing stored room by roomName.

      Parameters

      Returns Promise<boolean>

    • Update application-specific metadata for a file without re-uploading content. Skips the full-list refetch (which would re-sort and lose selection) and patches the matching entry in the local userFiles cache in place, so subscribers see the new appData immediately. Callers can still call fetchUserFiles to force a full refresh when they need server canon.

      Parameters

      • fileId: string
      • appData: Record<string, unknown>

      Returns Promise<void>

    • Upload a file to the user's file storage.

      Parameters

      • file: File
      • location: string
      • OptionalresourceType: string
      • OptionaluserIdOverride: string

        Upload as this user when the file slice has not been primed. Callers with no listable library of their own — a room-link guest, whose file view is built from relay broadcasts and who therefore never calls fetchUserFiles — have no slice userId, and without this every upload failed the ensureFileOps guard.

      Returns Promise<{ fileId: string }>