hume 0.11.2 → 0.11.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.
Files changed (76) hide show
  1. package/api/resources/empathicVoice/resources/chat/client/Client.d.ts +1 -0
  2. package/api/resources/empathicVoice/resources/chat/client/Client.js +12 -4
  3. package/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +3 -1
  4. package/api/resources/empathicVoice/resources/chatGroups/client/Client.js +9 -16
  5. package/api/resources/empathicVoice/resources/chats/client/Client.d.ts +3 -1
  6. package/api/resources/empathicVoice/resources/chats/client/Client.js +7 -12
  7. package/api/resources/empathicVoice/resources/configs/client/Client.d.ts +3 -1
  8. package/api/resources/empathicVoice/resources/configs/client/Client.js +19 -28
  9. package/api/resources/empathicVoice/resources/customVoices/client/Client.d.ts +3 -1
  10. package/api/resources/empathicVoice/resources/customVoices/client/Client.js +13 -18
  11. package/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +3 -1
  12. package/api/resources/empathicVoice/resources/prompts/client/Client.js +19 -28
  13. package/api/resources/empathicVoice/resources/tools/client/Client.d.ts +3 -1
  14. package/api/resources/empathicVoice/resources/tools/client/Client.js +19 -28
  15. package/api/resources/expressionMeasurement/client/Client.d.ts +2 -0
  16. package/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +3 -1
  17. package/api/resources/expressionMeasurement/resources/batch/client/Client.js +13 -20
  18. package/api/resources/tts/client/Client.d.ts +3 -1
  19. package/api/resources/tts/client/Client.js +9 -8
  20. package/api/resources/tts/resources/voices/client/Client.d.ts +3 -1
  21. package/api/resources/tts/resources/voices/client/Client.js +7 -10
  22. package/core/fetcher/Fetcher.d.ts +2 -1
  23. package/core/fetcher/Fetcher.js +22 -9
  24. package/core/form-data-utils/FormDataWrapper.js +5 -4
  25. package/core/form-data-utils/toReadableStream.d.ts +1 -0
  26. package/core/form-data-utils/toReadableStream.js +50 -0
  27. package/core/headers.d.ts +3 -0
  28. package/core/headers.js +29 -0
  29. package/core/index.d.ts +4 -4
  30. package/core/index.js +5 -4
  31. package/core/runtime/runtime.js +0 -1
  32. package/dist/api/resources/empathicVoice/resources/chat/client/Client.d.ts +1 -0
  33. package/dist/api/resources/empathicVoice/resources/chat/client/Client.js +12 -4
  34. package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.d.ts +3 -1
  35. package/dist/api/resources/empathicVoice/resources/chatGroups/client/Client.js +9 -16
  36. package/dist/api/resources/empathicVoice/resources/chats/client/Client.d.ts +3 -1
  37. package/dist/api/resources/empathicVoice/resources/chats/client/Client.js +7 -12
  38. package/dist/api/resources/empathicVoice/resources/configs/client/Client.d.ts +3 -1
  39. package/dist/api/resources/empathicVoice/resources/configs/client/Client.js +19 -28
  40. package/dist/api/resources/empathicVoice/resources/customVoices/client/Client.d.ts +3 -1
  41. package/dist/api/resources/empathicVoice/resources/customVoices/client/Client.js +13 -18
  42. package/dist/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +3 -1
  43. package/dist/api/resources/empathicVoice/resources/prompts/client/Client.js +19 -28
  44. package/dist/api/resources/empathicVoice/resources/tools/client/Client.d.ts +3 -1
  45. package/dist/api/resources/empathicVoice/resources/tools/client/Client.js +19 -28
  46. package/dist/api/resources/expressionMeasurement/client/Client.d.ts +2 -0
  47. package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +3 -1
  48. package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.js +13 -20
  49. package/dist/api/resources/tts/client/Client.d.ts +3 -1
  50. package/dist/api/resources/tts/client/Client.js +9 -8
  51. package/dist/api/resources/tts/resources/voices/client/Client.d.ts +3 -1
  52. package/dist/api/resources/tts/resources/voices/client/Client.js +7 -10
  53. package/dist/core/fetcher/Fetcher.d.ts +2 -1
  54. package/dist/core/fetcher/Fetcher.js +22 -9
  55. package/dist/core/form-data-utils/FormDataWrapper.js +5 -4
  56. package/dist/core/form-data-utils/toReadableStream.d.ts +1 -0
  57. package/dist/core/form-data-utils/toReadableStream.js +50 -0
  58. package/dist/core/headers.d.ts +3 -0
  59. package/dist/core/headers.js +29 -0
  60. package/dist/core/index.d.ts +4 -4
  61. package/dist/core/index.js +5 -4
  62. package/dist/core/runtime/runtime.js +0 -1
  63. package/dist/version.d.ts +1 -1
  64. package/dist/version.js +1 -1
  65. package/package.json +7 -3
  66. package/scripts/rename-to-esm-files.js +10 -2
  67. package/version.d.ts +1 -1
  68. package/version.js +1 -1
  69. /package/core/{streaming-fetcher → stream}/Stream.d.ts +0 -0
  70. /package/core/{streaming-fetcher → stream}/Stream.js +0 -0
  71. /package/core/{streaming-fetcher → stream}/index.d.ts +0 -0
  72. /package/core/{streaming-fetcher → stream}/index.js +0 -0
  73. /package/dist/core/{streaming-fetcher → stream}/Stream.d.ts +0 -0
  74. /package/dist/core/{streaming-fetcher → stream}/Stream.js +0 -0
  75. /package/dist/core/{streaming-fetcher → stream}/index.d.ts +0 -0
  76. /package/dist/core/{streaming-fetcher → stream}/index.js +0 -0
@@ -52,6 +52,7 @@ exports.Tools = void 0;
52
52
  const environments = __importStar(require("../../../../../../environments"));
53
53
  const core = __importStar(require("../../../../../../core"));
54
54
  const Hume = __importStar(require("../../../../../index"));
55
+ const headers_js_1 = require("../../../../../../core/headers.js");
55
56
  const url_join_1 = __importDefault(require("url-join"));
56
57
  const serializers = __importStar(require("../../../../../../serialization/index"));
57
58
  const errors = __importStar(require("../../../../../../errors/index"));
@@ -78,7 +79,7 @@ class Tools {
78
79
  listTools() {
79
80
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
80
81
  const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
81
- var _a, _b, _c;
82
+ var _a, _b, _c, _d;
82
83
  const { pageNumber, pageSize, restrictToMostRecent, name } = request;
83
84
  const _queryParams = {};
84
85
  if (pageNumber != null) {
@@ -96,10 +97,8 @@ class Tools {
96
97
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
97
98
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/evi/tools"),
98
99
  method: "GET",
99
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
100
- contentType: "application/json",
100
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
101
101
  queryParameters: _queryParams,
102
- requestType: "json",
103
102
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
104
103
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
105
104
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -186,11 +185,11 @@ class Tools {
186
185
  }
187
186
  __createTool(request, requestOptions) {
188
187
  return __awaiter(this, void 0, void 0, function* () {
189
- var _a, _b, _c;
188
+ var _a, _b, _c, _d;
190
189
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
191
190
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/evi/tools"),
192
191
  method: "POST",
193
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
192
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
194
193
  contentType: "application/json",
195
194
  requestType: "json",
196
195
  body: serializers.empathicVoice.PostedUserDefinedTool.jsonOrThrow(request, {
@@ -262,7 +261,7 @@ class Tools {
262
261
  listToolVersions(id_1) {
263
262
  return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
264
263
  const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
265
- var _a, _b, _c;
264
+ var _a, _b, _c, _d;
266
265
  const { pageNumber, pageSize, restrictToMostRecent } = request;
267
266
  const _queryParams = {};
268
267
  if (pageNumber != null) {
@@ -277,10 +276,8 @@ class Tools {
277
276
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
278
277
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}`),
279
278
  method: "GET",
280
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
281
- contentType: "application/json",
279
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
282
280
  queryParameters: _queryParams,
283
- requestType: "json",
284
281
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
285
282
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
286
283
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -367,11 +364,11 @@ class Tools {
367
364
  }
368
365
  __createToolVersion(id, request, requestOptions) {
369
366
  return __awaiter(this, void 0, void 0, function* () {
370
- var _a, _b, _c;
367
+ var _a, _b, _c, _d;
371
368
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
372
369
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}`),
373
370
  method: "POST",
374
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
371
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
375
372
  contentType: "application/json",
376
373
  requestType: "json",
377
374
  body: serializers.empathicVoice.PostedUserDefinedToolVersion.jsonOrThrow(request, {
@@ -444,13 +441,11 @@ class Tools {
444
441
  }
445
442
  __deleteTool(id, requestOptions) {
446
443
  return __awaiter(this, void 0, void 0, function* () {
447
- var _a, _b, _c;
444
+ var _a, _b, _c, _d;
448
445
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
449
446
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}`),
450
447
  method: "DELETE",
451
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
452
- contentType: "application/json",
453
- requestType: "json",
448
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
454
449
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
455
450
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
456
451
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -513,11 +508,11 @@ class Tools {
513
508
  }
514
509
  __updateToolName(id, request, requestOptions) {
515
510
  return __awaiter(this, void 0, void 0, function* () {
516
- var _a, _b, _c;
511
+ var _a, _b, _c, _d;
517
512
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
518
513
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}`),
519
514
  method: "PATCH",
520
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
515
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
521
516
  contentType: "application/json",
522
517
  requestType: "json",
523
518
  body: serializers.empathicVoice.PostedUserDefinedToolName.jsonOrThrow(request, {
@@ -588,13 +583,11 @@ class Tools {
588
583
  }
589
584
  __getToolVersion(id, version, requestOptions) {
590
585
  return __awaiter(this, void 0, void 0, function* () {
591
- var _a, _b, _c;
586
+ var _a, _b, _c, _d;
592
587
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
593
588
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}/version/${encodeURIComponent(version)}`),
594
589
  method: "GET",
595
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
596
- contentType: "application/json",
597
- requestType: "json",
590
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
598
591
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
599
592
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
600
593
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -667,13 +660,11 @@ class Tools {
667
660
  }
668
661
  __deleteToolVersion(id, version, requestOptions) {
669
662
  return __awaiter(this, void 0, void 0, function* () {
670
- var _a, _b, _c;
663
+ var _a, _b, _c, _d;
671
664
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
672
665
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}/version/${encodeURIComponent(version)}`),
673
666
  method: "DELETE",
674
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
675
- contentType: "application/json",
676
- requestType: "json",
667
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
677
668
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
678
669
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
679
670
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -741,11 +732,11 @@ class Tools {
741
732
  }
742
733
  __updateToolDescription(id_1, version_1) {
743
734
  return __awaiter(this, arguments, void 0, function* (id, version, request = {}, requestOptions) {
744
- var _a, _b, _c;
735
+ var _a, _b, _c, _d;
745
736
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
746
737
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/evi/tools/${encodeURIComponent(id)}/version/${encodeURIComponent(version)}`),
747
738
  method: "PATCH",
748
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
739
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
749
740
  contentType: "application/json",
750
741
  requestType: "json",
751
742
  body: serializers.empathicVoice.PostedUserDefinedToolVersionDescription.jsonOrThrow(request, {
@@ -10,6 +10,8 @@ export declare namespace ExpressionMeasurement {
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
12
  apiKey?: core.Supplier<string | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
13
15
  fetcher?: core.FetchFunction;
14
16
  }
15
17
  }
@@ -13,6 +13,8 @@ export declare namespace Batch {
13
13
  /** Specify a custom URL to connect the client to. */
14
14
  baseUrl?: core.Supplier<string>;
15
15
  apiKey?: core.Supplier<string | undefined>;
16
+ /** Additional headers to include in requests. */
17
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
16
18
  fetcher?: core.FetchFunction;
17
19
  }
18
20
  interface RequestOptions {
@@ -23,7 +25,7 @@ export declare namespace Batch {
23
25
  /** A hook to abort the request. */
24
26
  abortSignal?: AbortSignal;
25
27
  /** Additional headers to include in the request. */
26
- headers?: Record<string, string>;
28
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
27
29
  }
28
30
  }
29
31
  export declare class Batch {
@@ -52,6 +52,7 @@ exports.Batch = void 0;
52
52
  const environments = __importStar(require("../../../../../../environments"));
53
53
  const core = __importStar(require("../../../../../../core"));
54
54
  const serializers = __importStar(require("../../../../../../serialization/index"));
55
+ const headers_js_1 = require("../../../../../../core/headers.js");
55
56
  const url_join_1 = __importDefault(require("url-join"));
56
57
  const errors = __importStar(require("../../../../../../errors/index"));
57
58
  const json_1 = require("../../../../../../core/json");
@@ -73,7 +74,7 @@ class Batch {
73
74
  }
74
75
  __listJobs() {
75
76
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
76
- var _a, _b, _c;
77
+ var _a, _b, _c, _d;
77
78
  const { limit, status, when, timestampMs, sortBy, direction } = request;
78
79
  const _queryParams = {};
79
80
  if (limit != null) {
@@ -112,10 +113,8 @@ class Batch {
112
113
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
113
114
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/batch/jobs"),
114
115
  method: "GET",
115
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
116
- contentType: "application/json",
116
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
117
117
  queryParameters: _queryParams,
118
- requestType: "json",
119
118
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
120
119
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
121
120
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -172,11 +171,11 @@ class Batch {
172
171
  }
173
172
  __startInferenceJob(request, requestOptions) {
174
173
  return __awaiter(this, void 0, void 0, function* () {
175
- var _a, _b, _c;
174
+ var _a, _b, _c, _d;
176
175
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
177
176
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/batch/jobs"),
178
177
  method: "POST",
179
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
178
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
180
179
  contentType: "application/json",
181
180
  requestType: "json",
182
181
  body: serializers.expressionMeasurement.batch.InferenceBaseRequest.jsonOrThrow(request, {
@@ -235,13 +234,11 @@ class Batch {
235
234
  }
236
235
  __getJobDetails(id, requestOptions) {
237
236
  return __awaiter(this, void 0, void 0, function* () {
238
- var _a, _b, _c;
237
+ var _a, _b, _c, _d;
239
238
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
240
239
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}`),
241
240
  method: "GET",
242
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
243
- contentType: "application/json",
244
- requestType: "json",
241
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
245
242
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
246
243
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
247
244
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -295,13 +292,11 @@ class Batch {
295
292
  }
296
293
  __getJobPredictions(id, requestOptions) {
297
294
  return __awaiter(this, void 0, void 0, function* () {
298
- var _a, _b, _c;
295
+ var _a, _b, _c, _d;
299
296
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
300
297
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}/predictions`),
301
298
  method: "GET",
302
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
303
- contentType: "application/json",
304
- requestType: "json",
299
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
305
300
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
306
301
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
307
302
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -349,13 +344,11 @@ class Batch {
349
344
  }
350
345
  __getJobArtifacts(id, requestOptions) {
351
346
  return __awaiter(this, void 0, void 0, function* () {
352
- var _a, _b, _c;
347
+ var _a, _b, _c, _d;
353
348
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
354
349
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}/artifacts`),
355
350
  method: "GET",
356
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
357
- contentType: "application/json",
358
- requestType: "json",
351
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
359
352
  responseType: "streaming",
360
353
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
361
354
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -403,7 +396,7 @@ class Batch {
403
396
  }
404
397
  __startInferenceJobFromLocalFile(file, request, requestOptions) {
405
398
  return __awaiter(this, void 0, void 0, function* () {
406
- var _a, _b, _c;
399
+ var _a, _b, _c, _d;
407
400
  const _request = yield core.newFormData();
408
401
  if (request.json != null) {
409
402
  _request.append("json", (0, json_1.toJson)(serializers.expressionMeasurement.batch.InferenceBaseRequest.jsonOrThrow(request.json, {
@@ -417,7 +410,7 @@ class Batch {
417
410
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
418
411
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/batch/jobs"),
419
412
  method: "POST",
420
- headers: Object.assign(Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
413
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign(Object.assign({}, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
421
414
  requestType: "file",
422
415
  duplex: _maybeEncodedRequest.duplex,
423
416
  body: _maybeEncodedRequest.body,
@@ -12,6 +12,8 @@ export declare namespace Tts {
12
12
  /** Specify a custom URL to connect the client to. */
13
13
  baseUrl?: core.Supplier<string>;
14
14
  apiKey?: core.Supplier<string | undefined>;
15
+ /** Additional headers to include in requests. */
16
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
17
  fetcher?: core.FetchFunction;
16
18
  }
17
19
  interface RequestOptions {
@@ -22,7 +24,7 @@ export declare namespace Tts {
22
24
  /** A hook to abort the request. */
23
25
  abortSignal?: AbortSignal;
24
26
  /** Additional headers to include in the request. */
25
- headers?: Record<string, string>;
27
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
26
28
  }
27
29
  }
28
30
  export declare class Tts {
@@ -52,6 +52,7 @@ exports.Tts = void 0;
52
52
  const environments = __importStar(require("../../../../environments"));
53
53
  const core = __importStar(require("../../../../core"));
54
54
  const Hume = __importStar(require("../../../index"));
55
+ const headers_js_1 = require("../../../../core/headers.js");
55
56
  const serializers = __importStar(require("../../../../serialization/index"));
56
57
  const url_join_1 = __importDefault(require("url-join"));
57
58
  const errors = __importStar(require("../../../../errors/index"));
@@ -99,7 +100,7 @@ class Tts {
99
100
  }
100
101
  __synthesizeJson(request, requestOptions) {
101
102
  return __awaiter(this, void 0, void 0, function* () {
102
- var _a, _b, _c;
103
+ var _a, _b, _c, _d;
103
104
  const { accessToken, body: _body } = request;
104
105
  const _queryParams = {};
105
106
  if (accessToken != null) {
@@ -108,7 +109,7 @@ class Tts {
108
109
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
109
110
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts"),
110
111
  method: "POST",
111
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
112
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
112
113
  contentType: "application/json",
113
114
  queryParameters: _queryParams,
114
115
  requestType: "json",
@@ -173,11 +174,11 @@ class Tts {
173
174
  }
174
175
  __synthesizeFile(request, requestOptions) {
175
176
  return __awaiter(this, void 0, void 0, function* () {
176
- var _a, _b, _c;
177
+ var _a, _b, _c, _d;
177
178
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
178
179
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts/file"),
179
180
  method: "POST",
180
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
181
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
181
182
  contentType: "application/json",
182
183
  requestType: "json",
183
184
  body: serializers.tts.PostedTts.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -232,11 +233,11 @@ class Tts {
232
233
  }
233
234
  __synthesizeFileStreaming(request, requestOptions) {
234
235
  return __awaiter(this, void 0, void 0, function* () {
235
- var _a, _b, _c;
236
+ var _a, _b, _c, _d;
236
237
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
237
238
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts/stream/file"),
238
239
  method: "POST",
239
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
240
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
240
241
  contentType: "application/json",
241
242
  requestType: "json",
242
243
  body: serializers.tts.PostedTts.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -292,11 +293,11 @@ class Tts {
292
293
  }
293
294
  __synthesizeJsonStreaming(request, requestOptions) {
294
295
  return __awaiter(this, void 0, void 0, function* () {
295
- var _a, _b, _c;
296
+ var _a, _b, _c, _d;
296
297
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
297
298
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts/stream/json"),
298
299
  method: "POST",
299
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
300
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
300
301
  contentType: "application/json",
301
302
  requestType: "json",
302
303
  body: serializers.tts.PostedTts.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -10,6 +10,8 @@ export declare namespace Voices {
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
12
  apiKey?: core.Supplier<string | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
13
15
  fetcher?: core.FetchFunction;
14
16
  }
15
17
  interface RequestOptions {
@@ -20,7 +22,7 @@ export declare namespace Voices {
20
22
  /** A hook to abort the request. */
21
23
  abortSignal?: AbortSignal;
22
24
  /** Additional headers to include in the request. */
23
- headers?: Record<string, string>;
25
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
24
26
  }
25
27
  }
26
28
  export declare class Voices {
@@ -53,6 +53,7 @@ const environments = __importStar(require("../../../../../../environments"));
53
53
  const core = __importStar(require("../../../../../../core"));
54
54
  const Hume = __importStar(require("../../../../../index"));
55
55
  const serializers = __importStar(require("../../../../../../serialization/index"));
56
+ const headers_js_1 = require("../../../../../../core/headers.js");
56
57
  const url_join_1 = __importDefault(require("url-join"));
57
58
  const errors = __importStar(require("../../../../../../errors/index"));
58
59
  class Voices {
@@ -75,7 +76,7 @@ class Voices {
75
76
  list(request, requestOptions) {
76
77
  return __awaiter(this, void 0, void 0, function* () {
77
78
  const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
78
- var _a, _b, _c;
79
+ var _a, _b, _c, _d;
79
80
  const { provider, pageNumber, pageSize, ascendingOrder } = request;
80
81
  const _queryParams = {};
81
82
  _queryParams["provider"] = serializers.tts.VoiceProvider.jsonOrThrow(provider, {
@@ -93,10 +94,8 @@ class Voices {
93
94
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
94
95
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts/voices"),
95
96
  method: "GET",
96
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
97
- contentType: "application/json",
97
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
98
98
  queryParameters: _queryParams,
99
- requestType: "json",
100
99
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
101
100
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
102
101
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -180,11 +179,11 @@ class Voices {
180
179
  }
181
180
  __create(request, requestOptions) {
182
181
  return __awaiter(this, void 0, void 0, function* () {
183
- var _a, _b, _c;
182
+ var _a, _b, _c, _d;
184
183
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
185
184
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts/voices"),
186
185
  method: "POST",
187
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
186
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
188
187
  contentType: "application/json",
189
188
  requestType: "json",
190
189
  body: serializers.tts.PostedVoice.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -255,17 +254,15 @@ class Voices {
255
254
  }
256
255
  __delete(request, requestOptions) {
257
256
  return __awaiter(this, void 0, void 0, function* () {
258
- var _a, _b, _c;
257
+ var _a, _b, _c, _d;
259
258
  const { name } = request;
260
259
  const _queryParams = {};
261
260
  _queryParams["name"] = name;
262
261
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
263
262
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.HumeEnvironment.Production, "v0/tts/voices"),
264
263
  method: "DELETE",
265
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.11.2", "User-Agent": "hume/0.11.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
266
- contentType: "application/json",
264
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
267
265
  queryParameters: _queryParams,
268
- requestType: "json",
269
266
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
270
267
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
271
268
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -1,11 +1,12 @@
1
1
  import { APIResponse } from "./APIResponse";
2
+ import { Supplier } from "./Supplier";
2
3
  export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
3
4
  export declare namespace Fetcher {
4
5
  interface Args {
5
6
  url: string;
6
7
  method: string;
7
8
  contentType?: string;
8
- headers?: Record<string, string | undefined>;
9
+ headers?: Record<string, string | Supplier<string | undefined> | undefined>;
9
10
  queryParameters?: Record<string, string | string[] | object | object[] | null>;
10
11
  body?: unknown;
11
12
  timeoutMs?: number;
@@ -13,25 +13,38 @@ exports.fetcher = void 0;
13
13
  exports.fetcherImpl = fetcherImpl;
14
14
  const json_1 = require("../json");
15
15
  const RawResponse_1 = require("./RawResponse");
16
+ const Supplier_1 = require("./Supplier");
16
17
  const createRequestUrl_1 = require("./createRequestUrl");
17
18
  const getFetchFn_1 = require("./getFetchFn");
18
19
  const getRequestBody_1 = require("./getRequestBody");
19
20
  const getResponseBody_1 = require("./getResponseBody");
20
21
  const makeRequest_1 = require("./makeRequest");
21
22
  const requestWithRetries_1 = require("./requestWithRetries");
22
- function fetcherImpl(args) {
23
+ function getHeaders(args) {
23
24
  return __awaiter(this, void 0, void 0, function* () {
24
- const headers = {};
25
+ const newHeaders = {};
25
26
  if (args.body !== undefined && args.contentType != null) {
26
- headers["Content-Type"] = args.contentType;
27
+ newHeaders["Content-Type"] = args.contentType;
28
+ }
29
+ if (args.headers == null) {
30
+ return newHeaders;
27
31
  }
28
- if (args.headers != null) {
29
- for (const [key, value] of Object.entries(args.headers)) {
30
- if (value != null) {
31
- headers[key] = value;
32
- }
32
+ for (const [key, value] of Object.entries(args.headers)) {
33
+ const result = yield Supplier_1.Supplier.get(value);
34
+ if (typeof result === "string") {
35
+ newHeaders[key] = result;
36
+ continue;
33
37
  }
38
+ if (result == null) {
39
+ continue;
40
+ }
41
+ newHeaders[key] = `${result}`;
34
42
  }
43
+ return newHeaders;
44
+ });
45
+ }
46
+ function fetcherImpl(args) {
47
+ return __awaiter(this, void 0, void 0, function* () {
35
48
  const url = (0, createRequestUrl_1.createRequestUrl)(args.url, args.queryParameters);
36
49
  const requestBody = yield (0, getRequestBody_1.getRequestBody)({
37
50
  body: args.body,
@@ -40,7 +53,7 @@ function fetcherImpl(args) {
40
53
  const fetchFn = yield (0, getFetchFn_1.getFetchFn)();
41
54
  try {
42
55
  const response = yield (0, requestWithRetries_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
43
- return (0, makeRequest_1.makeRequest)(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
56
+ return (0, makeRequest_1.makeRequest)(fetchFn, url, args.method, yield getHeaders(args), requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
44
57
  }), args.maxRetries);
45
58
  const responseBody = yield (0, getResponseBody_1.getResponseBody)(response, args.responseType);
46
59
  if (response.status >= 200 && response.status < 400) {
@@ -44,7 +44,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.WebFormData = exports.Node16FormData = exports.Node18FormData = void 0;
46
46
  exports.newFormData = newFormData;
47
- const runtime_1 = require("../runtime");
47
+ const index_js_1 = require("../runtime/index.js");
48
+ const toReadableStream_js_1 = require("./toReadableStream.js");
48
49
  function isNamedValue(value) {
49
50
  return typeof value === "object" && value != null && "name" in value;
50
51
  }
@@ -60,10 +61,10 @@ function getLastPathSegment(pathStr) {
60
61
  function newFormData() {
61
62
  return __awaiter(this, void 0, void 0, function* () {
62
63
  let formdata;
63
- if (runtime_1.RUNTIME.type === "node" && runtime_1.RUNTIME.parsedVersion != null && runtime_1.RUNTIME.parsedVersion >= 18) {
64
+ if (index_js_1.RUNTIME.type === "node" && index_js_1.RUNTIME.parsedVersion != null && index_js_1.RUNTIME.parsedVersion >= 18) {
64
65
  formdata = new Node18FormData();
65
66
  }
66
- else if (runtime_1.RUNTIME.type === "node") {
67
+ else if (index_js_1.RUNTIME.type === "node") {
67
68
  formdata = new Node16FormData();
68
69
  }
69
70
  else {
@@ -121,7 +122,7 @@ class Node18FormData {
121
122
  return __awaiter(this, void 0, void 0, function* () {
122
123
  const encoder = new (yield Promise.resolve().then(() => __importStar(require("form-data-encoder")))).FormDataEncoder(this.fd);
123
124
  return {
124
- body: (yield Promise.resolve().then(() => __importStar(require("readable-stream")))).Readable.from(encoder),
125
+ body: yield (0, toReadableStream_js_1.toReadableStream)(encoder),
125
126
  headers: encoder.headers,
126
127
  duplex: "half",
127
128
  };
@@ -0,0 +1 @@
1
+ export declare function toReadableStream(encoder: import("form-data-encoder").FormDataEncoder): Promise<import("readable-stream").Readable>;