@cartesia/cartesia-js 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,179 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
var _Source_instances, _Source_emitter, _Source_buffer, _Source_readIndex, _Source_writeIndex, _Source_closed, _Source_sampleRate, _Source_encoding, _Source_container, _Source_createBuffer;
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
const emittery_1 = __importDefault(require("emittery"));
|
|
28
|
+
const utils_1 = require("./utils");
|
|
29
|
+
class Source {
|
|
30
|
+
/**
|
|
31
|
+
* Create a new Source.
|
|
32
|
+
*
|
|
33
|
+
* @param options - Options for the Source.
|
|
34
|
+
* @param options.sampleRate - The sample rate of the audio.
|
|
35
|
+
*/
|
|
36
|
+
constructor({ sampleRate, encoding, container }) {
|
|
37
|
+
_Source_instances.add(this);
|
|
38
|
+
_Source_emitter.set(this, new emittery_1.default());
|
|
39
|
+
_Source_buffer.set(this, void 0);
|
|
40
|
+
_Source_readIndex.set(this, 0);
|
|
41
|
+
_Source_writeIndex.set(this, 0);
|
|
42
|
+
_Source_closed.set(this, false);
|
|
43
|
+
_Source_sampleRate.set(this, void 0);
|
|
44
|
+
_Source_encoding.set(this, void 0);
|
|
45
|
+
_Source_container.set(this, void 0);
|
|
46
|
+
this.on = __classPrivateFieldGet(this, _Source_emitter, "f").on.bind(__classPrivateFieldGet(this, _Source_emitter, "f"));
|
|
47
|
+
this.once = __classPrivateFieldGet(this, _Source_emitter, "f").once.bind(__classPrivateFieldGet(this, _Source_emitter, "f"));
|
|
48
|
+
this.events = __classPrivateFieldGet(this, _Source_emitter, "f").events.bind(__classPrivateFieldGet(this, _Source_emitter, "f"));
|
|
49
|
+
this.off = __classPrivateFieldGet(this, _Source_emitter, "f").off.bind(__classPrivateFieldGet(this, _Source_emitter, "f"));
|
|
50
|
+
__classPrivateFieldSet(this, _Source_sampleRate, sampleRate, "f");
|
|
51
|
+
__classPrivateFieldSet(this, _Source_encoding, encoding, "f");
|
|
52
|
+
__classPrivateFieldSet(this, _Source_container, container, "f");
|
|
53
|
+
__classPrivateFieldSet(this, _Source_buffer, __classPrivateFieldGet(this, _Source_instances, "m", _Source_createBuffer).call(this, 1024), "f"); // Initial size, can be adjusted
|
|
54
|
+
}
|
|
55
|
+
get sampleRate() {
|
|
56
|
+
return __classPrivateFieldGet(this, _Source_sampleRate, "f");
|
|
57
|
+
}
|
|
58
|
+
get encoding() {
|
|
59
|
+
return __classPrivateFieldGet(this, _Source_encoding, "f");
|
|
60
|
+
}
|
|
61
|
+
get container() {
|
|
62
|
+
return __classPrivateFieldGet(this, _Source_container, "f");
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Append audio to the buffer.
|
|
66
|
+
*
|
|
67
|
+
* @param src The audio to append.
|
|
68
|
+
*/
|
|
69
|
+
enqueue(src) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const requiredCapacity = __classPrivateFieldGet(this, _Source_writeIndex, "f") + src.length;
|
|
72
|
+
// Resize buffer if necessary
|
|
73
|
+
if (requiredCapacity > __classPrivateFieldGet(this, _Source_buffer, "f").length) {
|
|
74
|
+
let newCapacity = __classPrivateFieldGet(this, _Source_buffer, "f").length;
|
|
75
|
+
while (newCapacity < requiredCapacity) {
|
|
76
|
+
newCapacity *= 2; // Double the buffer size
|
|
77
|
+
}
|
|
78
|
+
const newBuffer = __classPrivateFieldGet(this, _Source_instances, "m", _Source_createBuffer).call(this, newCapacity);
|
|
79
|
+
newBuffer.set(__classPrivateFieldGet(this, _Source_buffer, "f"));
|
|
80
|
+
__classPrivateFieldSet(this, _Source_buffer, newBuffer, "f");
|
|
81
|
+
}
|
|
82
|
+
// Append the audio to the buffer.
|
|
83
|
+
__classPrivateFieldGet(this, _Source_buffer, "f").set(src, __classPrivateFieldGet(this, _Source_writeIndex, "f"));
|
|
84
|
+
__classPrivateFieldSet(this, _Source_writeIndex, __classPrivateFieldGet(this, _Source_writeIndex, "f") + src.length, "f");
|
|
85
|
+
yield __classPrivateFieldGet(this, _Source_emitter, "f").emit("enqueue");
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Read audio from the buffer.
|
|
90
|
+
*
|
|
91
|
+
* @param dst The buffer to read the audio into.
|
|
92
|
+
* @returns The number of samples read. If the source is closed, this will be
|
|
93
|
+
* less than the length of the provided buffer.
|
|
94
|
+
*/
|
|
95
|
+
read(dst) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
// Read the buffer into the provided buffer.
|
|
98
|
+
const targetReadIndex = __classPrivateFieldGet(this, _Source_readIndex, "f") + dst.length;
|
|
99
|
+
while (!__classPrivateFieldGet(this, _Source_closed, "f") && targetReadIndex > __classPrivateFieldGet(this, _Source_writeIndex, "f")) {
|
|
100
|
+
// Wait for more audio to be enqueued.
|
|
101
|
+
yield __classPrivateFieldGet(this, _Source_emitter, "f").emit("wait");
|
|
102
|
+
yield Promise.race([__classPrivateFieldGet(this, _Source_emitter, "f").once("enqueue"), __classPrivateFieldGet(this, _Source_emitter, "f").once("close")]);
|
|
103
|
+
yield __classPrivateFieldGet(this, _Source_emitter, "f").emit("read");
|
|
104
|
+
}
|
|
105
|
+
const read = Math.min(dst.length, __classPrivateFieldGet(this, _Source_writeIndex, "f") - __classPrivateFieldGet(this, _Source_readIndex, "f"));
|
|
106
|
+
dst.set(__classPrivateFieldGet(this, _Source_buffer, "f").subarray(__classPrivateFieldGet(this, _Source_readIndex, "f"), __classPrivateFieldGet(this, _Source_readIndex, "f") + read));
|
|
107
|
+
__classPrivateFieldSet(this, _Source_readIndex, __classPrivateFieldGet(this, _Source_readIndex, "f") + read, "f");
|
|
108
|
+
return read;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Seek in the buffer.
|
|
113
|
+
*
|
|
114
|
+
* @param offset The offset to seek to.
|
|
115
|
+
* @param whence The position to seek from.
|
|
116
|
+
* @returns The new position in the buffer.
|
|
117
|
+
* @throws {Error} If the seek is invalid.
|
|
118
|
+
*/
|
|
119
|
+
seek(offset, whence) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
let position = __classPrivateFieldGet(this, _Source_readIndex, "f");
|
|
122
|
+
switch (whence) {
|
|
123
|
+
case "start":
|
|
124
|
+
position = offset;
|
|
125
|
+
break;
|
|
126
|
+
case "current":
|
|
127
|
+
position += offset;
|
|
128
|
+
break;
|
|
129
|
+
case "end":
|
|
130
|
+
position = __classPrivateFieldGet(this, _Source_writeIndex, "f") + offset;
|
|
131
|
+
break;
|
|
132
|
+
default:
|
|
133
|
+
throw new Error(`Invalid seek mode: ${whence}`);
|
|
134
|
+
}
|
|
135
|
+
if (position < 0 || position > __classPrivateFieldGet(this, _Source_writeIndex, "f")) {
|
|
136
|
+
throw new Error("Seek out of bounds");
|
|
137
|
+
}
|
|
138
|
+
__classPrivateFieldSet(this, _Source_readIndex, position, "f");
|
|
139
|
+
return position;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get the number of samples in a given duration.
|
|
144
|
+
*
|
|
145
|
+
* @param durationSecs The duration in seconds.
|
|
146
|
+
* @returns The number of samples.
|
|
147
|
+
*/
|
|
148
|
+
durationToSampleCount(durationSecs) {
|
|
149
|
+
return Math.trunc(durationSecs * __classPrivateFieldGet(this, _Source_sampleRate, "f"));
|
|
150
|
+
}
|
|
151
|
+
get buffer() {
|
|
152
|
+
return __classPrivateFieldGet(this, _Source_buffer, "f");
|
|
153
|
+
}
|
|
154
|
+
get readIndex() {
|
|
155
|
+
return __classPrivateFieldGet(this, _Source_readIndex, "f");
|
|
156
|
+
}
|
|
157
|
+
get writeIndex() {
|
|
158
|
+
return __classPrivateFieldGet(this, _Source_writeIndex, "f");
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Close the source. This signals that no more audio will be enqueued.
|
|
162
|
+
*
|
|
163
|
+
* This will emit a "close" event.
|
|
164
|
+
*
|
|
165
|
+
* @returns A promise that resolves when the source is closed.
|
|
166
|
+
*/
|
|
167
|
+
close() {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
__classPrivateFieldSet(this, _Source_closed, true, "f");
|
|
170
|
+
yield __classPrivateFieldGet(this, _Source_emitter, "f").emit("close");
|
|
171
|
+
__classPrivateFieldGet(this, _Source_emitter, "f").clearListeners();
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.default = Source;
|
|
176
|
+
_Source_emitter = new WeakMap(), _Source_buffer = new WeakMap(), _Source_readIndex = new WeakMap(), _Source_writeIndex = new WeakMap(), _Source_closed = new WeakMap(), _Source_sampleRate = new WeakMap(), _Source_encoding = new WeakMap(), _Source_container = new WeakMap(), _Source_instances = new WeakSet(), _Source_createBuffer = function _Source_createBuffer(size) {
|
|
177
|
+
const { arrayType: ArrayType } = utils_1.ENCODING_MAP[__classPrivateFieldGet(this, _Source_encoding, "f")];
|
|
178
|
+
return new ArrayType(size);
|
|
179
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type Emittery from "emittery";
|
|
2
|
+
import type { OutputFormat, RawEncoding, WebSocketResponse } from "../api";
|
|
3
|
+
export declare type EmitteryCallbacks<T> = {
|
|
4
|
+
on: Emittery<T>["on"];
|
|
5
|
+
off: Emittery<T>["off"];
|
|
6
|
+
once: Emittery<T>["once"];
|
|
7
|
+
events: Emittery<T>["events"];
|
|
8
|
+
};
|
|
9
|
+
export declare type ConnectionEventData = {
|
|
10
|
+
open: never;
|
|
11
|
+
close: never;
|
|
12
|
+
};
|
|
13
|
+
export declare type SourceEventData = {
|
|
14
|
+
enqueue: never;
|
|
15
|
+
close: never;
|
|
16
|
+
wait: never;
|
|
17
|
+
read: never;
|
|
18
|
+
};
|
|
19
|
+
export declare type TypedArray = Float32Array | Int16Array | Uint8Array;
|
|
20
|
+
export declare type Sentinel = null;
|
|
21
|
+
export declare type Chunk = string | Sentinel;
|
|
22
|
+
export declare type WebSocketOptions = {
|
|
23
|
+
container?: string;
|
|
24
|
+
encoding?: string;
|
|
25
|
+
sampleRate: number;
|
|
26
|
+
};
|
|
27
|
+
export declare type Language = "en" | "es" | "fr" | "de" | "ja" | "zh" | "pt" | (string & {});
|
|
28
|
+
export declare type EncodingInfo = {
|
|
29
|
+
arrayType: Float32ArrayConstructor | Int16ArrayConstructor | Uint8ArrayConstructor;
|
|
30
|
+
bytesPerElement: number;
|
|
31
|
+
};
|
|
32
|
+
export declare const ENCODING_MAP: Record<RawEncoding, EncodingInfo>;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the output format for a WebSocket request.
|
|
35
|
+
*
|
|
36
|
+
* @param container - The container type for the output.
|
|
37
|
+
* @param encoding - The encoding of the audio.
|
|
38
|
+
* @param sampleRate - The sample rate of the audio.
|
|
39
|
+
* @returns The output format for the WebSocket request.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveOutputFormat(container: "raw" | "wav" | "mp3", encoding: RawEncoding, sampleRate: number): OutputFormat;
|
|
42
|
+
/**
|
|
43
|
+
* Convert base64-encoded audio buffer(s) to a TypedArray.
|
|
44
|
+
*
|
|
45
|
+
* @param b64 The base64-encoded audio buffer, or an array of base64-encoded
|
|
46
|
+
* audio buffers.
|
|
47
|
+
* @param encoding The encoding of the audio buffer(s).
|
|
48
|
+
* @returns The audio buffer(s) as a TypedArray.
|
|
49
|
+
*/
|
|
50
|
+
export declare function base64ToArray(b64: Chunk[], encoding: string): TypedArray;
|
|
51
|
+
/**
|
|
52
|
+
* Schedule an audio buffer to play at a given time in the passed context.
|
|
53
|
+
*
|
|
54
|
+
* @param floats The audio buffer to play.
|
|
55
|
+
* @param context The audio context to play the buffer in.
|
|
56
|
+
* @param startAt The time to start playing the buffer at.
|
|
57
|
+
* @param sampleRate The sample rate of the audio.
|
|
58
|
+
* @returns A promise that resolves when the audio has finished playing.
|
|
59
|
+
*/
|
|
60
|
+
export declare function playAudioBuffer(floats: Float32Array, context: AudioContext, startAt: number, sampleRate: number): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Unwraps a chunk of audio data from a message event and calls the
|
|
63
|
+
* handler with it if the context ID matches.
|
|
64
|
+
*
|
|
65
|
+
* @param contextId The context ID to listen for.
|
|
66
|
+
* @param handler The handler to call with the chunk of audio data.
|
|
67
|
+
* @returns A message event handler.
|
|
68
|
+
*/
|
|
69
|
+
export declare function createMessageHandlerForContextId(contextId: string, handler: ({ chunk, message }: {
|
|
70
|
+
chunk?: Chunk;
|
|
71
|
+
message: string;
|
|
72
|
+
data: WebSocketResponse;
|
|
73
|
+
}) => void): (event: MessageEvent) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Get a sentinel value that indicates the end of a stream.
|
|
76
|
+
* @returns A sentinel value to indicate the end of a stream.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getSentinel(): Sentinel;
|
|
79
|
+
/**
|
|
80
|
+
* Check if a chunk is a sentinel value (i.e. null).
|
|
81
|
+
*
|
|
82
|
+
* @param chunk
|
|
83
|
+
* @returns Whether the chunk is a sentinel value.
|
|
84
|
+
*/
|
|
85
|
+
export declare function isSentinel(x: unknown): x is Sentinel;
|
|
86
|
+
/**
|
|
87
|
+
* Filter out null values from a collection.
|
|
88
|
+
*
|
|
89
|
+
* @param collection The collection to filter.
|
|
90
|
+
* @returns The collection with null values removed.
|
|
91
|
+
*/
|
|
92
|
+
export declare function filterSentinel<T>(collection: T[]): Exclude<T, Sentinel>[];
|
|
93
|
+
/**
|
|
94
|
+
* Check if an array of chunks is complete by testing if the last chunk is a sentinel
|
|
95
|
+
* value (i.e. null).
|
|
96
|
+
* @param chunk
|
|
97
|
+
* @returns Whether the array of chunks is complete.
|
|
98
|
+
*/
|
|
99
|
+
export declare function isComplete(chunks: Chunk[]): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Get user-facing emitter callbacks for an Emittery instance.
|
|
102
|
+
* @param emitter The Emittery instance to get callbacks for.
|
|
103
|
+
* @returns User-facing emitter callbacks.
|
|
104
|
+
*/
|
|
105
|
+
export declare function getEmitteryCallbacks<T>(emitter: Emittery<T>): EmitteryCallbacks<T>;
|
package/wrapper/utils.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
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.getEmitteryCallbacks = exports.isComplete = exports.filterSentinel = exports.isSentinel = exports.getSentinel = exports.createMessageHandlerForContextId = exports.playAudioBuffer = exports.base64ToArray = exports.resolveOutputFormat = exports.ENCODING_MAP = void 0;
|
|
7
|
+
const base64_js_1 = __importDefault(require("base64-js"));
|
|
8
|
+
exports.ENCODING_MAP = {
|
|
9
|
+
pcm_f32le: { arrayType: Float32Array, bytesPerElement: 4 },
|
|
10
|
+
pcm_s16le: { arrayType: Int16Array, bytesPerElement: 2 },
|
|
11
|
+
pcm_alaw: { arrayType: Uint8Array, bytesPerElement: 1 },
|
|
12
|
+
pcm_mulaw: { arrayType: Uint8Array, bytesPerElement: 1 },
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the output format for a WebSocket request.
|
|
16
|
+
*
|
|
17
|
+
* @param container - The container type for the output.
|
|
18
|
+
* @param encoding - The encoding of the audio.
|
|
19
|
+
* @param sampleRate - The sample rate of the audio.
|
|
20
|
+
* @returns The output format for the WebSocket request.
|
|
21
|
+
*/
|
|
22
|
+
function resolveOutputFormat(container, encoding, sampleRate) {
|
|
23
|
+
switch (container) {
|
|
24
|
+
case "wav":
|
|
25
|
+
return {
|
|
26
|
+
container: "wav",
|
|
27
|
+
encoding,
|
|
28
|
+
sampleRate,
|
|
29
|
+
};
|
|
30
|
+
case "raw":
|
|
31
|
+
return {
|
|
32
|
+
container: "raw",
|
|
33
|
+
encoding,
|
|
34
|
+
sampleRate,
|
|
35
|
+
};
|
|
36
|
+
case "mp3":
|
|
37
|
+
return {
|
|
38
|
+
container: "mp3",
|
|
39
|
+
encoding,
|
|
40
|
+
sampleRate,
|
|
41
|
+
bitRate: 128,
|
|
42
|
+
};
|
|
43
|
+
default:
|
|
44
|
+
throw new Error(`Unsupported container type: ${container}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.resolveOutputFormat = resolveOutputFormat;
|
|
48
|
+
/**
|
|
49
|
+
* Convert base64-encoded audio buffer(s) to a TypedArray.
|
|
50
|
+
*
|
|
51
|
+
* @param b64 The base64-encoded audio buffer, or an array of base64-encoded
|
|
52
|
+
* audio buffers.
|
|
53
|
+
* @param encoding The encoding of the audio buffer(s).
|
|
54
|
+
* @returns The audio buffer(s) as a TypedArray.
|
|
55
|
+
*/
|
|
56
|
+
function base64ToArray(b64, encoding) {
|
|
57
|
+
const byteArrays = filterSentinel(b64).map((b) => base64_js_1.default.toByteArray(b));
|
|
58
|
+
const { arrayType: ArrayType, bytesPerElement } = exports.ENCODING_MAP[encoding];
|
|
59
|
+
const totalLength = byteArrays.reduce((acc, arr) => acc + arr.length / bytesPerElement, 0);
|
|
60
|
+
const result = new ArrayType(totalLength);
|
|
61
|
+
let offset = 0;
|
|
62
|
+
for (const arr of byteArrays) {
|
|
63
|
+
const floats = new ArrayType(arr.buffer);
|
|
64
|
+
result.set(floats, offset);
|
|
65
|
+
offset += floats.length;
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
exports.base64ToArray = base64ToArray;
|
|
70
|
+
/**
|
|
71
|
+
* Schedule an audio buffer to play at a given time in the passed context.
|
|
72
|
+
*
|
|
73
|
+
* @param floats The audio buffer to play.
|
|
74
|
+
* @param context The audio context to play the buffer in.
|
|
75
|
+
* @param startAt The time to start playing the buffer at.
|
|
76
|
+
* @param sampleRate The sample rate of the audio.
|
|
77
|
+
* @returns A promise that resolves when the audio has finished playing.
|
|
78
|
+
*/
|
|
79
|
+
function playAudioBuffer(floats, context, startAt, sampleRate) {
|
|
80
|
+
const source = context.createBufferSource();
|
|
81
|
+
const buffer = context.createBuffer(1, floats.length, sampleRate);
|
|
82
|
+
buffer.getChannelData(0).set(floats);
|
|
83
|
+
source.buffer = buffer;
|
|
84
|
+
source.connect(context.destination);
|
|
85
|
+
source.start(startAt);
|
|
86
|
+
return new Promise((resolve) => {
|
|
87
|
+
source.onended = () => {
|
|
88
|
+
resolve();
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
exports.playAudioBuffer = playAudioBuffer;
|
|
93
|
+
/**
|
|
94
|
+
* Unwraps a chunk of audio data from a message event and calls the
|
|
95
|
+
* handler with it if the context ID matches.
|
|
96
|
+
*
|
|
97
|
+
* @param contextId The context ID to listen for.
|
|
98
|
+
* @param handler The handler to call with the chunk of audio data.
|
|
99
|
+
* @returns A message event handler.
|
|
100
|
+
*/
|
|
101
|
+
function createMessageHandlerForContextId(contextId, handler) {
|
|
102
|
+
return (event) => {
|
|
103
|
+
if (typeof event.data !== "string") {
|
|
104
|
+
return; // Ignore non-string messages.
|
|
105
|
+
}
|
|
106
|
+
const message = JSON.parse(event.data);
|
|
107
|
+
if (message.context_id !== contextId) {
|
|
108
|
+
return; // Ignore messages for other contexts.
|
|
109
|
+
}
|
|
110
|
+
let chunk;
|
|
111
|
+
if (message.done) {
|
|
112
|
+
// Convert the done message to a sentinel value.
|
|
113
|
+
chunk = getSentinel();
|
|
114
|
+
}
|
|
115
|
+
else if (message.type === "chunk") {
|
|
116
|
+
chunk = message.data;
|
|
117
|
+
}
|
|
118
|
+
handler({ chunk, message: event.data, data: message });
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
exports.createMessageHandlerForContextId = createMessageHandlerForContextId;
|
|
122
|
+
/**
|
|
123
|
+
* Get a sentinel value that indicates the end of a stream.
|
|
124
|
+
* @returns A sentinel value to indicate the end of a stream.
|
|
125
|
+
*/
|
|
126
|
+
function getSentinel() {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
exports.getSentinel = getSentinel;
|
|
130
|
+
/**
|
|
131
|
+
* Check if a chunk is a sentinel value (i.e. null).
|
|
132
|
+
*
|
|
133
|
+
* @param chunk
|
|
134
|
+
* @returns Whether the chunk is a sentinel value.
|
|
135
|
+
*/
|
|
136
|
+
function isSentinel(x) {
|
|
137
|
+
return x === getSentinel();
|
|
138
|
+
}
|
|
139
|
+
exports.isSentinel = isSentinel;
|
|
140
|
+
/**
|
|
141
|
+
* Filter out null values from a collection.
|
|
142
|
+
*
|
|
143
|
+
* @param collection The collection to filter.
|
|
144
|
+
* @returns The collection with null values removed.
|
|
145
|
+
*/
|
|
146
|
+
function filterSentinel(collection) {
|
|
147
|
+
return collection.filter((x) => !isSentinel(x));
|
|
148
|
+
}
|
|
149
|
+
exports.filterSentinel = filterSentinel;
|
|
150
|
+
/**
|
|
151
|
+
* Check if an array of chunks is complete by testing if the last chunk is a sentinel
|
|
152
|
+
* value (i.e. null).
|
|
153
|
+
* @param chunk
|
|
154
|
+
* @returns Whether the array of chunks is complete.
|
|
155
|
+
*/
|
|
156
|
+
function isComplete(chunks) {
|
|
157
|
+
return isSentinel(chunks[chunks.length - 1]);
|
|
158
|
+
}
|
|
159
|
+
exports.isComplete = isComplete;
|
|
160
|
+
/**
|
|
161
|
+
* Get user-facing emitter callbacks for an Emittery instance.
|
|
162
|
+
* @param emitter The Emittery instance to get callbacks for.
|
|
163
|
+
* @returns User-facing emitter callbacks.
|
|
164
|
+
*/
|
|
165
|
+
function getEmitteryCallbacks(emitter) {
|
|
166
|
+
return {
|
|
167
|
+
on: emitter.on.bind(emitter),
|
|
168
|
+
off: emitter.off.bind(emitter),
|
|
169
|
+
once: emitter.once.bind(emitter),
|
|
170
|
+
events: emitter.events.bind(emitter),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
exports.getEmitteryCallbacks = getEmitteryCallbacks;
|
package/CHANGELOG.md
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# @cartesia/cartesia-js
|
|
2
|
-
|
|
3
|
-
## 1.1.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- ed6be65: Add WebSocket continue method for input streaming with contexts
|
|
8
|
-
|
|
9
|
-
## 1.0.3
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- 9b157d6: Support Bun by adding socket binaryType
|
|
14
|
-
|
|
15
|
-
## 1.0.2
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- Make voice creation and cloning fully compatible with API.
|
|
20
|
-
|
|
21
|
-
## 1.0.1
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- cb7adc2: Introduces support for continuations, timestamps, voice control and multiple output formats. Improves typing and error handling for the package.
|
|
26
|
-
|
|
27
|
-
## 1.0.0
|
|
28
|
-
|
|
29
|
-
### Major Changes
|
|
30
|
-
|
|
31
|
-
- 3ee5bfc: Initial release of Cartesia client with voices and WebSocket support
|
|
32
|
-
|
|
33
|
-
### Minor Changes
|
|
34
|
-
|
|
35
|
-
- e49f73a: Stabilize audio playback in the browser to support play/pause functionality.
|
|
36
|
-
|
|
37
|
-
### Patch Changes
|
|
38
|
-
|
|
39
|
-
- c98a0c7: Fix typo in README
|
|
40
|
-
- 38af01f: Fix how URLs are constructed, solving WebSocket connection failure
|
|
41
|
-
- 8ecf940: Add provisional Node.js support
|
|
42
|
-
- 585d2c9: Makes JS client compatible with the Cartesia Stable API (2024-06-10)
|
|
43
|
-
|
|
44
|
-
## 1.0.0-alpha.4
|
|
45
|
-
|
|
46
|
-
### Patch Changes
|
|
47
|
-
|
|
48
|
-
- c98a0c7: Fix typo in README
|
|
49
|
-
|
|
50
|
-
## 1.0.0-alpha.3
|
|
51
|
-
|
|
52
|
-
### Patch Changes
|
|
53
|
-
|
|
54
|
-
- 38af01f: Fix how URLs are constructed, solving WebSocket connection failure
|
|
55
|
-
|
|
56
|
-
## 1.0.0-alpha.2
|
|
57
|
-
|
|
58
|
-
### Patch Changes
|
|
59
|
-
|
|
60
|
-
- 585d2c9: Makes JS client compatible with the Cartesia Stable API (2024-06-10)
|
|
61
|
-
|
|
62
|
-
## 1.0.0-alpha.1
|
|
63
|
-
|
|
64
|
-
### Major Changes
|
|
65
|
-
|
|
66
|
-
- 3ee5bfc: Initial release of Cartesia client with voices and WebSocket support
|
|
67
|
-
|
|
68
|
-
## 0.0.4-alpha.0
|
|
69
|
-
|
|
70
|
-
### Patch Changes
|
|
71
|
-
|
|
72
|
-
- 8ecf940: Add provisional Node.js support
|
|
73
|
-
|
|
74
|
-
## 0.0.3
|
|
75
|
-
|
|
76
|
-
### Patch Changes
|
|
77
|
-
|
|
78
|
-
- 8b671ff: Revert queuing feature
|
|
79
|
-
|
|
80
|
-
## 0.0.2
|
|
81
|
-
|
|
82
|
-
### Patch Changes
|
|
83
|
-
|
|
84
|
-
- 9a31c66: Improve error handling logic, add connection info, make audio downloadable, add latency metrics, more robust reconnection handling, and misc. changes
|
|
85
|
-
|
|
86
|
-
## 0.0.1
|
|
87
|
-
|
|
88
|
-
### Patch Changes
|
|
89
|
-
|
|
90
|
-
- 0ea132f: Publish Cartesia JS client
|
package/LICENSE.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Cartesia AI, Inc.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/chunk-2BFEKY3F.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// src/lib/constants.ts
|
|
2
|
-
var BASE_URL = "https://api.cartesia.ai";
|
|
3
|
-
var CARTESIA_VERSION = "2024-06-10";
|
|
4
|
-
var constructApiUrl = (baseUrl, path, { websocket = false } = {}) => {
|
|
5
|
-
const url = new URL(path, baseUrl);
|
|
6
|
-
if (websocket) {
|
|
7
|
-
url.protocol = baseUrl.replace(/^http/, "ws");
|
|
8
|
-
}
|
|
9
|
-
return url;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
BASE_URL,
|
|
14
|
-
CARTESIA_VERSION,
|
|
15
|
-
constructApiUrl
|
|
16
|
-
};
|
package/dist/chunk-5SBAQNWQ.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ENCODING_MAP
|
|
3
|
-
} from "./chunk-I5YVYTNK.js";
|
|
4
|
-
|
|
5
|
-
// src/tts/utils.ts
|
|
6
|
-
import base64 from "base64-js";
|
|
7
|
-
function base64ToArray(b64, encoding) {
|
|
8
|
-
const byteArrays = filterSentinel(b64).map((b) => base64.toByteArray(b));
|
|
9
|
-
const { arrayType: ArrayType, bytesPerElement } = ENCODING_MAP[encoding];
|
|
10
|
-
const totalLength = byteArrays.reduce(
|
|
11
|
-
(acc, arr) => acc + arr.length / bytesPerElement,
|
|
12
|
-
0
|
|
13
|
-
);
|
|
14
|
-
const result = new ArrayType(totalLength);
|
|
15
|
-
let offset = 0;
|
|
16
|
-
for (const arr of byteArrays) {
|
|
17
|
-
const floats = new ArrayType(arr.buffer);
|
|
18
|
-
result.set(floats, offset);
|
|
19
|
-
offset += floats.length;
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
function playAudioBuffer(floats, context, startAt, sampleRate) {
|
|
24
|
-
const source = context.createBufferSource();
|
|
25
|
-
const buffer = context.createBuffer(1, floats.length, sampleRate);
|
|
26
|
-
buffer.getChannelData(0).set(floats);
|
|
27
|
-
source.buffer = buffer;
|
|
28
|
-
source.connect(context.destination);
|
|
29
|
-
source.start(startAt);
|
|
30
|
-
return new Promise((resolve) => {
|
|
31
|
-
source.onended = () => {
|
|
32
|
-
resolve();
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function createMessageHandlerForContextId(contextId, handler) {
|
|
37
|
-
return (event) => {
|
|
38
|
-
if (typeof event.data !== "string") {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const message = JSON.parse(event.data);
|
|
42
|
-
if (message.context_id !== contextId) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
let chunk;
|
|
46
|
-
if (message.done) {
|
|
47
|
-
chunk = getSentinel();
|
|
48
|
-
} else if (message.type === "chunk") {
|
|
49
|
-
chunk = message.data;
|
|
50
|
-
}
|
|
51
|
-
handler({ chunk, message: event.data, data: message });
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function getSentinel() {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
function isSentinel(x) {
|
|
58
|
-
return x === getSentinel();
|
|
59
|
-
}
|
|
60
|
-
function filterSentinel(collection) {
|
|
61
|
-
return collection.filter(
|
|
62
|
-
(x) => !isSentinel(x)
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
function isComplete(chunks) {
|
|
66
|
-
return isSentinel(chunks[chunks.length - 1]);
|
|
67
|
-
}
|
|
68
|
-
function getEmitteryCallbacks(emitter) {
|
|
69
|
-
return {
|
|
70
|
-
on: emitter.on.bind(emitter),
|
|
71
|
-
off: emitter.off.bind(emitter),
|
|
72
|
-
once: emitter.once.bind(emitter),
|
|
73
|
-
events: emitter.events.bind(emitter)
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export {
|
|
78
|
-
base64ToArray,
|
|
79
|
-
playAudioBuffer,
|
|
80
|
-
createMessageHandlerForContextId,
|
|
81
|
-
getSentinel,
|
|
82
|
-
isSentinel,
|
|
83
|
-
filterSentinel,
|
|
84
|
-
isComplete,
|
|
85
|
-
getEmitteryCallbacks
|
|
86
|
-
};
|