@mulingai-npm/redis 2.12.2 → 2.12.4

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.
@@ -1,5 +1,5 @@
1
- export declare enum RedisDatabase {
2
- MULINGSTREAM_LISTENER = 0,
3
- MULINGSTREAM_CHUNK = 1,
4
- MULINGSTREAM_SPEAKER = 2
5
- }
1
+ export declare enum RedisDatabase {
2
+ MULINGSTREAM_LISTENER = 0,
3
+ MULINGSTREAM_CHUNK = 1,
4
+ MULINGSTREAM_SPEAKER = 2
5
+ }
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RedisDatabase = void 0;
4
- var RedisDatabase;
5
- (function (RedisDatabase) {
6
- RedisDatabase[RedisDatabase["MULINGSTREAM_LISTENER"] = 0] = "MULINGSTREAM_LISTENER";
7
- RedisDatabase[RedisDatabase["MULINGSTREAM_CHUNK"] = 1] = "MULINGSTREAM_CHUNK";
8
- RedisDatabase[RedisDatabase["MULINGSTREAM_SPEAKER"] = 2] = "MULINGSTREAM_SPEAKER";
9
- })(RedisDatabase = exports.RedisDatabase || (exports.RedisDatabase = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RedisDatabase = void 0;
4
+ var RedisDatabase;
5
+ (function (RedisDatabase) {
6
+ RedisDatabase[RedisDatabase["MULINGSTREAM_LISTENER"] = 0] = "MULINGSTREAM_LISTENER";
7
+ RedisDatabase[RedisDatabase["MULINGSTREAM_CHUNK"] = 1] = "MULINGSTREAM_CHUNK";
8
+ RedisDatabase[RedisDatabase["MULINGSTREAM_SPEAKER"] = 2] = "MULINGSTREAM_SPEAKER";
9
+ })(RedisDatabase = exports.RedisDatabase || (exports.RedisDatabase = {}));
@@ -1,129 +1,129 @@
1
- import { RedisClient } from '../redis-client';
2
- export type StepStatus = 'INIT' | 'DISCARDED' | 'READY' | 'USED';
3
- export type SttProvider = 'azure' | 'whisper' | 'google' | 'aws';
4
- export type MulingstreamChunkData = {
5
- roomId: string;
6
- chunkNumber: number;
7
- language: string;
8
- sttProviders: SttProvider[];
9
- targetLanguages: string[];
10
- shortCodeTargetLanguages: string[];
11
- finalTranscription: string;
12
- sttStatus: StepStatus;
13
- createdAt: number;
14
- audioChunk: {
15
- start: number;
16
- end: number;
17
- duration: number;
18
- isFirst: boolean;
19
- isLast: boolean;
20
- theme: string;
21
- processingStart: number;
22
- };
23
- stt: {
24
- [sttProvider: string]: {
25
- transcription: string;
26
- status: StepStatus;
27
- };
28
- };
29
- translation: {
30
- [language: string]: {
31
- translation: string;
32
- status: StepStatus;
33
- };
34
- };
35
- tts: {
36
- [language: string]: {
37
- ttsAudioPath: string;
38
- status: StepStatus;
39
- isEmitted: boolean;
40
- totalCheck: number;
41
- };
42
- };
43
- };
44
- export declare class MulingstreamChunkManager {
45
- private redisClient;
46
- constructor(redisClient: RedisClient);
47
- private getTimeout;
48
- /**
49
- * Initializes a room in Redis as an empty JSON array.
50
- * If the key [roomId] already exists, we do NOT overwrite it.
51
- * Returns true if room was created, false if room already existed.
52
- */
53
- initRoom(roomId: string): Promise<boolean>;
54
- /**
55
- * Returns all rooms. This is naive if you store many other keys in Redis,
56
- * because we search keys for pattern "[*]".
57
- * Adjust as needed if you have a separate naming prefix.
58
- */
59
- getRooms(): Promise<string[]>;
60
- /**
61
- * Returns the entire array of chunks for the given roomId,
62
- * or null if the room doesn't exist in Redis.
63
- */
64
- getMulingstreamChunksByRoom(roomId: string): Promise<MulingstreamChunkData[] | null>;
65
- getRoomById(roomId: string): Promise<MulingstreamChunkData[] | null>;
66
- addMulingstreamChunk(params: {
67
- roomId: string;
68
- chunkNumber: number;
69
- language: string;
70
- start: number;
71
- end: number;
72
- duration: number;
73
- isFirst: boolean;
74
- isLast: boolean;
75
- theme: string;
76
- sttProviders: SttProvider[];
77
- targetLanguages: string[];
78
- shortCodeTargetLanguages: string[];
79
- }): Promise<void>;
80
- /**
81
- * Given roomId and chunkNumber, return the single chunk from the array
82
- * or null if not found.
83
- */
84
- getMulingstreamChunkById(roomId: string, chunkNumber: number): Promise<MulingstreamChunkData | null>;
85
- /**
86
- * Update STT fields for a given chunk.
87
- * If transcription or sttStatus is null, skip that field.
88
- */
89
- updateStt(roomId: string, chunkNumber: number, sttProvider: SttProvider, options: {
90
- transcription?: string;
91
- sttStatus?: StepStatus;
92
- }): Promise<boolean>;
93
- updateSttObject(roomId: string, chunkNumber: number, newStt: Record<string, {
94
- transcription: string;
95
- status: StepStatus;
96
- }>): Promise<boolean>;
97
- discardStt(roomId: string, chunkNumber: number): Promise<boolean>;
98
- updateFinalTranscription(roomId: string, chunkNumber: number, options: {
99
- transcription?: string;
100
- sttStatus?: StepStatus;
101
- }): Promise<MulingstreamChunkData | null>;
102
- /**
103
- * Discards all post-STT steps for a given chunk:
104
- * sets all translation[].status & tts[].status to "DISCARDED".
105
- */
106
- discardPostStt(roomId: string, chunkNumber: number): Promise<boolean>;
107
- /**
108
- * Discards a specific language in both translation and tts for a chunk.
109
- */
110
- discardLanguage(roomId: string, chunkNumber: number, language: string): Promise<boolean>;
111
- discardLanguages(roomId: string, chunkNumber: number, options: {
112
- translation?: string[];
113
- tts?: string[];
114
- }): Promise<MulingstreamChunkData | null>;
115
- updateTranslation(roomId: string, chunkNumber: number, language: string, options: {
116
- translation?: string;
117
- status?: StepStatus;
118
- }): Promise<MulingstreamChunkData | null>;
119
- updateTranslationInBulk(roomId: string, chunkNumber: number, translations: Record<string, string>, status?: StepStatus): Promise<MulingstreamChunkData | null>;
120
- updateTts(roomId: string, chunkNumber: number, language: string, options: {
121
- ttsAudioPath?: string;
122
- status?: StepStatus;
123
- isEmitted?: boolean;
124
- totalCheck?: number;
125
- }): Promise<MulingstreamChunkData | null>;
126
- increaseTotalCheck(roomId: string, chunkNumber: number, language: string): Promise<MulingstreamChunkData | null>;
127
- areTranslationsProcessed(roomId: string, chunkNumber: number): Promise<boolean>;
128
- getAllReadyTts(roomId: string, language: string): Promise<MulingstreamChunkData[]>;
129
- }
1
+ import { RedisClient } from '../redis-client';
2
+ export type StepStatus = 'INIT' | 'DISCARDED' | 'READY' | 'USED';
3
+ export type SttProvider = 'azure' | 'whisper' | 'google' | 'aws';
4
+ export type MulingstreamChunkData = {
5
+ roomId: string;
6
+ chunkNumber: number;
7
+ language: string;
8
+ sttProviders: SttProvider[];
9
+ targetLanguages: string[];
10
+ shortCodeTargetLanguages: string[];
11
+ finalTranscription: string;
12
+ sttStatus: StepStatus;
13
+ createdAt: number;
14
+ audioChunk: {
15
+ start: number;
16
+ end: number;
17
+ duration: number;
18
+ isFirst: boolean;
19
+ isLast: boolean;
20
+ theme: string;
21
+ processingStart: number;
22
+ };
23
+ stt: {
24
+ [sttProvider: string]: {
25
+ transcription: string;
26
+ status: StepStatus;
27
+ };
28
+ };
29
+ translation: {
30
+ [language: string]: {
31
+ translation: string;
32
+ status: StepStatus;
33
+ };
34
+ };
35
+ tts: {
36
+ [language: string]: {
37
+ ttsAudioPath: string;
38
+ status: StepStatus;
39
+ isEmitted: boolean;
40
+ totalCheck: number;
41
+ };
42
+ };
43
+ };
44
+ export declare class MulingstreamChunkManager {
45
+ private redisClient;
46
+ constructor(redisClient: RedisClient);
47
+ private getTimeout;
48
+ /**
49
+ * Initializes a room in Redis as an empty JSON array.
50
+ * If the key [roomId] already exists, we do NOT overwrite it.
51
+ * Returns true if room was created, false if room already existed.
52
+ */
53
+ initRoom(roomId: string): Promise<boolean>;
54
+ /**
55
+ * Returns all rooms. This is naive if you store many other keys in Redis,
56
+ * because we search keys for pattern "[*]".
57
+ * Adjust as needed if you have a separate naming prefix.
58
+ */
59
+ getRooms(): Promise<string[]>;
60
+ /**
61
+ * Returns the entire array of chunks for the given roomId,
62
+ * or null if the room doesn't exist in Redis.
63
+ */
64
+ getMulingstreamChunksByRoom(roomId: string): Promise<MulingstreamChunkData[] | null>;
65
+ getRoomById(roomId: string): Promise<MulingstreamChunkData[] | null>;
66
+ addMulingstreamChunk(params: {
67
+ roomId: string;
68
+ chunkNumber: number;
69
+ language: string;
70
+ start: number;
71
+ end: number;
72
+ duration: number;
73
+ isFirst: boolean;
74
+ isLast: boolean;
75
+ theme: string;
76
+ sttProviders: SttProvider[];
77
+ targetLanguages: string[];
78
+ shortCodeTargetLanguages: string[];
79
+ }): Promise<void>;
80
+ /**
81
+ * Given roomId and chunkNumber, return the single chunk from the array
82
+ * or null if not found.
83
+ */
84
+ getMulingstreamChunkById(roomId: string, chunkNumber: number): Promise<MulingstreamChunkData | null>;
85
+ /**
86
+ * Update STT fields for a given chunk.
87
+ * If transcription or sttStatus is null, skip that field.
88
+ */
89
+ updateStt(roomId: string, chunkNumber: number, sttProvider: SttProvider, options: {
90
+ transcription?: string;
91
+ sttStatus?: StepStatus;
92
+ }): Promise<boolean>;
93
+ updateSttObject(roomId: string, chunkNumber: number, newStt: Record<string, {
94
+ transcription: string;
95
+ status: StepStatus;
96
+ }>): Promise<boolean>;
97
+ discardStt(roomId: string, chunkNumber: number): Promise<boolean>;
98
+ updateFinalTranscription(roomId: string, chunkNumber: number, options: {
99
+ transcription?: string;
100
+ sttStatus?: StepStatus;
101
+ }): Promise<MulingstreamChunkData | null>;
102
+ /**
103
+ * Discards all post-STT steps for a given chunk:
104
+ * sets all translation[].status & tts[].status to "DISCARDED".
105
+ */
106
+ discardPostStt(roomId: string, chunkNumber: number): Promise<boolean>;
107
+ /**
108
+ * Discards a specific language in both translation and tts for a chunk.
109
+ */
110
+ discardLanguage(roomId: string, chunkNumber: number, language: string): Promise<boolean>;
111
+ discardLanguages(roomId: string, chunkNumber: number, options: {
112
+ translation?: string[];
113
+ tts?: string[];
114
+ }): Promise<MulingstreamChunkData | null>;
115
+ updateTranslation(roomId: string, chunkNumber: number, language: string, options: {
116
+ translation?: string;
117
+ status?: StepStatus;
118
+ }): Promise<MulingstreamChunkData | null>;
119
+ updateTranslationInBulk(roomId: string, chunkNumber: number, translations: Record<string, string>, status?: StepStatus): Promise<MulingstreamChunkData | null>;
120
+ updateTts(roomId: string, chunkNumber: number, language: string, options: {
121
+ ttsAudioPath?: string;
122
+ status?: StepStatus;
123
+ isEmitted?: boolean;
124
+ totalCheck?: number;
125
+ }): Promise<MulingstreamChunkData | null>;
126
+ increaseTotalCheck(roomId: string, chunkNumber: number, language: string): Promise<MulingstreamChunkData | null>;
127
+ areTranslationsProcessed(roomId: string, chunkNumber: number): Promise<boolean>;
128
+ getAllReadyTts(roomId: string, language: string): Promise<MulingstreamChunkData[]>;
129
+ }