@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
package/dist/chunk-CJZSHIRI.js
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Client
|
|
3
|
-
} from "./chunk-FLWYXP5Z.js";
|
|
4
|
-
import {
|
|
5
|
-
CARTESIA_VERSION,
|
|
6
|
-
constructApiUrl
|
|
7
|
-
} from "./chunk-2BFEKY3F.js";
|
|
8
|
-
import {
|
|
9
|
-
base64ToArray,
|
|
10
|
-
createMessageHandlerForContextId,
|
|
11
|
-
getEmitteryCallbacks,
|
|
12
|
-
isSentinel
|
|
13
|
-
} from "./chunk-5SBAQNWQ.js";
|
|
14
|
-
import {
|
|
15
|
-
Source
|
|
16
|
-
} from "./chunk-I5YVYTNK.js";
|
|
17
|
-
import {
|
|
18
|
-
__async,
|
|
19
|
-
__privateAdd,
|
|
20
|
-
__privateGet,
|
|
21
|
-
__privateMethod,
|
|
22
|
-
__privateSet,
|
|
23
|
-
__spreadProps,
|
|
24
|
-
__spreadValues
|
|
25
|
-
} from "./chunk-NJDRWDQ3.js";
|
|
26
|
-
|
|
27
|
-
// src/tts/websocket.ts
|
|
28
|
-
import Emittery from "emittery";
|
|
29
|
-
import { humanId } from "human-id";
|
|
30
|
-
import { WebSocket as PartySocketWebSocket } from "partysocket";
|
|
31
|
-
var _isConnected, _sampleRate, _container, _encoding, _WebSocket_instances, generateId_fn;
|
|
32
|
-
var WebSocket = class extends Client {
|
|
33
|
-
/**
|
|
34
|
-
* Create a new WebSocket client.
|
|
35
|
-
*
|
|
36
|
-
* @param args - Arguments to pass to the Client constructor.
|
|
37
|
-
*/
|
|
38
|
-
constructor({ sampleRate, container, encoding }, ...args) {
|
|
39
|
-
super(...args);
|
|
40
|
-
__privateAdd(this, _WebSocket_instances);
|
|
41
|
-
__privateAdd(this, _isConnected, false);
|
|
42
|
-
__privateAdd(this, _sampleRate);
|
|
43
|
-
__privateAdd(this, _container);
|
|
44
|
-
__privateAdd(this, _encoding);
|
|
45
|
-
__privateSet(this, _sampleRate, sampleRate);
|
|
46
|
-
__privateSet(this, _container, container != null ? container : "raw");
|
|
47
|
-
__privateSet(this, _encoding, encoding != null ? encoding : "pcm_f32le");
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Send a message over the WebSocket to start a stream.
|
|
51
|
-
*
|
|
52
|
-
* @param inputs - Generation parameters. Defined in the StreamRequest type.
|
|
53
|
-
* @param options - Options for the stream.
|
|
54
|
-
* @param options.timeout - The maximum time to wait for a chunk before cancelling the stream.
|
|
55
|
-
* If set to `0`, the stream will not time out.
|
|
56
|
-
* @returns A Source object that can be passed to a Player to play the audio.
|
|
57
|
-
* @returns An Emittery instance that emits messages from the WebSocket.
|
|
58
|
-
* @returns An abort function that can be called to cancel the stream.
|
|
59
|
-
*/
|
|
60
|
-
send(inputs, { timeout = 0 } = {}) {
|
|
61
|
-
var _a, _b, _c, _d;
|
|
62
|
-
if (!__privateGet(this, _isConnected)) {
|
|
63
|
-
throw new Error("Not connected to WebSocket. Call .connect() first.");
|
|
64
|
-
}
|
|
65
|
-
if (!inputs.context_id) {
|
|
66
|
-
inputs.context_id = __privateMethod(this, _WebSocket_instances, generateId_fn).call(this);
|
|
67
|
-
}
|
|
68
|
-
if (!inputs.output_format) {
|
|
69
|
-
inputs.output_format = {
|
|
70
|
-
container: __privateGet(this, _container),
|
|
71
|
-
encoding: __privateGet(this, _encoding),
|
|
72
|
-
sample_rate: __privateGet(this, _sampleRate)
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
(_a = this.socket) == null ? void 0 : _a.send(
|
|
76
|
-
JSON.stringify(__spreadValues({}, inputs))
|
|
77
|
-
);
|
|
78
|
-
const emitter = new Emittery();
|
|
79
|
-
const source = new Source({
|
|
80
|
-
sampleRate: __privateGet(this, _sampleRate),
|
|
81
|
-
encoding: __privateGet(this, _encoding),
|
|
82
|
-
container: __privateGet(this, _container)
|
|
83
|
-
});
|
|
84
|
-
const streamCompleteController = new AbortController();
|
|
85
|
-
let timeoutId = null;
|
|
86
|
-
if (timeout > 0) {
|
|
87
|
-
timeoutId = setTimeout(streamCompleteController.abort, timeout);
|
|
88
|
-
}
|
|
89
|
-
const handleMessage = createMessageHandlerForContextId(
|
|
90
|
-
inputs.context_id,
|
|
91
|
-
(_0) => __async(this, [_0], function* ({ chunk, message, data }) {
|
|
92
|
-
emitter.emit("message", message);
|
|
93
|
-
if (data.type === "timestamps") {
|
|
94
|
-
emitter.emit("timestamps", data.word_timestamps);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (isSentinel(chunk)) {
|
|
98
|
-
yield source.close();
|
|
99
|
-
streamCompleteController.abort();
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (timeoutId) {
|
|
103
|
-
clearTimeout(timeoutId);
|
|
104
|
-
timeoutId = setTimeout(streamCompleteController.abort, timeout);
|
|
105
|
-
}
|
|
106
|
-
if (!chunk) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
yield source.enqueue(base64ToArray([chunk], __privateGet(this, _encoding)));
|
|
110
|
-
})
|
|
111
|
-
);
|
|
112
|
-
(_b = this.socket) == null ? void 0 : _b.addEventListener("message", handleMessage, {
|
|
113
|
-
signal: streamCompleteController.signal
|
|
114
|
-
});
|
|
115
|
-
(_c = this.socket) == null ? void 0 : _c.addEventListener(
|
|
116
|
-
"close",
|
|
117
|
-
() => {
|
|
118
|
-
streamCompleteController.abort();
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
once: true,
|
|
122
|
-
signal: streamCompleteController.signal
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
(_d = this.socket) == null ? void 0 : _d.addEventListener(
|
|
126
|
-
"error",
|
|
127
|
-
() => {
|
|
128
|
-
streamCompleteController.abort();
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
once: true,
|
|
132
|
-
signal: streamCompleteController.signal
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
streamCompleteController.signal.addEventListener("abort", () => {
|
|
136
|
-
source.close();
|
|
137
|
-
if (timeoutId) {
|
|
138
|
-
clearTimeout(timeoutId);
|
|
139
|
-
}
|
|
140
|
-
emitter.clearListeners();
|
|
141
|
-
});
|
|
142
|
-
return __spreadProps(__spreadValues({
|
|
143
|
-
source
|
|
144
|
-
}, getEmitteryCallbacks(emitter)), {
|
|
145
|
-
stop: streamCompleteController.abort.bind(streamCompleteController)
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Continue a stream.
|
|
150
|
-
*
|
|
151
|
-
* @param inputs - Generation parameters. Defined in the StreamRequest type, but must include a `context_id` field. `continue` is set to true by default.
|
|
152
|
-
*/
|
|
153
|
-
continue(inputs) {
|
|
154
|
-
var _a;
|
|
155
|
-
if (!__privateGet(this, _isConnected)) {
|
|
156
|
-
throw new Error("Not connected to WebSocket. Call .connect() first.");
|
|
157
|
-
}
|
|
158
|
-
if (!inputs.context_id) {
|
|
159
|
-
throw new Error("context_id is required to continue a context.");
|
|
160
|
-
}
|
|
161
|
-
if (!inputs.output_format) {
|
|
162
|
-
inputs.output_format = {
|
|
163
|
-
container: __privateGet(this, _container),
|
|
164
|
-
encoding: __privateGet(this, _encoding),
|
|
165
|
-
sample_rate: __privateGet(this, _sampleRate)
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
(_a = this.socket) == null ? void 0 : _a.send(
|
|
169
|
-
JSON.stringify(__spreadValues({
|
|
170
|
-
continue: true
|
|
171
|
-
}, inputs))
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Authenticate and connect to a Cartesia streaming WebSocket.
|
|
176
|
-
*
|
|
177
|
-
* @returns A promise that resolves when the WebSocket is connected.
|
|
178
|
-
* @throws {Error} If the WebSocket fails to connect.
|
|
179
|
-
*/
|
|
180
|
-
connect() {
|
|
181
|
-
return __async(this, arguments, function* (options = {}) {
|
|
182
|
-
if (__privateGet(this, _isConnected)) {
|
|
183
|
-
throw new Error("WebSocket is already connected.");
|
|
184
|
-
}
|
|
185
|
-
const emitter = new Emittery();
|
|
186
|
-
this.socket = new PartySocketWebSocket(
|
|
187
|
-
() => __async(this, null, function* () {
|
|
188
|
-
const url = constructApiUrl(this.baseUrl, "/tts/websocket", {
|
|
189
|
-
websocket: true
|
|
190
|
-
});
|
|
191
|
-
url.searchParams.set("api_key", yield this.apiKey());
|
|
192
|
-
url.searchParams.set("cartesia_version", CARTESIA_VERSION);
|
|
193
|
-
return url.toString();
|
|
194
|
-
}),
|
|
195
|
-
void 0,
|
|
196
|
-
options
|
|
197
|
-
);
|
|
198
|
-
this.socket.binaryType = "arraybuffer";
|
|
199
|
-
this.socket.onopen = () => {
|
|
200
|
-
__privateSet(this, _isConnected, true);
|
|
201
|
-
emitter.emit("open");
|
|
202
|
-
};
|
|
203
|
-
this.socket.onclose = () => {
|
|
204
|
-
__privateSet(this, _isConnected, false);
|
|
205
|
-
emitter.emit("close");
|
|
206
|
-
};
|
|
207
|
-
return new Promise(
|
|
208
|
-
(resolve, reject) => {
|
|
209
|
-
var _a, _b, _c;
|
|
210
|
-
(_a = this.socket) == null ? void 0 : _a.addEventListener(
|
|
211
|
-
"open",
|
|
212
|
-
() => {
|
|
213
|
-
resolve(getEmitteryCallbacks(emitter));
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
once: true
|
|
217
|
-
}
|
|
218
|
-
);
|
|
219
|
-
const aborter = new AbortController();
|
|
220
|
-
(_b = this.socket) == null ? void 0 : _b.addEventListener(
|
|
221
|
-
"error",
|
|
222
|
-
() => {
|
|
223
|
-
aborter.abort();
|
|
224
|
-
reject(new Error("WebSocket failed to connect."));
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
signal: aborter.signal
|
|
228
|
-
}
|
|
229
|
-
);
|
|
230
|
-
(_c = this.socket) == null ? void 0 : _c.addEventListener(
|
|
231
|
-
"close",
|
|
232
|
-
() => {
|
|
233
|
-
aborter.abort();
|
|
234
|
-
reject(new Error("WebSocket closed before it could connect."));
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
signal: aborter.signal
|
|
238
|
-
}
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
);
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Disconnect from the Cartesia streaming WebSocket.
|
|
246
|
-
*/
|
|
247
|
-
disconnect() {
|
|
248
|
-
var _a;
|
|
249
|
-
(_a = this.socket) == null ? void 0 : _a.close();
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
_isConnected = new WeakMap();
|
|
253
|
-
_sampleRate = new WeakMap();
|
|
254
|
-
_container = new WeakMap();
|
|
255
|
-
_encoding = new WeakMap();
|
|
256
|
-
_WebSocket_instances = new WeakSet();
|
|
257
|
-
/**
|
|
258
|
-
* Generate a unique ID suitable for a streaming context.
|
|
259
|
-
*
|
|
260
|
-
* Not suitable for security purposes or as a primary key, since
|
|
261
|
-
* it lacks the amount of entropy required for those use cases.
|
|
262
|
-
*
|
|
263
|
-
* @returns A unique ID.
|
|
264
|
-
*/
|
|
265
|
-
generateId_fn = function() {
|
|
266
|
-
return humanId({
|
|
267
|
-
separator: "-",
|
|
268
|
-
capitalize: false
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
export {
|
|
273
|
-
WebSocket
|
|
274
|
-
};
|
package/dist/chunk-CSOXALSC.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
playAudioBuffer
|
|
3
|
-
} from "./chunk-5SBAQNWQ.js";
|
|
4
|
-
import {
|
|
5
|
-
__async,
|
|
6
|
-
__privateAdd,
|
|
7
|
-
__privateGet,
|
|
8
|
-
__privateMethod,
|
|
9
|
-
__privateSet
|
|
10
|
-
} from "./chunk-NJDRWDQ3.js";
|
|
11
|
-
|
|
12
|
-
// src/tts/player.ts
|
|
13
|
-
var _context, _startNextPlaybackAt, _bufferDuration, _Player_instances, playBuffer_fn;
|
|
14
|
-
var Player = class {
|
|
15
|
-
/**
|
|
16
|
-
* Create a new Player.
|
|
17
|
-
*
|
|
18
|
-
* @param options - Options for the Player.
|
|
19
|
-
* @param options.bufferDuration - The duration of the audio buffer to play.
|
|
20
|
-
*/
|
|
21
|
-
constructor({ bufferDuration }) {
|
|
22
|
-
__privateAdd(this, _Player_instances);
|
|
23
|
-
__privateAdd(this, _context, null);
|
|
24
|
-
__privateAdd(this, _startNextPlaybackAt, 0);
|
|
25
|
-
__privateAdd(this, _bufferDuration);
|
|
26
|
-
__privateSet(this, _bufferDuration, bufferDuration);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Play audio from a source.
|
|
30
|
-
*
|
|
31
|
-
* @param source The source to play audio from.
|
|
32
|
-
* @returns A promise that resolves when the audio has finished playing.
|
|
33
|
-
*/
|
|
34
|
-
play(source) {
|
|
35
|
-
return __async(this, null, function* () {
|
|
36
|
-
__privateSet(this, _startNextPlaybackAt, 0);
|
|
37
|
-
__privateSet(this, _context, new AudioContext({ sampleRate: source.sampleRate }));
|
|
38
|
-
const buffer = new Float32Array(
|
|
39
|
-
source.durationToSampleCount(__privateGet(this, _bufferDuration))
|
|
40
|
-
);
|
|
41
|
-
const plays = [];
|
|
42
|
-
while (true) {
|
|
43
|
-
const read = yield source.read(buffer);
|
|
44
|
-
const playableAudio = buffer.subarray(0, read);
|
|
45
|
-
plays.push(__privateMethod(this, _Player_instances, playBuffer_fn).call(this, playableAudio, source.sampleRate));
|
|
46
|
-
if (read < buffer.length) {
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
yield Promise.all(plays);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Pause the audio.
|
|
55
|
-
*
|
|
56
|
-
* @returns A promise that resolves when the audio has been paused.
|
|
57
|
-
*/
|
|
58
|
-
pause() {
|
|
59
|
-
return __async(this, null, function* () {
|
|
60
|
-
if (!__privateGet(this, _context)) {
|
|
61
|
-
throw new Error("AudioContext not initialized.");
|
|
62
|
-
}
|
|
63
|
-
yield __privateGet(this, _context).suspend();
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Resume the audio.
|
|
68
|
-
*
|
|
69
|
-
* @returns A promise that resolves when the audio has been resumed.
|
|
70
|
-
*/
|
|
71
|
-
resume() {
|
|
72
|
-
return __async(this, null, function* () {
|
|
73
|
-
if (!__privateGet(this, _context)) {
|
|
74
|
-
throw new Error("AudioContext not initialized.");
|
|
75
|
-
}
|
|
76
|
-
yield __privateGet(this, _context).resume();
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Toggle the audio.
|
|
81
|
-
*
|
|
82
|
-
* @returns A promise that resolves when the audio has been toggled.
|
|
83
|
-
*/
|
|
84
|
-
toggle() {
|
|
85
|
-
return __async(this, null, function* () {
|
|
86
|
-
if (!__privateGet(this, _context)) {
|
|
87
|
-
throw new Error("AudioContext not initialized.");
|
|
88
|
-
}
|
|
89
|
-
if (__privateGet(this, _context).state === "running") {
|
|
90
|
-
yield this.pause();
|
|
91
|
-
} else {
|
|
92
|
-
yield this.resume();
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Stop the audio.
|
|
98
|
-
*
|
|
99
|
-
* @returns A promise that resolves when the audio has been stopped.
|
|
100
|
-
*/
|
|
101
|
-
stop() {
|
|
102
|
-
return __async(this, null, function* () {
|
|
103
|
-
var _a;
|
|
104
|
-
if (!__privateGet(this, _context)) {
|
|
105
|
-
throw new Error("AudioContext not initialized.");
|
|
106
|
-
}
|
|
107
|
-
yield (_a = __privateGet(this, _context)) == null ? void 0 : _a.close();
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
_context = new WeakMap();
|
|
112
|
-
_startNextPlaybackAt = new WeakMap();
|
|
113
|
-
_bufferDuration = new WeakMap();
|
|
114
|
-
_Player_instances = new WeakSet();
|
|
115
|
-
playBuffer_fn = function(buf, sampleRate) {
|
|
116
|
-
return __async(this, null, function* () {
|
|
117
|
-
if (!__privateGet(this, _context)) {
|
|
118
|
-
throw new Error("AudioContext not initialized.");
|
|
119
|
-
}
|
|
120
|
-
if (buf.length === 0) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
const startAt = __privateGet(this, _startNextPlaybackAt);
|
|
124
|
-
const duration = buf.length / sampleRate;
|
|
125
|
-
__privateSet(this, _startNextPlaybackAt, duration + Math.max(__privateGet(this, _context).currentTime, __privateGet(this, _startNextPlaybackAt)));
|
|
126
|
-
yield playAudioBuffer(buf, __privateGet(this, _context), startAt, sampleRate);
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export {
|
|
131
|
-
Player
|
|
132
|
-
};
|
package/dist/chunk-FLWYXP5Z.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BASE_URL,
|
|
3
|
-
CARTESIA_VERSION,
|
|
4
|
-
constructApiUrl
|
|
5
|
-
} from "./chunk-2BFEKY3F.js";
|
|
6
|
-
import {
|
|
7
|
-
__async,
|
|
8
|
-
__spreadProps,
|
|
9
|
-
__spreadValues
|
|
10
|
-
} from "./chunk-NJDRWDQ3.js";
|
|
11
|
-
|
|
12
|
-
// src/lib/client.ts
|
|
13
|
-
import fetch from "cross-fetch";
|
|
14
|
-
var Client = class {
|
|
15
|
-
constructor(options = {}) {
|
|
16
|
-
const apiKey = options.apiKey || process.env.CARTESIA_API_KEY;
|
|
17
|
-
if (!apiKey) {
|
|
18
|
-
throw new Error("Missing Cartesia API key.");
|
|
19
|
-
}
|
|
20
|
-
this.apiKey = typeof apiKey === "function" ? apiKey : () => __async(this, null, function* () {
|
|
21
|
-
return apiKey;
|
|
22
|
-
});
|
|
23
|
-
this.baseUrl = options.baseUrl || BASE_URL;
|
|
24
|
-
}
|
|
25
|
-
_fetch(_0) {
|
|
26
|
-
return __async(this, arguments, function* (path, options = {}) {
|
|
27
|
-
const url = constructApiUrl(this.baseUrl, path);
|
|
28
|
-
const headers = new Headers(options.headers);
|
|
29
|
-
headers.set("X-API-Key", yield this.apiKey());
|
|
30
|
-
headers.set("Cartesia-Version", CARTESIA_VERSION);
|
|
31
|
-
return fetch(url.toString(), __spreadProps(__spreadValues({}, options), {
|
|
32
|
-
headers
|
|
33
|
-
}));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
Client
|
|
40
|
-
};
|
package/dist/chunk-FXPGR372.js
DELETED
|
File without changes
|
package/dist/chunk-I5YVYTNK.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__async,
|
|
3
|
-
__privateAdd,
|
|
4
|
-
__privateGet,
|
|
5
|
-
__privateMethod,
|
|
6
|
-
__privateSet
|
|
7
|
-
} from "./chunk-NJDRWDQ3.js";
|
|
8
|
-
|
|
9
|
-
// src/tts/source.ts
|
|
10
|
-
import Emittery from "emittery";
|
|
11
|
-
var ENCODING_MAP = {
|
|
12
|
-
pcm_f32le: { arrayType: Float32Array, bytesPerElement: 4 },
|
|
13
|
-
pcm_s16le: { arrayType: Int16Array, bytesPerElement: 2 },
|
|
14
|
-
pcm_alaw: { arrayType: Uint8Array, bytesPerElement: 1 },
|
|
15
|
-
pcm_mulaw: { arrayType: Uint8Array, bytesPerElement: 1 }
|
|
16
|
-
};
|
|
17
|
-
var _emitter, _buffer, _readIndex, _writeIndex, _closed, _sampleRate, _encoding, _container, _Source_instances, createBuffer_fn;
|
|
18
|
-
var Source = class {
|
|
19
|
-
/**
|
|
20
|
-
* Create a new Source.
|
|
21
|
-
*
|
|
22
|
-
* @param options - Options for the Source.
|
|
23
|
-
* @param options.sampleRate - The sample rate of the audio.
|
|
24
|
-
*/
|
|
25
|
-
constructor({
|
|
26
|
-
sampleRate,
|
|
27
|
-
encoding,
|
|
28
|
-
container
|
|
29
|
-
}) {
|
|
30
|
-
__privateAdd(this, _Source_instances);
|
|
31
|
-
__privateAdd(this, _emitter, new Emittery());
|
|
32
|
-
__privateAdd(this, _buffer);
|
|
33
|
-
__privateAdd(this, _readIndex, 0);
|
|
34
|
-
__privateAdd(this, _writeIndex, 0);
|
|
35
|
-
__privateAdd(this, _closed, false);
|
|
36
|
-
__privateAdd(this, _sampleRate);
|
|
37
|
-
__privateAdd(this, _encoding);
|
|
38
|
-
__privateAdd(this, _container);
|
|
39
|
-
this.on = __privateGet(this, _emitter).on.bind(__privateGet(this, _emitter));
|
|
40
|
-
this.once = __privateGet(this, _emitter).once.bind(__privateGet(this, _emitter));
|
|
41
|
-
this.events = __privateGet(this, _emitter).events.bind(__privateGet(this, _emitter));
|
|
42
|
-
this.off = __privateGet(this, _emitter).off.bind(__privateGet(this, _emitter));
|
|
43
|
-
__privateSet(this, _sampleRate, sampleRate);
|
|
44
|
-
__privateSet(this, _encoding, encoding);
|
|
45
|
-
__privateSet(this, _container, container);
|
|
46
|
-
__privateSet(this, _buffer, __privateMethod(this, _Source_instances, createBuffer_fn).call(this, 1024));
|
|
47
|
-
}
|
|
48
|
-
get sampleRate() {
|
|
49
|
-
return __privateGet(this, _sampleRate);
|
|
50
|
-
}
|
|
51
|
-
get encoding() {
|
|
52
|
-
return __privateGet(this, _encoding);
|
|
53
|
-
}
|
|
54
|
-
get container() {
|
|
55
|
-
return __privateGet(this, _container);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Append audio to the buffer.
|
|
59
|
-
*
|
|
60
|
-
* @param src The audio to append.
|
|
61
|
-
*/
|
|
62
|
-
enqueue(src) {
|
|
63
|
-
return __async(this, null, function* () {
|
|
64
|
-
const requiredCapacity = __privateGet(this, _writeIndex) + src.length;
|
|
65
|
-
if (requiredCapacity > __privateGet(this, _buffer).length) {
|
|
66
|
-
let newCapacity = __privateGet(this, _buffer).length;
|
|
67
|
-
while (newCapacity < requiredCapacity) {
|
|
68
|
-
newCapacity *= 2;
|
|
69
|
-
}
|
|
70
|
-
const newBuffer = __privateMethod(this, _Source_instances, createBuffer_fn).call(this, newCapacity);
|
|
71
|
-
newBuffer.set(__privateGet(this, _buffer));
|
|
72
|
-
__privateSet(this, _buffer, newBuffer);
|
|
73
|
-
}
|
|
74
|
-
__privateGet(this, _buffer).set(src, __privateGet(this, _writeIndex));
|
|
75
|
-
__privateSet(this, _writeIndex, __privateGet(this, _writeIndex) + src.length);
|
|
76
|
-
yield __privateGet(this, _emitter).emit("enqueue");
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Read audio from the buffer.
|
|
81
|
-
*
|
|
82
|
-
* @param dst The buffer to read the audio into.
|
|
83
|
-
* @returns The number of samples read. If the source is closed, this will be
|
|
84
|
-
* less than the length of the provided buffer.
|
|
85
|
-
*/
|
|
86
|
-
read(dst) {
|
|
87
|
-
return __async(this, null, function* () {
|
|
88
|
-
const targetReadIndex = __privateGet(this, _readIndex) + dst.length;
|
|
89
|
-
while (!__privateGet(this, _closed) && targetReadIndex > __privateGet(this, _writeIndex)) {
|
|
90
|
-
yield __privateGet(this, _emitter).emit("wait");
|
|
91
|
-
yield Promise.race([
|
|
92
|
-
__privateGet(this, _emitter).once("enqueue"),
|
|
93
|
-
__privateGet(this, _emitter).once("close")
|
|
94
|
-
]);
|
|
95
|
-
yield __privateGet(this, _emitter).emit("read");
|
|
96
|
-
}
|
|
97
|
-
const read = Math.min(dst.length, __privateGet(this, _writeIndex) - __privateGet(this, _readIndex));
|
|
98
|
-
dst.set(__privateGet(this, _buffer).subarray(__privateGet(this, _readIndex), __privateGet(this, _readIndex) + read));
|
|
99
|
-
__privateSet(this, _readIndex, __privateGet(this, _readIndex) + read);
|
|
100
|
-
return read;
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Seek in the buffer.
|
|
105
|
-
*
|
|
106
|
-
* @param offset The offset to seek to.
|
|
107
|
-
* @param whence The position to seek from.
|
|
108
|
-
* @returns The new position in the buffer.
|
|
109
|
-
* @throws {Error} If the seek is invalid.
|
|
110
|
-
*/
|
|
111
|
-
seek(offset, whence) {
|
|
112
|
-
return __async(this, null, function* () {
|
|
113
|
-
let position = __privateGet(this, _readIndex);
|
|
114
|
-
switch (whence) {
|
|
115
|
-
case "start":
|
|
116
|
-
position = offset;
|
|
117
|
-
break;
|
|
118
|
-
case "current":
|
|
119
|
-
position += offset;
|
|
120
|
-
break;
|
|
121
|
-
case "end":
|
|
122
|
-
position = __privateGet(this, _writeIndex) + offset;
|
|
123
|
-
break;
|
|
124
|
-
default:
|
|
125
|
-
throw new Error(`Invalid seek mode: ${whence}`);
|
|
126
|
-
}
|
|
127
|
-
if (position < 0 || position > __privateGet(this, _writeIndex)) {
|
|
128
|
-
throw new Error("Seek out of bounds");
|
|
129
|
-
}
|
|
130
|
-
__privateSet(this, _readIndex, position);
|
|
131
|
-
return position;
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Get the number of samples in a given duration.
|
|
136
|
-
*
|
|
137
|
-
* @param durationSecs The duration in seconds.
|
|
138
|
-
* @returns The number of samples.
|
|
139
|
-
*/
|
|
140
|
-
durationToSampleCount(durationSecs) {
|
|
141
|
-
return Math.trunc(durationSecs * __privateGet(this, _sampleRate));
|
|
142
|
-
}
|
|
143
|
-
get buffer() {
|
|
144
|
-
return __privateGet(this, _buffer);
|
|
145
|
-
}
|
|
146
|
-
get readIndex() {
|
|
147
|
-
return __privateGet(this, _readIndex);
|
|
148
|
-
}
|
|
149
|
-
get writeIndex() {
|
|
150
|
-
return __privateGet(this, _writeIndex);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Close the source. This signals that no more audio will be enqueued.
|
|
154
|
-
*
|
|
155
|
-
* This will emit a "close" event.
|
|
156
|
-
*
|
|
157
|
-
* @returns A promise that resolves when the source is closed.
|
|
158
|
-
*/
|
|
159
|
-
close() {
|
|
160
|
-
return __async(this, null, function* () {
|
|
161
|
-
__privateSet(this, _closed, true);
|
|
162
|
-
yield __privateGet(this, _emitter).emit("close");
|
|
163
|
-
__privateGet(this, _emitter).clearListeners();
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
_emitter = new WeakMap();
|
|
168
|
-
_buffer = new WeakMap();
|
|
169
|
-
_readIndex = new WeakMap();
|
|
170
|
-
_writeIndex = new WeakMap();
|
|
171
|
-
_closed = new WeakMap();
|
|
172
|
-
_sampleRate = new WeakMap();
|
|
173
|
-
_encoding = new WeakMap();
|
|
174
|
-
_container = new WeakMap();
|
|
175
|
-
_Source_instances = new WeakSet();
|
|
176
|
-
/**
|
|
177
|
-
* Create a new buffer for the source.
|
|
178
|
-
*
|
|
179
|
-
* @param size - The size of the buffer to create.
|
|
180
|
-
* @returns The new buffer as a TypedArray based on the encoding.
|
|
181
|
-
*/
|
|
182
|
-
createBuffer_fn = function(size) {
|
|
183
|
-
const { arrayType: ArrayType } = ENCODING_MAP[__privateGet(this, _encoding)];
|
|
184
|
-
return new ArrayType(size);
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export {
|
|
188
|
-
ENCODING_MAP,
|
|
189
|
-
Source
|
|
190
|
-
};
|
package/dist/chunk-LKKWJLUG.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__async
|
|
3
|
-
} from "./chunk-NJDRWDQ3.js";
|
|
4
|
-
|
|
5
|
-
// src/react/utils.ts
|
|
6
|
-
function pingServer(url) {
|
|
7
|
-
return __async(this, null, function* () {
|
|
8
|
-
const start = (/* @__PURE__ */ new Date()).getTime();
|
|
9
|
-
yield fetch(url);
|
|
10
|
-
const end = (/* @__PURE__ */ new Date()).getTime();
|
|
11
|
-
return end - start;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
pingServer
|
|
17
|
-
};
|