speechflow 1.3.2 → 1.4.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.
- package/CHANGELOG.md +17 -0
- package/etc/stx.conf +54 -58
- package/package.json +25 -106
- package/speechflow-cli/etc/stx.conf +77 -0
- package/speechflow-cli/package.json +116 -0
- package/speechflow-cli/src/speechflow-node-a2a-meter.ts +217 -0
- package/{src → speechflow-cli/src}/speechflow-node-a2a-vad.ts +14 -21
- package/{src → speechflow-cli/src}/speechflow-node-a2t-deepgram.ts +21 -38
- package/{src → speechflow-cli/src}/speechflow-node-t2a-elevenlabs.ts +10 -16
- package/speechflow-cli/src/speechflow-node-t2t-subtitle.ts +276 -0
- package/{src → speechflow-cli/src}/speechflow-node-x2x-filter.ts +5 -1
- package/{src → speechflow-cli/src}/speechflow-node-x2x-trace.ts +15 -7
- package/{src → speechflow-cli/src}/speechflow-node.ts +7 -0
- package/{src → speechflow-cli/src}/speechflow.ts +81 -25
- package/speechflow-ui-db/etc/eslint.mjs +106 -0
- package/speechflow-ui-db/etc/htmllint.json +55 -0
- package/speechflow-ui-db/etc/stx.conf +79 -0
- package/speechflow-ui-db/etc/stylelint.js +46 -0
- package/speechflow-ui-db/etc/stylelint.yaml +33 -0
- package/speechflow-ui-db/etc/tsc-client.json +30 -0
- package/speechflow-ui-db/etc/tsc.node.json +9 -0
- package/speechflow-ui-db/etc/vite-client.mts +63 -0
- package/speechflow-ui-db/package.d/htmllint-cli+0.0.7.patch +20 -0
- package/speechflow-ui-db/package.json +75 -0
- package/speechflow-ui-db/src/app-icon.ai +1989 -4
- package/speechflow-ui-db/src/app-icon.svg +26 -0
- package/speechflow-ui-db/src/app.styl +64 -0
- package/speechflow-ui-db/src/app.vue +221 -0
- package/speechflow-ui-db/src/index.html +23 -0
- package/speechflow-ui-db/src/index.ts +26 -0
- package/{dst/speechflow.d.ts → speechflow-ui-db/src/lib.d.ts} +5 -3
- package/speechflow-ui-db/src/tsconfig.json +3 -0
- package/speechflow-ui-st/etc/eslint.mjs +106 -0
- package/speechflow-ui-st/etc/htmllint.json +55 -0
- package/speechflow-ui-st/etc/stx.conf +79 -0
- package/speechflow-ui-st/etc/stylelint.js +46 -0
- package/speechflow-ui-st/etc/stylelint.yaml +33 -0
- package/speechflow-ui-st/etc/tsc-client.json +30 -0
- package/speechflow-ui-st/etc/tsc.node.json +9 -0
- package/speechflow-ui-st/etc/vite-client.mts +63 -0
- package/speechflow-ui-st/package.d/htmllint-cli+0.0.7.patch +20 -0
- package/speechflow-ui-st/package.json +79 -0
- package/speechflow-ui-st/src/app-icon.ai +1989 -4
- package/speechflow-ui-st/src/app-icon.svg +26 -0
- package/speechflow-ui-st/src/app.styl +64 -0
- package/speechflow-ui-st/src/app.vue +142 -0
- package/speechflow-ui-st/src/index.html +23 -0
- package/speechflow-ui-st/src/index.ts +26 -0
- package/speechflow-ui-st/src/lib.d.ts +9 -0
- package/speechflow-ui-st/src/tsconfig.json +3 -0
- package/dst/speechflow-node-a2a-ffmpeg.d.ts +0 -13
- package/dst/speechflow-node-a2a-ffmpeg.js +0 -153
- package/dst/speechflow-node-a2a-ffmpeg.js.map +0 -1
- package/dst/speechflow-node-a2a-gender.d.ts +0 -20
- package/dst/speechflow-node-a2a-gender.js +0 -349
- package/dst/speechflow-node-a2a-gender.js.map +0 -1
- package/dst/speechflow-node-a2a-meter.d.ts +0 -14
- package/dst/speechflow-node-a2a-meter.js +0 -196
- package/dst/speechflow-node-a2a-meter.js.map +0 -1
- package/dst/speechflow-node-a2a-mute.d.ts +0 -17
- package/dst/speechflow-node-a2a-mute.js +0 -117
- package/dst/speechflow-node-a2a-mute.js.map +0 -1
- package/dst/speechflow-node-a2a-vad.d.ts +0 -19
- package/dst/speechflow-node-a2a-vad.js +0 -383
- package/dst/speechflow-node-a2a-vad.js.map +0 -1
- package/dst/speechflow-node-a2a-wav.d.ts +0 -11
- package/dst/speechflow-node-a2a-wav.js +0 -211
- package/dst/speechflow-node-a2a-wav.js.map +0 -1
- package/dst/speechflow-node-a2t-deepgram.d.ts +0 -19
- package/dst/speechflow-node-a2t-deepgram.js +0 -345
- package/dst/speechflow-node-a2t-deepgram.js.map +0 -1
- package/dst/speechflow-node-t2a-elevenlabs.d.ts +0 -18
- package/dst/speechflow-node-t2a-elevenlabs.js +0 -244
- package/dst/speechflow-node-t2a-elevenlabs.js.map +0 -1
- package/dst/speechflow-node-t2a-kokoro.d.ts +0 -14
- package/dst/speechflow-node-t2a-kokoro.js +0 -155
- package/dst/speechflow-node-t2a-kokoro.js.map +0 -1
- package/dst/speechflow-node-t2t-deepl.d.ts +0 -15
- package/dst/speechflow-node-t2t-deepl.js +0 -146
- package/dst/speechflow-node-t2t-deepl.js.map +0 -1
- package/dst/speechflow-node-t2t-format.d.ts +0 -11
- package/dst/speechflow-node-t2t-format.js +0 -82
- package/dst/speechflow-node-t2t-format.js.map +0 -1
- package/dst/speechflow-node-t2t-ollama.d.ts +0 -13
- package/dst/speechflow-node-t2t-ollama.js +0 -247
- package/dst/speechflow-node-t2t-ollama.js.map +0 -1
- package/dst/speechflow-node-t2t-openai.d.ts +0 -13
- package/dst/speechflow-node-t2t-openai.js +0 -227
- package/dst/speechflow-node-t2t-openai.js.map +0 -1
- package/dst/speechflow-node-t2t-sentence.d.ts +0 -17
- package/dst/speechflow-node-t2t-sentence.js +0 -250
- package/dst/speechflow-node-t2t-sentence.js.map +0 -1
- package/dst/speechflow-node-t2t-subtitle.d.ts +0 -12
- package/dst/speechflow-node-t2t-subtitle.js +0 -166
- package/dst/speechflow-node-t2t-subtitle.js.map +0 -1
- package/dst/speechflow-node-t2t-transformers.d.ts +0 -14
- package/dst/speechflow-node-t2t-transformers.js +0 -265
- package/dst/speechflow-node-t2t-transformers.js.map +0 -1
- package/dst/speechflow-node-x2x-filter.d.ts +0 -11
- package/dst/speechflow-node-x2x-filter.js +0 -117
- package/dst/speechflow-node-x2x-filter.js.map +0 -1
- package/dst/speechflow-node-x2x-trace.d.ts +0 -11
- package/dst/speechflow-node-x2x-trace.js +0 -104
- package/dst/speechflow-node-x2x-trace.js.map +0 -1
- package/dst/speechflow-node-xio-device.d.ts +0 -13
- package/dst/speechflow-node-xio-device.js +0 -230
- package/dst/speechflow-node-xio-device.js.map +0 -1
- package/dst/speechflow-node-xio-file.d.ts +0 -11
- package/dst/speechflow-node-xio-file.js +0 -216
- package/dst/speechflow-node-xio-file.js.map +0 -1
- package/dst/speechflow-node-xio-mqtt.d.ts +0 -13
- package/dst/speechflow-node-xio-mqtt.js +0 -188
- package/dst/speechflow-node-xio-mqtt.js.map +0 -1
- package/dst/speechflow-node-xio-websocket.d.ts +0 -13
- package/dst/speechflow-node-xio-websocket.js +0 -278
- package/dst/speechflow-node-xio-websocket.js.map +0 -1
- package/dst/speechflow-node.d.ts +0 -63
- package/dst/speechflow-node.js +0 -177
- package/dst/speechflow-node.js.map +0 -1
- package/dst/speechflow-utils.d.ts +0 -74
- package/dst/speechflow-utils.js +0 -519
- package/dst/speechflow-utils.js.map +0 -1
- package/dst/speechflow.js +0 -787
- package/dst/speechflow.js.map +0 -1
- package/src/speechflow-node-a2a-meter.ts +0 -177
- package/src/speechflow-node-t2t-subtitle.ts +0 -149
- /package/{etc → speechflow-cli/etc}/biome.jsonc +0 -0
- /package/{etc → speechflow-cli/etc}/eslint.mjs +0 -0
- /package/{etc → speechflow-cli/etc}/oxlint.jsonc +0 -0
- /package/{etc → speechflow-cli/etc}/speechflow.bat +0 -0
- /package/{etc → speechflow-cli/etc}/speechflow.sh +0 -0
- /package/{etc → speechflow-cli/etc}/speechflow.yaml +0 -0
- /package/{etc → speechflow-cli/etc}/tsconfig.json +0 -0
- /package/{package.d → speechflow-cli/package.d}/@ericedouard+vad-node-realtime+0.2.0.patch +0 -0
- /package/{src → speechflow-cli/src}/lib.d.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-logo.ai +0 -0
- /package/{src → speechflow-cli/src}/speechflow-logo.svg +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-a2a-ffmpeg.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-a2a-gender.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-a2a-mute.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-a2a-wav.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2a-kokoro.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-deepl.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-format.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-ollama.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-openai.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-sentence.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-t2t-transformers.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-xio-device.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-xio-file.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-xio-mqtt.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-node-xio-websocket.ts +0 -0
- /package/{src → speechflow-cli/src}/speechflow-utils.ts +0 -0
- /package/{tsconfig.json → speechflow-cli/tsconfig.json} +0 -0
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
** SpeechFlow - Speech Processing Flow Graph
|
|
4
|
-
** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
5
|
-
** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
6
|
-
*/
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
/* standard dependencies */
|
|
12
|
-
const node_stream_1 = __importDefault(require("node:stream"));
|
|
13
|
-
/* internal dependencies */
|
|
14
|
-
const speechflow_node_1 = __importDefault(require("./speechflow-node"));
|
|
15
|
-
/* write WAV header */
|
|
16
|
-
const writeWavHeader = (length, options) => {
|
|
17
|
-
const audioFormat = options?.audioFormat ?? 0x001; /* PCM */
|
|
18
|
-
const channels = options?.channels ?? 1; /* mono */
|
|
19
|
-
const sampleRate = options?.sampleRate ?? 44100; /* 44KHz */
|
|
20
|
-
const bitDepth = options?.bitDepth ?? 16; /* 16-Bit */
|
|
21
|
-
const headerLength = 44;
|
|
22
|
-
const dataLength = length || (4294967295 - 100);
|
|
23
|
-
const fileSize = dataLength + headerLength;
|
|
24
|
-
const header = Buffer.alloc(headerLength);
|
|
25
|
-
const RIFF = Buffer.alloc(4, "RIFF");
|
|
26
|
-
const WAVE = Buffer.alloc(4, "WAVE");
|
|
27
|
-
const fmt = Buffer.alloc(4, "fmt ");
|
|
28
|
-
const data = Buffer.alloc(4, "data");
|
|
29
|
-
const byteRate = (sampleRate * channels * bitDepth) / 8;
|
|
30
|
-
const blockAlign = (channels * bitDepth) / 8;
|
|
31
|
-
let offset = 0;
|
|
32
|
-
RIFF.copy(header, offset);
|
|
33
|
-
offset += RIFF.length;
|
|
34
|
-
header.writeUInt32LE(fileSize - 8, offset);
|
|
35
|
-
offset += 4;
|
|
36
|
-
WAVE.copy(header, offset);
|
|
37
|
-
offset += WAVE.length;
|
|
38
|
-
fmt.copy(header, offset);
|
|
39
|
-
offset += fmt.length;
|
|
40
|
-
header.writeUInt32LE(16, offset);
|
|
41
|
-
offset += 4;
|
|
42
|
-
header.writeUInt16LE(audioFormat, offset);
|
|
43
|
-
offset += 2;
|
|
44
|
-
header.writeUInt16LE(channels, offset);
|
|
45
|
-
offset += 2;
|
|
46
|
-
header.writeUInt32LE(sampleRate, offset);
|
|
47
|
-
offset += 4;
|
|
48
|
-
header.writeUInt32LE(byteRate, offset);
|
|
49
|
-
offset += 4;
|
|
50
|
-
header.writeUInt16LE(blockAlign, offset);
|
|
51
|
-
offset += 2;
|
|
52
|
-
header.writeUInt16LE(bitDepth, offset);
|
|
53
|
-
offset += 2;
|
|
54
|
-
data.copy(header, offset);
|
|
55
|
-
offset += data.length;
|
|
56
|
-
header.writeUInt32LE(dataLength, offset);
|
|
57
|
-
offset += 4;
|
|
58
|
-
return header;
|
|
59
|
-
};
|
|
60
|
-
/* read WAV header */
|
|
61
|
-
const readWavHeader = (buffer) => {
|
|
62
|
-
let offset = 0;
|
|
63
|
-
const riffHead = buffer.subarray(offset, offset + 4).toString();
|
|
64
|
-
offset += 4;
|
|
65
|
-
const fileSize = buffer.readUInt32LE(offset);
|
|
66
|
-
offset += 4;
|
|
67
|
-
const waveHead = buffer.subarray(offset, offset + 4).toString();
|
|
68
|
-
offset += 4;
|
|
69
|
-
const fmtHead = buffer.subarray(offset, offset + 4).toString();
|
|
70
|
-
offset += 4;
|
|
71
|
-
const formatLength = buffer.readUInt32LE(offset);
|
|
72
|
-
offset += 4;
|
|
73
|
-
const audioFormat = buffer.readUInt16LE(offset);
|
|
74
|
-
offset += 2;
|
|
75
|
-
const channels = buffer.readUInt16LE(offset);
|
|
76
|
-
offset += 2;
|
|
77
|
-
const sampleRate = buffer.readUInt32LE(offset);
|
|
78
|
-
offset += 4;
|
|
79
|
-
const byteRate = buffer.readUInt32LE(offset);
|
|
80
|
-
offset += 4;
|
|
81
|
-
const blockAlign = buffer.readUInt16LE(offset);
|
|
82
|
-
offset += 2;
|
|
83
|
-
const bitDepth = buffer.readUInt16LE(offset);
|
|
84
|
-
offset += 2;
|
|
85
|
-
const data = buffer.subarray(offset, offset + 4).toString();
|
|
86
|
-
offset += 4;
|
|
87
|
-
const dataLength = buffer.readUInt32LE(offset);
|
|
88
|
-
offset += 4;
|
|
89
|
-
return {
|
|
90
|
-
riffHead, fileSize, waveHead, fmtHead, formatLength, audioFormat,
|
|
91
|
-
channels, sampleRate, byteRate, blockAlign, bitDepth, data, dataLength
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
/* SpeechFlow node for WAV format conversion */
|
|
95
|
-
class SpeechFlowNodeWAV extends speechflow_node_1.default {
|
|
96
|
-
/* declare official node name */
|
|
97
|
-
static name = "wav";
|
|
98
|
-
/* construct node */
|
|
99
|
-
constructor(id, cfg, opts, args) {
|
|
100
|
-
super(id, cfg, opts, args);
|
|
101
|
-
/* declare node configuration parameters */
|
|
102
|
-
this.configure({
|
|
103
|
-
mode: { type: "string", pos: 1, val: "encode", match: /^(?:encode|decode)$/ }
|
|
104
|
-
});
|
|
105
|
-
/* declare node input/output format */
|
|
106
|
-
this.input = "audio";
|
|
107
|
-
this.output = "audio";
|
|
108
|
-
}
|
|
109
|
-
/* open node */
|
|
110
|
-
async open() {
|
|
111
|
-
/* establish a transform stream */
|
|
112
|
-
const self = this;
|
|
113
|
-
let firstChunk = true;
|
|
114
|
-
this.stream = new node_stream_1.default.Transform({
|
|
115
|
-
readableObjectMode: true,
|
|
116
|
-
writableObjectMode: true,
|
|
117
|
-
decodeStrings: false,
|
|
118
|
-
highWaterMark: 1,
|
|
119
|
-
transform(chunk, encoding, callback) {
|
|
120
|
-
if (!Buffer.isBuffer(chunk.payload)) {
|
|
121
|
-
callback(new Error("invalid chunk payload type"));
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
else if (firstChunk) {
|
|
125
|
-
if (self.params.mode === "encode") {
|
|
126
|
-
/* convert raw/PCM to WAV/PCM
|
|
127
|
-
(NOTICE: as this is a continuous stream, the
|
|
128
|
-
resulting WAV header is not 100% conforming
|
|
129
|
-
to the WAV standard, as it has to use a zero
|
|
130
|
-
duration information. This cannot be changed in
|
|
131
|
-
a stream-based processing.) */
|
|
132
|
-
const headerBuffer = writeWavHeader(0, {
|
|
133
|
-
audioFormat: 0x0001 /* PCM */,
|
|
134
|
-
channels: self.config.audioChannels,
|
|
135
|
-
sampleRate: self.config.audioSampleRate,
|
|
136
|
-
bitDepth: self.config.audioBitDepth
|
|
137
|
-
});
|
|
138
|
-
const headerChunk = chunk.clone();
|
|
139
|
-
headerChunk.payload = headerBuffer;
|
|
140
|
-
this.push(headerChunk);
|
|
141
|
-
this.push(chunk);
|
|
142
|
-
callback();
|
|
143
|
-
}
|
|
144
|
-
else if (self.params.mode === "decode") {
|
|
145
|
-
/* convert WAV/PCM to raw/PCM */
|
|
146
|
-
if (chunk.payload.length < 44) {
|
|
147
|
-
callback(new Error("WAV header too short, expected at least 44 bytes"));
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const header = readWavHeader(chunk.payload);
|
|
151
|
-
self.log("info", "WAV audio stream: " +
|
|
152
|
-
`audioFormat=${header.audioFormat === 0x0001 ? "PCM" :
|
|
153
|
-
"0x" + header.audioFormat.toString(16).padStart(4, "0")} ` +
|
|
154
|
-
`channels=${header.channels} ` +
|
|
155
|
-
`sampleRate=${header.sampleRate} ` +
|
|
156
|
-
`bitDepth=${header.bitDepth}`);
|
|
157
|
-
if (header.audioFormat !== 0x0001 /* PCM */) {
|
|
158
|
-
callback(new Error("WAV not based on PCM format"));
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
if (header.bitDepth !== self.config.audioBitDepth) {
|
|
162
|
-
callback(new Error(`WAV not based on ${self.config.audioBitDepth} bit samples`));
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
if (header.sampleRate !== self.config.audioSampleRate) {
|
|
166
|
-
callback(new Error(`WAV not based on ${self.config.audioSampleRate}Hz sample rate`));
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
if (header.channels !== self.config.audioChannels) {
|
|
170
|
-
callback(new Error(`WAV not based on ${self.config.audioChannels} channel(s)`));
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
chunk.payload = chunk.payload.subarray(44);
|
|
174
|
-
this.push(chunk);
|
|
175
|
-
callback();
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
callback(new Error(`invalid operation mode "${self.params.mode}"`));
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
/* pass-through original chunk */
|
|
184
|
-
this.push(chunk);
|
|
185
|
-
callback();
|
|
186
|
-
}
|
|
187
|
-
firstChunk = false;
|
|
188
|
-
},
|
|
189
|
-
final(callback) {
|
|
190
|
-
this.push(null);
|
|
191
|
-
callback();
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
/* close node */
|
|
196
|
-
async close() {
|
|
197
|
-
/* shutdown stream */
|
|
198
|
-
if (this.stream !== null) {
|
|
199
|
-
await new Promise((resolve) => {
|
|
200
|
-
if (this.stream instanceof node_stream_1.default.Duplex)
|
|
201
|
-
this.stream.end(() => { resolve(); });
|
|
202
|
-
else
|
|
203
|
-
resolve();
|
|
204
|
-
});
|
|
205
|
-
this.stream.destroy();
|
|
206
|
-
this.stream = null;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
exports.default = SpeechFlowNodeWAV;
|
|
211
|
-
//# sourceMappingURL=speechflow-node-a2a-wav.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"speechflow-node-a2a-wav.js","sourceRoot":"","sources":["../src/speechflow-node-a2a-wav.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;AAEF,6BAA6B;AAC7B,8DAA0C;AAE1C,6BAA6B;AAC7B,wEAAmE;AAEnE,wBAAwB;AACxB,MAAM,cAAc,GAAG,CACnB,MAAc,EACd,OAA6F,EAC/F,EAAE;IACA,MAAM,WAAW,GAAI,OAAO,EAAE,WAAW,IAAI,KAAK,CAAA,CAAC,SAAS;IAC5D,MAAM,QAAQ,GAAO,OAAO,EAAE,QAAQ,IAAO,CAAC,CAAA,CAAK,UAAU;IAC7D,MAAM,UAAU,GAAK,OAAO,EAAE,UAAU,IAAK,KAAK,CAAA,CAAC,WAAW;IAC9D,MAAM,QAAQ,GAAO,OAAO,EAAE,QAAQ,IAAO,EAAE,CAAA,CAAI,YA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ACtB,CAAC;YACD,KAAK,CAAE,QAAQ;gBACX,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;gBACf,QAAQ,EAAE,CAAA;YACd,CAAC;SACJ,CAAC,CAAA;IACN,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,KAAK;QACP,uBAAuB;QACvB,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;gBAChC,IAAI,IAAI,CAAC,MAAM,YAAY,qBAAM,CAAC,MAAM;oBACpC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,CAAA,CAAC,CAAC,CAAC,CAAA;;oBAEpC,OAAO,EAAE,CAAA;YACjB,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;YACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QACtB,CAAC;IACL,CAAC;;AAtHL,oCAuHC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import SpeechFlowNode from "./speechflow-node";
|
|
2
|
-
export default class SpeechFlowNodeDeepgram extends SpeechFlowNode {
|
|
3
|
-
static name: string;
|
|
4
|
-
private dg;
|
|
5
|
-
private destroyed;
|
|
6
|
-
private initTimeout;
|
|
7
|
-
private connectionTimeout;
|
|
8
|
-
private queue;
|
|
9
|
-
constructor(id: string, cfg: {
|
|
10
|
-
[id: string]: any;
|
|
11
|
-
}, opts: {
|
|
12
|
-
[id: string]: any;
|
|
13
|
-
}, args: any[]);
|
|
14
|
-
status(): Promise<{
|
|
15
|
-
balance: string;
|
|
16
|
-
}>;
|
|
17
|
-
open(): Promise<void>;
|
|
18
|
-
close(): Promise<void>;
|
|
19
|
-
}
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
** SpeechFlow - Speech Processing Flow Graph
|
|
4
|
-
** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
5
|
-
** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
|
|
6
|
-
*/
|
|
7
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
-
if (k2 === undefined) k2 = k;
|
|
9
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(o, k2, desc);
|
|
14
|
-
}) : (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
o[k2] = m[k];
|
|
17
|
-
}));
|
|
18
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
-
}) : function(o, v) {
|
|
21
|
-
o["default"] = v;
|
|
22
|
-
});
|
|
23
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
-
var ownKeys = function(o) {
|
|
25
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
-
var ar = [];
|
|
27
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
-
return ar;
|
|
29
|
-
};
|
|
30
|
-
return ownKeys(o);
|
|
31
|
-
};
|
|
32
|
-
return function (mod) {
|
|
33
|
-
if (mod && mod.__esModule) return mod;
|
|
34
|
-
var result = {};
|
|
35
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
-
__setModuleDefault(result, mod);
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
})();
|
|
40
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
-
};
|
|
43
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
/* standard dependencies */
|
|
45
|
-
const node_stream_1 = __importDefault(require("node:stream"));
|
|
46
|
-
/* external dependencies */
|
|
47
|
-
const Deepgram = __importStar(require("@deepgram/sdk"));
|
|
48
|
-
const luxon_1 = require("luxon");
|
|
49
|
-
/* internal dependencies */
|
|
50
|
-
const speechflow_node_1 = __importStar(require("./speechflow-node"));
|
|
51
|
-
const utils = __importStar(require("./speechflow-utils"));
|
|
52
|
-
/* SpeechFlow node for Deepgram speech-to-text conversion */
|
|
53
|
-
class SpeechFlowNodeDeepgram extends speechflow_node_1.default {
|
|
54
|
-
/* declare official node name */
|
|
55
|
-
static name = "deepgram";
|
|
56
|
-
/* internal state */
|
|
57
|
-
dg = null;
|
|
58
|
-
destroyed = false;
|
|
59
|
-
initTimeout = null;
|
|
60
|
-
connectionTimeout = null;
|
|
61
|
-
queue = null;
|
|
62
|
-
/* construct node */
|
|
63
|
-
constructor(id, cfg, opts, args) {
|
|
64
|
-
super(id, cfg, opts, args);
|
|
65
|
-
/* declare node configuration parameters */
|
|
66
|
-
this.configure({
|
|
67
|
-
key: { type: "string", val: process.env.SPEECHFLOW_DEEPGRAM_KEY },
|
|
68
|
-
keyAdm: { type: "string", val: process.env.SPEECHFLOW_DEEPGRAM_KEY_ADM },
|
|
69
|
-
model: { type: "string", val: "nova-3", pos: 0 },
|
|
70
|
-
version: { type: "string", val: "latest", pos: 1 },
|
|
71
|
-
language: { type: "string", val: "multi", pos: 2 }
|
|
72
|
-
});
|
|
73
|
-
/* declare node input/output format */
|
|
74
|
-
this.input = "audio";
|
|
75
|
-
this.output = "text";
|
|
76
|
-
}
|
|
77
|
-
/* one-time status of node */
|
|
78
|
-
async status() {
|
|
79
|
-
let balance = 0;
|
|
80
|
-
try {
|
|
81
|
-
const deepgram = Deepgram.createClient(this.params.keyAdm);
|
|
82
|
-
const response = await deepgram.manage.getProjects();
|
|
83
|
-
if (response !== null && response.error === null) {
|
|
84
|
-
for (const project of response.result.projects) {
|
|
85
|
-
const response = await deepgram.manage.getProjectBalances(project.project_id);
|
|
86
|
-
if (response !== null && response.error === null)
|
|
87
|
-
balance += response.result.balances[0]?.amount ?? 0;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
this.log("warning", `failed to fetch balance: ${error}`);
|
|
93
|
-
}
|
|
94
|
-
return { balance: balance.toFixed(2) };
|
|
95
|
-
}
|
|
96
|
-
/* open node */
|
|
97
|
-
async open() {
|
|
98
|
-
/* sanity check situation */
|
|
99
|
-
if (this.config.audioBitDepth !== 16 || !this.config.audioLittleEndian)
|
|
100
|
-
throw new Error("Deepgram node currently supports PCM-S16LE audio only");
|
|
101
|
-
/* clear destruction flag */
|
|
102
|
-
this.destroyed = false;
|
|
103
|
-
/* create queue for results */
|
|
104
|
-
this.queue = new utils.SingleQueue();
|
|
105
|
-
/* create a store for the meta information */
|
|
106
|
-
const metastore = new utils.TimeStore();
|
|
107
|
-
/* connect to Deepgram API */
|
|
108
|
-
const deepgram = Deepgram.createClient(this.params.key);
|
|
109
|
-
let language = "en";
|
|
110
|
-
if (this.params.model.match(/^nova-2/) && this.params.language !== "en")
|
|
111
|
-
language = this.params.language;
|
|
112
|
-
else if (this.params.model.match(/^nova-3/) && this.params.language !== "en")
|
|
113
|
-
language = "multi";
|
|
114
|
-
this.dg = deepgram.listen.live({
|
|
115
|
-
mip_opt_out: true,
|
|
116
|
-
model: this.params.model,
|
|
117
|
-
version: this.params.version,
|
|
118
|
-
language,
|
|
119
|
-
channels: this.config.audioChannels,
|
|
120
|
-
sample_rate: this.config.audioSampleRate,
|
|
121
|
-
encoding: "linear16",
|
|
122
|
-
multichannel: false,
|
|
123
|
-
endpointing: 10,
|
|
124
|
-
interim_results: false,
|
|
125
|
-
smart_format: true,
|
|
126
|
-
punctuate: true,
|
|
127
|
-
filler_words: true,
|
|
128
|
-
diarize: false,
|
|
129
|
-
numerals: true,
|
|
130
|
-
profanity_filter: false
|
|
131
|
-
});
|
|
132
|
-
/* hook onto Deepgram API events */
|
|
133
|
-
this.dg.on(Deepgram.LiveTranscriptionEvents.Transcript, async (data) => {
|
|
134
|
-
if (this.destroyed || this.queue === null)
|
|
135
|
-
return;
|
|
136
|
-
const text = (data.channel?.alternatives[0]?.transcript ?? "");
|
|
137
|
-
const words = (data.channel?.alternatives[0]?.words ?? []);
|
|
138
|
-
if (text === "")
|
|
139
|
-
this.log("info", `empty/dummy text received (start: ${data.start}s, duration: ${data.duration.toFixed(2)}s)`);
|
|
140
|
-
else {
|
|
141
|
-
this.log("info", `text received (start: ${data.start}s, duration: ${data.duration.toFixed(2)}s): "${text}"`);
|
|
142
|
-
const start = luxon_1.Duration.fromMillis(data.start * 1000).plus(this.timeZeroOffset);
|
|
143
|
-
const end = start.plus({ seconds: data.duration });
|
|
144
|
-
const metas = metastore.fetch(start, end);
|
|
145
|
-
const meta = metas.reduce((prev, curr) => {
|
|
146
|
-
curr.forEach((val, key) => { prev.set(key, val); });
|
|
147
|
-
return prev;
|
|
148
|
-
}, new Map());
|
|
149
|
-
metastore.prune(start);
|
|
150
|
-
meta.set("words", words.map((word) => {
|
|
151
|
-
const start = luxon_1.Duration.fromMillis(word.start * 1000).plus(this.timeZeroOffset);
|
|
152
|
-
const end = luxon_1.Duration.fromMillis(word.end * 1000).plus(this.timeZeroOffset);
|
|
153
|
-
return { word: word.punctuated_word ?? word.word, start, end };
|
|
154
|
-
}));
|
|
155
|
-
const chunk = new speechflow_node_1.SpeechFlowChunk(start, end, "final", "text", text, meta);
|
|
156
|
-
this.queue.write(chunk);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
this.dg.on(Deepgram.LiveTranscriptionEvents.Metadata, (data) => {
|
|
160
|
-
this.log("info", "metadata received");
|
|
161
|
-
});
|
|
162
|
-
this.dg.on(Deepgram.LiveTranscriptionEvents.Close, () => {
|
|
163
|
-
this.log("info", "connection close");
|
|
164
|
-
if (!this.destroyed && this.queue !== null)
|
|
165
|
-
this.queue.write(null);
|
|
166
|
-
});
|
|
167
|
-
this.dg.on(Deepgram.LiveTranscriptionEvents.Error, (error) => {
|
|
168
|
-
this.log("error", `error: ${error.message}`);
|
|
169
|
-
if (!this.destroyed && this.queue !== null)
|
|
170
|
-
this.queue.write(null);
|
|
171
|
-
this.emit("error");
|
|
172
|
-
});
|
|
173
|
-
/* wait for Deepgram API to be available */
|
|
174
|
-
await new Promise((resolve, reject) => {
|
|
175
|
-
this.connectionTimeout = setTimeout(() => {
|
|
176
|
-
if (this.connectionTimeout !== null) {
|
|
177
|
-
this.connectionTimeout = null;
|
|
178
|
-
reject(new Error("Deepgram: timeout waiting for connection open"));
|
|
179
|
-
}
|
|
180
|
-
}, 8000);
|
|
181
|
-
this.dg.once(Deepgram.LiveTranscriptionEvents.Open, () => {
|
|
182
|
-
this.log("info", "connection open");
|
|
183
|
-
if (this.connectionTimeout !== null) {
|
|
184
|
-
clearTimeout(this.connectionTimeout);
|
|
185
|
-
this.connectionTimeout = null;
|
|
186
|
-
}
|
|
187
|
-
resolve(true);
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
/* remember opening time to receive time zero offset */
|
|
191
|
-
this.timeOpen = luxon_1.DateTime.now();
|
|
192
|
-
/* workaround Deepgram initialization problems */
|
|
193
|
-
let initDone = false;
|
|
194
|
-
const initTimeoutStart = () => {
|
|
195
|
-
if (initDone || this.destroyed)
|
|
196
|
-
return;
|
|
197
|
-
this.initTimeout = setTimeout(async () => {
|
|
198
|
-
if (this.initTimeout === null || this.destroyed)
|
|
199
|
-
return;
|
|
200
|
-
this.initTimeout = null;
|
|
201
|
-
this.log("warning", "initialization timeout -- restarting service usage");
|
|
202
|
-
await this.close();
|
|
203
|
-
if (!this.destroyed)
|
|
204
|
-
await this.open();
|
|
205
|
-
}, 3 * 1000);
|
|
206
|
-
};
|
|
207
|
-
const initTimeoutStop = () => {
|
|
208
|
-
if (initDone)
|
|
209
|
-
return;
|
|
210
|
-
initDone = true;
|
|
211
|
-
if (this.initTimeout !== null) {
|
|
212
|
-
clearTimeout(this.initTimeout);
|
|
213
|
-
this.initTimeout = null;
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
/* provide Duplex stream and internally attach to Deepgram API */
|
|
217
|
-
const self = this;
|
|
218
|
-
this.stream = new node_stream_1.default.Duplex({
|
|
219
|
-
writableObjectMode: true,
|
|
220
|
-
readableObjectMode: true,
|
|
221
|
-
decodeStrings: false,
|
|
222
|
-
highWaterMark: 1,
|
|
223
|
-
write(chunk, encoding, callback) {
|
|
224
|
-
if (self.destroyed || self.dg === null) {
|
|
225
|
-
callback(new Error("stream already destroyed"));
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
if (chunk.type !== "audio")
|
|
229
|
-
callback(new Error("expected audio input chunk"));
|
|
230
|
-
else if (!Buffer.isBuffer(chunk.payload))
|
|
231
|
-
callback(new Error("expected Buffer input chunk"));
|
|
232
|
-
else {
|
|
233
|
-
if (chunk.payload.byteLength > 0) {
|
|
234
|
-
self.log("debug", `send data (${chunk.payload.byteLength} bytes)`);
|
|
235
|
-
initTimeoutStart();
|
|
236
|
-
if (chunk.meta.size > 0)
|
|
237
|
-
metastore.store(chunk.timestampStart, chunk.timestampEnd, chunk.meta);
|
|
238
|
-
try {
|
|
239
|
-
self.dg.send(chunk.payload.buffer); /* intentionally discard all time information */
|
|
240
|
-
}
|
|
241
|
-
catch (error) {
|
|
242
|
-
callback(error instanceof Error ? error : new Error("failed to send to Deepgram"));
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
callback();
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
read(size) {
|
|
250
|
-
if (self.destroyed || self.queue === null) {
|
|
251
|
-
this.push(null);
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
let readTimeout = setTimeout(() => {
|
|
255
|
-
if (readTimeout !== null) {
|
|
256
|
-
readTimeout = null;
|
|
257
|
-
if (!self.destroyed) {
|
|
258
|
-
self.log("warning", "read timeout - pushing null to prevent hanging");
|
|
259
|
-
this.push(null);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}, 30 * 1000);
|
|
263
|
-
self.queue.read().then((chunk) => {
|
|
264
|
-
if (readTimeout !== null) {
|
|
265
|
-
clearTimeout(readTimeout);
|
|
266
|
-
readTimeout = null;
|
|
267
|
-
}
|
|
268
|
-
if (self.destroyed) {
|
|
269
|
-
this.push(null);
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
if (chunk === null) {
|
|
273
|
-
self.log("info", "received EOF signal");
|
|
274
|
-
this.push(null);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
self.log("info", `received data (${chunk.payload.length} bytes)`);
|
|
278
|
-
initTimeoutStop();
|
|
279
|
-
this.push(chunk, self.config.textEncoding);
|
|
280
|
-
}
|
|
281
|
-
}).catch((error) => {
|
|
282
|
-
if (readTimeout !== null) {
|
|
283
|
-
clearTimeout(readTimeout);
|
|
284
|
-
readTimeout = null;
|
|
285
|
-
}
|
|
286
|
-
if (!self.destroyed) {
|
|
287
|
-
self.log("error", `queue read error: ${error.message}`);
|
|
288
|
-
this.push(null);
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
},
|
|
292
|
-
final(callback) {
|
|
293
|
-
if (self.destroyed || self.dg === null) {
|
|
294
|
-
callback();
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
try {
|
|
298
|
-
self.dg.requestClose();
|
|
299
|
-
}
|
|
300
|
-
catch (error) {
|
|
301
|
-
self.log("warning", `error closing Deepgram connection: ${error}`);
|
|
302
|
-
}
|
|
303
|
-
/* NOTICE: do not push null here -- let the Deepgram close event handle it */
|
|
304
|
-
callback();
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
/* close node */
|
|
309
|
-
async close() {
|
|
310
|
-
/* indicate destruction first to stop all async operations */
|
|
311
|
-
this.destroyed = true;
|
|
312
|
-
/* cleanup all timers */
|
|
313
|
-
if (this.initTimeout !== null) {
|
|
314
|
-
clearTimeout(this.initTimeout);
|
|
315
|
-
this.initTimeout = null;
|
|
316
|
-
}
|
|
317
|
-
if (this.connectionTimeout !== null) {
|
|
318
|
-
clearTimeout(this.connectionTimeout);
|
|
319
|
-
this.connectionTimeout = null;
|
|
320
|
-
}
|
|
321
|
-
/* close stream */
|
|
322
|
-
if (this.stream !== null) {
|
|
323
|
-
this.stream.destroy();
|
|
324
|
-
this.stream = null;
|
|
325
|
-
}
|
|
326
|
-
/* close Deepgram connection and remove listeners */
|
|
327
|
-
if (this.dg !== null) {
|
|
328
|
-
try {
|
|
329
|
-
this.dg.removeAllListeners();
|
|
330
|
-
this.dg.requestClose();
|
|
331
|
-
}
|
|
332
|
-
catch (error) {
|
|
333
|
-
this.log("warning", `error during Deepgram cleanup: ${error}`);
|
|
334
|
-
}
|
|
335
|
-
this.dg = null;
|
|
336
|
-
}
|
|
337
|
-
/* signal EOF to any pending read operations */
|
|
338
|
-
if (this.queue !== null) {
|
|
339
|
-
this.queue.write(null);
|
|
340
|
-
this.queue = null;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
exports.default = SpeechFlowNodeDeepgram;
|
|
345
|
-
//# sourceMappingURL=speechflow-node-a2t-deepgram.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"speechflow-node-a2t-deepgram.js","sourceRoot":"","sources":["../src/speechflow-node-a2t-deepgram.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,8DAAgC;AAEhC,6BAA6B;AAC7B,wDAAkD;AAClD,iCAA0C;AAE1C,6BAA6B;AAC7B,qEAAmE;AACnE,0D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AAK,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;YACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QACtB,CAAC;QAED,sDAAsD;QACtD,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC;gBACD,IAAI,CAAC,EAAE,CAAC,kBAAkB,EAAE,CAAA;gBAC5B,IAAI,CAAC,EAAE,CAAC,YAAY,EAAE,CAAA;YAC1B,CAAC;YACD,OAAO,KAAK,EAAE,CAAC;gBACX,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,kCAAkC,KAAK,EAAE,CAAC,CAAA;YAClE,CAAC;YACD,IAAI,CAAC,EAAE,GAAG,IAAI,CAAA;QAClB,CAAC;QAED,iDAAiD;QACjD,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACrB,CAAC;IACL,CAAC;;AAtTL,yCAuTC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import SpeechFlowNode from "./speechflow-node";
|
|
2
|
-
export default class SpeechFlowNodeElevenlabs extends SpeechFlowNode {
|
|
3
|
-
static name: string;
|
|
4
|
-
private elevenlabs;
|
|
5
|
-
private static speexInitialized;
|
|
6
|
-
private destroyed;
|
|
7
|
-
private resampler;
|
|
8
|
-
constructor(id: string, cfg: {
|
|
9
|
-
[id: string]: any;
|
|
10
|
-
}, opts: {
|
|
11
|
-
[id: string]: any;
|
|
12
|
-
}, args: any[]);
|
|
13
|
-
status(): Promise<{
|
|
14
|
-
usage: string;
|
|
15
|
-
}>;
|
|
16
|
-
open(): Promise<void>;
|
|
17
|
-
close(): Promise<void>;
|
|
18
|
-
}
|