@cartesia/cartesia-js 2.0.1 → 2.0.2
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.js +9 -13
- package/api/index.js +1 -17
- package/api/resources/apiStatus/client/Client.js +6 -33
- package/api/resources/apiStatus/client/index.js +1 -2
- package/api/resources/apiStatus/index.js +2 -18
- package/api/resources/apiStatus/types/ApiInfo.js +1 -2
- package/api/resources/apiStatus/types/index.js +1 -17
- package/api/resources/embedding/index.js +1 -17
- package/api/resources/embedding/types/Embedding.js +1 -2
- package/api/resources/embedding/types/index.js +1 -17
- package/api/resources/index.js +12 -41
- package/api/resources/tts/client/Client.js +10 -40
- package/api/resources/tts/client/index.js +1 -2
- package/api/resources/tts/index.js +2 -18
- package/api/resources/tts/types/CancelContextRequest.js +1 -2
- package/api/resources/tts/types/ContextId.js +1 -2
- package/api/resources/tts/types/Controls.js +1 -2
- package/api/resources/tts/types/Emotion.js +1 -4
- package/api/resources/tts/types/GenerationRequest.js +1 -2
- package/api/resources/tts/types/Mp3OutputFormat.js +1 -2
- package/api/resources/tts/types/NaturalSpecifier.js +1 -4
- package/api/resources/tts/types/NumericalSpecifier.js +1 -2
- package/api/resources/tts/types/OutputFormat.js +1 -2
- package/api/resources/tts/types/RawEncoding.js +1 -4
- package/api/resources/tts/types/RawOutputFormat.js +1 -2
- package/api/resources/tts/types/Speed.js +1 -2
- package/api/resources/tts/types/SupportedLanguage.js +1 -4
- package/api/resources/tts/types/TtsRequest.js +1 -2
- package/api/resources/tts/types/TtsRequestEmbeddingSpecifier.js +1 -2
- package/api/resources/tts/types/TtsRequestIdSpecifier.js +1 -2
- package/api/resources/tts/types/TtsRequestVoiceSpecifier.js +1 -2
- package/api/resources/tts/types/WavOutputFormat.js +1 -2
- package/api/resources/tts/types/WebSocketBaseResponse.js +1 -2
- package/api/resources/tts/types/WebSocketChunkResponse.js +1 -2
- package/api/resources/tts/types/WebSocketDoneResponse.js +1 -2
- package/api/resources/tts/types/WebSocketErrorResponse.js +1 -2
- package/api/resources/tts/types/WebSocketRawOutputFormat.js +1 -2
- package/api/resources/tts/types/WebSocketRequest.js +1 -2
- package/api/resources/tts/types/WebSocketResponse.js +1 -2
- package/api/resources/tts/types/WebSocketStreamOptions.js +1 -2
- package/api/resources/tts/types/WebSocketTimestampsResponse.js +1 -2
- package/api/resources/tts/types/WebSocketTtsOutput.js +1 -2
- package/api/resources/tts/types/WebSocketTtsRequest.js +1 -2
- package/api/resources/tts/types/WordTimestamps.js +1 -2
- package/api/resources/tts/types/index.js +30 -46
- package/api/resources/voiceChanger/client/Client.js +10 -40
- package/api/resources/voiceChanger/client/index.js +1 -17
- package/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.js +1 -2
- package/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.js +1 -2
- package/api/resources/voiceChanger/client/requests/index.js +1 -2
- package/api/resources/voiceChanger/index.js +2 -18
- package/api/resources/voiceChanger/types/OutputFormatContainer.js +1 -4
- package/api/resources/voiceChanger/types/StreamingResponse.js +1 -2
- package/api/resources/voiceChanger/types/index.js +2 -18
- package/api/resources/voices/client/Client.js +22 -52
- package/api/resources/voices/client/index.js +1 -17
- package/api/resources/voices/client/requests/CloneVoiceRequest.js +1 -2
- package/api/resources/voices/client/requests/index.js +1 -2
- package/api/resources/voices/index.js +2 -18
- package/api/resources/voices/types/BaseVoiceId.js +1 -2
- package/api/resources/voices/types/CloneMode.js +1 -4
- package/api/resources/voices/types/CreateVoiceRequest.js +1 -2
- package/api/resources/voices/types/EmbeddingResponse.js +1 -2
- package/api/resources/voices/types/EmbeddingSpecifier.js +1 -2
- package/api/resources/voices/types/Gender.js +1 -4
- package/api/resources/voices/types/IdSpecifier.js +1 -2
- package/api/resources/voices/types/LocalizeDialect.js +1 -4
- package/api/resources/voices/types/LocalizeTargetLanguage.js +1 -4
- package/api/resources/voices/types/LocalizeVoiceRequest.js +1 -2
- package/api/resources/voices/types/MixVoiceSpecifier.js +1 -2
- package/api/resources/voices/types/MixVoicesRequest.js +1 -2
- package/api/resources/voices/types/UpdateVoiceRequest.js +1 -2
- package/api/resources/voices/types/Voice.js +1 -2
- package/api/resources/voices/types/VoiceId.js +1 -2
- package/api/resources/voices/types/VoiceMetadata.js +1 -2
- package/api/resources/voices/types/Weight.js +1 -2
- package/api/resources/voices/types/index.js +17 -33
- package/core/fetcher/APIResponse.js +1 -2
- package/core/fetcher/Fetcher.js +14 -18
- package/core/fetcher/Supplier.js +1 -4
- package/core/fetcher/createRequestUrl.js +3 -10
- package/core/fetcher/getFetchFn.js +6 -33
- package/core/fetcher/getHeader.js +1 -5
- package/core/fetcher/getRequestBody.js +1 -5
- package/core/fetcher/getResponseBody.js +3 -7
- package/core/fetcher/index.js +3 -9
- package/core/fetcher/makeRequest.js +4 -8
- package/core/fetcher/requestWithRetries.js +1 -5
- package/core/fetcher/signals.js +2 -7
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +1 -5
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +1 -5
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +1 -5
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +7 -34
- package/core/form-data-utils/FormDataWrapper.js +11 -41
- package/core/form-data-utils/index.js +1 -17
- package/core/index.js +5 -34
- package/core/runtime/index.js +1 -5
- package/core/runtime/runtime.js +1 -4
- package/core/schemas/Schema.js +1 -4
- package/core/schemas/builders/bigint/bigint.js +9 -13
- package/core/schemas/builders/bigint/index.js +1 -5
- package/core/schemas/builders/date/date.js +10 -14
- package/core/schemas/builders/date/index.js +1 -5
- package/core/schemas/builders/enum/enum.js +7 -11
- package/core/schemas/builders/enum/index.js +1 -5
- package/core/schemas/builders/index.js +14 -30
- package/core/schemas/builders/lazy/index.js +2 -7
- package/core/schemas/builders/lazy/lazy.js +5 -11
- package/core/schemas/builders/lazy/lazyObject.js +7 -11
- package/core/schemas/builders/list/index.js +1 -5
- package/core/schemas/builders/list/list.js +8 -12
- package/core/schemas/builders/literals/booleanLiteral.js +6 -10
- package/core/schemas/builders/literals/index.js +2 -7
- package/core/schemas/builders/literals/stringLiteral.js +6 -10
- package/core/schemas/builders/object/index.js +3 -11
- package/core/schemas/builders/object/object.js +33 -38
- package/core/schemas/builders/object/objectWithoutOptionalProperties.js +3 -7
- package/core/schemas/builders/object/property.js +2 -7
- package/core/schemas/builders/object/types.js +1 -2
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +10 -15
- package/core/schemas/builders/object-like/index.js +1 -6
- package/core/schemas/builders/object-like/types.js +1 -2
- package/core/schemas/builders/primitives/any.js +3 -6
- package/core/schemas/builders/primitives/boolean.js +5 -8
- package/core/schemas/builders/primitives/index.js +5 -13
- package/core/schemas/builders/primitives/number.js +5 -8
- package/core/schemas/builders/primitives/string.js +5 -8
- package/core/schemas/builders/primitives/unknown.js +3 -6
- package/core/schemas/builders/record/index.js +1 -5
- package/core/schemas/builders/record/record.js +14 -18
- package/core/schemas/builders/record/types.js +1 -2
- package/core/schemas/builders/schema-utils/JsonError.js +3 -7
- package/core/schemas/builders/schema-utils/ParseError.js +3 -7
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +9 -15
- package/core/schemas/builders/schema-utils/index.js +3 -11
- package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -5
- package/core/schemas/builders/set/index.js +1 -5
- package/core/schemas/builders/set/set.js +10 -14
- package/core/schemas/builders/undiscriminated-union/index.js +1 -5
- package/core/schemas/builders/undiscriminated-union/types.js +1 -2
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +6 -10
- package/core/schemas/builders/union/discriminant.js +1 -5
- package/core/schemas/builders/union/index.js +2 -7
- package/core/schemas/builders/union/types.js +1 -2
- package/core/schemas/builders/union/union.js +14 -18
- package/core/schemas/index.js +1 -17
- package/core/schemas/utils/MaybePromise.js +1 -2
- package/core/schemas/utils/addQuestionMarksToNullableProperties.js +1 -2
- package/core/schemas/utils/createIdentitySchemaCreator.js +4 -8
- package/core/schemas/utils/entries.js +1 -5
- package/core/schemas/utils/filterObject.js +1 -5
- package/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -5
- package/core/schemas/utils/isPlainObject.js +1 -5
- package/core/schemas/utils/keys.js +1 -5
- package/core/schemas/utils/maybeSkipValidation.js +1 -5
- package/core/schemas/utils/partition.js +1 -5
- package/core/streaming-fetcher/Stream.js +4 -9
- package/core/streaming-fetcher/index.js +1 -5
- package/core/websocket/events.js +3 -9
- package/core/websocket/index.js +1 -17
- package/core/websocket/ws.js +6 -33
- package/dist/Client.js +9 -13
- package/dist/api/index.js +1 -17
- package/dist/api/resources/apiStatus/client/Client.js +6 -33
- package/dist/api/resources/apiStatus/client/index.js +1 -2
- package/dist/api/resources/apiStatus/index.js +2 -18
- package/dist/api/resources/apiStatus/types/ApiInfo.js +1 -2
- package/dist/api/resources/apiStatus/types/index.js +1 -17
- package/dist/api/resources/embedding/index.js +1 -17
- package/dist/api/resources/embedding/types/Embedding.js +1 -2
- package/dist/api/resources/embedding/types/index.js +1 -17
- package/dist/api/resources/index.js +12 -41
- package/dist/api/resources/tts/client/Client.js +10 -40
- package/dist/api/resources/tts/client/index.js +1 -2
- package/dist/api/resources/tts/index.js +2 -18
- package/dist/api/resources/tts/types/CancelContextRequest.js +1 -2
- package/dist/api/resources/tts/types/ContextId.js +1 -2
- package/dist/api/resources/tts/types/Controls.js +1 -2
- package/dist/api/resources/tts/types/Emotion.js +1 -4
- package/dist/api/resources/tts/types/GenerationRequest.js +1 -2
- package/dist/api/resources/tts/types/Mp3OutputFormat.js +1 -2
- package/dist/api/resources/tts/types/NaturalSpecifier.js +1 -4
- package/dist/api/resources/tts/types/NumericalSpecifier.js +1 -2
- package/dist/api/resources/tts/types/OutputFormat.js +1 -2
- package/dist/api/resources/tts/types/RawEncoding.js +1 -4
- package/dist/api/resources/tts/types/RawOutputFormat.js +1 -2
- package/dist/api/resources/tts/types/Speed.js +1 -2
- package/dist/api/resources/tts/types/SupportedLanguage.js +1 -4
- package/dist/api/resources/tts/types/TtsRequest.js +1 -2
- package/dist/api/resources/tts/types/TtsRequestEmbeddingSpecifier.js +1 -2
- package/dist/api/resources/tts/types/TtsRequestIdSpecifier.js +1 -2
- package/dist/api/resources/tts/types/TtsRequestVoiceSpecifier.js +1 -2
- package/dist/api/resources/tts/types/WavOutputFormat.js +1 -2
- package/dist/api/resources/tts/types/WebSocketBaseResponse.js +1 -2
- package/dist/api/resources/tts/types/WebSocketChunkResponse.js +1 -2
- package/dist/api/resources/tts/types/WebSocketDoneResponse.js +1 -2
- package/dist/api/resources/tts/types/WebSocketErrorResponse.js +1 -2
- package/dist/api/resources/tts/types/WebSocketRawOutputFormat.js +1 -2
- package/dist/api/resources/tts/types/WebSocketRequest.js +1 -2
- package/dist/api/resources/tts/types/WebSocketResponse.js +1 -2
- package/dist/api/resources/tts/types/WebSocketStreamOptions.js +1 -2
- package/dist/api/resources/tts/types/WebSocketTimestampsResponse.js +1 -2
- package/dist/api/resources/tts/types/WebSocketTtsOutput.js +1 -2
- package/dist/api/resources/tts/types/WebSocketTtsRequest.js +1 -2
- package/dist/api/resources/tts/types/WordTimestamps.js +1 -2
- package/dist/api/resources/tts/types/index.js +30 -46
- package/dist/api/resources/voiceChanger/client/Client.js +10 -40
- package/dist/api/resources/voiceChanger/client/index.js +1 -17
- package/dist/api/resources/voiceChanger/client/requests/VoiceChangerBytesRequest.js +1 -2
- package/dist/api/resources/voiceChanger/client/requests/VoiceChangerSseRequest.js +1 -2
- package/dist/api/resources/voiceChanger/client/requests/index.js +1 -2
- package/dist/api/resources/voiceChanger/index.js +2 -18
- package/dist/api/resources/voiceChanger/types/OutputFormatContainer.js +1 -4
- package/dist/api/resources/voiceChanger/types/StreamingResponse.js +1 -2
- package/dist/api/resources/voiceChanger/types/index.js +2 -18
- package/dist/api/resources/voices/client/Client.js +22 -52
- package/dist/api/resources/voices/client/index.js +1 -17
- package/dist/api/resources/voices/client/requests/CloneVoiceRequest.js +1 -2
- package/dist/api/resources/voices/client/requests/index.js +1 -2
- package/dist/api/resources/voices/index.js +2 -18
- package/dist/api/resources/voices/types/BaseVoiceId.js +1 -2
- package/dist/api/resources/voices/types/CloneMode.js +1 -4
- package/dist/api/resources/voices/types/CreateVoiceRequest.js +1 -2
- package/dist/api/resources/voices/types/EmbeddingResponse.js +1 -2
- package/dist/api/resources/voices/types/EmbeddingSpecifier.js +1 -2
- package/dist/api/resources/voices/types/Gender.js +1 -4
- package/dist/api/resources/voices/types/IdSpecifier.js +1 -2
- package/dist/api/resources/voices/types/LocalizeDialect.js +1 -4
- package/dist/api/resources/voices/types/LocalizeTargetLanguage.js +1 -4
- package/dist/api/resources/voices/types/LocalizeVoiceRequest.js +1 -2
- package/dist/api/resources/voices/types/MixVoiceSpecifier.js +1 -2
- package/dist/api/resources/voices/types/MixVoicesRequest.js +1 -2
- package/dist/api/resources/voices/types/UpdateVoiceRequest.js +1 -2
- package/dist/api/resources/voices/types/Voice.js +1 -2
- package/dist/api/resources/voices/types/VoiceId.js +1 -2
- package/dist/api/resources/voices/types/VoiceMetadata.js +1 -2
- package/dist/api/resources/voices/types/Weight.js +1 -2
- package/dist/api/resources/voices/types/index.js +17 -33
- package/dist/core/fetcher/APIResponse.js +1 -2
- package/dist/core/fetcher/Fetcher.js +14 -18
- package/dist/core/fetcher/Supplier.js +1 -4
- package/dist/core/fetcher/createRequestUrl.js +3 -10
- package/dist/core/fetcher/getFetchFn.js +6 -33
- package/dist/core/fetcher/getHeader.js +1 -5
- package/dist/core/fetcher/getRequestBody.js +1 -5
- package/dist/core/fetcher/getResponseBody.js +3 -7
- package/dist/core/fetcher/index.js +3 -9
- package/dist/core/fetcher/makeRequest.js +4 -8
- package/dist/core/fetcher/requestWithRetries.js +1 -5
- package/dist/core/fetcher/signals.js +2 -7
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +1 -5
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +1 -5
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +1 -5
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +7 -34
- package/dist/core/form-data-utils/FormDataWrapper.js +11 -41
- package/dist/core/form-data-utils/index.js +1 -17
- package/dist/core/index.js +5 -34
- package/dist/core/runtime/index.js +1 -5
- package/dist/core/runtime/runtime.js +1 -4
- package/dist/core/schemas/Schema.js +1 -4
- package/dist/core/schemas/builders/bigint/bigint.js +9 -13
- package/dist/core/schemas/builders/bigint/index.js +1 -5
- package/dist/core/schemas/builders/date/date.js +10 -14
- package/dist/core/schemas/builders/date/index.js +1 -5
- package/dist/core/schemas/builders/enum/enum.js +7 -11
- package/dist/core/schemas/builders/enum/index.js +1 -5
- package/dist/core/schemas/builders/index.js +14 -30
- package/dist/core/schemas/builders/lazy/index.js +2 -7
- package/dist/core/schemas/builders/lazy/lazy.js +5 -11
- package/dist/core/schemas/builders/lazy/lazyObject.js +7 -11
- package/dist/core/schemas/builders/list/index.js +1 -5
- package/dist/core/schemas/builders/list/list.js +8 -12
- package/dist/core/schemas/builders/literals/booleanLiteral.js +6 -10
- package/dist/core/schemas/builders/literals/index.js +2 -7
- package/dist/core/schemas/builders/literals/stringLiteral.js +6 -10
- package/dist/core/schemas/builders/object/index.js +3 -11
- package/dist/core/schemas/builders/object/object.js +33 -38
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +3 -7
- package/dist/core/schemas/builders/object/property.js +2 -7
- package/dist/core/schemas/builders/object/types.js +1 -2
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +10 -15
- package/dist/core/schemas/builders/object-like/index.js +1 -6
- package/dist/core/schemas/builders/object-like/types.js +1 -2
- package/dist/core/schemas/builders/primitives/any.js +3 -6
- package/dist/core/schemas/builders/primitives/boolean.js +5 -8
- package/dist/core/schemas/builders/primitives/index.js +5 -13
- package/dist/core/schemas/builders/primitives/number.js +5 -8
- package/dist/core/schemas/builders/primitives/string.js +5 -8
- package/dist/core/schemas/builders/primitives/unknown.js +3 -6
- package/dist/core/schemas/builders/record/index.js +1 -5
- package/dist/core/schemas/builders/record/record.js +14 -18
- package/dist/core/schemas/builders/record/types.js +1 -2
- package/dist/core/schemas/builders/schema-utils/JsonError.js +3 -7
- package/dist/core/schemas/builders/schema-utils/ParseError.js +3 -7
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +9 -15
- package/dist/core/schemas/builders/schema-utils/index.js +3 -11
- package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -5
- package/dist/core/schemas/builders/set/index.js +1 -5
- package/dist/core/schemas/builders/set/set.js +10 -14
- package/dist/core/schemas/builders/undiscriminated-union/index.js +1 -5
- package/dist/core/schemas/builders/undiscriminated-union/types.js +1 -2
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +6 -10
- package/dist/core/schemas/builders/union/discriminant.js +1 -5
- package/dist/core/schemas/builders/union/index.js +2 -7
- package/dist/core/schemas/builders/union/types.js +1 -2
- package/dist/core/schemas/builders/union/union.js +14 -18
- package/dist/core/schemas/index.js +1 -17
- package/dist/core/schemas/utils/MaybePromise.js +1 -2
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.js +1 -2
- package/dist/core/schemas/utils/createIdentitySchemaCreator.js +4 -8
- package/dist/core/schemas/utils/entries.js +1 -5
- package/dist/core/schemas/utils/filterObject.js +1 -5
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -5
- package/dist/core/schemas/utils/isPlainObject.js +1 -5
- package/dist/core/schemas/utils/keys.js +1 -5
- package/dist/core/schemas/utils/maybeSkipValidation.js +1 -5
- package/dist/core/schemas/utils/partition.js +1 -5
- package/dist/core/streaming-fetcher/Stream.js +4 -9
- package/dist/core/streaming-fetcher/index.js +1 -5
- package/dist/core/websocket/events.js +3 -9
- package/dist/core/websocket/index.js +1 -17
- package/dist/core/websocket/ws.js +6 -33
- package/dist/environments.js +1 -4
- package/dist/errors/CartesiaError.js +1 -5
- package/dist/errors/CartesiaTimeoutError.js +1 -5
- package/dist/errors/index.js +2 -7
- package/dist/index.js +4 -34
- package/dist/serialization/index.js +1 -17
- package/dist/serialization/resources/apiStatus/index.js +1 -17
- package/dist/serialization/resources/apiStatus/types/ApiInfo.js +2 -28
- package/dist/serialization/resources/apiStatus/types/index.js +1 -17
- package/dist/serialization/resources/embedding/index.js +1 -17
- package/dist/serialization/resources/embedding/types/Embedding.js +2 -28
- package/dist/serialization/resources/embedding/types/index.js +1 -17
- package/dist/serialization/resources/index.js +10 -39
- package/dist/serialization/resources/tts/index.js +1 -17
- package/dist/serialization/resources/tts/types/CancelContextRequest.js +4 -30
- package/dist/serialization/resources/tts/types/ContextId.js +2 -28
- package/dist/serialization/resources/tts/types/Controls.js +6 -32
- package/dist/serialization/resources/tts/types/Emotion.js +2 -28
- package/dist/serialization/resources/tts/types/GenerationRequest.js +10 -36
- package/dist/serialization/resources/tts/types/Mp3OutputFormat.js +2 -28
- package/dist/serialization/resources/tts/types/NaturalSpecifier.js +2 -28
- package/dist/serialization/resources/tts/types/NumericalSpecifier.js +2 -28
- package/dist/serialization/resources/tts/types/OutputFormat.js +8 -34
- package/dist/serialization/resources/tts/types/RawEncoding.js +2 -28
- package/dist/serialization/resources/tts/types/RawOutputFormat.js +4 -30
- package/dist/serialization/resources/tts/types/Speed.js +4 -30
- package/dist/serialization/resources/tts/types/SupportedLanguage.js +2 -28
- package/dist/serialization/resources/tts/types/TtsRequest.js +8 -34
- package/dist/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.js +6 -32
- package/dist/serialization/resources/tts/types/TtsRequestIdSpecifier.js +6 -32
- package/dist/serialization/resources/tts/types/TtsRequestVoiceSpecifier.js +4 -30
- package/dist/serialization/resources/tts/types/WavOutputFormat.js +3 -29
- package/dist/serialization/resources/tts/types/WebSocketBaseResponse.js +4 -30
- package/dist/serialization/resources/tts/types/WebSocketChunkResponse.js +4 -30
- package/dist/serialization/resources/tts/types/WebSocketDoneResponse.js +3 -29
- package/dist/serialization/resources/tts/types/WebSocketErrorResponse.js +4 -30
- package/dist/serialization/resources/tts/types/WebSocketRawOutputFormat.js +4 -30
- package/dist/serialization/resources/tts/types/WebSocketRequest.js +4 -30
- package/dist/serialization/resources/tts/types/WebSocketResponse.js +10 -36
- package/dist/serialization/resources/tts/types/WebSocketStreamOptions.js +2 -28
- package/dist/serialization/resources/tts/types/WebSocketTimestampsResponse.js +6 -32
- package/dist/serialization/resources/tts/types/WebSocketTtsOutput.js +6 -32
- package/dist/serialization/resources/tts/types/WebSocketTtsRequest.js +6 -32
- package/dist/serialization/resources/tts/types/WordTimestamps.js +2 -28
- package/dist/serialization/resources/tts/types/index.js +30 -46
- package/dist/serialization/resources/voiceChanger/index.js +1 -17
- package/dist/serialization/resources/voiceChanger/types/OutputFormatContainer.js +2 -28
- package/dist/serialization/resources/voiceChanger/types/StreamingResponse.js +8 -34
- package/dist/serialization/resources/voiceChanger/types/index.js +2 -18
- package/dist/serialization/resources/voices/client/index.js +1 -27
- package/dist/serialization/resources/voices/client/list.js +3 -29
- package/dist/serialization/resources/voices/index.js +2 -18
- package/dist/serialization/resources/voices/types/BaseVoiceId.js +2 -5
- package/dist/serialization/resources/voices/types/CloneMode.js +2 -28
- package/dist/serialization/resources/voices/types/CreateVoiceRequest.js +8 -34
- package/dist/serialization/resources/voices/types/EmbeddingResponse.js +4 -30
- package/dist/serialization/resources/voices/types/EmbeddingSpecifier.js +6 -32
- package/dist/serialization/resources/voices/types/Gender.js +2 -28
- package/dist/serialization/resources/voices/types/IdSpecifier.js +6 -32
- package/dist/serialization/resources/voices/types/LocalizeDialect.js +2 -28
- package/dist/serialization/resources/voices/types/LocalizeTargetLanguage.js +2 -28
- package/dist/serialization/resources/voices/types/LocalizeVoiceRequest.js +10 -36
- package/dist/serialization/resources/voices/types/MixVoiceSpecifier.js +4 -30
- package/dist/serialization/resources/voices/types/MixVoicesRequest.js +4 -30
- package/dist/serialization/resources/voices/types/UpdateVoiceRequest.js +2 -28
- package/dist/serialization/resources/voices/types/Voice.js +10 -36
- package/dist/serialization/resources/voices/types/VoiceId.js +2 -28
- package/dist/serialization/resources/voices/types/VoiceMetadata.js +6 -32
- package/dist/serialization/resources/voices/types/Weight.js +2 -28
- package/dist/serialization/resources/voices/types/index.js +17 -33
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -4
- package/dist/wrapper/Client.js +4 -8
- package/dist/wrapper/StreamingTTSClient.js +4 -11
- package/dist/wrapper/WebPlayer.js +3 -7
- package/dist/wrapper/Websocket.js +23 -52
- package/dist/wrapper/source.js +5 -11
- package/dist/wrapper/utils.js +13 -28
- package/environments.js +1 -4
- package/errors/CartesiaError.js +1 -5
- package/errors/CartesiaTimeoutError.js +1 -5
- package/errors/index.js +2 -7
- package/index.js +4 -34
- package/package.json +1 -1
- package/serialization/index.js +1 -17
- package/serialization/resources/apiStatus/index.js +1 -17
- package/serialization/resources/apiStatus/types/ApiInfo.js +2 -28
- package/serialization/resources/apiStatus/types/index.js +1 -17
- package/serialization/resources/embedding/index.js +1 -17
- package/serialization/resources/embedding/types/Embedding.js +2 -28
- package/serialization/resources/embedding/types/index.js +1 -17
- package/serialization/resources/index.js +10 -39
- package/serialization/resources/tts/index.js +1 -17
- package/serialization/resources/tts/types/CancelContextRequest.js +4 -30
- package/serialization/resources/tts/types/ContextId.js +2 -28
- package/serialization/resources/tts/types/Controls.js +6 -32
- package/serialization/resources/tts/types/Emotion.js +2 -28
- package/serialization/resources/tts/types/GenerationRequest.js +10 -36
- package/serialization/resources/tts/types/Mp3OutputFormat.js +2 -28
- package/serialization/resources/tts/types/NaturalSpecifier.js +2 -28
- package/serialization/resources/tts/types/NumericalSpecifier.js +2 -28
- package/serialization/resources/tts/types/OutputFormat.js +8 -34
- package/serialization/resources/tts/types/RawEncoding.js +2 -28
- package/serialization/resources/tts/types/RawOutputFormat.js +4 -30
- package/serialization/resources/tts/types/Speed.js +4 -30
- package/serialization/resources/tts/types/SupportedLanguage.js +2 -28
- package/serialization/resources/tts/types/TtsRequest.js +8 -34
- package/serialization/resources/tts/types/TtsRequestEmbeddingSpecifier.js +6 -32
- package/serialization/resources/tts/types/TtsRequestIdSpecifier.js +6 -32
- package/serialization/resources/tts/types/TtsRequestVoiceSpecifier.js +4 -30
- package/serialization/resources/tts/types/WavOutputFormat.js +3 -29
- package/serialization/resources/tts/types/WebSocketBaseResponse.js +4 -30
- package/serialization/resources/tts/types/WebSocketChunkResponse.js +4 -30
- package/serialization/resources/tts/types/WebSocketDoneResponse.js +3 -29
- package/serialization/resources/tts/types/WebSocketErrorResponse.js +4 -30
- package/serialization/resources/tts/types/WebSocketRawOutputFormat.js +4 -30
- package/serialization/resources/tts/types/WebSocketRequest.js +4 -30
- package/serialization/resources/tts/types/WebSocketResponse.js +10 -36
- package/serialization/resources/tts/types/WebSocketStreamOptions.js +2 -28
- package/serialization/resources/tts/types/WebSocketTimestampsResponse.js +6 -32
- package/serialization/resources/tts/types/WebSocketTtsOutput.js +6 -32
- package/serialization/resources/tts/types/WebSocketTtsRequest.js +6 -32
- package/serialization/resources/tts/types/WordTimestamps.js +2 -28
- package/serialization/resources/tts/types/index.js +30 -46
- package/serialization/resources/voiceChanger/index.js +1 -17
- package/serialization/resources/voiceChanger/types/OutputFormatContainer.js +2 -28
- package/serialization/resources/voiceChanger/types/StreamingResponse.js +8 -34
- package/serialization/resources/voiceChanger/types/index.js +2 -18
- package/serialization/resources/voices/client/index.js +1 -27
- package/serialization/resources/voices/client/list.js +3 -29
- package/serialization/resources/voices/index.js +2 -18
- package/serialization/resources/voices/types/BaseVoiceId.js +2 -5
- package/serialization/resources/voices/types/CloneMode.js +2 -28
- package/serialization/resources/voices/types/CreateVoiceRequest.js +8 -34
- package/serialization/resources/voices/types/EmbeddingResponse.js +4 -30
- package/serialization/resources/voices/types/EmbeddingSpecifier.js +6 -32
- package/serialization/resources/voices/types/Gender.js +2 -28
- package/serialization/resources/voices/types/IdSpecifier.js +6 -32
- package/serialization/resources/voices/types/LocalizeDialect.js +2 -28
- package/serialization/resources/voices/types/LocalizeTargetLanguage.js +2 -28
- package/serialization/resources/voices/types/LocalizeVoiceRequest.js +10 -36
- package/serialization/resources/voices/types/MixVoiceSpecifier.js +4 -30
- package/serialization/resources/voices/types/MixVoicesRequest.js +4 -30
- package/serialization/resources/voices/types/UpdateVoiceRequest.js +2 -28
- package/serialization/resources/voices/types/Voice.js +10 -36
- package/serialization/resources/voices/types/VoiceId.js +2 -28
- package/serialization/resources/voices/types/VoiceMetadata.js +6 -32
- package/serialization/resources/voices/types/Weight.js +2 -28
- package/serialization/resources/voices/types/index.js +17 -33
- package/version.d.ts +1 -1
- package/version.js +1 -4
- package/wrapper/Client.js +4 -8
- package/wrapper/StreamingTTSClient.js +4 -11
- package/wrapper/WebPlayer.js +3 -7
- package/wrapper/Websocket.js +23 -52
- package/wrapper/source.js +5 -11
- package/wrapper/utils.js +13 -28
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -31,19 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
8
|
});
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
exports.WebFormData = exports.Node16FormData = exports.Node18FormData = exports.newFormData = void 0;
|
|
36
|
-
const runtime_1 = require("../runtime");
|
|
10
|
+
import { RUNTIME } from "../runtime";
|
|
37
11
|
function isNamedValue(value) {
|
|
38
12
|
return typeof value === "object" && value != null && "name" in value;
|
|
39
13
|
}
|
|
40
|
-
function newFormData() {
|
|
14
|
+
export function newFormData() {
|
|
41
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
16
|
let formdata;
|
|
43
|
-
if (
|
|
17
|
+
if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) {
|
|
44
18
|
formdata = new Node18FormData();
|
|
45
19
|
}
|
|
46
|
-
else if (
|
|
20
|
+
else if (RUNTIME.type === "node") {
|
|
47
21
|
formdata = new Node16FormData();
|
|
48
22
|
}
|
|
49
23
|
else {
|
|
@@ -53,14 +27,13 @@ function newFormData() {
|
|
|
53
27
|
return formdata;
|
|
54
28
|
});
|
|
55
29
|
}
|
|
56
|
-
exports.newFormData = newFormData;
|
|
57
30
|
/**
|
|
58
31
|
* Form Data Implementation for Node.js 18+
|
|
59
32
|
*/
|
|
60
|
-
class Node18FormData {
|
|
33
|
+
export class Node18FormData {
|
|
61
34
|
setup() {
|
|
62
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
this.fd = new (yield
|
|
36
|
+
this.fd = new (yield import("formdata-node")).FormData();
|
|
64
37
|
});
|
|
65
38
|
}
|
|
66
39
|
append(key, value) {
|
|
@@ -90,23 +63,22 @@ class Node18FormData {
|
|
|
90
63
|
}
|
|
91
64
|
getRequest() {
|
|
92
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
const encoder = new (yield
|
|
66
|
+
const encoder = new (yield import("form-data-encoder")).FormDataEncoder(this.fd);
|
|
94
67
|
return {
|
|
95
|
-
body: (yield
|
|
68
|
+
body: (yield import("readable-stream")).Readable.from(encoder),
|
|
96
69
|
headers: encoder.headers,
|
|
97
70
|
duplex: "half",
|
|
98
71
|
};
|
|
99
72
|
});
|
|
100
73
|
}
|
|
101
74
|
}
|
|
102
|
-
exports.Node18FormData = Node18FormData;
|
|
103
75
|
/**
|
|
104
76
|
* Form Data Implementation for Node.js 16-18
|
|
105
77
|
*/
|
|
106
|
-
class Node16FormData {
|
|
78
|
+
export class Node16FormData {
|
|
107
79
|
setup() {
|
|
108
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
-
this.fd = new (yield
|
|
81
|
+
this.fd = new (yield import("form-data")).default();
|
|
110
82
|
});
|
|
111
83
|
}
|
|
112
84
|
append(key, value) {
|
|
@@ -141,11 +113,10 @@ class Node16FormData {
|
|
|
141
113
|
};
|
|
142
114
|
}
|
|
143
115
|
}
|
|
144
|
-
exports.Node16FormData = Node16FormData;
|
|
145
116
|
/**
|
|
146
117
|
* Form Data Implementation for Web
|
|
147
118
|
*/
|
|
148
|
-
class WebFormData {
|
|
119
|
+
export class WebFormData {
|
|
149
120
|
setup() {
|
|
150
121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
122
|
this.fd = new FormData();
|
|
@@ -171,4 +142,3 @@ class WebFormData {
|
|
|
171
142
|
};
|
|
172
143
|
}
|
|
173
144
|
}
|
|
174
|
-
exports.WebFormData = WebFormData;
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./FormDataWrapper"), exports);
|
|
1
|
+
export * from "./FormDataWrapper";
|
package/core/index.js
CHANGED
|
@@ -1,34 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
-
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.serialization = void 0;
|
|
30
|
-
__exportStar(require("./fetcher"), exports);
|
|
31
|
-
__exportStar(require("./runtime"), exports);
|
|
32
|
-
__exportStar(require("./streaming-fetcher"), exports);
|
|
33
|
-
__exportStar(require("./form-data-utils"), exports);
|
|
34
|
-
exports.serialization = __importStar(require("./schemas"));
|
|
1
|
+
export * from "./fetcher";
|
|
2
|
+
export * from "./runtime";
|
|
3
|
+
export * from "./streaming-fetcher";
|
|
4
|
+
export * from "./form-data-utils";
|
|
5
|
+
export * as serialization from "./schemas";
|
package/core/runtime/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RUNTIME = void 0;
|
|
4
|
-
var runtime_1 = require("./runtime");
|
|
5
|
-
Object.defineProperty(exports, "RUNTIME", { enumerable: true, get: function () { return runtime_1.RUNTIME; } });
|
|
1
|
+
export { RUNTIME } from "./runtime";
|
package/core/runtime/runtime.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var _a, _b, _c, _d, _e;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.RUNTIME = void 0;
|
|
5
2
|
/**
|
|
6
3
|
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
7
4
|
*/
|
|
@@ -45,7 +42,7 @@ const isCloudflare = typeof globalThis !== "undefined" && ((_e = globalThis ===
|
|
|
45
42
|
/**
|
|
46
43
|
* A constant that indicates which environment and version the SDK is running in.
|
|
47
44
|
*/
|
|
48
|
-
|
|
45
|
+
export const RUNTIME = evaluateRuntime();
|
|
49
46
|
function evaluateRuntime() {
|
|
50
47
|
if (isBrowser) {
|
|
51
48
|
return {
|
package/core/schemas/Schema.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
7
|
-
const schema_utils_1 = require("../schema-utils");
|
|
8
|
-
function bigint() {
|
|
1
|
+
import { SchemaType } from "../../Schema";
|
|
2
|
+
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
3
|
+
import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
4
|
+
import { getSchemaUtils } from "../schema-utils";
|
|
5
|
+
export function bigint() {
|
|
9
6
|
const baseSchema = {
|
|
10
7
|
parse: (raw, { breadcrumbsPrefix = [] } = {}) => {
|
|
11
8
|
if (typeof raw !== "string") {
|
|
@@ -14,7 +11,7 @@ function bigint() {
|
|
|
14
11
|
errors: [
|
|
15
12
|
{
|
|
16
13
|
path: breadcrumbsPrefix,
|
|
17
|
-
message:
|
|
14
|
+
message: getErrorMessageForIncorrectType(raw, "string"),
|
|
18
15
|
},
|
|
19
16
|
],
|
|
20
17
|
};
|
|
@@ -37,14 +34,13 @@ function bigint() {
|
|
|
37
34
|
errors: [
|
|
38
35
|
{
|
|
39
36
|
path: breadcrumbsPrefix,
|
|
40
|
-
message:
|
|
37
|
+
message: getErrorMessageForIncorrectType(bigint, "bigint"),
|
|
41
38
|
},
|
|
42
39
|
],
|
|
43
40
|
};
|
|
44
41
|
}
|
|
45
42
|
},
|
|
46
|
-
getType: () =>
|
|
43
|
+
getType: () => SchemaType.BIGINT,
|
|
47
44
|
};
|
|
48
|
-
return Object.assign(Object.assign({},
|
|
45
|
+
return Object.assign(Object.assign({}, maybeSkipValidation(baseSchema)), getSchemaUtils(baseSchema));
|
|
49
46
|
}
|
|
50
|
-
exports.bigint = bigint;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bigint = void 0;
|
|
4
|
-
var bigint_1 = require("./bigint");
|
|
5
|
-
Object.defineProperty(exports, "bigint", { enumerable: true, get: function () { return bigint_1.bigint; } });
|
|
1
|
+
export { bigint } from "./bigint";
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
6
|
-
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
7
|
-
const schema_utils_1 = require("../schema-utils");
|
|
1
|
+
import { SchemaType } from "../../Schema";
|
|
2
|
+
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
3
|
+
import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
4
|
+
import { getSchemaUtils } from "../schema-utils";
|
|
8
5
|
// https://stackoverflow.com/questions/12756159/regex-and-iso8601-formatted-datetime
|
|
9
6
|
const ISO_8601_REGEX = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
|
|
10
|
-
function date() {
|
|
7
|
+
export function date() {
|
|
11
8
|
const baseSchema = {
|
|
12
9
|
parse: (raw, { breadcrumbsPrefix = [] } = {}) => {
|
|
13
10
|
if (typeof raw !== "string") {
|
|
@@ -16,7 +13,7 @@ function date() {
|
|
|
16
13
|
errors: [
|
|
17
14
|
{
|
|
18
15
|
path: breadcrumbsPrefix,
|
|
19
|
-
message:
|
|
16
|
+
message: getErrorMessageForIncorrectType(raw, "string"),
|
|
20
17
|
},
|
|
21
18
|
],
|
|
22
19
|
};
|
|
@@ -27,7 +24,7 @@ function date() {
|
|
|
27
24
|
errors: [
|
|
28
25
|
{
|
|
29
26
|
path: breadcrumbsPrefix,
|
|
30
|
-
message:
|
|
27
|
+
message: getErrorMessageForIncorrectType(raw, "ISO 8601 date string"),
|
|
31
28
|
},
|
|
32
29
|
],
|
|
33
30
|
};
|
|
@@ -50,14 +47,13 @@ function date() {
|
|
|
50
47
|
errors: [
|
|
51
48
|
{
|
|
52
49
|
path: breadcrumbsPrefix,
|
|
53
|
-
message:
|
|
50
|
+
message: getErrorMessageForIncorrectType(date, "Date object"),
|
|
54
51
|
},
|
|
55
52
|
],
|
|
56
53
|
};
|
|
57
54
|
}
|
|
58
55
|
},
|
|
59
|
-
getType: () =>
|
|
56
|
+
getType: () => SchemaType.DATE,
|
|
60
57
|
};
|
|
61
|
-
return Object.assign(Object.assign({},
|
|
58
|
+
return Object.assign(Object.assign({}, maybeSkipValidation(baseSchema)), getSchemaUtils(baseSchema));
|
|
62
59
|
}
|
|
63
|
-
exports.date = date;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.date = void 0;
|
|
4
|
-
var date_1 = require("./date");
|
|
5
|
-
Object.defineProperty(exports, "date", { enumerable: true, get: function () { return date_1.date; } });
|
|
1
|
+
export { date } from "./date";
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
|
|
6
|
-
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
7
|
-
function enum_(values) {
|
|
1
|
+
import { SchemaType } from "../../Schema";
|
|
2
|
+
import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator";
|
|
3
|
+
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
4
|
+
export function enum_(values) {
|
|
8
5
|
const validValues = new Set(values);
|
|
9
|
-
const schemaCreator =
|
|
6
|
+
const schemaCreator = createIdentitySchemaCreator(SchemaType.ENUM, (value, { allowUnrecognizedEnumValues, breadcrumbsPrefix = [] } = {}) => {
|
|
10
7
|
if (typeof value !== "string") {
|
|
11
8
|
return {
|
|
12
9
|
ok: false,
|
|
13
10
|
errors: [
|
|
14
11
|
{
|
|
15
12
|
path: breadcrumbsPrefix,
|
|
16
|
-
message:
|
|
13
|
+
message: getErrorMessageForIncorrectType(value, "string"),
|
|
17
14
|
},
|
|
18
15
|
],
|
|
19
16
|
};
|
|
@@ -24,7 +21,7 @@ function enum_(values) {
|
|
|
24
21
|
errors: [
|
|
25
22
|
{
|
|
26
23
|
path: breadcrumbsPrefix,
|
|
27
|
-
message:
|
|
24
|
+
message: getErrorMessageForIncorrectType(value, "enum"),
|
|
28
25
|
},
|
|
29
26
|
],
|
|
30
27
|
};
|
|
@@ -36,4 +33,3 @@ function enum_(values) {
|
|
|
36
33
|
});
|
|
37
34
|
return schemaCreator();
|
|
38
35
|
}
|
|
39
|
-
exports.enum_ = enum_;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enum_ = void 0;
|
|
4
|
-
var enum_1 = require("./enum");
|
|
5
|
-
Object.defineProperty(exports, "enum_", { enumerable: true, get: function () { return enum_1.enum_; } });
|
|
1
|
+
export { enum_ } from "./enum";
|
|
@@ -1,30 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./bigint"), exports);
|
|
18
|
-
__exportStar(require("./date"), exports);
|
|
19
|
-
__exportStar(require("./enum"), exports);
|
|
20
|
-
__exportStar(require("./lazy"), exports);
|
|
21
|
-
__exportStar(require("./list"), exports);
|
|
22
|
-
__exportStar(require("./literals"), exports);
|
|
23
|
-
__exportStar(require("./object"), exports);
|
|
24
|
-
__exportStar(require("./object-like"), exports);
|
|
25
|
-
__exportStar(require("./primitives"), exports);
|
|
26
|
-
__exportStar(require("./record"), exports);
|
|
27
|
-
__exportStar(require("./schema-utils"), exports);
|
|
28
|
-
__exportStar(require("./set"), exports);
|
|
29
|
-
__exportStar(require("./undiscriminated-union"), exports);
|
|
30
|
-
__exportStar(require("./union"), exports);
|
|
1
|
+
export * from "./bigint";
|
|
2
|
+
export * from "./date";
|
|
3
|
+
export * from "./enum";
|
|
4
|
+
export * from "./lazy";
|
|
5
|
+
export * from "./list";
|
|
6
|
+
export * from "./literals";
|
|
7
|
+
export * from "./object";
|
|
8
|
+
export * from "./object-like";
|
|
9
|
+
export * from "./primitives";
|
|
10
|
+
export * from "./record";
|
|
11
|
+
export * from "./schema-utils";
|
|
12
|
+
export * from "./set";
|
|
13
|
+
export * from "./undiscriminated-union";
|
|
14
|
+
export * from "./union";
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.lazyObject = exports.lazy = void 0;
|
|
4
|
-
var lazy_1 = require("./lazy");
|
|
5
|
-
Object.defineProperty(exports, "lazy", { enumerable: true, get: function () { return lazy_1.lazy; } });
|
|
6
|
-
var lazyObject_1 = require("./lazyObject");
|
|
7
|
-
Object.defineProperty(exports, "lazyObject", { enumerable: true, get: function () { return lazyObject_1.lazyObject; } });
|
|
1
|
+
export { lazy } from "./lazy";
|
|
2
|
+
export { lazyObject } from "./lazyObject";
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getMemoizedSchema = exports.constructLazyBaseSchema = exports.lazy = void 0;
|
|
4
|
-
const schema_utils_1 = require("../schema-utils");
|
|
5
|
-
function lazy(getter) {
|
|
1
|
+
import { getSchemaUtils } from "../schema-utils";
|
|
2
|
+
export function lazy(getter) {
|
|
6
3
|
const baseSchema = constructLazyBaseSchema(getter);
|
|
7
|
-
return Object.assign(Object.assign({}, baseSchema),
|
|
4
|
+
return Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema));
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
function constructLazyBaseSchema(getter) {
|
|
6
|
+
export function constructLazyBaseSchema(getter) {
|
|
11
7
|
return {
|
|
12
8
|
parse: (raw, opts) => getMemoizedSchema(getter).parse(raw, opts),
|
|
13
9
|
json: (parsed, opts) => getMemoizedSchema(getter).json(parsed, opts),
|
|
14
10
|
getType: () => getMemoizedSchema(getter).getType(),
|
|
15
11
|
};
|
|
16
12
|
}
|
|
17
|
-
|
|
18
|
-
function getMemoizedSchema(getter) {
|
|
13
|
+
export function getMemoizedSchema(getter) {
|
|
19
14
|
const castedGetter = getter;
|
|
20
15
|
if (castedGetter.__zurg_memoized == null) {
|
|
21
16
|
castedGetter.__zurg_memoized = getter();
|
|
22
17
|
}
|
|
23
18
|
return castedGetter.__zurg_memoized;
|
|
24
19
|
}
|
|
25
|
-
exports.getMemoizedSchema = getMemoizedSchema;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
function lazyObject(getter) {
|
|
9
|
-
const baseSchema = Object.assign(Object.assign({}, (0, lazy_1.constructLazyBaseSchema)(getter)), { _getRawProperties: () => (0, lazy_1.getMemoizedSchema)(getter)._getRawProperties(), _getParsedProperties: () => (0, lazy_1.getMemoizedSchema)(getter)._getParsedProperties() });
|
|
10
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, baseSchema), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema)), (0, object_1.getObjectUtils)(baseSchema));
|
|
1
|
+
import { getObjectUtils } from "../object";
|
|
2
|
+
import { getObjectLikeUtils } from "../object-like";
|
|
3
|
+
import { getSchemaUtils } from "../schema-utils";
|
|
4
|
+
import { constructLazyBaseSchema, getMemoizedSchema } from "./lazy";
|
|
5
|
+
export function lazyObject(getter) {
|
|
6
|
+
const baseSchema = Object.assign(Object.assign({}, constructLazyBaseSchema(getter)), { _getRawProperties: () => getMemoizedSchema(getter)._getRawProperties(), _getParsedProperties: () => getMemoizedSchema(getter)._getParsedProperties() });
|
|
7
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema)), getObjectLikeUtils(baseSchema)), getObjectUtils(baseSchema));
|
|
11
8
|
}
|
|
12
|
-
exports.lazyObject = lazyObject;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.list = void 0;
|
|
4
|
-
var list_1 = require("./list");
|
|
5
|
-
Object.defineProperty(exports, "list", { enumerable: true, get: function () { return list_1.list; } });
|
|
1
|
+
export { list } from "./list";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
7
|
-
const schema_utils_1 = require("../schema-utils");
|
|
8
|
-
function list(schema) {
|
|
1
|
+
import { SchemaType } from "../../Schema";
|
|
2
|
+
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
3
|
+
import { maybeSkipValidation } from "../../utils/maybeSkipValidation";
|
|
4
|
+
import { getSchemaUtils } from "../schema-utils";
|
|
5
|
+
export function list(schema) {
|
|
9
6
|
const baseSchema = {
|
|
10
7
|
parse: (raw, opts) => validateAndTransformArray(raw, (item, index) => {
|
|
11
8
|
var _a;
|
|
@@ -15,18 +12,17 @@ function list(schema) {
|
|
|
15
12
|
var _a;
|
|
16
13
|
return schema.json(item, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `[${index}]`] }));
|
|
17
14
|
}),
|
|
18
|
-
getType: () =>
|
|
15
|
+
getType: () => SchemaType.LIST,
|
|
19
16
|
};
|
|
20
|
-
return Object.assign(Object.assign({},
|
|
17
|
+
return Object.assign(Object.assign({}, maybeSkipValidation(baseSchema)), getSchemaUtils(baseSchema));
|
|
21
18
|
}
|
|
22
|
-
exports.list = list;
|
|
23
19
|
function validateAndTransformArray(value, transformItem) {
|
|
24
20
|
if (!Array.isArray(value)) {
|
|
25
21
|
return {
|
|
26
22
|
ok: false,
|
|
27
23
|
errors: [
|
|
28
24
|
{
|
|
29
|
-
message:
|
|
25
|
+
message: getErrorMessageForIncorrectType(value, "list"),
|
|
30
26
|
path: [],
|
|
31
27
|
},
|
|
32
28
|
],
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
7
|
-
function booleanLiteral(literal) {
|
|
8
|
-
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.BOOLEAN_LITERAL, (value, { breadcrumbsPrefix = [] } = {}) => {
|
|
1
|
+
import { SchemaType } from "../../Schema";
|
|
2
|
+
import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator";
|
|
3
|
+
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
4
|
+
export function booleanLiteral(literal) {
|
|
5
|
+
const schemaCreator = createIdentitySchemaCreator(SchemaType.BOOLEAN_LITERAL, (value, { breadcrumbsPrefix = [] } = {}) => {
|
|
9
6
|
if (value === literal) {
|
|
10
7
|
return {
|
|
11
8
|
ok: true,
|
|
@@ -18,7 +15,7 @@ function booleanLiteral(literal) {
|
|
|
18
15
|
errors: [
|
|
19
16
|
{
|
|
20
17
|
path: breadcrumbsPrefix,
|
|
21
|
-
message:
|
|
18
|
+
message: getErrorMessageForIncorrectType(value, `${literal.toString()}`),
|
|
22
19
|
},
|
|
23
20
|
],
|
|
24
21
|
};
|
|
@@ -26,4 +23,3 @@ function booleanLiteral(literal) {
|
|
|
26
23
|
});
|
|
27
24
|
return schemaCreator();
|
|
28
25
|
}
|
|
29
|
-
exports.booleanLiteral = booleanLiteral;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.booleanLiteral = exports.stringLiteral = void 0;
|
|
4
|
-
var stringLiteral_1 = require("./stringLiteral");
|
|
5
|
-
Object.defineProperty(exports, "stringLiteral", { enumerable: true, get: function () { return stringLiteral_1.stringLiteral; } });
|
|
6
|
-
var booleanLiteral_1 = require("./booleanLiteral");
|
|
7
|
-
Object.defineProperty(exports, "booleanLiteral", { enumerable: true, get: function () { return booleanLiteral_1.booleanLiteral; } });
|
|
1
|
+
export { stringLiteral } from "./stringLiteral";
|
|
2
|
+
export { booleanLiteral } from "./booleanLiteral";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
7
|
-
function stringLiteral(literal) {
|
|
8
|
-
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.STRING_LITERAL, (value, { breadcrumbsPrefix = [] } = {}) => {
|
|
1
|
+
import { SchemaType } from "../../Schema";
|
|
2
|
+
import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator";
|
|
3
|
+
import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType";
|
|
4
|
+
export function stringLiteral(literal) {
|
|
5
|
+
const schemaCreator = createIdentitySchemaCreator(SchemaType.STRING_LITERAL, (value, { breadcrumbsPrefix = [] } = {}) => {
|
|
9
6
|
if (value === literal) {
|
|
10
7
|
return {
|
|
11
8
|
ok: true,
|
|
@@ -18,7 +15,7 @@ function stringLiteral(literal) {
|
|
|
18
15
|
errors: [
|
|
19
16
|
{
|
|
20
17
|
path: breadcrumbsPrefix,
|
|
21
|
-
message:
|
|
18
|
+
message: getErrorMessageForIncorrectType(value, `"${literal}"`),
|
|
22
19
|
},
|
|
23
20
|
],
|
|
24
21
|
};
|
|
@@ -26,4 +23,3 @@ function stringLiteral(literal) {
|
|
|
26
23
|
});
|
|
27
24
|
return schemaCreator();
|
|
28
25
|
}
|
|
29
|
-
exports.stringLiteral = stringLiteral;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var object_1 = require("./object");
|
|
5
|
-
Object.defineProperty(exports, "getObjectUtils", { enumerable: true, get: function () { return object_1.getObjectUtils; } });
|
|
6
|
-
Object.defineProperty(exports, "object", { enumerable: true, get: function () { return object_1.object; } });
|
|
7
|
-
var objectWithoutOptionalProperties_1 = require("./objectWithoutOptionalProperties");
|
|
8
|
-
Object.defineProperty(exports, "objectWithoutOptionalProperties", { enumerable: true, get: function () { return objectWithoutOptionalProperties_1.objectWithoutOptionalProperties; } });
|
|
9
|
-
var property_1 = require("./property");
|
|
10
|
-
Object.defineProperty(exports, "isProperty", { enumerable: true, get: function () { return property_1.isProperty; } });
|
|
11
|
-
Object.defineProperty(exports, "property", { enumerable: true, get: function () { return property_1.property; } });
|
|
1
|
+
export { getObjectUtils, object } from "./object";
|
|
2
|
+
export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties";
|
|
3
|
+
export { isProperty, property } from "./property";
|