@cartesia/cartesia-js 1.3.0 → 2.0.0-alpha
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/Client.d.ts +40 -0
- package/Client.js +32 -0
- package/README.md +170 -197
- package/api/index.d.ts +1 -0
- package/api/index.js +17 -0
- package/api/resources/apiStatus/client/Client.d.ts +39 -0
- package/api/resources/apiStatus/client/Client.js +103 -0
- package/api/resources/apiStatus/client/index.d.ts +1 -0
- package/api/resources/apiStatus/client/index.js +2 -0
- package/api/resources/apiStatus/index.d.ts +2 -0
- package/api/resources/apiStatus/index.js +18 -0
- package/api/resources/apiStatus/types/ApiInfo.d.ts +7 -0
- package/api/resources/apiStatus/types/ApiInfo.js +5 -0
- package/api/resources/apiStatus/types/index.d.ts +1 -0
- package/api/resources/apiStatus/types/index.js +17 -0
- package/api/resources/embedding/index.d.ts +1 -0
- package/api/resources/embedding/index.js +17 -0
- package/api/resources/embedding/types/Embedding.d.ts +10 -0
- package/api/resources/embedding/types/Embedding.js +5 -0
- package/api/resources/embedding/types/index.d.ts +1 -0
- package/api/resources/embedding/types/index.js +17 -0
- package/api/resources/index.d.ts +12 -0
- package/api/resources/index.js +41 -0
- package/api/resources/tts/client/Client.d.ts +36 -0
- package/api/resources/tts/client/Client.js +152 -0
- package/api/resources/tts/client/index.d.ts +1 -0
- package/api/resources/tts/client/index.js +2 -0
- package/api/resources/tts/index.d.ts +2 -0
- package/api/resources/tts/index.js +18 -0
- package/api/resources/tts/types/CancelContextRequest.d.ts +10 -0
- package/api/resources/tts/types/CancelContextRequest.js +5 -0
- package/api/resources/tts/types/ContextId.d.ts +9 -0
- package/api/resources/tts/types/ContextId.js +5 -0
- package/api/resources/tts/types/Controls.d.ts +8 -0
- package/api/resources/tts/types/Controls.js +5 -0
- package/api/resources/tts/types/Emotion.d.ts +33 -0
- package/api/resources/tts/types/Emotion.js +28 -0
- package/api/resources/tts/types/GenerationRequest.d.ts +25 -0
- package/api/resources/tts/types/GenerationRequest.js +5 -0
- package/api/resources/tts/types/Mp3OutputFormat.d.ts +7 -0
- package/api/resources/tts/types/Mp3OutputFormat.js +5 -0
- package/api/resources/tts/types/NaturalSpecifier.d.ts +11 -0
- package/api/resources/tts/types/NaturalSpecifier.js +13 -0
- package/api/resources/tts/types/NumericalSpecifier.d.ts +4 -0
- package/api/resources/tts/types/NumericalSpecifier.js +5 -0
- package/api/resources/tts/types/OutputFormat.d.ts +16 -0
- package/api/resources/tts/types/OutputFormat.js +5 -0
- package/api/resources/tts/types/RawEncoding.d.ts +10 -0
- package/api/resources/tts/types/RawEncoding.js +12 -0
- package/api/resources/tts/types/RawOutputFormat.d.ts +8 -0
- package/api/resources/tts/types/RawOutputFormat.js +5 -0
- package/api/resources/tts/types/Speed.d.ts +10 -0
- package/api/resources/tts/types/Speed.js +5 -0
- package/api/resources/tts/types/SupportedLanguage.d.ts +26 -0
- package/api/resources/tts/types/SupportedLanguage.js +23 -0
- package/api/resources/tts/types/TtsRequest.d.ts +17 -0
- package/api/resources/tts/types/TtsRequest.js +5 -0
- package/api/resources/tts/types/TtsRequestEmbeddingSpecifier.d.ts +9 -0
- package/api/resources/tts/types/TtsRequestEmbeddingSpecifier.js +5 -0
- package/api/resources/tts/types/TtsRequestIdSpecifier.d.ts +9 -0
- package/api/resources/tts/types/TtsRequestIdSpecifier.js +5 -0
- package/api/resources/tts/types/TtsRequestVoiceSpecifier.d.ts +5 -0
- package/api/resources/tts/types/TtsRequestVoiceSpecifier.js +5 -0
- package/api/resources/tts/types/WavOutputFormat.d.ts +6 -0
- package/api/resources/tts/types/WavOutputFormat.js +5 -0
- package/api/resources/tts/types/WebSocketBaseResponse.d.ts +9 -0
- package/api/resources/tts/types/WebSocketBaseResponse.js +5 -0
- package/api/resources/tts/types/WebSocketChunkResponse.d.ts +8 -0
- package/api/resources/tts/types/WebSocketChunkResponse.js +5 -0
- package/api/resources/tts/types/WebSocketDoneResponse.d.ts +6 -0
- package/api/resources/tts/types/WebSocketDoneResponse.js +5 -0
- package/api/resources/tts/types/WebSocketErrorResponse.d.ts +7 -0
- package/api/resources/tts/types/WebSocketErrorResponse.js +5 -0
- package/api/resources/tts/types/WebSocketRawOutputFormat.d.ts +9 -0
- package/api/resources/tts/types/WebSocketRawOutputFormat.js +5 -0
- package/api/resources/tts/types/WebSocketRequest.d.ts +13 -0
- package/api/resources/tts/types/WebSocketRequest.js +5 -0
- package/api/resources/tts/types/WebSocketResponse.d.ts +19 -0
- package/api/resources/tts/types/WebSocketResponse.js +5 -0
- package/api/resources/tts/types/WebSocketStreamOptions.d.ts +6 -0
- package/api/resources/tts/types/WebSocketStreamOptions.js +5 -0
- package/api/resources/tts/types/WebSocketTimestampsResponse.d.ts +7 -0
- package/api/resources/tts/types/WebSocketTimestampsResponse.js +5 -0
- package/api/resources/tts/types/WebSocketTtsOutput.d.ts +9 -0
- package/api/resources/tts/types/WebSocketTtsOutput.js +5 -0
- package/api/resources/tts/types/WebSocketTtsRequest.d.ts +15 -0
- package/api/resources/tts/types/WebSocketTtsRequest.js +5 -0
- package/api/resources/tts/types/WordTimestamps.d.ts +8 -0
- package/api/resources/tts/types/WordTimestamps.js +5 -0
- package/api/resources/tts/types/index.d.ts +30 -0
- package/api/resources/tts/types/index.js +46 -0
- package/api/resources/voiceChanger/client/Client.d.ts +43 -0
- package/api/resources/voiceChanger/client/Client.js +181 -0
- package/api/resources/voiceChanger/client/index.d.ts +1 -0
- package/api/resources/voiceChanger/client/index.js +17 -0
- package/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.d.ts +44 -0
- package/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.js +5 -0
- package/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.d.ts +44 -0
- package/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.js +5 -0
- package/api/resources/voiceChanger/client/requests/index.d.ts +2 -0
- package/api/resources/voiceChanger/client/requests/index.js +2 -0
- package/api/resources/voiceChanger/index.d.ts +2 -0
- package/api/resources/voiceChanger/index.js +18 -0
- package/api/resources/voiceChanger/types/OutputFormatContainer.d.ts +9 -0
- package/api/resources/voiceChanger/types/OutputFormatContainer.js +11 -0
- package/api/resources/voiceChanger/types/StreamingResponse.d.ts +16 -0
- package/api/resources/voiceChanger/types/StreamingResponse.js +5 -0
- package/api/resources/voiceChanger/types/index.d.ts +2 -0
- package/api/resources/voiceChanger/types/index.js +18 -0
- package/api/resources/voices/client/Client.d.ts +141 -0
- package/api/resources/voices/client/Client.js +512 -0
- package/api/resources/voices/client/index.d.ts +1 -0
- package/api/resources/voices/client/index.js +17 -0
- package/api/resources/voices/client/requests/CloneVoiceRequest.d.ts +56 -0
- package/api/resources/voices/client/requests/CloneVoiceRequest.js +5 -0
- package/api/resources/voices/client/requests/index.d.ts +1 -0
- package/api/resources/voices/client/requests/index.js +2 -0
- package/api/resources/voices/index.d.ts +2 -0
- package/api/resources/voices/index.js +18 -0
- package/api/resources/voices/types/BaseVoiceId.d.ts +8 -0
- package/api/resources/voices/types/BaseVoiceId.js +5 -0
- package/api/resources/voices/types/CloneMode.d.ts +8 -0
- package/api/resources/voices/types/CloneMode.js +10 -0
- package/api/resources/voices/types/CreateVoiceRequest.d.ts +13 -0
- package/api/resources/voices/types/CreateVoiceRequest.js +5 -0
- package/api/resources/voices/types/EmbeddingResponse.d.ts +7 -0
- package/api/resources/voices/types/EmbeddingResponse.js +5 -0
- package/api/resources/voices/types/EmbeddingSpecifier.d.ts +8 -0
- package/api/resources/voices/types/EmbeddingSpecifier.js +5 -0
- package/api/resources/voices/types/Gender.d.ts +8 -0
- package/api/resources/voices/types/Gender.js +10 -0
- package/api/resources/voices/types/IdSpecifier.d.ts +8 -0
- package/api/resources/voices/types/IdSpecifier.js +5 -0
- package/api/resources/voices/types/LocalizeDialect.d.ts +16 -0
- package/api/resources/voices/types/LocalizeDialect.js +13 -0
- package/api/resources/voices/types/LocalizeTargetLanguage.d.ts +26 -0
- package/api/resources/voices/types/LocalizeTargetLanguage.js +23 -0
- package/api/resources/voices/types/LocalizeVoiceRequest.d.ts +10 -0
- package/api/resources/voices/types/LocalizeVoiceRequest.js +5 -0
- package/api/resources/voices/types/MixVoiceSpecifier.d.ts +5 -0
- package/api/resources/voices/types/MixVoiceSpecifier.js +5 -0
- package/api/resources/voices/types/MixVoicesRequest.d.ts +7 -0
- package/api/resources/voices/types/MixVoicesRequest.js +5 -0
- package/api/resources/voices/types/UpdateVoiceRequest.d.ts +9 -0
- package/api/resources/voices/types/UpdateVoiceRequest.js +5 -0
- package/api/resources/voices/types/Voice.d.ts +20 -0
- package/api/resources/voices/types/Voice.js +5 -0
- package/api/resources/voices/types/VoiceId.d.ts +7 -0
- package/api/resources/voices/types/VoiceId.js +5 -0
- package/api/resources/voices/types/VoiceMetadata.d.ts +18 -0
- package/api/resources/voices/types/VoiceMetadata.js +5 -0
- package/api/resources/voices/types/Weight.d.ts +7 -0
- package/api/resources/voices/types/Weight.js +5 -0
- package/api/resources/voices/types/index.d.ts +17 -0
- package/api/resources/voices/types/index.js +33 -0
- package/core/fetcher/APIResponse.d.ts +10 -0
- package/core/fetcher/APIResponse.js +2 -0
- package/core/fetcher/Fetcher.d.ts +39 -0
- package/core/fetcher/Fetcher.js +99 -0
- package/core/fetcher/Supplier.d.ts +4 -0
- package/core/fetcher/Supplier.js +22 -0
- package/core/fetcher/createRequestUrl.d.ts +1 -0
- package/core/fetcher/createRequestUrl.js +13 -0
- package/core/fetcher/getFetchFn.d.ts +4 -0
- package/core/fetcher/getFetchFn.js +59 -0
- package/core/fetcher/getHeader.d.ts +1 -0
- package/core/fetcher/getHeader.js +12 -0
- package/core/fetcher/getRequestBody.d.ts +7 -0
- package/core/fetcher/getRequestBody.js +23 -0
- package/core/fetcher/getResponseBody.d.ts +1 -0
- package/core/fetcher/getResponseBody.js +52 -0
- package/core/fetcher/index.d.ts +5 -0
- package/core/fetcher/index.js +9 -0
- package/core/fetcher/makeRequest.d.ts +1 -0
- package/core/fetcher/makeRequest.js +42 -0
- package/core/fetcher/requestWithRetries.d.ts +1 -0
- package/core/fetcher/requestWithRetries.js +41 -0
- package/core/fetcher/signals.d.ts +12 -0
- package/core/fetcher/signals.js +37 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +22 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +124 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +50 -0
- package/core/form-data-utils/FormDataWrapper.d.ts +60 -0
- package/core/form-data-utils/FormDataWrapper.js +174 -0
- package/core/form-data-utils/index.d.ts +1 -0
- package/core/form-data-utils/index.js +17 -0
- package/core/index.d.ts +5 -0
- package/core/index.js +34 -0
- package/core/runtime/index.d.ts +1 -0
- package/core/runtime/index.js +5 -0
- package/core/runtime/runtime.d.ts +9 -0
- package/core/runtime/runtime.js +93 -0
- package/core/schemas/Schema.d.ts +85 -0
- package/core/schemas/Schema.js +22 -0
- package/core/schemas/builders/bigint/bigint.d.ts +2 -0
- package/core/schemas/builders/bigint/bigint.js +50 -0
- package/core/schemas/builders/bigint/index.d.ts +1 -0
- package/core/schemas/builders/bigint/index.js +5 -0
- package/core/schemas/builders/date/date.d.ts +2 -0
- package/core/schemas/builders/date/date.js +63 -0
- package/core/schemas/builders/date/index.d.ts +1 -0
- package/core/schemas/builders/date/index.js +5 -0
- package/core/schemas/builders/enum/enum.d.ts +2 -0
- package/core/schemas/builders/enum/enum.js +39 -0
- package/core/schemas/builders/enum/index.d.ts +1 -0
- package/core/schemas/builders/enum/index.js +5 -0
- package/core/schemas/builders/index.d.ts +14 -0
- package/core/schemas/builders/index.js +30 -0
- package/core/schemas/builders/lazy/index.d.ts +3 -0
- package/core/schemas/builders/lazy/index.js +7 -0
- package/core/schemas/builders/lazy/lazy.d.ts +5 -0
- package/core/schemas/builders/lazy/lazy.js +25 -0
- package/core/schemas/builders/lazy/lazyObject.d.ts +3 -0
- package/core/schemas/builders/lazy/lazyObject.js +12 -0
- package/core/schemas/builders/list/index.d.ts +1 -0
- package/core/schemas/builders/list/index.js +5 -0
- package/core/schemas/builders/list/list.d.ts +2 -0
- package/core/schemas/builders/list/list.js +55 -0
- package/core/schemas/builders/literals/booleanLiteral.d.ts +2 -0
- package/core/schemas/builders/literals/booleanLiteral.js +29 -0
- package/core/schemas/builders/literals/index.d.ts +2 -0
- package/core/schemas/builders/literals/index.js +7 -0
- package/core/schemas/builders/literals/stringLiteral.d.ts +2 -0
- package/core/schemas/builders/literals/stringLiteral.js +29 -0
- package/core/schemas/builders/object/index.d.ts +6 -0
- package/core/schemas/builders/object/index.js +11 -0
- package/core/schemas/builders/object/object.d.ts +3 -0
- package/core/schemas/builders/object/object.js +233 -0
- package/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +6 -0
- package/core/schemas/builders/object/objectWithoutOptionalProperties.js +8 -0
- package/core/schemas/builders/object/property.d.ts +8 -0
- package/core/schemas/builders/object/property.js +16 -0
- package/core/schemas/builders/object/types.d.ts +26 -0
- package/core/schemas/builders/object/types.js +2 -0
- package/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +9 -0
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +54 -0
- package/core/schemas/builders/object-like/index.d.ts +2 -0
- package/core/schemas/builders/object-like/index.js +6 -0
- package/core/schemas/builders/object-like/types.d.ts +7 -0
- package/core/schemas/builders/object-like/types.js +2 -0
- package/core/schemas/builders/primitives/any.d.ts +1 -0
- package/core/schemas/builders/primitives/any.js +6 -0
- package/core/schemas/builders/primitives/boolean.d.ts +1 -0
- package/core/schemas/builders/primitives/boolean.js +25 -0
- package/core/schemas/builders/primitives/index.d.ts +5 -0
- package/core/schemas/builders/primitives/index.js +13 -0
- package/core/schemas/builders/primitives/number.d.ts +1 -0
- package/core/schemas/builders/primitives/number.js +25 -0
- package/core/schemas/builders/primitives/string.d.ts +1 -0
- package/core/schemas/builders/primitives/string.js +25 -0
- package/core/schemas/builders/primitives/unknown.d.ts +1 -0
- package/core/schemas/builders/primitives/unknown.js +6 -0
- package/core/schemas/builders/record/index.d.ts +2 -0
- package/core/schemas/builders/record/index.js +5 -0
- package/core/schemas/builders/record/record.d.ts +3 -0
- package/core/schemas/builders/record/record.js +95 -0
- package/core/schemas/builders/record/types.d.ts +4 -0
- package/core/schemas/builders/record/types.js +2 -0
- package/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
- package/core/schemas/builders/schema-utils/JsonError.js +12 -0
- package/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
- package/core/schemas/builders/schema-utils/ParseError.js +12 -0
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +17 -0
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +82 -0
- package/core/schemas/builders/schema-utils/index.d.ts +4 -0
- package/core/schemas/builders/schema-utils/index.js +11 -0
- package/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
- package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +10 -0
- package/core/schemas/builders/set/index.d.ts +1 -0
- package/core/schemas/builders/set/index.js +5 -0
- package/core/schemas/builders/set/set.d.ts +2 -0
- package/core/schemas/builders/set/set.js +44 -0
- package/core/schemas/builders/undiscriminated-union/index.d.ts +2 -0
- package/core/schemas/builders/undiscriminated-union/index.js +5 -0
- package/core/schemas/builders/undiscriminated-union/types.d.ts +4 -0
- package/core/schemas/builders/undiscriminated-union/types.js +2 -0
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +3 -0
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +40 -0
- package/core/schemas/builders/union/discriminant.d.ts +5 -0
- package/core/schemas/builders/union/discriminant.js +10 -0
- package/core/schemas/builders/union/index.d.ts +4 -0
- package/core/schemas/builders/union/index.js +7 -0
- package/core/schemas/builders/union/types.d.ts +13 -0
- package/core/schemas/builders/union/types.js +2 -0
- package/core/schemas/builders/union/union.d.ts +4 -0
- package/core/schemas/builders/union/union.js +130 -0
- package/core/schemas/index.d.ts +2 -0
- package/core/schemas/index.js +17 -0
- package/core/schemas/utils/MaybePromise.d.ts +1 -0
- package/core/schemas/utils/MaybePromise.js +2 -0
- package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +7 -0
- package/core/schemas/utils/addQuestionMarksToNullableProperties.js +2 -0
- package/core/schemas/utils/createIdentitySchemaCreator.d.ts +2 -0
- package/core/schemas/utils/createIdentitySchemaCreator.js +16 -0
- package/core/schemas/utils/entries.d.ts +1 -0
- package/core/schemas/utils/entries.js +7 -0
- package/core/schemas/utils/filterObject.d.ts +1 -0
- package/core/schemas/utils/filterObject.js +14 -0
- package/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +1 -0
- package/core/schemas/utils/getErrorMessageForIncorrectType.js +28 -0
- package/core/schemas/utils/isPlainObject.d.ts +1 -0
- package/core/schemas/utils/isPlainObject.js +18 -0
- package/core/schemas/utils/keys.d.ts +1 -0
- package/core/schemas/utils/keys.js +7 -0
- package/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
- package/core/schemas/utils/maybeSkipValidation.js +28 -0
- package/core/schemas/utils/partition.d.ts +1 -0
- package/core/schemas/utils/partition.js +16 -0
- package/core/streaming-fetcher/Stream.d.ts +48 -0
- package/core/streaming-fetcher/Stream.js +170 -0
- package/core/streaming-fetcher/index.d.ts +1 -0
- package/core/streaming-fetcher/index.js +5 -0
- package/core/websocket/events.d.ts +36 -0
- package/core/websocket/events.js +27 -0
- package/core/websocket/index.d.ts +1 -0
- package/core/websocket/index.js +17 -0
- package/core/websocket/ws.d.ts +136 -0
- package/core/websocket/ws.js +438 -0
- package/dist/Client.d.ts +40 -0
- package/dist/Client.js +32 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +17 -0
- package/dist/api/resources/apiStatus/client/Client.d.ts +39 -0
- package/dist/api/resources/apiStatus/client/Client.js +103 -0
- package/dist/api/resources/apiStatus/client/index.d.ts +1 -0
- package/dist/api/resources/apiStatus/client/index.js +2 -0
- package/dist/api/resources/apiStatus/index.d.ts +2 -0
- package/dist/api/resources/apiStatus/index.js +18 -0
- package/dist/api/resources/apiStatus/types/ApiInfo.d.ts +7 -0
- package/dist/api/resources/apiStatus/types/ApiInfo.js +5 -0
- package/dist/api/resources/apiStatus/types/index.d.ts +1 -0
- package/dist/api/resources/apiStatus/types/index.js +17 -0
- package/dist/api/resources/embedding/index.d.ts +1 -0
- package/dist/api/resources/embedding/index.js +17 -0
- package/dist/api/resources/embedding/types/Embedding.d.ts +10 -0
- package/dist/api/resources/embedding/types/Embedding.js +5 -0
- package/dist/api/resources/embedding/types/index.d.ts +1 -0
- package/dist/api/resources/embedding/types/index.js +17 -0
- package/dist/api/resources/index.d.ts +12 -0
- package/dist/api/resources/index.js +41 -0
- package/dist/api/resources/tts/client/Client.d.ts +36 -0
- package/dist/api/resources/tts/client/Client.js +152 -0
- package/dist/api/resources/tts/client/index.d.ts +1 -0
- package/dist/api/resources/tts/client/index.js +2 -0
- package/dist/api/resources/tts/index.d.ts +2 -0
- package/dist/api/resources/tts/index.js +18 -0
- package/dist/api/resources/tts/types/CancelContextRequest.d.ts +10 -0
- package/dist/api/resources/tts/types/CancelContextRequest.js +5 -0
- package/dist/api/resources/tts/types/ContextId.d.ts +9 -0
- package/dist/api/resources/tts/types/ContextId.js +5 -0
- package/dist/api/resources/tts/types/Controls.d.ts +8 -0
- package/dist/api/resources/tts/types/Controls.js +5 -0
- package/dist/api/resources/tts/types/Emotion.d.ts +33 -0
- package/dist/api/resources/tts/types/Emotion.js +28 -0
- package/dist/api/resources/tts/types/GenerationRequest.d.ts +25 -0
- package/dist/api/resources/tts/types/GenerationRequest.js +5 -0
- package/dist/api/resources/tts/types/Mp3OutputFormat.d.ts +7 -0
- package/dist/api/resources/tts/types/Mp3OutputFormat.js +5 -0
- package/dist/api/resources/tts/types/NaturalSpecifier.d.ts +11 -0
- package/dist/api/resources/tts/types/NaturalSpecifier.js +13 -0
- package/dist/api/resources/tts/types/NumericalSpecifier.d.ts +4 -0
- package/dist/api/resources/tts/types/NumericalSpecifier.js +5 -0
- package/dist/api/resources/tts/types/OutputFormat.d.ts +16 -0
- package/dist/api/resources/tts/types/OutputFormat.js +5 -0
- package/dist/api/resources/tts/types/RawEncoding.d.ts +10 -0
- package/dist/api/resources/tts/types/RawEncoding.js +12 -0
- package/dist/api/resources/tts/types/RawOutputFormat.d.ts +8 -0
- package/dist/api/resources/tts/types/RawOutputFormat.js +5 -0
- package/dist/api/resources/tts/types/Speed.d.ts +10 -0
- package/dist/api/resources/tts/types/Speed.js +5 -0
- package/dist/api/resources/tts/types/SupportedLanguage.d.ts +26 -0
- package/dist/api/resources/tts/types/SupportedLanguage.js +23 -0
- package/dist/api/resources/tts/types/TtsRequest.d.ts +17 -0
- package/dist/api/resources/tts/types/TtsRequest.js +5 -0
- package/dist/api/resources/tts/types/TtsRequestEmbeddingSpecifier.d.ts +9 -0
- package/dist/api/resources/tts/types/TtsRequestEmbeddingSpecifier.js +5 -0
- package/dist/api/resources/tts/types/TtsRequestIdSpecifier.d.ts +9 -0
- package/dist/api/resources/tts/types/TtsRequestIdSpecifier.js +5 -0
- package/dist/api/resources/tts/types/TtsRequestVoiceSpecifier.d.ts +5 -0
- package/dist/api/resources/tts/types/TtsRequestVoiceSpecifier.js +5 -0
- package/dist/api/resources/tts/types/WavOutputFormat.d.ts +6 -0
- package/dist/api/resources/tts/types/WavOutputFormat.js +5 -0
- package/dist/api/resources/tts/types/WebSocketBaseResponse.d.ts +9 -0
- package/dist/api/resources/tts/types/WebSocketBaseResponse.js +5 -0
- package/dist/api/resources/tts/types/WebSocketChunkResponse.d.ts +8 -0
- package/dist/api/resources/tts/types/WebSocketChunkResponse.js +5 -0
- package/dist/api/resources/tts/types/WebSocketDoneResponse.d.ts +6 -0
- package/dist/api/resources/tts/types/WebSocketDoneResponse.js +5 -0
- package/dist/api/resources/tts/types/WebSocketErrorResponse.d.ts +7 -0
- package/dist/api/resources/tts/types/WebSocketErrorResponse.js +5 -0
- package/dist/api/resources/tts/types/WebSocketRawOutputFormat.d.ts +9 -0
- package/dist/api/resources/tts/types/WebSocketRawOutputFormat.js +5 -0
- package/dist/api/resources/tts/types/WebSocketRequest.d.ts +13 -0
- package/dist/api/resources/tts/types/WebSocketRequest.js +5 -0
- package/dist/api/resources/tts/types/WebSocketResponse.d.ts +19 -0
- package/dist/api/resources/tts/types/WebSocketResponse.js +5 -0
- package/dist/api/resources/tts/types/WebSocketStreamOptions.d.ts +6 -0
- package/dist/api/resources/tts/types/WebSocketStreamOptions.js +5 -0
- package/dist/api/resources/tts/types/WebSocketTimestampsResponse.d.ts +7 -0
- package/dist/api/resources/tts/types/WebSocketTimestampsResponse.js +5 -0
- package/dist/api/resources/tts/types/WebSocketTtsOutput.d.ts +9 -0
- package/dist/api/resources/tts/types/WebSocketTtsOutput.js +5 -0
- package/dist/api/resources/tts/types/WebSocketTtsRequest.d.ts +15 -0
- package/dist/api/resources/tts/types/WebSocketTtsRequest.js +5 -0
- package/dist/api/resources/tts/types/WordTimestamps.d.ts +8 -0
- package/dist/api/resources/tts/types/WordTimestamps.js +5 -0
- package/dist/api/resources/tts/types/index.d.ts +30 -0
- package/dist/api/resources/tts/types/index.js +46 -0
- package/dist/api/resources/voiceChanger/client/Client.d.ts +43 -0
- package/dist/api/resources/voiceChanger/client/Client.js +181 -0
- package/dist/api/resources/voiceChanger/client/index.d.ts +1 -0
- package/dist/api/resources/voiceChanger/client/index.js +17 -0
- package/dist/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.d.ts +44 -0
- package/dist/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.js +5 -0
- package/dist/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.d.ts +44 -0
- package/dist/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.js +5 -0
- package/dist/api/resources/voiceChanger/client/requests/index.d.ts +2 -0
- package/dist/api/resources/voiceChanger/client/requests/index.js +2 -0
- package/dist/api/resources/voiceChanger/index.d.ts +2 -0
- package/dist/api/resources/voiceChanger/index.js +18 -0
- package/dist/api/resources/voiceChanger/types/OutputFormatContainer.d.ts +9 -0
- package/dist/api/resources/voiceChanger/types/OutputFormatContainer.js +11 -0
- package/dist/api/resources/voiceChanger/types/StreamingResponse.d.ts +16 -0
- package/dist/api/resources/voiceChanger/types/StreamingResponse.js +5 -0
- package/dist/api/resources/voiceChanger/types/index.d.ts +2 -0
- package/dist/api/resources/voiceChanger/types/index.js +18 -0
- package/dist/api/resources/voices/client/Client.d.ts +141 -0
- package/dist/api/resources/voices/client/Client.js +512 -0
- package/dist/api/resources/voices/client/index.d.ts +1 -0
- package/dist/api/resources/voices/client/index.js +17 -0
- package/dist/api/resources/voices/client/requests/CloneVoiceRequest.d.ts +56 -0
- package/dist/api/resources/voices/client/requests/CloneVoiceRequest.js +5 -0
- package/dist/api/resources/voices/client/requests/index.d.ts +1 -0
- package/dist/api/resources/voices/client/requests/index.js +2 -0
- package/dist/api/resources/voices/index.d.ts +2 -0
- package/dist/api/resources/voices/index.js +18 -0
- package/dist/api/resources/voices/types/BaseVoiceId.d.ts +8 -0
- package/dist/api/resources/voices/types/BaseVoiceId.js +5 -0
- package/dist/api/resources/voices/types/CloneMode.d.ts +8 -0
- package/dist/api/resources/voices/types/CloneMode.js +10 -0
- package/dist/api/resources/voices/types/CreateVoiceRequest.d.ts +13 -0
- package/dist/api/resources/voices/types/CreateVoiceRequest.js +5 -0
- package/dist/api/resources/voices/types/EmbeddingResponse.d.ts +7 -0
- package/dist/api/resources/voices/types/EmbeddingResponse.js +5 -0
- package/dist/api/resources/voices/types/EmbeddingSpecifier.d.ts +8 -0
- package/dist/api/resources/voices/types/EmbeddingSpecifier.js +5 -0
- package/dist/api/resources/voices/types/Gender.d.ts +8 -0
- package/dist/api/resources/voices/types/Gender.js +10 -0
- package/dist/api/resources/voices/types/IdSpecifier.d.ts +8 -0
- package/dist/api/resources/voices/types/IdSpecifier.js +5 -0
- package/dist/api/resources/voices/types/LocalizeDialect.d.ts +16 -0
- package/dist/api/resources/voices/types/LocalizeDialect.js +13 -0
- package/dist/api/resources/voices/types/LocalizeTargetLanguage.d.ts +26 -0
- package/dist/api/resources/voices/types/LocalizeTargetLanguage.js +23 -0
- package/dist/api/resources/voices/types/LocalizeVoiceRequest.d.ts +10 -0
- package/dist/api/resources/voices/types/LocalizeVoiceRequest.js +5 -0
- package/dist/api/resources/voices/types/MixVoiceSpecifier.d.ts +5 -0
- package/dist/api/resources/voices/types/MixVoiceSpecifier.js +5 -0
- package/dist/api/resources/voices/types/MixVoicesRequest.d.ts +7 -0
- package/dist/api/resources/voices/types/MixVoicesRequest.js +5 -0
- package/dist/api/resources/voices/types/UpdateVoiceRequest.d.ts +9 -0
- package/dist/api/resources/voices/types/UpdateVoiceRequest.js +5 -0
- package/dist/api/resources/voices/types/Voice.d.ts +20 -0
- package/dist/api/resources/voices/types/Voice.js +5 -0
- package/dist/api/resources/voices/types/VoiceId.d.ts +7 -0
- package/dist/api/resources/voices/types/VoiceId.js +5 -0
- package/dist/api/resources/voices/types/VoiceMetadata.d.ts +18 -0
- package/dist/api/resources/voices/types/VoiceMetadata.js +5 -0
- package/dist/api/resources/voices/types/Weight.d.ts +7 -0
- package/dist/api/resources/voices/types/Weight.js +5 -0
- package/dist/api/resources/voices/types/index.d.ts +17 -0
- package/dist/api/resources/voices/types/index.js +33 -0
- package/dist/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/core/fetcher/APIResponse.js +2 -0
- package/dist/core/fetcher/Fetcher.d.ts +39 -0
- package/dist/core/fetcher/Fetcher.js +99 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +22 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +13 -0
- package/dist/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/core/fetcher/getFetchFn.js +59 -0
- package/dist/core/fetcher/getHeader.d.ts +1 -0
- package/dist/core/fetcher/getHeader.js +12 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +23 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +52 -0
- package/dist/core/fetcher/index.d.ts +5 -0
- package/dist/core/fetcher/index.js +9 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +42 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +41 -0
- package/dist/core/fetcher/signals.d.ts +12 -0
- package/dist/core/fetcher/signals.js +37 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +22 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +124 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +50 -0
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +60 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +174 -0
- package/dist/core/form-data-utils/index.d.ts +1 -0
- package/dist/core/form-data-utils/index.js +17 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.js +34 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +5 -0
- package/dist/core/runtime/runtime.d.ts +9 -0
- package/dist/core/runtime/runtime.js +93 -0
- package/dist/core/schemas/Schema.d.ts +85 -0
- package/dist/core/schemas/Schema.js +22 -0
- package/dist/core/schemas/builders/bigint/bigint.d.ts +2 -0
- package/dist/core/schemas/builders/bigint/bigint.js +50 -0
- package/dist/core/schemas/builders/bigint/index.d.ts +1 -0
- package/dist/core/schemas/builders/bigint/index.js +5 -0
- package/dist/core/schemas/builders/date/date.d.ts +2 -0
- package/dist/core/schemas/builders/date/date.js +63 -0
- package/dist/core/schemas/builders/date/index.d.ts +1 -0
- package/dist/core/schemas/builders/date/index.js +5 -0
- package/dist/core/schemas/builders/enum/enum.d.ts +2 -0
- package/dist/core/schemas/builders/enum/enum.js +39 -0
- package/dist/core/schemas/builders/enum/index.d.ts +1 -0
- package/dist/core/schemas/builders/enum/index.js +5 -0
- package/dist/core/schemas/builders/index.d.ts +14 -0
- package/dist/core/schemas/builders/index.js +30 -0
- package/dist/core/schemas/builders/lazy/index.d.ts +3 -0
- package/dist/core/schemas/builders/lazy/index.js +7 -0
- package/dist/core/schemas/builders/lazy/lazy.d.ts +5 -0
- package/dist/core/schemas/builders/lazy/lazy.js +25 -0
- package/dist/core/schemas/builders/lazy/lazyObject.d.ts +3 -0
- package/dist/core/schemas/builders/lazy/lazyObject.js +12 -0
- package/dist/core/schemas/builders/list/index.d.ts +1 -0
- package/dist/core/schemas/builders/list/index.js +5 -0
- package/dist/core/schemas/builders/list/list.d.ts +2 -0
- package/dist/core/schemas/builders/list/list.js +55 -0
- package/dist/core/schemas/builders/literals/booleanLiteral.d.ts +2 -0
- package/dist/core/schemas/builders/literals/booleanLiteral.js +29 -0
- package/dist/core/schemas/builders/literals/index.d.ts +2 -0
- package/dist/core/schemas/builders/literals/index.js +7 -0
- package/dist/core/schemas/builders/literals/stringLiteral.d.ts +2 -0
- package/dist/core/schemas/builders/literals/stringLiteral.js +29 -0
- package/dist/core/schemas/builders/object/index.d.ts +6 -0
- package/dist/core/schemas/builders/object/index.js +11 -0
- package/dist/core/schemas/builders/object/object.d.ts +3 -0
- package/dist/core/schemas/builders/object/object.js +233 -0
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +6 -0
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +8 -0
- package/dist/core/schemas/builders/object/property.d.ts +8 -0
- package/dist/core/schemas/builders/object/property.js +16 -0
- package/dist/core/schemas/builders/object/types.d.ts +26 -0
- package/dist/core/schemas/builders/object/types.js +2 -0
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +9 -0
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +54 -0
- package/dist/core/schemas/builders/object-like/index.d.ts +2 -0
- package/dist/core/schemas/builders/object-like/index.js +6 -0
- package/dist/core/schemas/builders/object-like/types.d.ts +7 -0
- package/dist/core/schemas/builders/object-like/types.js +2 -0
- package/dist/core/schemas/builders/primitives/any.d.ts +1 -0
- package/dist/core/schemas/builders/primitives/any.js +6 -0
- package/dist/core/schemas/builders/primitives/boolean.d.ts +1 -0
- package/dist/core/schemas/builders/primitives/boolean.js +25 -0
- package/dist/core/schemas/builders/primitives/index.d.ts +5 -0
- package/dist/core/schemas/builders/primitives/index.js +13 -0
- package/dist/core/schemas/builders/primitives/number.d.ts +1 -0
- package/dist/core/schemas/builders/primitives/number.js +25 -0
- package/dist/core/schemas/builders/primitives/string.d.ts +1 -0
- package/dist/core/schemas/builders/primitives/string.js +25 -0
- package/dist/core/schemas/builders/primitives/unknown.d.ts +1 -0
- package/dist/core/schemas/builders/primitives/unknown.js +6 -0
- package/dist/core/schemas/builders/record/index.d.ts +2 -0
- package/dist/core/schemas/builders/record/index.js +5 -0
- package/dist/core/schemas/builders/record/record.d.ts +3 -0
- package/dist/core/schemas/builders/record/record.js +95 -0
- package/dist/core/schemas/builders/record/types.d.ts +4 -0
- package/dist/core/schemas/builders/record/types.js +2 -0
- package/dist/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
- package/dist/core/schemas/builders/schema-utils/JsonError.js +12 -0
- package/dist/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
- package/dist/core/schemas/builders/schema-utils/ParseError.js +12 -0
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +17 -0
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +82 -0
- package/dist/core/schemas/builders/schema-utils/index.d.ts +4 -0
- package/dist/core/schemas/builders/schema-utils/index.js +11 -0
- package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
- package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.js +10 -0
- package/dist/core/schemas/builders/set/index.d.ts +1 -0
- package/dist/core/schemas/builders/set/index.js +5 -0
- package/dist/core/schemas/builders/set/set.d.ts +2 -0
- package/dist/core/schemas/builders/set/set.js +44 -0
- package/dist/core/schemas/builders/undiscriminated-union/index.d.ts +2 -0
- package/dist/core/schemas/builders/undiscriminated-union/index.js +5 -0
- package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +4 -0
- package/dist/core/schemas/builders/undiscriminated-union/types.js +2 -0
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +3 -0
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +40 -0
- package/dist/core/schemas/builders/union/discriminant.d.ts +5 -0
- package/dist/core/schemas/builders/union/discriminant.js +10 -0
- package/dist/core/schemas/builders/union/index.d.ts +4 -0
- package/dist/core/schemas/builders/union/index.js +7 -0
- package/dist/core/schemas/builders/union/types.d.ts +13 -0
- package/dist/core/schemas/builders/union/types.js +2 -0
- package/dist/core/schemas/builders/union/union.d.ts +4 -0
- package/dist/core/schemas/builders/union/union.js +130 -0
- package/dist/core/schemas/index.d.ts +2 -0
- package/dist/core/schemas/index.js +17 -0
- package/dist/core/schemas/utils/MaybePromise.d.ts +1 -0
- package/dist/core/schemas/utils/MaybePromise.js +2 -0
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +7 -0
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.js +2 -0
- package/dist/core/schemas/utils/createIdentitySchemaCreator.d.ts +2 -0
- package/dist/core/schemas/utils/createIdentitySchemaCreator.js +16 -0
- package/dist/core/schemas/utils/entries.d.ts +1 -0
- package/dist/core/schemas/utils/entries.js +7 -0
- package/dist/core/schemas/utils/filterObject.d.ts +1 -0
- package/dist/core/schemas/utils/filterObject.js +14 -0
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +1 -0
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +28 -0
- package/dist/core/schemas/utils/isPlainObject.d.ts +1 -0
- package/dist/core/schemas/utils/isPlainObject.js +18 -0
- package/dist/core/schemas/utils/keys.d.ts +1 -0
- package/dist/core/schemas/utils/keys.js +7 -0
- package/dist/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
- package/dist/core/schemas/utils/maybeSkipValidation.js +28 -0
- package/dist/core/schemas/utils/partition.d.ts +1 -0
- package/dist/core/schemas/utils/partition.js +16 -0
- package/dist/core/streaming-fetcher/Stream.d.ts +48 -0
- package/dist/core/streaming-fetcher/Stream.js +170 -0
- package/dist/core/streaming-fetcher/index.d.ts +1 -0
- package/dist/core/streaming-fetcher/index.js +5 -0
- package/dist/core/websocket/events.d.ts +36 -0
- package/dist/core/websocket/events.js +27 -0
- package/dist/core/websocket/index.d.ts +1 -0
- package/dist/core/websocket/index.js +17 -0
- package/dist/core/websocket/ws.d.ts +136 -0
- package/dist/core/websocket/ws.js +438 -0
- package/dist/environments.d.ts +7 -0
- package/dist/environments.js +9 -0
- package/dist/errors/CartesiaError.d.ts +12 -0
- package/dist/errors/CartesiaError.js +32 -0
- package/dist/errors/CartesiaTimeoutError.d.ts +6 -0
- package/dist/errors/CartesiaTimeoutError.js +13 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +7 -0
- package/dist/index.d.ts +4 -12
- package/dist/index.js +33 -26
- package/dist/serialization/index.d.ts +1 -0
- package/dist/serialization/index.js +17 -0
- package/dist/serialization/resources/apiStatus/index.d.ts +1 -0
- package/dist/serialization/resources/apiStatus/index.js +17 -0
- package/dist/serialization/resources/apiStatus/types/ApiInfo.d.ts +13 -0
- package/dist/serialization/resources/apiStatus/types/ApiInfo.js +34 -0
- package/dist/serialization/resources/apiStatus/types/index.d.ts +1 -0
- package/dist/serialization/resources/apiStatus/types/index.js +17 -0
- package/dist/serialization/resources/embedding/index.d.ts +1 -0
- package/dist/serialization/resources/embedding/index.js +17 -0
- package/dist/serialization/resources/embedding/types/Embedding.d.ts +10 -0
- package/dist/serialization/resources/embedding/types/Embedding.js +31 -0
- package/dist/serialization/resources/embedding/types/index.d.ts +1 -0
- package/dist/serialization/resources/embedding/types/index.js +17 -0
- package/dist/serialization/resources/index.d.ts +10 -0
- package/dist/serialization/resources/index.js +39 -0
- package/dist/serialization/resources/tts/index.d.ts +1 -0
- package/dist/serialization/resources/tts/index.js +17 -0
- package/dist/serialization/resources/tts/types/CancelContextRequest.d.ts +14 -0
- package/dist/serialization/resources/tts/types/CancelContextRequest.js +35 -0
- package/dist/serialization/resources/tts/types/ContextId.d.ts +10 -0
- package/dist/serialization/resources/tts/types/ContextId.js +31 -0
- package/dist/serialization/resources/tts/types/Controls.d.ts +15 -0
- package/dist/serialization/resources/tts/types/Controls.js +36 -0
- package/dist/serialization/resources/tts/types/Emotion.d.ts +10 -0
- package/dist/serialization/resources/tts/types/Emotion.js +52 -0
- package/dist/serialization/resources/tts/types/GenerationRequest.d.ts +24 -0
- package/dist/serialization/resources/tts/types/GenerationRequest.js +45 -0
- package/dist/serialization/resources/tts/types/Mp3OutputFormat.d.ts +13 -0
- package/dist/serialization/resources/tts/types/Mp3OutputFormat.js +34 -0
- package/dist/serialization/resources/tts/types/NaturalSpecifier.d.ts +10 -0
- package/dist/serialization/resources/tts/types/NaturalSpecifier.js +31 -0
- package/dist/serialization/resources/tts/types/NumericalSpecifier.d.ts +10 -0
- package/dist/serialization/resources/tts/types/NumericalSpecifier.js +31 -0
- package/dist/serialization/resources/tts/types/OutputFormat.d.ts +22 -0
- package/dist/serialization/resources/tts/types/OutputFormat.js +43 -0
- package/dist/serialization/resources/tts/types/RawEncoding.d.ts +10 -0
- package/dist/serialization/resources/tts/types/RawEncoding.js +31 -0
- package/dist/serialization/resources/tts/types/RawOutputFormat.d.ts +14 -0
- package/dist/serialization/resources/tts/types/RawOutputFormat.js +35 -0
- package/dist/serialization/resources/tts/types/Speed.d.ts +12 -0
- package/dist/serialization/resources/tts/types/Speed.js +33 -0
- package/dist/serialization/resources/tts/types/SupportedLanguage.d.ts +10 -0
- package/dist/serialization/resources/tts/types/SupportedLanguage.js +47 -0
- package/dist/serialization/resources/tts/types/TtsRequest.d.ts +20 -0
- package/dist/serialization/resources/tts/types/TtsRequest.js +41 -0
- package/dist/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.d.ts +16 -0
- package/dist/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.js +37 -0
- package/dist/serialization/resources/tts/types/TtsRequestIdSpecifier.d.ts +16 -0
- package/dist/serialization/resources/tts/types/TtsRequestIdSpecifier.js +37 -0
- package/dist/serialization/resources/tts/types/TtsRequestVoiceSpecifier.d.ts +12 -0
- package/dist/serialization/resources/tts/types/TtsRequestVoiceSpecifier.js +33 -0
- package/dist/serialization/resources/tts/types/WavOutputFormat.d.ts +12 -0
- package/dist/serialization/resources/tts/types/WavOutputFormat.js +32 -0
- package/dist/serialization/resources/tts/types/WebSocketBaseResponse.d.ts +15 -0
- package/dist/serialization/resources/tts/types/WebSocketBaseResponse.js +36 -0
- package/dist/serialization/resources/tts/types/WebSocketChunkResponse.d.ts +14 -0
- package/dist/serialization/resources/tts/types/WebSocketChunkResponse.js +37 -0
- package/dist/serialization/resources/tts/types/WebSocketDoneResponse.d.ts +12 -0
- package/dist/serialization/resources/tts/types/WebSocketDoneResponse.js +32 -0
- package/dist/serialization/resources/tts/types/WebSocketErrorResponse.d.ts +13 -0
- package/dist/serialization/resources/tts/types/WebSocketErrorResponse.js +36 -0
- package/dist/serialization/resources/tts/types/WebSocketRawOutputFormat.d.ts +15 -0
- package/dist/serialization/resources/tts/types/WebSocketRawOutputFormat.js +36 -0
- package/dist/serialization/resources/tts/types/WebSocketRequest.d.ts +12 -0
- package/dist/serialization/resources/tts/types/WebSocketRequest.js +33 -0
- package/dist/serialization/resources/tts/types/WebSocketResponse.d.ts +26 -0
- package/dist/serialization/resources/tts/types/WebSocketResponse.js +45 -0
- package/dist/serialization/resources/tts/types/WebSocketStreamOptions.d.ts +12 -0
- package/dist/serialization/resources/tts/types/WebSocketStreamOptions.js +33 -0
- package/dist/serialization/resources/tts/types/WebSocketTimestampsResponse.d.ts +14 -0
- package/dist/serialization/resources/tts/types/WebSocketTimestampsResponse.js +37 -0
- package/dist/serialization/resources/tts/types/WebSocketTtsOutput.d.ts +16 -0
- package/dist/serialization/resources/tts/types/WebSocketTtsOutput.js +37 -0
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +21 -0
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +42 -0
- package/dist/serialization/resources/tts/types/WordTimestamps.d.ts +14 -0
- package/dist/serialization/resources/tts/types/WordTimestamps.js +35 -0
- package/dist/serialization/resources/tts/types/index.d.ts +30 -0
- package/dist/serialization/resources/tts/types/index.js +46 -0
- package/dist/serialization/resources/voiceChanger/index.d.ts +1 -0
- package/dist/serialization/resources/voiceChanger/index.js +17 -0
- package/dist/serialization/resources/voiceChanger/types/OutputFormatContainer.d.ts +10 -0
- package/dist/serialization/resources/voiceChanger/types/OutputFormatContainer.js +31 -0
- package/dist/serialization/resources/voiceChanger/types/StreamingResponse.d.ts +22 -0
- package/dist/serialization/resources/voiceChanger/types/StreamingResponse.js +43 -0
- package/dist/serialization/resources/voiceChanger/types/index.d.ts +2 -0
- package/dist/serialization/resources/voiceChanger/types/index.js +18 -0
- package/dist/serialization/resources/voices/client/index.d.ts +1 -0
- package/dist/serialization/resources/voices/client/index.js +27 -0
- package/dist/serialization/resources/voices/client/list.d.ts +11 -0
- package/dist/serialization/resources/voices/client/list.js +32 -0
- package/dist/serialization/resources/voices/index.d.ts +2 -0
- package/dist/serialization/resources/voices/index.js +18 -0
- package/dist/serialization/resources/voices/types/BaseVoiceId.d.ts +11 -0
- package/dist/serialization/resources/voices/types/BaseVoiceId.js +8 -0
- package/dist/serialization/resources/voices/types/CloneMode.d.ts +10 -0
- package/dist/serialization/resources/voices/types/CloneMode.js +31 -0
- package/dist/serialization/resources/voices/types/CreateVoiceRequest.d.ts +19 -0
- package/dist/serialization/resources/voices/types/CreateVoiceRequest.js +40 -0
- package/dist/serialization/resources/voices/types/EmbeddingResponse.d.ts +13 -0
- package/dist/serialization/resources/voices/types/EmbeddingResponse.js +34 -0
- package/dist/serialization/resources/voices/types/EmbeddingSpecifier.d.ts +15 -0
- package/dist/serialization/resources/voices/types/EmbeddingSpecifier.js +36 -0
- package/dist/serialization/resources/voices/types/Gender.d.ts +10 -0
- package/dist/serialization/resources/voices/types/Gender.js +34 -0
- package/dist/serialization/resources/voices/types/IdSpecifier.d.ts +15 -0
- package/dist/serialization/resources/voices/types/IdSpecifier.js +36 -0
- package/dist/serialization/resources/voices/types/LocalizeDialect.d.ts +10 -0
- package/dist/serialization/resources/voices/types/LocalizeDialect.js +31 -0
- package/dist/serialization/resources/voices/types/LocalizeTargetLanguage.d.ts +10 -0
- package/dist/serialization/resources/voices/types/LocalizeTargetLanguage.js +47 -0
- package/dist/serialization/resources/voices/types/LocalizeVoiceRequest.d.ts +19 -0
- package/dist/serialization/resources/voices/types/LocalizeVoiceRequest.js +40 -0
- package/dist/serialization/resources/voices/types/MixVoiceSpecifier.d.ts +12 -0
- package/dist/serialization/resources/voices/types/MixVoiceSpecifier.js +33 -0
- package/dist/serialization/resources/voices/types/MixVoicesRequest.d.ts +13 -0
- package/dist/serialization/resources/voices/types/MixVoicesRequest.js +34 -0
- package/dist/serialization/resources/voices/types/UpdateVoiceRequest.d.ts +13 -0
- package/dist/serialization/resources/voices/types/UpdateVoiceRequest.js +34 -0
- package/dist/serialization/resources/voices/types/Voice.d.ts +24 -0
- package/dist/serialization/resources/voices/types/Voice.js +45 -0
- package/dist/serialization/resources/voices/types/VoiceId.d.ts +10 -0
- package/dist/serialization/resources/voices/types/VoiceId.js +31 -0
- package/dist/serialization/resources/voices/types/VoiceMetadata.d.ts +20 -0
- package/dist/serialization/resources/voices/types/VoiceMetadata.js +41 -0
- package/dist/serialization/resources/voices/types/Weight.d.ts +10 -0
- package/dist/serialization/resources/voices/types/Weight.js +31 -0
- package/dist/serialization/resources/voices/types/index.d.ts +17 -0
- package/dist/serialization/resources/voices/types/index.js +33 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/dist/wrapper/Client.d.ts +6 -0
- package/dist/wrapper/Client.js +12 -0
- package/dist/wrapper/StreamingTTSClient.d.ts +16 -0
- package/dist/wrapper/StreamingTTSClient.js +23 -0
- package/dist/{tts/player.d.ts → wrapper/WebPlayer.d.ts} +2 -8
- package/dist/wrapper/WebPlayer.js +141 -0
- package/dist/wrapper/Websocket.d.ts +57 -0
- package/dist/wrapper/Websocket.js +218 -0
- package/dist/{tts → wrapper}/source.d.ts +8 -17
- package/dist/wrapper/source.js +179 -0
- package/dist/wrapper/utils.d.ts +105 -0
- package/dist/wrapper/utils.js +173 -0
- package/environments.d.ts +7 -0
- package/environments.js +9 -0
- package/errors/CartesiaError.d.ts +12 -0
- package/errors/CartesiaError.js +32 -0
- package/errors/CartesiaTimeoutError.d.ts +6 -0
- package/errors/CartesiaTimeoutError.js +13 -0
- package/errors/index.d.ts +2 -0
- package/errors/index.js +7 -0
- package/index.d.ts +4 -0
- package/index.js +34 -0
- package/jest.config.js +5 -0
- package/package.json +45 -46
- package/reference.md +771 -0
- package/serialization/index.d.ts +1 -0
- package/serialization/index.js +17 -0
- package/serialization/resources/apiStatus/index.d.ts +1 -0
- package/serialization/resources/apiStatus/index.js +17 -0
- package/serialization/resources/apiStatus/types/ApiInfo.d.ts +13 -0
- package/serialization/resources/apiStatus/types/ApiInfo.js +34 -0
- package/serialization/resources/apiStatus/types/index.d.ts +1 -0
- package/serialization/resources/apiStatus/types/index.js +17 -0
- package/serialization/resources/embedding/index.d.ts +1 -0
- package/serialization/resources/embedding/index.js +17 -0
- package/serialization/resources/embedding/types/Embedding.d.ts +10 -0
- package/serialization/resources/embedding/types/Embedding.js +31 -0
- package/serialization/resources/embedding/types/index.d.ts +1 -0
- package/serialization/resources/embedding/types/index.js +17 -0
- package/serialization/resources/index.d.ts +10 -0
- package/serialization/resources/index.js +39 -0
- package/serialization/resources/tts/index.d.ts +1 -0
- package/serialization/resources/tts/index.js +17 -0
- package/serialization/resources/tts/types/CancelContextRequest.d.ts +14 -0
- package/serialization/resources/tts/types/CancelContextRequest.js +35 -0
- package/serialization/resources/tts/types/ContextId.d.ts +10 -0
- package/serialization/resources/tts/types/ContextId.js +31 -0
- package/serialization/resources/tts/types/Controls.d.ts +15 -0
- package/serialization/resources/tts/types/Controls.js +36 -0
- package/serialization/resources/tts/types/Emotion.d.ts +10 -0
- package/serialization/resources/tts/types/Emotion.js +52 -0
- package/serialization/resources/tts/types/GenerationRequest.d.ts +24 -0
- package/serialization/resources/tts/types/GenerationRequest.js +45 -0
- package/serialization/resources/tts/types/Mp3OutputFormat.d.ts +13 -0
- package/serialization/resources/tts/types/Mp3OutputFormat.js +34 -0
- package/serialization/resources/tts/types/NaturalSpecifier.d.ts +10 -0
- package/serialization/resources/tts/types/NaturalSpecifier.js +31 -0
- package/serialization/resources/tts/types/NumericalSpecifier.d.ts +10 -0
- package/serialization/resources/tts/types/NumericalSpecifier.js +31 -0
- package/serialization/resources/tts/types/OutputFormat.d.ts +22 -0
- package/serialization/resources/tts/types/OutputFormat.js +43 -0
- package/serialization/resources/tts/types/RawEncoding.d.ts +10 -0
- package/serialization/resources/tts/types/RawEncoding.js +31 -0
- package/serialization/resources/tts/types/RawOutputFormat.d.ts +14 -0
- package/serialization/resources/tts/types/RawOutputFormat.js +35 -0
- package/serialization/resources/tts/types/Speed.d.ts +12 -0
- package/serialization/resources/tts/types/Speed.js +33 -0
- package/serialization/resources/tts/types/SupportedLanguage.d.ts +10 -0
- package/serialization/resources/tts/types/SupportedLanguage.js +47 -0
- package/serialization/resources/tts/types/TtsRequest.d.ts +20 -0
- package/serialization/resources/tts/types/TtsRequest.js +41 -0
- package/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.d.ts +16 -0
- package/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.js +37 -0
- package/serialization/resources/tts/types/TtsRequestIdSpecifier.d.ts +16 -0
- package/serialization/resources/tts/types/TtsRequestIdSpecifier.js +37 -0
- package/serialization/resources/tts/types/TtsRequestVoiceSpecifier.d.ts +12 -0
- package/serialization/resources/tts/types/TtsRequestVoiceSpecifier.js +33 -0
- package/serialization/resources/tts/types/WavOutputFormat.d.ts +12 -0
- package/serialization/resources/tts/types/WavOutputFormat.js +32 -0
- package/serialization/resources/tts/types/WebSocketBaseResponse.d.ts +15 -0
- package/serialization/resources/tts/types/WebSocketBaseResponse.js +36 -0
- package/serialization/resources/tts/types/WebSocketChunkResponse.d.ts +14 -0
- package/serialization/resources/tts/types/WebSocketChunkResponse.js +37 -0
- package/serialization/resources/tts/types/WebSocketDoneResponse.d.ts +12 -0
- package/serialization/resources/tts/types/WebSocketDoneResponse.js +32 -0
- package/serialization/resources/tts/types/WebSocketErrorResponse.d.ts +13 -0
- package/serialization/resources/tts/types/WebSocketErrorResponse.js +36 -0
- package/serialization/resources/tts/types/WebSocketRawOutputFormat.d.ts +15 -0
- package/serialization/resources/tts/types/WebSocketRawOutputFormat.js +36 -0
- package/serialization/resources/tts/types/WebSocketRequest.d.ts +12 -0
- package/serialization/resources/tts/types/WebSocketRequest.js +33 -0
- package/serialization/resources/tts/types/WebSocketResponse.d.ts +26 -0
- package/serialization/resources/tts/types/WebSocketResponse.js +45 -0
- package/serialization/resources/tts/types/WebSocketStreamOptions.d.ts +12 -0
- package/serialization/resources/tts/types/WebSocketStreamOptions.js +33 -0
- package/serialization/resources/tts/types/WebSocketTimestampsResponse.d.ts +14 -0
- package/serialization/resources/tts/types/WebSocketTimestampsResponse.js +37 -0
- package/serialization/resources/tts/types/WebSocketTtsOutput.d.ts +16 -0
- package/serialization/resources/tts/types/WebSocketTtsOutput.js +37 -0
- package/serialization/resources/tts/types/WebSocketTtsRequest.d.ts +21 -0
- package/serialization/resources/tts/types/WebSocketTtsRequest.js +42 -0
- package/serialization/resources/tts/types/WordTimestamps.d.ts +14 -0
- package/serialization/resources/tts/types/WordTimestamps.js +35 -0
- package/serialization/resources/tts/types/index.d.ts +30 -0
- package/serialization/resources/tts/types/index.js +46 -0
- package/serialization/resources/voiceChanger/index.d.ts +1 -0
- package/serialization/resources/voiceChanger/index.js +17 -0
- package/serialization/resources/voiceChanger/types/OutputFormatContainer.d.ts +10 -0
- package/serialization/resources/voiceChanger/types/OutputFormatContainer.js +31 -0
- package/serialization/resources/voiceChanger/types/StreamingResponse.d.ts +22 -0
- package/serialization/resources/voiceChanger/types/StreamingResponse.js +43 -0
- package/serialization/resources/voiceChanger/types/index.d.ts +2 -0
- package/serialization/resources/voiceChanger/types/index.js +18 -0
- package/serialization/resources/voices/client/index.d.ts +1 -0
- package/serialization/resources/voices/client/index.js +27 -0
- package/serialization/resources/voices/client/list.d.ts +11 -0
- package/serialization/resources/voices/client/list.js +32 -0
- package/serialization/resources/voices/index.d.ts +2 -0
- package/serialization/resources/voices/index.js +18 -0
- package/serialization/resources/voices/types/BaseVoiceId.d.ts +11 -0
- package/serialization/resources/voices/types/BaseVoiceId.js +8 -0
- package/serialization/resources/voices/types/CloneMode.d.ts +10 -0
- package/serialization/resources/voices/types/CloneMode.js +31 -0
- package/serialization/resources/voices/types/CreateVoiceRequest.d.ts +19 -0
- package/serialization/resources/voices/types/CreateVoiceRequest.js +40 -0
- package/serialization/resources/voices/types/EmbeddingResponse.d.ts +13 -0
- package/serialization/resources/voices/types/EmbeddingResponse.js +34 -0
- package/serialization/resources/voices/types/EmbeddingSpecifier.d.ts +15 -0
- package/serialization/resources/voices/types/EmbeddingSpecifier.js +36 -0
- package/serialization/resources/voices/types/Gender.d.ts +10 -0
- package/serialization/resources/voices/types/Gender.js +34 -0
- package/serialization/resources/voices/types/IdSpecifier.d.ts +15 -0
- package/serialization/resources/voices/types/IdSpecifier.js +36 -0
- package/serialization/resources/voices/types/LocalizeDialect.d.ts +10 -0
- package/serialization/resources/voices/types/LocalizeDialect.js +31 -0
- package/serialization/resources/voices/types/LocalizeTargetLanguage.d.ts +10 -0
- package/serialization/resources/voices/types/LocalizeTargetLanguage.js +47 -0
- package/serialization/resources/voices/types/LocalizeVoiceRequest.d.ts +19 -0
- package/serialization/resources/voices/types/LocalizeVoiceRequest.js +40 -0
- package/serialization/resources/voices/types/MixVoiceSpecifier.d.ts +12 -0
- package/serialization/resources/voices/types/MixVoiceSpecifier.js +33 -0
- package/serialization/resources/voices/types/MixVoicesRequest.d.ts +13 -0
- package/serialization/resources/voices/types/MixVoicesRequest.js +34 -0
- package/serialization/resources/voices/types/UpdateVoiceRequest.d.ts +13 -0
- package/serialization/resources/voices/types/UpdateVoiceRequest.js +34 -0
- package/serialization/resources/voices/types/Voice.d.ts +24 -0
- package/serialization/resources/voices/types/Voice.js +45 -0
- package/serialization/resources/voices/types/VoiceId.d.ts +10 -0
- package/serialization/resources/voices/types/VoiceId.js +31 -0
- package/serialization/resources/voices/types/VoiceMetadata.d.ts +20 -0
- package/serialization/resources/voices/types/VoiceMetadata.js +41 -0
- package/serialization/resources/voices/types/Weight.d.ts +10 -0
- package/serialization/resources/voices/types/Weight.js +31 -0
- package/serialization/resources/voices/types/index.d.ts +17 -0
- package/serialization/resources/voices/types/index.js +33 -0
- package/version.d.ts +1 -0
- package/version.js +4 -0
- package/wrapper/Client.d.ts +6 -0
- package/wrapper/Client.js +12 -0
- package/wrapper/StreamingTTSClient.d.ts +16 -0
- package/wrapper/StreamingTTSClient.js +23 -0
- package/{dist/tts/player.d.cts → wrapper/WebPlayer.d.ts} +2 -8
- package/wrapper/WebPlayer.js +141 -0
- package/wrapper/Websocket.d.ts +57 -0
- package/wrapper/Websocket.js +218 -0
- package/{dist/tts/source.d.cts → wrapper/source.d.ts} +8 -17
- package/wrapper/source.js +179 -0
- package/wrapper/utils.d.ts +105 -0
- package/wrapper/utils.js +173 -0
- package/CHANGELOG.md +0 -90
- package/LICENSE.md +0 -21
- package/dist/chunk-2BFEKY3F.js +0 -16
- package/dist/chunk-5SBAQNWQ.js +0 -86
- package/dist/chunk-CJZSHIRI.js +0 -274
- package/dist/chunk-CSOXALSC.js +0 -132
- package/dist/chunk-FLWYXP5Z.js +0 -40
- package/dist/chunk-FXPGR372.js +0 -0
- package/dist/chunk-I5YVYTNK.js +0 -190
- package/dist/chunk-LKKWJLUG.js +0 -17
- package/dist/chunk-NJDRWDQ3.js +0 -57
- package/dist/chunk-QT5LHJ3D.js +0 -43
- package/dist/chunk-RJICGVPL.js +0 -79
- package/dist/chunk-RYHHRY64.js +0 -26
- package/dist/chunk-WLEVU3HN.js +0 -42
- package/dist/index.cjs +0 -883
- package/dist/index.d.cts +0 -12
- package/dist/lib/client.cjs +0 -113
- package/dist/lib/client.d.cts +0 -12
- package/dist/lib/client.d.ts +0 -12
- package/dist/lib/client.js +0 -8
- package/dist/lib/constants.cjs +0 -42
- package/dist/lib/constants.d.cts +0 -16
- package/dist/lib/constants.d.ts +0 -16
- package/dist/lib/constants.js +0 -11
- package/dist/lib/index.cjs +0 -745
- package/dist/lib/index.d.cts +0 -19
- package/dist/lib/index.d.ts +0 -19
- package/dist/lib/index.js +0 -15
- package/dist/react/index.cjs +0 -1137
- package/dist/react/index.d.cts +0 -35
- package/dist/react/index.d.ts +0 -35
- package/dist/react/index.js +0 -274
- package/dist/react/utils.cjs +0 -57
- package/dist/react/utils.d.cts +0 -7
- package/dist/react/utils.d.ts +0 -7
- package/dist/react/utils.js +0 -7
- package/dist/tts/index.cjs +0 -630
- package/dist/tts/index.d.cts +0 -25
- package/dist/tts/index.d.ts +0 -25
- package/dist/tts/index.js +0 -12
- package/dist/tts/player.cjs +0 -202
- package/dist/tts/player.js +0 -9
- package/dist/tts/source.cjs +0 -244
- package/dist/tts/source.js +0 -9
- package/dist/tts/utils.cjs +0 -134
- package/dist/tts/utils.d.cts +0 -70
- package/dist/tts/utils.d.ts +0 -70
- package/dist/tts/utils.js +0 -22
- package/dist/tts/websocket.cjs +0 -598
- package/dist/tts/websocket.d.cts +0 -70
- package/dist/tts/websocket.d.ts +0 -70
- package/dist/tts/websocket.js +0 -11
- package/dist/types/index.cjs +0 -18
- package/dist/types/index.d.cts +0 -167
- package/dist/types/index.d.ts +0 -167
- package/dist/types/index.js +0 -1
- package/dist/voice-changer/index.cjs +0 -143
- package/dist/voice-changer/index.d.cts +0 -10
- package/dist/voice-changer/index.d.ts +0 -10
- package/dist/voice-changer/index.js +0 -9
- package/dist/voices/index.cjs +0 -180
- package/dist/voices/index.d.cts +0 -16
- package/dist/voices/index.d.ts +0 -16
- package/dist/voices/index.js +0 -9
- package/src/index.ts +0 -6
- package/src/lib/client.ts +0 -31
- package/src/lib/constants.ts +0 -25
- package/src/lib/index.ts +0 -19
- package/src/react/index.ts +0 -303
- package/src/react/utils.ts +0 -11
- package/src/tts/index.ts +0 -32
- package/src/tts/player.ts +0 -117
- package/src/tts/source.ts +0 -196
- package/src/tts/utils.ts +0 -164
- package/src/tts/websocket.ts +0 -283
- package/src/types/index.ts +0 -227
- package/src/voice-changer/index.ts +0 -37
- package/src/voices/index.ts +0 -76
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./VoiceId"), exports);
|
|
18
|
+
__exportStar(require("./BaseVoiceId"), exports);
|
|
19
|
+
__exportStar(require("./Voice"), exports);
|
|
20
|
+
__exportStar(require("./VoiceMetadata"), exports);
|
|
21
|
+
__exportStar(require("./CreateVoiceRequest"), exports);
|
|
22
|
+
__exportStar(require("./UpdateVoiceRequest"), exports);
|
|
23
|
+
__exportStar(require("./LocalizeTargetLanguage"), exports);
|
|
24
|
+
__exportStar(require("./LocalizeDialect"), exports);
|
|
25
|
+
__exportStar(require("./Gender"), exports);
|
|
26
|
+
__exportStar(require("./LocalizeVoiceRequest"), exports);
|
|
27
|
+
__exportStar(require("./EmbeddingResponse"), exports);
|
|
28
|
+
__exportStar(require("./MixVoicesRequest"), exports);
|
|
29
|
+
__exportStar(require("./Weight"), exports);
|
|
30
|
+
__exportStar(require("./IdSpecifier"), exports);
|
|
31
|
+
__exportStar(require("./EmbeddingSpecifier"), exports);
|
|
32
|
+
__exportStar(require("./MixVoiceSpecifier"), exports);
|
|
33
|
+
__exportStar(require("./CloneMode"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION = "2.0.0-alpha";
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CartesiaClient as FernCartesiaClient } from "../Client";
|
|
2
|
+
import { StreamingTTSClient } from "./StreamingTTSClient";
|
|
3
|
+
export declare class CartesiaClient extends FernCartesiaClient {
|
|
4
|
+
protected _tts: StreamingTTSClient | undefined;
|
|
5
|
+
get tts(): StreamingTTSClient;
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CartesiaClient = void 0;
|
|
4
|
+
const Client_1 = require("../Client");
|
|
5
|
+
const StreamingTTSClient_1 = require("./StreamingTTSClient");
|
|
6
|
+
class CartesiaClient extends Client_1.CartesiaClient {
|
|
7
|
+
get tts() {
|
|
8
|
+
var _a;
|
|
9
|
+
return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new StreamingTTSClient_1.StreamingTTSClient(this._options)));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.CartesiaClient = CartesiaClient;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Tts } from "../api/resources/tts/client/Client";
|
|
2
|
+
import Websocket from "./Websocket";
|
|
3
|
+
export declare class StreamingTTSClient extends Tts {
|
|
4
|
+
constructor(options?: Tts.Options);
|
|
5
|
+
/**
|
|
6
|
+
* Get a WebSocket client for streaming TTS.
|
|
7
|
+
*
|
|
8
|
+
* @param options - Options for the WebSocket client.
|
|
9
|
+
* @returns A WebSocket client configured for streaming TTS.
|
|
10
|
+
*/
|
|
11
|
+
websocket({ sampleRate, container, encoding, }: {
|
|
12
|
+
sampleRate: number;
|
|
13
|
+
container?: string;
|
|
14
|
+
encoding?: string;
|
|
15
|
+
}): Websocket;
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StreamingTTSClient = void 0;
|
|
7
|
+
const Client_1 = require("../api/resources/tts/client/Client");
|
|
8
|
+
const Websocket_1 = __importDefault(require("./Websocket"));
|
|
9
|
+
class StreamingTTSClient extends Client_1.Tts {
|
|
10
|
+
constructor(options = {}) {
|
|
11
|
+
super(options);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get a WebSocket client for streaming TTS.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Options for the WebSocket client.
|
|
17
|
+
* @returns A WebSocket client configured for streaming TTS.
|
|
18
|
+
*/
|
|
19
|
+
websocket({ sampleRate, container, encoding, }) {
|
|
20
|
+
return new Websocket_1.default({ sampleRate, container, encoding }, Object.assign({ cartesiaVersion: "2024-06-10" }, this._options));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.StreamingTTSClient = StreamingTTSClient;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import Source from
|
|
2
|
-
|
|
3
|
-
import '../types/index.js';
|
|
4
|
-
import 'partysocket/ws';
|
|
5
|
-
|
|
6
|
-
declare class Player {
|
|
1
|
+
import type Source from "./source";
|
|
2
|
+
export declare class WebPlayer {
|
|
7
3
|
#private;
|
|
8
4
|
/**
|
|
9
5
|
* Create a new Player.
|
|
@@ -46,5 +42,3 @@ declare class Player {
|
|
|
46
42
|
*/
|
|
47
43
|
stop(): Promise<void>;
|
|
48
44
|
}
|
|
49
|
-
|
|
50
|
-
export { Player as default };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
14
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
15
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
16
|
+
};
|
|
17
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
18
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
19
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
20
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
|
+
};
|
|
22
|
+
var _WebPlayer_instances, _WebPlayer_context, _WebPlayer_startNextPlaybackAt, _WebPlayer_bufferDuration, _WebPlayer_playBuffer;
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.WebPlayer = void 0;
|
|
25
|
+
const utils_1 = require("./utils");
|
|
26
|
+
class WebPlayer {
|
|
27
|
+
/**
|
|
28
|
+
* Create a new Player.
|
|
29
|
+
*
|
|
30
|
+
* @param options - Options for the Player.
|
|
31
|
+
* @param options.bufferDuration - The duration of the audio buffer to play.
|
|
32
|
+
*/
|
|
33
|
+
constructor({ bufferDuration }) {
|
|
34
|
+
_WebPlayer_instances.add(this);
|
|
35
|
+
_WebPlayer_context.set(this, null);
|
|
36
|
+
_WebPlayer_startNextPlaybackAt.set(this, 0);
|
|
37
|
+
_WebPlayer_bufferDuration.set(this, void 0);
|
|
38
|
+
__classPrivateFieldSet(this, _WebPlayer_bufferDuration, bufferDuration, "f");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Play audio from a source.
|
|
42
|
+
*
|
|
43
|
+
* @param source The source to play audio from.
|
|
44
|
+
* @returns A promise that resolves when the audio has finished playing.
|
|
45
|
+
*/
|
|
46
|
+
play(source) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
__classPrivateFieldSet(this, _WebPlayer_startNextPlaybackAt, 0, "f");
|
|
49
|
+
__classPrivateFieldSet(this, _WebPlayer_context, new AudioContext({ sampleRate: source.sampleRate }), "f");
|
|
50
|
+
const buffer = new Float32Array(source.durationToSampleCount(__classPrivateFieldGet(this, _WebPlayer_bufferDuration, "f")));
|
|
51
|
+
const plays = [];
|
|
52
|
+
while (true) {
|
|
53
|
+
const read = yield source.read(buffer);
|
|
54
|
+
// If we've reached the end of the source, then read < buffer.length.
|
|
55
|
+
// In that case, we don't want to play the entire buffer, as that
|
|
56
|
+
// will cause repeated audio.
|
|
57
|
+
// So we set the buffer to the correct length.
|
|
58
|
+
const playableAudio = buffer.subarray(0, read);
|
|
59
|
+
plays.push(__classPrivateFieldGet(this, _WebPlayer_instances, "m", _WebPlayer_playBuffer).call(this, playableAudio, source.sampleRate));
|
|
60
|
+
if (read < buffer.length) {
|
|
61
|
+
// No more audio to read.
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
yield Promise.all(plays);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Pause the audio.
|
|
70
|
+
*
|
|
71
|
+
* @returns A promise that resolves when the audio has been paused.
|
|
72
|
+
*/
|
|
73
|
+
pause() {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
if (!__classPrivateFieldGet(this, _WebPlayer_context, "f")) {
|
|
76
|
+
throw new Error("AudioContext not initialized.");
|
|
77
|
+
}
|
|
78
|
+
yield __classPrivateFieldGet(this, _WebPlayer_context, "f").suspend();
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Resume the audio.
|
|
83
|
+
*
|
|
84
|
+
* @returns A promise that resolves when the audio has been resumed.
|
|
85
|
+
*/
|
|
86
|
+
resume() {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
if (!__classPrivateFieldGet(this, _WebPlayer_context, "f")) {
|
|
89
|
+
throw new Error("AudioContext not initialized.");
|
|
90
|
+
}
|
|
91
|
+
yield __classPrivateFieldGet(this, _WebPlayer_context, "f").resume();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Toggle the audio.
|
|
96
|
+
*
|
|
97
|
+
* @returns A promise that resolves when the audio has been toggled.
|
|
98
|
+
*/
|
|
99
|
+
toggle() {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
if (!__classPrivateFieldGet(this, _WebPlayer_context, "f")) {
|
|
102
|
+
throw new Error("AudioContext not initialized.");
|
|
103
|
+
}
|
|
104
|
+
if (__classPrivateFieldGet(this, _WebPlayer_context, "f").state === "running") {
|
|
105
|
+
yield this.pause();
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
yield this.resume();
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Stop the audio.
|
|
114
|
+
*
|
|
115
|
+
* @returns A promise that resolves when the audio has been stopped.
|
|
116
|
+
*/
|
|
117
|
+
stop() {
|
|
118
|
+
var _a;
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
if (!__classPrivateFieldGet(this, _WebPlayer_context, "f")) {
|
|
121
|
+
throw new Error("AudioContext not initialized.");
|
|
122
|
+
}
|
|
123
|
+
yield ((_a = __classPrivateFieldGet(this, _WebPlayer_context, "f")) === null || _a === void 0 ? void 0 : _a.close());
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.WebPlayer = WebPlayer;
|
|
128
|
+
_WebPlayer_context = new WeakMap(), _WebPlayer_startNextPlaybackAt = new WeakMap(), _WebPlayer_bufferDuration = new WeakMap(), _WebPlayer_instances = new WeakSet(), _WebPlayer_playBuffer = function _WebPlayer_playBuffer(buf, sampleRate) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
if (!__classPrivateFieldGet(this, _WebPlayer_context, "f")) {
|
|
131
|
+
throw new Error("AudioContext not initialized.");
|
|
132
|
+
}
|
|
133
|
+
if (buf.length === 0) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const startAt = __classPrivateFieldGet(this, _WebPlayer_startNextPlaybackAt, "f");
|
|
137
|
+
const duration = buf.length / sampleRate;
|
|
138
|
+
__classPrivateFieldSet(this, _WebPlayer_startNextPlaybackAt, duration + Math.max(__classPrivateFieldGet(this, _WebPlayer_context, "f").currentTime, __classPrivateFieldGet(this, _WebPlayer_startNextPlaybackAt, "f")), "f");
|
|
139
|
+
yield (0, utils_1.playAudioBuffer)(buf, __classPrivateFieldGet(this, _WebPlayer_context, "f"), startAt, sampleRate);
|
|
140
|
+
});
|
|
141
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ReconnectingWebSocket, Options } from "../core/websocket";
|
|
2
|
+
import type { WebSocketStreamOptions, WebSocketTtsRequest, WordTimestamps } from "../api";
|
|
3
|
+
import { ConnectionEventData, WebSocketOptions, EmitteryCallbacks } from "./utils";
|
|
4
|
+
import { Tts } from "api/resources/tts/client/Client";
|
|
5
|
+
import Source from "./source";
|
|
6
|
+
export default class Websocket {
|
|
7
|
+
#private;
|
|
8
|
+
private readonly options;
|
|
9
|
+
socket?: ReconnectingWebSocket;
|
|
10
|
+
constructor({ sampleRate, container, encoding }: WebSocketOptions, options: Tts.Options);
|
|
11
|
+
/**
|
|
12
|
+
* Send a message over the WebSocket to start a stream.
|
|
13
|
+
*
|
|
14
|
+
* @param inputs - Generation parameters. Defined in the StreamRequest type.
|
|
15
|
+
* @param options - Options for the stream.
|
|
16
|
+
* @param options.timeout - The maximum time to wait for a chunk before cancelling the stream.
|
|
17
|
+
* If set to `0`, the stream will not time out.
|
|
18
|
+
* @returns A Source object that can be passed to a Player to play the audio.
|
|
19
|
+
* @returns An Emittery instance that emits messages from the WebSocket.
|
|
20
|
+
* @returns An abort function that can be called to cancel the stream.
|
|
21
|
+
*/
|
|
22
|
+
send(inputs: WebSocketTtsRequest, { timeout }?: WebSocketStreamOptions): {
|
|
23
|
+
stop: {
|
|
24
|
+
(reason?: any): void;
|
|
25
|
+
(): void;
|
|
26
|
+
};
|
|
27
|
+
on: <Name extends "timestamps" | "message" | keyof import("emittery").OmnipresentEventData>(eventName: Name | readonly Name[], listener: (eventData: ({
|
|
28
|
+
message: string;
|
|
29
|
+
timestamps: WordTimestamps;
|
|
30
|
+
} & import("emittery").OmnipresentEventData)[Name]) => void | Promise<void>) => import("emittery").UnsubscribeFunction;
|
|
31
|
+
off: <Name_1 extends "timestamps" | "message" | keyof import("emittery").OmnipresentEventData>(eventName: Name_1 | readonly Name_1[], listener: (eventData: ({
|
|
32
|
+
message: string;
|
|
33
|
+
timestamps: WordTimestamps;
|
|
34
|
+
} & import("emittery").OmnipresentEventData)[Name_1]) => void | Promise<void>) => void;
|
|
35
|
+
once: <Name_2 extends "timestamps" | "message" | keyof import("emittery").OmnipresentEventData>(eventName: Name_2 | readonly Name_2[]) => import("emittery").EmitteryOncePromise<({
|
|
36
|
+
message: string;
|
|
37
|
+
timestamps: WordTimestamps;
|
|
38
|
+
} & import("emittery").OmnipresentEventData)[Name_2]>;
|
|
39
|
+
events: <Name_3 extends "timestamps" | "message">(eventName: Name_3 | readonly Name_3[]) => AsyncIterableIterator<{
|
|
40
|
+
message: string;
|
|
41
|
+
timestamps: WordTimestamps;
|
|
42
|
+
}[Name_3]>;
|
|
43
|
+
source: Source;
|
|
44
|
+
};
|
|
45
|
+
continue(inputs: WebSocketTtsRequest): void;
|
|
46
|
+
/**
|
|
47
|
+
* Authenticate and connect to a Cartesia streaming WebSocket.
|
|
48
|
+
*
|
|
49
|
+
* @returns A promise that resolves when the WebSocket is connected.
|
|
50
|
+
* @throws {Error} If the WebSocket fails to connect.
|
|
51
|
+
*/
|
|
52
|
+
connect(options?: Options): Promise<EmitteryCallbacks<ConnectionEventData>>;
|
|
53
|
+
/**
|
|
54
|
+
* Disconnect from the Cartesia streaming WebSocket.
|
|
55
|
+
*/
|
|
56
|
+
disconnect(): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
35
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
36
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
37
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
38
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
39
|
+
};
|
|
40
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
41
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
42
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
43
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
44
|
+
};
|
|
45
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
+
};
|
|
48
|
+
var _Websocket_instances, _Websocket_isConnected, _Websocket_sampleRate, _Websocket_container, _Websocket_encoding, _Websocket_generateId;
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
const core = __importStar(require("../core"));
|
|
51
|
+
const environments = __importStar(require("../environments"));
|
|
52
|
+
const serializers = __importStar(require("../serialization"));
|
|
53
|
+
const emittery_1 = __importDefault(require("emittery"));
|
|
54
|
+
const human_id_1 = require("human-id");
|
|
55
|
+
const websocket_1 = require("../core/websocket");
|
|
56
|
+
const utils_1 = require("./utils");
|
|
57
|
+
const source_1 = __importDefault(require("./source"));
|
|
58
|
+
const qs_1 = __importDefault(require("qs"));
|
|
59
|
+
class Websocket {
|
|
60
|
+
constructor({ sampleRate, container, encoding }, options) {
|
|
61
|
+
this.options = options;
|
|
62
|
+
_Websocket_instances.add(this);
|
|
63
|
+
_Websocket_isConnected.set(this, false);
|
|
64
|
+
_Websocket_sampleRate.set(this, void 0);
|
|
65
|
+
_Websocket_container.set(this, void 0);
|
|
66
|
+
_Websocket_encoding.set(this, void 0);
|
|
67
|
+
__classPrivateFieldSet(this, _Websocket_sampleRate, sampleRate, "f");
|
|
68
|
+
__classPrivateFieldSet(this, _Websocket_container, container !== null && container !== void 0 ? container : "raw", "f");
|
|
69
|
+
__classPrivateFieldSet(this, _Websocket_encoding, encoding !== null && encoding !== void 0 ? encoding : "pcm_f32le", "f");
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Send a message over the WebSocket to start a stream.
|
|
73
|
+
*
|
|
74
|
+
* @param inputs - Generation parameters. Defined in the StreamRequest type.
|
|
75
|
+
* @param options - Options for the stream.
|
|
76
|
+
* @param options.timeout - The maximum time to wait for a chunk before cancelling the stream.
|
|
77
|
+
* If set to `0`, the stream will not time out.
|
|
78
|
+
* @returns A Source object that can be passed to a Player to play the audio.
|
|
79
|
+
* @returns An Emittery instance that emits messages from the WebSocket.
|
|
80
|
+
* @returns An abort function that can be called to cancel the stream.
|
|
81
|
+
*/
|
|
82
|
+
send(inputs, { timeout = 0 } = {}) {
|
|
83
|
+
var _a, _b, _c, _d;
|
|
84
|
+
if (!__classPrivateFieldGet(this, _Websocket_isConnected, "f")) {
|
|
85
|
+
throw new Error("Not connected to WebSocket. Call .connect() first.");
|
|
86
|
+
}
|
|
87
|
+
if (!inputs.contextId) {
|
|
88
|
+
inputs.contextId = __classPrivateFieldGet(this, _Websocket_instances, "m", _Websocket_generateId).call(this);
|
|
89
|
+
}
|
|
90
|
+
if (!inputs.outputFormat) {
|
|
91
|
+
inputs.outputFormat = (0, utils_1.resolveOutputFormat)(__classPrivateFieldGet(this, _Websocket_container, "f"), __classPrivateFieldGet(this, _Websocket_encoding, "f"), __classPrivateFieldGet(this, _Websocket_sampleRate, "f"));
|
|
92
|
+
}
|
|
93
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify(serializers.WebSocketTtsRequest.jsonOrThrow(inputs, { unrecognizedObjectKeys: "strip" })));
|
|
94
|
+
const emitter = new emittery_1.default();
|
|
95
|
+
const source = new source_1.default({
|
|
96
|
+
sampleRate: __classPrivateFieldGet(this, _Websocket_sampleRate, "f"),
|
|
97
|
+
encoding: __classPrivateFieldGet(this, _Websocket_encoding, "f"),
|
|
98
|
+
container: __classPrivateFieldGet(this, _Websocket_container, "f"),
|
|
99
|
+
});
|
|
100
|
+
// Used to signal that the stream is complete, either because the
|
|
101
|
+
// WebSocket has closed, or because the stream has finished.
|
|
102
|
+
const streamCompleteController = new AbortController();
|
|
103
|
+
// Set a timeout.
|
|
104
|
+
let timeoutId = null;
|
|
105
|
+
if (timeout > 0) {
|
|
106
|
+
timeoutId = setTimeout(streamCompleteController.abort, timeout);
|
|
107
|
+
}
|
|
108
|
+
const handleMessage = (0, utils_1.createMessageHandlerForContextId)(inputs.contextId, ({ chunk, message, data }) => __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
emitter.emit("message", message);
|
|
110
|
+
if (data.type === "timestamps" && data.wordTimestamps) {
|
|
111
|
+
emitter.emit("timestamps", data.wordTimestamps);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if ((0, utils_1.isSentinel)(chunk)) {
|
|
115
|
+
yield source.close();
|
|
116
|
+
streamCompleteController.abort();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (timeoutId) {
|
|
120
|
+
clearTimeout(timeoutId);
|
|
121
|
+
timeoutId = setTimeout(streamCompleteController.abort, timeout);
|
|
122
|
+
}
|
|
123
|
+
if (!chunk) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
yield source.enqueue((0, utils_1.base64ToArray)([chunk], __classPrivateFieldGet(this, _Websocket_encoding, "f")));
|
|
127
|
+
}));
|
|
128
|
+
(_b = this.socket) === null || _b === void 0 ? void 0 : _b.addEventListener("message", handleMessage);
|
|
129
|
+
(_c = this.socket) === null || _c === void 0 ? void 0 : _c.addEventListener("close", () => {
|
|
130
|
+
streamCompleteController.abort();
|
|
131
|
+
});
|
|
132
|
+
(_d = this.socket) === null || _d === void 0 ? void 0 : _d.addEventListener("error", () => {
|
|
133
|
+
streamCompleteController.abort();
|
|
134
|
+
});
|
|
135
|
+
streamCompleteController.signal.addEventListener("abort", () => {
|
|
136
|
+
source.close();
|
|
137
|
+
if (timeoutId) {
|
|
138
|
+
clearTimeout(timeoutId);
|
|
139
|
+
}
|
|
140
|
+
emitter.clearListeners();
|
|
141
|
+
});
|
|
142
|
+
return Object.assign(Object.assign({ source }, (0, utils_1.getEmitteryCallbacks)(emitter)), { stop: streamCompleteController.abort.bind(streamCompleteController) });
|
|
143
|
+
}
|
|
144
|
+
continue(inputs) {
|
|
145
|
+
var _a;
|
|
146
|
+
if (!__classPrivateFieldGet(this, _Websocket_isConnected, "f")) {
|
|
147
|
+
throw new Error("Not connected to WebSocket. Call .connect() first.");
|
|
148
|
+
}
|
|
149
|
+
if (!inputs.contextId) {
|
|
150
|
+
throw new Error("context_id is required to continue a context.");
|
|
151
|
+
}
|
|
152
|
+
if (!inputs.outputFormat) {
|
|
153
|
+
inputs.outputFormat = (0, utils_1.resolveOutputFormat)(__classPrivateFieldGet(this, _Websocket_container, "f"), __classPrivateFieldGet(this, _Websocket_encoding, "f"), __classPrivateFieldGet(this, _Websocket_sampleRate, "f"));
|
|
154
|
+
}
|
|
155
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify(Object.assign({ continue: true }, serializers.WebSocketTtsRequest.jsonOrThrow(inputs, { unrecognizedObjectKeys: "strip" }))));
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Authenticate and connect to a Cartesia streaming WebSocket.
|
|
159
|
+
*
|
|
160
|
+
* @returns A promise that resolves when the WebSocket is connected.
|
|
161
|
+
* @throws {Error} If the WebSocket fails to connect.
|
|
162
|
+
*/
|
|
163
|
+
connect(options = {}) {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
if (__classPrivateFieldGet(this, _Websocket_isConnected, "f")) {
|
|
166
|
+
throw new Error("WebSocket is already connected.");
|
|
167
|
+
}
|
|
168
|
+
const emitter = new emittery_1.default();
|
|
169
|
+
this.socket = new websocket_1.ReconnectingWebSocket(() => __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
var _a;
|
|
171
|
+
const baseUrl = ((_a = (yield core.Supplier.get(this.options.environment))) !== null && _a !== void 0 ? _a : environments.CartesiaEnvironment.Production).replace(/^https?:\/\//, "");
|
|
172
|
+
const params = {
|
|
173
|
+
api_key: this.options.apiKeyHeader,
|
|
174
|
+
cartesia_version: this.options.cartesiaVersion,
|
|
175
|
+
};
|
|
176
|
+
return `wss://${baseUrl}/tts/websocket${qs_1.default.stringify(params, { addQueryPrefix: true })}`;
|
|
177
|
+
}), undefined, options);
|
|
178
|
+
this.socket.reconnect();
|
|
179
|
+
this.socket.onopen = () => {
|
|
180
|
+
__classPrivateFieldSet(this, _Websocket_isConnected, true, "f");
|
|
181
|
+
emitter.emit("open");
|
|
182
|
+
};
|
|
183
|
+
this.socket.onclose = () => {
|
|
184
|
+
__classPrivateFieldSet(this, _Websocket_isConnected, false, "f");
|
|
185
|
+
emitter.emit("close");
|
|
186
|
+
};
|
|
187
|
+
return new Promise((resolve, reject) => {
|
|
188
|
+
var _a, _b, _c;
|
|
189
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.addEventListener("open", () => {
|
|
190
|
+
resolve((0, utils_1.getEmitteryCallbacks)(emitter));
|
|
191
|
+
});
|
|
192
|
+
const aborter = new AbortController();
|
|
193
|
+
(_b = this.socket) === null || _b === void 0 ? void 0 : _b.addEventListener("error", () => {
|
|
194
|
+
aborter.abort();
|
|
195
|
+
reject(new Error("WebSocket failed to connect."));
|
|
196
|
+
});
|
|
197
|
+
(_c = this.socket) === null || _c === void 0 ? void 0 : _c.addEventListener("close", () => {
|
|
198
|
+
aborter.abort();
|
|
199
|
+
reject(new Error("WebSocket closed before it could connect."));
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Disconnect from the Cartesia streaming WebSocket.
|
|
206
|
+
*/
|
|
207
|
+
disconnect() {
|
|
208
|
+
var _a;
|
|
209
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.close();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.default = Websocket;
|
|
213
|
+
_Websocket_isConnected = new WeakMap(), _Websocket_sampleRate = new WeakMap(), _Websocket_container = new WeakMap(), _Websocket_encoding = new WeakMap(), _Websocket_instances = new WeakSet(), _Websocket_generateId = function _Websocket_generateId() {
|
|
214
|
+
return (0, human_id_1.humanId)({
|
|
215
|
+
separator: "-",
|
|
216
|
+
capitalize: false,
|
|
217
|
+
});
|
|
218
|
+
};
|
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type EncodingInfo = {
|
|
6
|
-
arrayType: Float32ArrayConstructor | Int16ArrayConstructor | Uint8ArrayConstructor;
|
|
7
|
-
bytesPerElement: number;
|
|
8
|
-
};
|
|
9
|
-
declare const ENCODING_MAP: Record<Encoding, EncodingInfo>;
|
|
10
|
-
declare class Source {
|
|
1
|
+
import { RawEncoding } from "../api";
|
|
2
|
+
import { SourceEventData, TypedArray } from "./utils";
|
|
3
|
+
export default class Source {
|
|
11
4
|
#private;
|
|
12
|
-
on: <Name extends keyof
|
|
13
|
-
once: <Name extends keyof
|
|
5
|
+
on: <Name extends keyof import("emittery").OmnipresentEventData | keyof SourceEventData>(eventName: Name | readonly Name[], listener: (eventData: (SourceEventData & import("emittery").OmnipresentEventData)[Name]) => void | Promise<void>) => import("emittery").UnsubscribeFunction;
|
|
6
|
+
once: <Name extends keyof import("emittery").OmnipresentEventData | keyof SourceEventData>(eventName: Name | readonly Name[]) => import("emittery").EmitteryOncePromise<(SourceEventData & import("emittery").OmnipresentEventData)[Name]>;
|
|
14
7
|
events: <Name extends keyof SourceEventData>(eventName: Name | readonly Name[]) => AsyncIterableIterator<SourceEventData[Name]>;
|
|
15
|
-
off: <Name extends keyof
|
|
8
|
+
off: <Name extends keyof import("emittery").OmnipresentEventData | keyof SourceEventData>(eventName: Name | readonly Name[], listener: (eventData: (SourceEventData & import("emittery").OmnipresentEventData)[Name]) => void | Promise<void>) => void;
|
|
16
9
|
/**
|
|
17
10
|
* Create a new Source.
|
|
18
11
|
*
|
|
19
12
|
* @param options - Options for the Source.
|
|
20
13
|
* @param options.sampleRate - The sample rate of the audio.
|
|
21
14
|
*/
|
|
22
|
-
constructor({ sampleRate, encoding, container
|
|
15
|
+
constructor({ sampleRate, encoding, container }: {
|
|
23
16
|
sampleRate: number;
|
|
24
17
|
encoding: string;
|
|
25
18
|
container: string;
|
|
26
19
|
});
|
|
27
20
|
get sampleRate(): number;
|
|
28
|
-
get encoding():
|
|
21
|
+
get encoding(): RawEncoding;
|
|
29
22
|
get container(): string;
|
|
30
23
|
/**
|
|
31
24
|
* Append audio to the buffer.
|
|
@@ -69,5 +62,3 @@ declare class Source {
|
|
|
69
62
|
*/
|
|
70
63
|
close(): Promise<void>;
|
|
71
64
|
}
|
|
72
|
-
|
|
73
|
-
export { ENCODING_MAP, Source as default };
|