hume 0.14.2-beta.4 → 0.14.2-beta.6
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/.claude/settings.local.json +4 -1
- package/Client.d.ts +1 -0
- package/api/resources/empathicVoice/client/Client.d.ts +1 -0
- package/api/resources/empathicVoice/resources/chat/client/Client.d.ts +1 -1
- package/api/resources/empathicVoice/resources/chat/client/Client.js +3 -28
- package/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +1 -0
- package/api/resources/empathicVoice/resources/chatGroups/client/Client.js +12 -20
- package/api/resources/empathicVoice/resources/chats/client/Client.d.ts +1 -0
- package/api/resources/empathicVoice/resources/chats/client/Client.js +9 -15
- package/api/resources/empathicVoice/resources/configs/client/Client.d.ts +1 -0
- package/api/resources/empathicVoice/resources/configs/client/Client.js +29 -52
- package/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +1 -0
- package/api/resources/empathicVoice/resources/prompts/client/Client.js +29 -52
- package/api/resources/empathicVoice/resources/tools/client/Client.d.ts +1 -0
- package/api/resources/empathicVoice/resources/tools/client/Client.js +27 -46
- package/api/resources/expressionMeasurement/client/Client.d.ts +1 -0
- package/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +1 -0
- package/api/resources/expressionMeasurement/resources/batch/client/Client.js +18 -30
- package/api/resources/expressionMeasurement/resources/stream/resources/stream/client/Client.d.ts +1 -0
- package/api/resources/expressionMeasurement/resources/stream/resources/stream/client/Socket.js +0 -4
- package/api/resources/tts/client/Client.d.ts +1 -0
- package/api/resources/tts/client/Client.js +16 -34
- package/api/resources/tts/index.d.ts +1 -1
- package/api/resources/tts/index.js +1 -1
- package/api/resources/tts/resources/index.d.ts +0 -1
- package/api/resources/tts/resources/index.js +0 -1
- package/api/resources/tts/resources/streamInput/client/Client.d.ts +4 -3
- package/api/resources/tts/resources/streamInput/client/Client.js +14 -15
- package/api/resources/tts/resources/streamInput/client/Socket.d.ts +1 -1
- package/api/resources/tts/resources/streamInput/client/Socket.js +0 -4
- package/api/resources/tts/resources/streamInput/index.d.ts +0 -1
- package/api/resources/tts/resources/streamInput/index.js +0 -1
- package/api/resources/tts/resources/streamInput/types/index.js +26 -14
- package/api/resources/tts/resources/voices/client/Client.d.ts +1 -0
- package/api/resources/tts/resources/voices/client/Client.js +10 -19
- package/api/resources/tts/types/index.d.ts +2 -2
- package/api/resources/tts/types/index.js +2 -2
- package/changes.md +843 -0
- package/comment_changes.txt +0 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +37 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +37 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/core/file.d.ts +11 -0
- package/diff.txt +18143 -0
- package/dist/Client.d.ts +1 -0
- package/dist/api/resources/empathicVoice/client/Client.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/chat/client/Client.d.ts +1 -1
- package/dist/api/resources/empathicVoice/resources/chat/client/Client.js +3 -28
- package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.js +12 -20
- package/dist/api/resources/empathicVoice/resources/chats/client/Client.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/chats/client/Client.js +9 -15
- package/dist/api/resources/empathicVoice/resources/configs/client/Client.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/configs/client/Client.js +29 -52
- package/dist/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/prompts/client/Client.js +29 -52
- package/dist/api/resources/empathicVoice/resources/tools/client/Client.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/tools/client/Client.js +27 -46
- package/dist/api/resources/expressionMeasurement/client/Client.d.ts +1 -0
- package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +1 -0
- package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.js +18 -30
- package/dist/api/resources/expressionMeasurement/resources/stream/resources/stream/client/Client.d.ts +1 -0
- package/dist/api/resources/expressionMeasurement/resources/stream/resources/stream/client/Socket.js +0 -4
- package/dist/api/resources/tts/client/Client.d.ts +1 -0
- package/dist/api/resources/tts/client/Client.js +16 -34
- package/dist/api/resources/tts/index.d.ts +1 -1
- package/dist/api/resources/tts/index.js +1 -1
- package/dist/api/resources/tts/resources/index.d.ts +0 -1
- package/dist/api/resources/tts/resources/index.js +0 -1
- package/dist/api/resources/tts/resources/streamInput/client/Client.d.ts +4 -3
- package/dist/api/resources/tts/resources/streamInput/client/Client.js +14 -15
- package/dist/api/resources/tts/resources/streamInput/client/Socket.d.ts +1 -1
- package/dist/api/resources/tts/resources/streamInput/client/Socket.js +0 -4
- package/dist/api/resources/tts/resources/streamInput/index.d.ts +0 -1
- package/dist/api/resources/tts/resources/streamInput/index.js +0 -1
- package/dist/api/resources/tts/resources/streamInput/types/index.js +26 -14
- package/dist/api/resources/tts/resources/voices/client/Client.d.ts +1 -0
- package/dist/api/resources/tts/resources/voices/client/Client.js +10 -19
- package/dist/api/resources/tts/types/index.d.ts +2 -2
- package/dist/api/resources/tts/types/index.js +2 -2
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +37 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +37 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/dist/core/file.d.ts +11 -0
- package/dist/main.js +40944 -0
- package/dist/serialization/resources/tts/resources/index.d.ts +0 -1
- package/dist/serialization/resources/tts/resources/index.js +0 -1
- package/dist/serialization/resources/tts/resources/streamInput/client/socket/StreamInputSocketResponse.d.ts +3 -3
- package/dist/serialization/resources/tts/resources/streamInput/client/socket/StreamInputSocketResponse.js +2 -2
- package/dist/serialization/resources/tts/resources/streamInput/index.d.ts +0 -1
- package/dist/serialization/resources/tts/resources/streamInput/index.js +0 -1
- package/dist/serialization/resources/tts/resources/streamInput/types/SubscribeEvent.d.ts +4 -1
- package/dist/serialization/resources/tts/resources/streamInput/types/SubscribeEvent.js +55 -33
- package/dist/serialization/resources/tts/resources/streamInput/types/index.js +26 -14
- package/dist/serialization/resources/tts/types/index.d.ts +2 -2
- package/dist/serialization/resources/tts/types/index.js +2 -2
- package/dist/wrapper/HumeClient.d.ts +1 -1
- package/dist/wrapper/HumeClient.js +27 -20
- package/hume-v0.14.2-beta.6.tgz +0 -0
- package/js_changes.txt +2610 -0
- package/main.js +40944 -0
- package/package.json +1 -1
- package/serialization/resources/tts/resources/index.d.ts +0 -1
- package/serialization/resources/tts/resources/index.js +0 -1
- package/serialization/resources/tts/resources/streamInput/client/socket/StreamInputSocketResponse.d.ts +3 -3
- package/serialization/resources/tts/resources/streamInput/client/socket/StreamInputSocketResponse.js +2 -2
- package/serialization/resources/tts/resources/streamInput/index.d.ts +0 -1
- package/serialization/resources/tts/resources/streamInput/index.js +0 -1
- package/serialization/resources/tts/resources/streamInput/types/SubscribeEvent.d.ts +4 -1
- package/serialization/resources/tts/resources/streamInput/types/SubscribeEvent.js +55 -33
- package/serialization/resources/tts/resources/streamInput/types/index.js +26 -14
- package/serialization/resources/tts/types/index.d.ts +2 -2
- package/serialization/resources/tts/types/index.js +2 -2
- package/tts-audio/tts-74f0e855-cd7e-46e7-9657-c9bdf4b60693.wav +0 -0
- package/tts-audio/tts-8d0d6c9c-f54d-4ffa-880a-556f3a77eb99.wav +0 -0
- package/tts-audio/tts-f2a1d9fa-8f28-4011-9c02-08364592d0a9.wav +0 -0
- package/wrapper/HumeClient.d.ts +1 -1
- package/wrapper/HumeClient.js +27 -20
- package/hume-v0.14.2-beta.2.tgz +0 -0
- package/hume-v0.14.2-beta.4.tgz +0 -0
- package/hume-v0.14.2-beta1.tgz +0 -0
|
@@ -99,19 +99,16 @@ class Tts {
|
|
|
99
99
|
}
|
|
100
100
|
__synthesizeJson(request, requestOptions) {
|
|
101
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
var _a, _b, _c;
|
|
102
|
+
var _a, _b, _c, _d;
|
|
103
103
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
104
|
-
const _response = yield core.fetcher({
|
|
105
|
-
url: core.url.join((
|
|
104
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
105
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.HumeEnvironment.Prod).base, "v0/tts"),
|
|
106
106
|
method: "POST",
|
|
107
107
|
headers: _headers,
|
|
108
108
|
contentType: "application/json",
|
|
109
109
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
110
110
|
requestType: "json",
|
|
111
|
-
body: serializers.tts.PostedTts.jsonOrThrow(request, {
|
|
112
|
-
unrecognizedObjectKeys: "strip",
|
|
113
|
-
omitUndefined: true,
|
|
114
|
-
}),
|
|
111
|
+
body: serializers.tts.PostedTts.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
115
112
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
116
113
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
117
114
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -122,7 +119,6 @@ class Tts {
|
|
|
122
119
|
unrecognizedObjectKeys: "passthrough",
|
|
123
120
|
allowUnrecognizedUnionMembers: true,
|
|
124
121
|
allowUnrecognizedEnumValues: true,
|
|
125
|
-
skipValidation: true,
|
|
126
122
|
breadcrumbsPrefix: ["response"],
|
|
127
123
|
}),
|
|
128
124
|
rawResponse: _response.rawResponse,
|
|
@@ -135,7 +131,6 @@ class Tts {
|
|
|
135
131
|
unrecognizedObjectKeys: "passthrough",
|
|
136
132
|
allowUnrecognizedUnionMembers: true,
|
|
137
133
|
allowUnrecognizedEnumValues: true,
|
|
138
|
-
skipValidation: true,
|
|
139
134
|
breadcrumbsPrefix: ["response"],
|
|
140
135
|
}), _response.rawResponse);
|
|
141
136
|
default:
|
|
@@ -174,19 +169,16 @@ class Tts {
|
|
|
174
169
|
}
|
|
175
170
|
__synthesizeFile(request, requestOptions) {
|
|
176
171
|
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
-
var _a, _b, _c;
|
|
172
|
+
var _a, _b, _c, _d;
|
|
178
173
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
179
|
-
const _response = yield core.fetcher({
|
|
180
|
-
url: core.url.join((
|
|
174
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
175
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.HumeEnvironment.Prod).base, "v0/tts/file"),
|
|
181
176
|
method: "POST",
|
|
182
177
|
headers: _headers,
|
|
183
178
|
contentType: "application/json",
|
|
184
179
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
185
180
|
requestType: "json",
|
|
186
|
-
body: serializers.tts.PostedTts.jsonOrThrow(request, {
|
|
187
|
-
unrecognizedObjectKeys: "strip",
|
|
188
|
-
omitUndefined: true,
|
|
189
|
-
}),
|
|
181
|
+
body: serializers.tts.PostedTts.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
190
182
|
responseType: "binary-response",
|
|
191
183
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
192
184
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -202,7 +194,6 @@ class Tts {
|
|
|
202
194
|
unrecognizedObjectKeys: "passthrough",
|
|
203
195
|
allowUnrecognizedUnionMembers: true,
|
|
204
196
|
allowUnrecognizedEnumValues: true,
|
|
205
|
-
skipValidation: true,
|
|
206
197
|
breadcrumbsPrefix: ["response"],
|
|
207
198
|
}), _response.rawResponse);
|
|
208
199
|
default:
|
|
@@ -239,19 +230,16 @@ class Tts {
|
|
|
239
230
|
}
|
|
240
231
|
__synthesizeFileStreaming(request, requestOptions) {
|
|
241
232
|
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
-
var _a, _b, _c;
|
|
233
|
+
var _a, _b, _c, _d;
|
|
243
234
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
244
|
-
const _response = yield core.fetcher({
|
|
245
|
-
url: core.url.join((
|
|
235
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
236
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.HumeEnvironment.Prod).base, "v0/tts/stream/file"),
|
|
246
237
|
method: "POST",
|
|
247
238
|
headers: _headers,
|
|
248
239
|
contentType: "application/json",
|
|
249
240
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
250
241
|
requestType: "json",
|
|
251
|
-
body: serializers.tts.PostedTts.jsonOrThrow(request, {
|
|
252
|
-
unrecognizedObjectKeys: "strip",
|
|
253
|
-
omitUndefined: true,
|
|
254
|
-
}),
|
|
242
|
+
body: serializers.tts.PostedTts.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
255
243
|
responseType: "binary-response",
|
|
256
244
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
257
245
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -267,7 +255,6 @@ class Tts {
|
|
|
267
255
|
unrecognizedObjectKeys: "passthrough",
|
|
268
256
|
allowUnrecognizedUnionMembers: true,
|
|
269
257
|
allowUnrecognizedEnumValues: true,
|
|
270
|
-
skipValidation: true,
|
|
271
258
|
breadcrumbsPrefix: ["response"],
|
|
272
259
|
}), _response.rawResponse);
|
|
273
260
|
default:
|
|
@@ -305,19 +292,16 @@ class Tts {
|
|
|
305
292
|
}
|
|
306
293
|
__synthesizeJsonStreaming(request, requestOptions) {
|
|
307
294
|
return __awaiter(this, void 0, void 0, function* () {
|
|
308
|
-
var _a, _b, _c;
|
|
295
|
+
var _a, _b, _c, _d;
|
|
309
296
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
310
|
-
const _response = yield core.fetcher({
|
|
311
|
-
url: core.url.join((
|
|
297
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
298
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.HumeEnvironment.Prod).base, "v0/tts/stream/json"),
|
|
312
299
|
method: "POST",
|
|
313
300
|
headers: _headers,
|
|
314
301
|
contentType: "application/json",
|
|
315
302
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
316
303
|
requestType: "json",
|
|
317
|
-
body: serializers.tts.PostedTts.jsonOrThrow(request, {
|
|
318
|
-
unrecognizedObjectKeys: "strip",
|
|
319
|
-
omitUndefined: true,
|
|
320
|
-
}),
|
|
304
|
+
body: serializers.tts.PostedTts.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
321
305
|
responseType: "sse",
|
|
322
306
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
323
307
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -332,7 +316,6 @@ class Tts {
|
|
|
332
316
|
unrecognizedObjectKeys: "passthrough",
|
|
333
317
|
allowUnrecognizedUnionMembers: true,
|
|
334
318
|
allowUnrecognizedEnumValues: true,
|
|
335
|
-
skipValidation: true,
|
|
336
319
|
breadcrumbsPrefix: ["response"],
|
|
337
320
|
});
|
|
338
321
|
}),
|
|
@@ -352,7 +335,6 @@ class Tts {
|
|
|
352
335
|
unrecognizedObjectKeys: "passthrough",
|
|
353
336
|
allowUnrecognizedUnionMembers: true,
|
|
354
337
|
allowUnrecognizedEnumValues: true,
|
|
355
|
-
skipValidation: true,
|
|
356
338
|
breadcrumbsPrefix: ["response"],
|
|
357
339
|
}), _response.rawResponse);
|
|
358
340
|
default:
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./resources/index.js"), exports);
|
|
18
17
|
__exportStar(require("./types/index.js"), exports);
|
|
19
18
|
__exportStar(require("./errors/index.js"), exports);
|
|
19
|
+
__exportStar(require("./resources/index.js"), exports);
|
|
20
20
|
__exportStar(require("./client/index.js"), exports);
|
|
@@ -38,6 +38,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.voices = exports.streamInput = void 0;
|
|
40
40
|
exports.streamInput = __importStar(require("./streamInput/index.js"));
|
|
41
|
-
__exportStar(require("./streamInput/types/index.js"), exports);
|
|
42
41
|
exports.voices = __importStar(require("./voices/index.js"));
|
|
43
42
|
__exportStar(require("./voices/client/requests/index.js"), exports);
|
|
@@ -13,16 +13,17 @@ export declare namespace StreamInput {
|
|
|
13
13
|
apiKey?: core.Supplier<string | undefined>;
|
|
14
14
|
/** Additional headers to include in requests. */
|
|
15
15
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
16
|
+
fetcher?: core.FetchFunction;
|
|
16
17
|
}
|
|
17
18
|
interface ConnectArgs {
|
|
18
19
|
accessToken?: string | undefined;
|
|
19
20
|
contextGenerationId?: string | undefined;
|
|
20
|
-
formatType
|
|
21
|
+
formatType?: Hume.tts.AudioFormatType | undefined;
|
|
21
22
|
includeTimestampTypes?: Hume.tts.TimestampType | undefined;
|
|
22
23
|
instantMode?: boolean | undefined;
|
|
23
24
|
noBinary?: boolean | undefined;
|
|
24
25
|
stripHeaders?: boolean | undefined;
|
|
25
|
-
version
|
|
26
|
+
version?: Hume.tts.OctaveVersion | undefined;
|
|
26
27
|
apiKey?: string | undefined;
|
|
27
28
|
/** Arbitrary headers to send with the websocket connect request. */
|
|
28
29
|
headers?: Record<string, string>;
|
|
@@ -35,7 +36,7 @@ export declare namespace StreamInput {
|
|
|
35
36
|
export declare class StreamInput {
|
|
36
37
|
protected readonly _options: StreamInput.Options;
|
|
37
38
|
constructor(_options?: StreamInput.Options);
|
|
38
|
-
connect(args
|
|
39
|
+
connect(args?: StreamInput.ConnectArgs): Promise<StreamInputSocket>;
|
|
39
40
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
40
41
|
"X-Hume-Api-Key": string | undefined;
|
|
41
42
|
}>;
|
|
@@ -55,8 +55,8 @@ class StreamInput {
|
|
|
55
55
|
constructor(_options = {}) {
|
|
56
56
|
this._options = _options;
|
|
57
57
|
}
|
|
58
|
-
connect(
|
|
59
|
-
return __awaiter(this,
|
|
58
|
+
connect() {
|
|
59
|
+
return __awaiter(this, arguments, void 0, function* (args = {}) {
|
|
60
60
|
var _a, _b;
|
|
61
61
|
const { accessToken, contextGenerationId, formatType, includeTimestampTypes, instantMode, noBinary, stripHeaders, version, apiKey, headers, debug, reconnectAttempts, } = args;
|
|
62
62
|
const _queryParams = {};
|
|
@@ -66,19 +66,17 @@ class StreamInput {
|
|
|
66
66
|
if (contextGenerationId != null) {
|
|
67
67
|
_queryParams["context_generation_id"] = contextGenerationId;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
if (formatType != null) {
|
|
70
|
+
_queryParams["format_type"] = serializers.tts.AudioFormatType.jsonOrThrow(formatType, {
|
|
71
|
+
unrecognizedObjectKeys: "strip",
|
|
72
|
+
});
|
|
73
|
+
}
|
|
73
74
|
if (includeTimestampTypes != null) {
|
|
74
75
|
if (Array.isArray(includeTimestampTypes)) {
|
|
75
|
-
_queryParams["include_timestamp_types"] = includeTimestampTypes.map((item) => serializers.tts.TimestampType.jsonOrThrow(item, {
|
|
76
|
-
unrecognizedObjectKeys: "strip",
|
|
77
|
-
omitUndefined: true,
|
|
78
|
-
}));
|
|
76
|
+
_queryParams["include_timestamp_types"] = includeTimestampTypes.map((item) => serializers.tts.TimestampType.jsonOrThrow(item, { unrecognizedObjectKeys: "strip" }));
|
|
79
77
|
}
|
|
80
78
|
else {
|
|
81
|
-
_queryParams["include_timestamp_types"] = serializers.tts.TimestampType.jsonOrThrow(includeTimestampTypes, { unrecognizedObjectKeys: "strip"
|
|
79
|
+
_queryParams["include_timestamp_types"] = serializers.tts.TimestampType.jsonOrThrow(includeTimestampTypes, { unrecognizedObjectKeys: "strip" });
|
|
82
80
|
}
|
|
83
81
|
}
|
|
84
82
|
if (instantMode != null) {
|
|
@@ -90,10 +88,11 @@ class StreamInput {
|
|
|
90
88
|
if (stripHeaders != null) {
|
|
91
89
|
_queryParams["strip_headers"] = stripHeaders.toString();
|
|
92
90
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
if (version != null) {
|
|
92
|
+
_queryParams["version"] = serializers.tts.OctaveVersion.jsonOrThrow(version, {
|
|
93
|
+
unrecognizedObjectKeys: "strip",
|
|
94
|
+
});
|
|
95
|
+
}
|
|
97
96
|
if (apiKey != null) {
|
|
98
97
|
_queryParams["api_key"] = apiKey;
|
|
99
98
|
}
|
|
@@ -7,7 +7,7 @@ export declare namespace StreamInputSocket {
|
|
|
7
7
|
interface Args {
|
|
8
8
|
socket: core.ReconnectingWebSocket;
|
|
9
9
|
}
|
|
10
|
-
type Response = Hume.tts.
|
|
10
|
+
type Response = Hume.tts.TtsOutput;
|
|
11
11
|
type EventHandlers = {
|
|
12
12
|
open?: () => void;
|
|
13
13
|
message?: (message: Response) => void;
|
|
@@ -64,8 +64,6 @@ class StreamInputSocket {
|
|
|
64
64
|
unrecognizedObjectKeys: "passthrough",
|
|
65
65
|
allowUnrecognizedUnionMembers: true,
|
|
66
66
|
allowUnrecognizedEnumValues: true,
|
|
67
|
-
skipValidation: true,
|
|
68
|
-
omitUndefined: true,
|
|
69
67
|
});
|
|
70
68
|
if (parsedResponse.ok) {
|
|
71
69
|
(_b = (_a = this.eventHandlers).message) === null || _b === void 0 ? void 0 : _b.call(_a, parsedResponse.value);
|
|
@@ -112,8 +110,6 @@ class StreamInputSocket {
|
|
|
112
110
|
unrecognizedObjectKeys: "passthrough",
|
|
113
111
|
allowUnrecognizedUnionMembers: true,
|
|
114
112
|
allowUnrecognizedEnumValues: true,
|
|
115
|
-
skipValidation: true,
|
|
116
|
-
omitUndefined: true,
|
|
117
113
|
});
|
|
118
114
|
this.socket.send(JSON.stringify(jsonPayload));
|
|
119
115
|
}
|
|
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types/index.js"), exports);
|
|
18
17
|
__exportStar(require("./client/index.js"), exports);
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
2
|
+
var __createBinding =
|
|
3
|
+
(this && this.__createBinding) ||
|
|
4
|
+
(Object.create
|
|
5
|
+
? function (o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return m[k];
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}
|
|
18
|
+
: function (o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
});
|
|
22
|
+
var __exportStar =
|
|
23
|
+
(this && this.__exportStar) ||
|
|
24
|
+
function (m, exports) {
|
|
25
|
+
for (var p in m)
|
|
26
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
16
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
29
|
__exportStar(require("./SubscribeEvent.js"), exports);
|
|
@@ -12,6 +12,7 @@ export declare namespace Voices {
|
|
|
12
12
|
apiKey?: core.Supplier<string | undefined>;
|
|
13
13
|
/** Additional headers to include in requests. */
|
|
14
14
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
15
|
+
fetcher?: core.FetchFunction;
|
|
15
16
|
}
|
|
16
17
|
interface RequestOptions {
|
|
17
18
|
/** The maximum time to wait for a response in seconds. */
|
|
@@ -72,12 +72,11 @@ class Voices {
|
|
|
72
72
|
list(request, requestOptions) {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
74
|
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
var _a, _b, _c;
|
|
75
|
+
var _a, _b, _c, _d;
|
|
76
76
|
const { provider, pageNumber, pageSize, ascendingOrder } = request;
|
|
77
77
|
const _queryParams = {};
|
|
78
78
|
_queryParams["provider"] = serializers.tts.VoiceProvider.jsonOrThrow(provider, {
|
|
79
79
|
unrecognizedObjectKeys: "strip",
|
|
80
|
-
omitUndefined: true,
|
|
81
80
|
});
|
|
82
81
|
if (pageNumber != null) {
|
|
83
82
|
_queryParams["page_number"] = pageNumber.toString();
|
|
@@ -89,8 +88,8 @@ class Voices {
|
|
|
89
88
|
_queryParams["ascending_order"] = ascendingOrder.toString();
|
|
90
89
|
}
|
|
91
90
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
92
|
-
const _response = yield core.fetcher({
|
|
93
|
-
url: core.url.join((
|
|
91
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
92
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.HumeEnvironment.Prod)
|
|
94
93
|
.base, "v0/tts/voices"),
|
|
95
94
|
method: "GET",
|
|
96
95
|
headers: _headers,
|
|
@@ -105,7 +104,6 @@ class Voices {
|
|
|
105
104
|
unrecognizedObjectKeys: "passthrough",
|
|
106
105
|
allowUnrecognizedUnionMembers: true,
|
|
107
106
|
allowUnrecognizedEnumValues: true,
|
|
108
|
-
skipValidation: true,
|
|
109
107
|
breadcrumbsPrefix: ["response"],
|
|
110
108
|
}),
|
|
111
109
|
rawResponse: _response.rawResponse,
|
|
@@ -118,7 +116,6 @@ class Voices {
|
|
|
118
116
|
unrecognizedObjectKeys: "passthrough",
|
|
119
117
|
allowUnrecognizedUnionMembers: true,
|
|
120
118
|
allowUnrecognizedEnumValues: true,
|
|
121
|
-
skipValidation: true,
|
|
122
119
|
breadcrumbsPrefix: ["response"],
|
|
123
120
|
}), _response.rawResponse);
|
|
124
121
|
default:
|
|
@@ -180,19 +177,16 @@ class Voices {
|
|
|
180
177
|
}
|
|
181
178
|
__create(request, requestOptions) {
|
|
182
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
-
var _a, _b, _c;
|
|
180
|
+
var _a, _b, _c, _d;
|
|
184
181
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
185
|
-
const _response = yield core.fetcher({
|
|
186
|
-
url: core.url.join((
|
|
182
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
183
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.HumeEnvironment.Prod).base, "v0/tts/voices"),
|
|
187
184
|
method: "POST",
|
|
188
185
|
headers: _headers,
|
|
189
186
|
contentType: "application/json",
|
|
190
187
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
191
188
|
requestType: "json",
|
|
192
|
-
body: serializers.tts.PostedVoice.jsonOrThrow(request, {
|
|
193
|
-
unrecognizedObjectKeys: "strip",
|
|
194
|
-
omitUndefined: true,
|
|
195
|
-
}),
|
|
189
|
+
body: serializers.tts.PostedVoice.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
196
190
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
197
191
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
198
192
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -203,7 +197,6 @@ class Voices {
|
|
|
203
197
|
unrecognizedObjectKeys: "passthrough",
|
|
204
198
|
allowUnrecognizedUnionMembers: true,
|
|
205
199
|
allowUnrecognizedEnumValues: true,
|
|
206
|
-
skipValidation: true,
|
|
207
200
|
breadcrumbsPrefix: ["response"],
|
|
208
201
|
}),
|
|
209
202
|
rawResponse: _response.rawResponse,
|
|
@@ -216,7 +209,6 @@ class Voices {
|
|
|
216
209
|
unrecognizedObjectKeys: "passthrough",
|
|
217
210
|
allowUnrecognizedUnionMembers: true,
|
|
218
211
|
allowUnrecognizedEnumValues: true,
|
|
219
|
-
skipValidation: true,
|
|
220
212
|
breadcrumbsPrefix: ["response"],
|
|
221
213
|
}), _response.rawResponse);
|
|
222
214
|
default:
|
|
@@ -262,13 +254,13 @@ class Voices {
|
|
|
262
254
|
}
|
|
263
255
|
__delete(request, requestOptions) {
|
|
264
256
|
return __awaiter(this, void 0, void 0, function* () {
|
|
265
|
-
var _a, _b, _c;
|
|
257
|
+
var _a, _b, _c, _d;
|
|
266
258
|
const { name } = request;
|
|
267
259
|
const _queryParams = {};
|
|
268
260
|
_queryParams["name"] = name;
|
|
269
261
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
270
|
-
const _response = yield core.fetcher({
|
|
271
|
-
url: core.url.join((
|
|
262
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
263
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.HumeEnvironment.Prod).base, "v0/tts/voices"),
|
|
272
264
|
method: "DELETE",
|
|
273
265
|
headers: _headers,
|
|
274
266
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
@@ -286,7 +278,6 @@ class Voices {
|
|
|
286
278
|
unrecognizedObjectKeys: "passthrough",
|
|
287
279
|
allowUnrecognizedUnionMembers: true,
|
|
288
280
|
allowUnrecognizedEnumValues: true,
|
|
289
|
-
skipValidation: true,
|
|
290
281
|
breadcrumbsPrefix: ["response"],
|
|
291
282
|
}), _response.rawResponse);
|
|
292
283
|
default:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./TtsOutput.js";
|
|
2
1
|
export * from "./AudioFormatType.js";
|
|
3
2
|
export * from "./PublishTts.js";
|
|
4
3
|
export * from "./MillisecondInterval.js";
|
|
@@ -11,6 +10,8 @@ export * from "./PostedUtteranceVoiceWithName.js";
|
|
|
11
10
|
export * from "./VoiceProvider.js";
|
|
12
11
|
export * from "./PostedUtteranceVoice.js";
|
|
13
12
|
export * from "./OctaveVersion.js";
|
|
13
|
+
export * from "./TtsOutput.js";
|
|
14
|
+
export * from "./Snippet.js";
|
|
14
15
|
export * from "./PostedContextWithGenerationId.js";
|
|
15
16
|
export * from "./PostedContextWithUtterances.js";
|
|
16
17
|
export * from "./AudioEncoding.js";
|
|
@@ -23,7 +24,6 @@ export * from "./PostedTts.js";
|
|
|
23
24
|
export * from "./ReturnTts.js";
|
|
24
25
|
export * from "./ReturnVoice.js";
|
|
25
26
|
export * from "./FormatPcm.js";
|
|
26
|
-
export * from "./Snippet.js";
|
|
27
27
|
export * from "./PostedUtterance.js";
|
|
28
28
|
export * from "./ValidationErrorLocItem.js";
|
|
29
29
|
export * from "./ValidationError.js";
|
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./TtsOutput.js"), exports);
|
|
18
17
|
__exportStar(require("./AudioFormatType.js"), exports);
|
|
19
18
|
__exportStar(require("./PublishTts.js"), exports);
|
|
20
19
|
__exportStar(require("./MillisecondInterval.js"), exports);
|
|
@@ -27,6 +26,8 @@ __exportStar(require("./PostedUtteranceVoiceWithName.js"), exports);
|
|
|
27
26
|
__exportStar(require("./VoiceProvider.js"), exports);
|
|
28
27
|
__exportStar(require("./PostedUtteranceVoice.js"), exports);
|
|
29
28
|
__exportStar(require("./OctaveVersion.js"), exports);
|
|
29
|
+
__exportStar(require("./TtsOutput.js"), exports);
|
|
30
|
+
__exportStar(require("./Snippet.js"), exports);
|
|
30
31
|
__exportStar(require("./PostedContextWithGenerationId.js"), exports);
|
|
31
32
|
__exportStar(require("./PostedContextWithUtterances.js"), exports);
|
|
32
33
|
__exportStar(require("./AudioEncoding.js"), exports);
|
|
@@ -39,7 +40,6 @@ __exportStar(require("./PostedTts.js"), exports);
|
|
|
39
40
|
__exportStar(require("./ReturnTts.js"), exports);
|
|
40
41
|
__exportStar(require("./ReturnVoice.js"), exports);
|
|
41
42
|
__exportStar(require("./FormatPcm.js"), exports);
|
|
42
|
-
__exportStar(require("./Snippet.js"), exports);
|
|
43
43
|
__exportStar(require("./PostedUtterance.js"), exports);
|
|
44
44
|
__exportStar(require("./ValidationErrorLocItem.js"), exports);
|
|
45
45
|
__exportStar(require("./ValidationError.js"), exports);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Writable } from "readable-stream";
|
|
2
|
+
import { EventCallback, StreamWrapper } from "./chooseStreamWrapper";
|
|
3
|
+
export declare class Node18UniversalStreamWrapper<ReadFormat extends Uint8Array | Uint16Array | Uint32Array>
|
|
4
|
+
implements
|
|
5
|
+
StreamWrapper<Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>, ReadFormat>
|
|
6
|
+
{
|
|
7
|
+
private readableStream;
|
|
8
|
+
private reader;
|
|
9
|
+
private events;
|
|
10
|
+
private paused;
|
|
11
|
+
private resumeCallback;
|
|
12
|
+
private encoding;
|
|
13
|
+
constructor(readableStream: ReadableStream<ReadFormat>);
|
|
14
|
+
on(event: string, callback: EventCallback): void;
|
|
15
|
+
off(event: string, callback: EventCallback): void;
|
|
16
|
+
pipe(
|
|
17
|
+
dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>
|
|
18
|
+
): Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>;
|
|
19
|
+
pipeTo(
|
|
20
|
+
dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>
|
|
21
|
+
): Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>;
|
|
22
|
+
unpipe(dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>): void;
|
|
23
|
+
destroy(error?: Error): void;
|
|
24
|
+
pause(): void;
|
|
25
|
+
resume(): void;
|
|
26
|
+
get isPaused(): boolean;
|
|
27
|
+
read(): Promise<ReadFormat | undefined>;
|
|
28
|
+
setEncoding(encoding: string): void;
|
|
29
|
+
text(): Promise<string>;
|
|
30
|
+
json<T>(): Promise<T>;
|
|
31
|
+
private _write;
|
|
32
|
+
private _end;
|
|
33
|
+
private _error;
|
|
34
|
+
private _emit;
|
|
35
|
+
private _startReading;
|
|
36
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Readable, Writable } from "readable-stream";
|
|
2
|
+
import { EventCallback, StreamWrapper } from "./chooseStreamWrapper";
|
|
3
|
+
export declare class NodePre18StreamWrapper implements StreamWrapper<Writable, Buffer> {
|
|
4
|
+
private readableStream;
|
|
5
|
+
private encoding;
|
|
6
|
+
constructor(readableStream: Readable);
|
|
7
|
+
on(event: string, callback: EventCallback): void;
|
|
8
|
+
off(event: string, callback: EventCallback): void;
|
|
9
|
+
pipe(dest: Writable): Writable;
|
|
10
|
+
pipeTo(dest: Writable): Writable;
|
|
11
|
+
unpipe(dest?: Writable): void;
|
|
12
|
+
destroy(error?: Error): void;
|
|
13
|
+
pause(): void;
|
|
14
|
+
resume(): void;
|
|
15
|
+
get isPaused(): boolean;
|
|
16
|
+
read(): Promise<Buffer | undefined>;
|
|
17
|
+
setEncoding(encoding?: string): void;
|
|
18
|
+
text(): Promise<string>;
|
|
19
|
+
json<T>(): Promise<T>;
|
|
20
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<Buffer>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { StreamWrapper } from "./chooseStreamWrapper";
|
|
2
|
+
type EventCallback = (data?: any) => void;
|
|
3
|
+
export declare class UndiciStreamWrapper<ReadFormat extends Uint8Array | Uint16Array | Uint32Array>
|
|
4
|
+
implements StreamWrapper<UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>, ReadFormat>
|
|
5
|
+
{
|
|
6
|
+
private readableStream;
|
|
7
|
+
private reader;
|
|
8
|
+
private events;
|
|
9
|
+
private paused;
|
|
10
|
+
private resumeCallback;
|
|
11
|
+
private encoding;
|
|
12
|
+
constructor(readableStream: ReadableStream<ReadFormat>);
|
|
13
|
+
on(event: string, callback: EventCallback): void;
|
|
14
|
+
off(event: string, callback: EventCallback): void;
|
|
15
|
+
pipe(
|
|
16
|
+
dest: UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>
|
|
17
|
+
): UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>;
|
|
18
|
+
pipeTo(
|
|
19
|
+
dest: UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>
|
|
20
|
+
): UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>;
|
|
21
|
+
unpipe(dest: UndiciStreamWrapper<ReadFormat> | WritableStream): void;
|
|
22
|
+
destroy(error?: Error): void;
|
|
23
|
+
pause(): void;
|
|
24
|
+
resume(): void;
|
|
25
|
+
get isPaused(): boolean;
|
|
26
|
+
read(): Promise<ReadFormat | undefined>;
|
|
27
|
+
setEncoding(encoding: string): void;
|
|
28
|
+
text(): Promise<string>;
|
|
29
|
+
json<T>(): Promise<T>;
|
|
30
|
+
private _write;
|
|
31
|
+
private _end;
|
|
32
|
+
private _error;
|
|
33
|
+
private _emit;
|
|
34
|
+
private _startReading;
|
|
35
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type EventCallback = (data?: any) => void;
|
|
2
|
+
export interface StreamWrapper<WritableStream, ReadFormat> {
|
|
3
|
+
setEncoding(encoding?: string): void;
|
|
4
|
+
on(event: string, callback: EventCallback): void;
|
|
5
|
+
off(event: string, callback: EventCallback): void;
|
|
6
|
+
pipe(dest: WritableStream): WritableStream;
|
|
7
|
+
pipeTo(dest: WritableStream): WritableStream;
|
|
8
|
+
unpipe(dest?: WritableStream): void;
|
|
9
|
+
destroy(error?: Error): void;
|
|
10
|
+
pause(): void;
|
|
11
|
+
resume(): void;
|
|
12
|
+
get isPaused(): boolean;
|
|
13
|
+
read(): Promise<ReadFormat | undefined>;
|
|
14
|
+
text(): Promise<string>;
|
|
15
|
+
json<T>(): Promise<T>;
|
|
16
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
|
|
17
|
+
}
|
|
18
|
+
export declare function chooseStreamWrapper(responseBody: any): Promise<Promise<StreamWrapper<any, any>>>;
|