hume 0.1.0 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +42 -0
- package/Client.js +291 -0
- package/README.md +135 -1
- package/api/client/index.d.ts +1 -0
- package/api/client/index.js +17 -0
- package/api/client/requests/BaseRequest.d.ts +18 -0
- package/api/client/requests/BaseRequest.js +5 -0
- package/api/client/requests/ListJobsRequest.d.ts +30 -0
- package/api/client/requests/ListJobsRequest.js +5 -0
- package/api/client/requests/index.d.ts +2 -0
- package/api/client/requests/index.js +2 -0
- package/api/index.d.ts +2 -0
- package/api/index.js +18 -0
- package/api/types/Bcp47Tag.d.ts +35 -0
- package/api/types/Bcp47Tag.js +37 -0
- package/api/types/BoundingBox.d.ts +16 -0
- package/api/types/BoundingBox.js +5 -0
- package/api/types/BurstPrediction.d.ts +11 -0
- package/api/types/BurstPrediction.js +5 -0
- package/api/types/BurstResponse.d.ts +10 -0
- package/api/types/BurstResponse.js +5 -0
- package/api/types/Completed.d.ts +15 -0
- package/api/types/Completed.js +5 -0
- package/api/types/DescriptionsScore.d.ts +9 -0
- package/api/types/DescriptionsScore.js +5 -0
- package/api/types/Direction.d.ts +8 -0
- package/api/types/Direction.js +10 -0
- package/api/types/EmotionEmbedding.d.ts +8 -0
- package/api/types/EmotionEmbedding.js +5 -0
- package/api/types/EmotionEmbeddingItem.d.ts +9 -0
- package/api/types/EmotionEmbeddingItem.js +5 -0
- package/api/types/EmotionScore.d.ts +9 -0
- package/api/types/EmotionScore.js +5 -0
- package/api/types/Empty.d.ts +7 -0
- package/api/types/Empty.js +5 -0
- package/api/types/Error_.d.ts +9 -0
- package/api/types/Error_.js +5 -0
- package/api/types/Face.d.ts +18 -0
- package/api/types/Face.js +5 -0
- package/api/types/FaceModelConfig.d.ts +35 -0
- package/api/types/FaceModelConfig.js +5 -0
- package/api/types/FacePrediction.d.ts +19 -0
- package/api/types/FacePrediction.js +5 -0
- package/api/types/FaceResponse.d.ts +10 -0
- package/api/types/FaceResponse.js +5 -0
- package/api/types/FacemeshPrediction.d.ts +8 -0
- package/api/types/FacemeshPrediction.js +5 -0
- package/api/types/FacemeshResponse.d.ts +10 -0
- package/api/types/FacemeshResponse.js +5 -0
- package/api/types/FacsScore.d.ts +9 -0
- package/api/types/FacsScore.js +5 -0
- package/api/types/Failed.d.ts +13 -0
- package/api/types/Failed.js +5 -0
- package/api/types/File_.d.ts +11 -0
- package/api/types/File_.js +5 -0
- package/api/types/Granularity.d.ts +13 -0
- package/api/types/Granularity.js +12 -0
- package/api/types/GroupedPredictionsBurstPrediction.d.ts +9 -0
- package/api/types/GroupedPredictionsBurstPrediction.js +5 -0
- package/api/types/GroupedPredictionsFacePrediction.d.ts +9 -0
- package/api/types/GroupedPredictionsFacePrediction.js +5 -0
- package/api/types/GroupedPredictionsFacemeshPrediction.d.ts +9 -0
- package/api/types/GroupedPredictionsFacemeshPrediction.js +5 -0
- package/api/types/GroupedPredictionsLanguagePrediction.d.ts +9 -0
- package/api/types/GroupedPredictionsLanguagePrediction.js +5 -0
- package/api/types/GroupedPredictionsNerPrediction.d.ts +9 -0
- package/api/types/GroupedPredictionsNerPrediction.js +5 -0
- package/api/types/GroupedPredictionsProsodyPrediction.d.ts +9 -0
- package/api/types/GroupedPredictionsProsodyPrediction.js +5 -0
- package/api/types/InProgress.d.ts +9 -0
- package/api/types/InProgress.js +5 -0
- package/api/types/JobId.d.ts +7 -0
- package/api/types/JobId.js +5 -0
- package/api/types/JobRequest.d.ts +10 -0
- package/api/types/JobRequest.js +5 -0
- package/api/types/Language.d.ts +11 -0
- package/api/types/Language.js +5 -0
- package/api/types/LanguageConfig.d.ts +14 -0
- package/api/types/LanguageConfig.js +5 -0
- package/api/types/LanguagePrediction.d.ts +24 -0
- package/api/types/LanguagePrediction.js +5 -0
- package/api/types/LanguageResponse.d.ts +10 -0
- package/api/types/LanguageResponse.js +5 -0
- package/api/types/ModelConfig.d.ts +46 -0
- package/api/types/ModelConfig.js +5 -0
- package/api/types/ModelResponse.d.ts +16 -0
- package/api/types/ModelResponse.js +5 -0
- package/api/types/Models.d.ts +12 -0
- package/api/types/Models.js +5 -0
- package/api/types/ModelsError.d.ts +9 -0
- package/api/types/ModelsError.js +5 -0
- package/api/types/ModelsInput.d.ts +56 -0
- package/api/types/ModelsInput.js +5 -0
- package/api/types/ModelsPredictions.d.ts +12 -0
- package/api/types/ModelsPredictions.js +5 -0
- package/api/types/ModelsSuccessBurstPredictionsItem.d.ts +8 -0
- package/api/types/ModelsSuccessBurstPredictionsItem.js +5 -0
- package/api/types/ModelsSuccessFacePredictionsItem.d.ts +18 -0
- package/api/types/ModelsSuccessFacePredictionsItem.js +5 -0
- package/api/types/ModelsSuccessFacemeshPredictionsItem.d.ts +7 -0
- package/api/types/ModelsSuccessFacemeshPredictionsItem.js +5 -0
- package/api/types/ModelsSuccessLanguagePredictionsItem.d.ts +12 -0
- package/api/types/ModelsSuccessLanguagePredictionsItem.js +5 -0
- package/api/types/ModelsSuccessProsodyPredictionsItem.d.ts +8 -0
- package/api/types/ModelsSuccessProsodyPredictionsItem.js +5 -0
- package/api/types/ModelsWarning.d.ts +9 -0
- package/api/types/ModelsWarning.js +5 -0
- package/api/types/Ner.d.ts +7 -0
- package/api/types/Ner.js +5 -0
- package/api/types/NerPrediction.d.ts +24 -0
- package/api/types/NerPrediction.js +5 -0
- package/api/types/Null.d.ts +7 -0
- package/api/types/Null.js +5 -0
- package/api/types/PositionInterval.d.ts +12 -0
- package/api/types/PositionInterval.js +5 -0
- package/api/types/Prediction.d.ts +9 -0
- package/api/types/Prediction.js +5 -0
- package/api/types/PredictionsOptionalNullBurstPrediction.d.ts +8 -0
- package/api/types/PredictionsOptionalNullBurstPrediction.js +5 -0
- package/api/types/PredictionsOptionalNullFacePrediction.d.ts +8 -0
- package/api/types/PredictionsOptionalNullFacePrediction.js +5 -0
- package/api/types/PredictionsOptionalNullFacemeshPrediction.d.ts +8 -0
- package/api/types/PredictionsOptionalNullFacemeshPrediction.js +5 -0
- package/api/types/PredictionsOptionalTranscriptionMetadataLanguagePrediction.d.ts +8 -0
- package/api/types/PredictionsOptionalTranscriptionMetadataLanguagePrediction.js +5 -0
- package/api/types/PredictionsOptionalTranscriptionMetadataNerPrediction.d.ts +8 -0
- package/api/types/PredictionsOptionalTranscriptionMetadataNerPrediction.js +5 -0
- package/api/types/PredictionsOptionalTranscriptionMetadataProsodyPrediction.d.ts +8 -0
- package/api/types/PredictionsOptionalTranscriptionMetadataProsodyPrediction.js +5 -0
- package/api/types/Prosody.d.ts +13 -0
- package/api/types/Prosody.js +5 -0
- package/api/types/ProsodyPrediction.d.ts +15 -0
- package/api/types/ProsodyPrediction.js +5 -0
- package/api/types/ProsodyResponse.d.ts +10 -0
- package/api/types/ProsodyResponse.js +5 -0
- package/api/types/Queued.d.ts +7 -0
- package/api/types/Queued.js +5 -0
- package/api/types/Request.d.ts +19 -0
- package/api/types/Request.js +5 -0
- package/api/types/Results.d.ts +8 -0
- package/api/types/Results.js +5 -0
- package/api/types/Sentiment.d.ts +10 -0
- package/api/types/Sentiment.js +5 -0
- package/api/types/SentimentItem.d.ts +9 -0
- package/api/types/SentimentItem.js +5 -0
- package/api/types/SentimentScore.d.ts +9 -0
- package/api/types/SentimentScore.js +5 -0
- package/api/types/SortBy.d.ts +9 -0
- package/api/types/SortBy.js +11 -0
- package/api/types/Source.d.ts +13 -0
- package/api/types/Source.js +5 -0
- package/api/types/SourceFile.d.ts +5 -0
- package/api/types/SourceFile.js +5 -0
- package/api/types/SourceResult.d.ts +10 -0
- package/api/types/SourceResult.js +5 -0
- package/api/types/SourceUrl.d.ts +5 -0
- package/api/types/SourceUrl.js +5 -0
- package/api/types/State.d.ts +19 -0
- package/api/types/State.js +5 -0
- package/api/types/StateCompleted.d.ts +5 -0
- package/api/types/StateCompleted.js +5 -0
- package/api/types/StateFailed.d.ts +5 -0
- package/api/types/StateFailed.js +5 -0
- package/api/types/StateInProgress.d.ts +5 -0
- package/api/types/StateInProgress.js +5 -0
- package/api/types/StateQueued.d.ts +5 -0
- package/api/types/StateQueued.js +5 -0
- package/api/types/Status.d.ts +10 -0
- package/api/types/Status.js +12 -0
- package/api/types/TextPosition.d.ts +13 -0
- package/api/types/TextPosition.js +5 -0
- package/api/types/TimeInterval.d.ts +12 -0
- package/api/types/TimeInterval.js +5 -0
- package/api/types/TimeRange.d.ts +12 -0
- package/api/types/TimeRange.js +5 -0
- package/api/types/Toxicity.d.ts +8 -0
- package/api/types/Toxicity.js +5 -0
- package/api/types/ToxicityItem.d.ts +9 -0
- package/api/types/ToxicityItem.js +5 -0
- package/api/types/ToxicityScore.d.ts +9 -0
- package/api/types/ToxicityScore.js +5 -0
- package/api/types/Transcription.d.ts +7 -0
- package/api/types/Transcription.js +5 -0
- package/api/types/TranscriptionMetadata.d.ts +12 -0
- package/api/types/TranscriptionMetadata.js +5 -0
- package/api/types/Url.d.ts +7 -0
- package/api/types/Url.js +5 -0
- package/api/types/When.d.ts +8 -0
- package/api/types/When.js +10 -0
- package/api/types/Window.d.ts +9 -0
- package/api/types/Window.js +5 -0
- package/api/types/index.d.ts +89 -0
- package/api/types/index.js +105 -0
- package/core/fetcher/APIResponse.d.ts +9 -0
- package/core/fetcher/APIResponse.js +2 -0
- package/core/fetcher/Fetcher.d.ts +38 -0
- package/core/fetcher/Fetcher.js +129 -0
- package/core/fetcher/Supplier.d.ts +4 -0
- package/core/fetcher/Supplier.js +22 -0
- package/core/fetcher/index.d.ts +4 -0
- package/core/fetcher/index.js +7 -0
- package/core/index.d.ts +3 -0
- package/core/index.js +32 -0
- package/core/schemas/Schema.d.ts +81 -0
- package/core/schemas/Schema.js +21 -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 +13 -0
- package/core/schemas/builders/index.js +29 -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 +36 -0
- package/core/schemas/builders/lazy/lazyObject.d.ts +3 -0
- package/core/schemas/builders/lazy/lazyObject.js +21 -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 +68 -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 +258 -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 +63 -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 +106 -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 +85 -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 +53 -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 +51 -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 +141 -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 +24 -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 +37 -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 +14 -0
- package/core/streaming-fetcher/Stream.js +75 -0
- package/core/streaming-fetcher/StreamingFetcher.d.ts +24 -0
- package/core/streaming-fetcher/StreamingFetcher.js +58 -0
- package/core/streaming-fetcher/getHeader.d.ts +2 -0
- package/core/streaming-fetcher/getHeader.js +12 -0
- package/core/streaming-fetcher/index.d.ts +4 -0
- package/core/streaming-fetcher/index.js +9 -0
- package/dist/Client.d.ts +42 -0
- package/dist/Client.js +291 -0
- package/dist/api/client/index.d.ts +1 -0
- package/dist/api/client/index.js +17 -0
- package/dist/api/client/requests/BaseRequest.d.ts +18 -0
- package/dist/api/client/requests/BaseRequest.js +5 -0
- package/dist/api/client/requests/ListJobsRequest.d.ts +30 -0
- package/dist/api/client/requests/ListJobsRequest.js +5 -0
- package/dist/api/client/requests/index.d.ts +2 -0
- package/dist/api/client/requests/index.js +2 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +18 -0
- package/dist/api/types/Bcp47Tag.d.ts +35 -0
- package/dist/api/types/Bcp47Tag.js +37 -0
- package/dist/api/types/BoundingBox.d.ts +16 -0
- package/dist/api/types/BoundingBox.js +5 -0
- package/dist/api/types/BurstPrediction.d.ts +11 -0
- package/dist/api/types/BurstPrediction.js +5 -0
- package/dist/api/types/BurstResponse.d.ts +10 -0
- package/dist/api/types/BurstResponse.js +5 -0
- package/dist/api/types/Completed.d.ts +15 -0
- package/dist/api/types/Completed.js +5 -0
- package/dist/api/types/DescriptionsScore.d.ts +9 -0
- package/dist/api/types/DescriptionsScore.js +5 -0
- package/dist/api/types/Direction.d.ts +8 -0
- package/dist/api/types/Direction.js +10 -0
- package/dist/api/types/EmotionEmbedding.d.ts +8 -0
- package/dist/api/types/EmotionEmbedding.js +5 -0
- package/dist/api/types/EmotionEmbeddingItem.d.ts +9 -0
- package/dist/api/types/EmotionEmbeddingItem.js +5 -0
- package/dist/api/types/EmotionScore.d.ts +9 -0
- package/dist/api/types/EmotionScore.js +5 -0
- package/dist/api/types/Empty.d.ts +7 -0
- package/dist/api/types/Empty.js +5 -0
- package/dist/api/types/Error_.d.ts +9 -0
- package/dist/api/types/Error_.js +5 -0
- package/dist/api/types/Face.d.ts +18 -0
- package/dist/api/types/Face.js +5 -0
- package/dist/api/types/FaceModelConfig.d.ts +35 -0
- package/dist/api/types/FaceModelConfig.js +5 -0
- package/dist/api/types/FacePrediction.d.ts +19 -0
- package/dist/api/types/FacePrediction.js +5 -0
- package/dist/api/types/FaceResponse.d.ts +10 -0
- package/dist/api/types/FaceResponse.js +5 -0
- package/dist/api/types/FacemeshPrediction.d.ts +8 -0
- package/dist/api/types/FacemeshPrediction.js +5 -0
- package/dist/api/types/FacemeshResponse.d.ts +10 -0
- package/dist/api/types/FacemeshResponse.js +5 -0
- package/dist/api/types/FacsScore.d.ts +9 -0
- package/dist/api/types/FacsScore.js +5 -0
- package/dist/api/types/Failed.d.ts +13 -0
- package/dist/api/types/Failed.js +5 -0
- package/dist/api/types/File_.d.ts +11 -0
- package/dist/api/types/File_.js +5 -0
- package/dist/api/types/Granularity.d.ts +13 -0
- package/dist/api/types/Granularity.js +12 -0
- package/dist/api/types/GroupedPredictionsBurstPrediction.d.ts +9 -0
- package/dist/api/types/GroupedPredictionsBurstPrediction.js +5 -0
- package/dist/api/types/GroupedPredictionsFacePrediction.d.ts +9 -0
- package/dist/api/types/GroupedPredictionsFacePrediction.js +5 -0
- package/dist/api/types/GroupedPredictionsFacemeshPrediction.d.ts +9 -0
- package/dist/api/types/GroupedPredictionsFacemeshPrediction.js +5 -0
- package/dist/api/types/GroupedPredictionsLanguagePrediction.d.ts +9 -0
- package/dist/api/types/GroupedPredictionsLanguagePrediction.js +5 -0
- package/dist/api/types/GroupedPredictionsNerPrediction.d.ts +9 -0
- package/dist/api/types/GroupedPredictionsNerPrediction.js +5 -0
- package/dist/api/types/GroupedPredictionsProsodyPrediction.d.ts +9 -0
- package/dist/api/types/GroupedPredictionsProsodyPrediction.js +5 -0
- package/dist/api/types/InProgress.d.ts +9 -0
- package/dist/api/types/InProgress.js +5 -0
- package/dist/api/types/JobId.d.ts +7 -0
- package/dist/api/types/JobId.js +5 -0
- package/dist/api/types/JobRequest.d.ts +10 -0
- package/dist/api/types/JobRequest.js +5 -0
- package/dist/api/types/Language.d.ts +11 -0
- package/dist/api/types/Language.js +5 -0
- package/dist/api/types/LanguageConfig.d.ts +14 -0
- package/dist/api/types/LanguageConfig.js +5 -0
- package/dist/api/types/LanguagePrediction.d.ts +24 -0
- package/dist/api/types/LanguagePrediction.js +5 -0
- package/dist/api/types/LanguageResponse.d.ts +10 -0
- package/dist/api/types/LanguageResponse.js +5 -0
- package/dist/api/types/ModelConfig.d.ts +46 -0
- package/dist/api/types/ModelConfig.js +5 -0
- package/dist/api/types/ModelResponse.d.ts +16 -0
- package/dist/api/types/ModelResponse.js +5 -0
- package/dist/api/types/Models.d.ts +12 -0
- package/dist/api/types/Models.js +5 -0
- package/dist/api/types/ModelsError.d.ts +9 -0
- package/dist/api/types/ModelsError.js +5 -0
- package/dist/api/types/ModelsInput.d.ts +56 -0
- package/dist/api/types/ModelsInput.js +5 -0
- package/dist/api/types/ModelsPredictions.d.ts +12 -0
- package/dist/api/types/ModelsPredictions.js +5 -0
- package/dist/api/types/ModelsSuccessBurstPredictionsItem.d.ts +8 -0
- package/dist/api/types/ModelsSuccessBurstPredictionsItem.js +5 -0
- package/dist/api/types/ModelsSuccessFacePredictionsItem.d.ts +18 -0
- package/dist/api/types/ModelsSuccessFacePredictionsItem.js +5 -0
- package/dist/api/types/ModelsSuccessFacemeshPredictionsItem.d.ts +7 -0
- package/dist/api/types/ModelsSuccessFacemeshPredictionsItem.js +5 -0
- package/dist/api/types/ModelsSuccessLanguagePredictionsItem.d.ts +12 -0
- package/dist/api/types/ModelsSuccessLanguagePredictionsItem.js +5 -0
- package/dist/api/types/ModelsSuccessProsodyPredictionsItem.d.ts +8 -0
- package/dist/api/types/ModelsSuccessProsodyPredictionsItem.js +5 -0
- package/dist/api/types/ModelsWarning.d.ts +9 -0
- package/dist/api/types/ModelsWarning.js +5 -0
- package/dist/api/types/Ner.d.ts +7 -0
- package/dist/api/types/Ner.js +5 -0
- package/dist/api/types/NerPrediction.d.ts +24 -0
- package/dist/api/types/NerPrediction.js +5 -0
- package/dist/api/types/Null.d.ts +7 -0
- package/dist/api/types/Null.js +5 -0
- package/dist/api/types/PositionInterval.d.ts +12 -0
- package/dist/api/types/PositionInterval.js +5 -0
- package/dist/api/types/Prediction.d.ts +9 -0
- package/dist/api/types/Prediction.js +5 -0
- package/dist/api/types/PredictionsOptionalNullBurstPrediction.d.ts +8 -0
- package/dist/api/types/PredictionsOptionalNullBurstPrediction.js +5 -0
- package/dist/api/types/PredictionsOptionalNullFacePrediction.d.ts +8 -0
- package/dist/api/types/PredictionsOptionalNullFacePrediction.js +5 -0
- package/dist/api/types/PredictionsOptionalNullFacemeshPrediction.d.ts +8 -0
- package/dist/api/types/PredictionsOptionalNullFacemeshPrediction.js +5 -0
- package/dist/api/types/PredictionsOptionalTranscriptionMetadataLanguagePrediction.d.ts +8 -0
- package/dist/api/types/PredictionsOptionalTranscriptionMetadataLanguagePrediction.js +5 -0
- package/dist/api/types/PredictionsOptionalTranscriptionMetadataNerPrediction.d.ts +8 -0
- package/dist/api/types/PredictionsOptionalTranscriptionMetadataNerPrediction.js +5 -0
- package/dist/api/types/PredictionsOptionalTranscriptionMetadataProsodyPrediction.d.ts +8 -0
- package/dist/api/types/PredictionsOptionalTranscriptionMetadataProsodyPrediction.js +5 -0
- package/dist/api/types/Prosody.d.ts +13 -0
- package/dist/api/types/Prosody.js +5 -0
- package/dist/api/types/ProsodyPrediction.d.ts +15 -0
- package/dist/api/types/ProsodyPrediction.js +5 -0
- package/dist/api/types/ProsodyResponse.d.ts +10 -0
- package/dist/api/types/ProsodyResponse.js +5 -0
- package/dist/api/types/Queued.d.ts +7 -0
- package/dist/api/types/Queued.js +5 -0
- package/dist/api/types/Request.d.ts +19 -0
- package/dist/api/types/Request.js +5 -0
- package/dist/api/types/Results.d.ts +8 -0
- package/dist/api/types/Results.js +5 -0
- package/dist/api/types/Sentiment.d.ts +10 -0
- package/dist/api/types/Sentiment.js +5 -0
- package/dist/api/types/SentimentItem.d.ts +9 -0
- package/dist/api/types/SentimentItem.js +5 -0
- package/dist/api/types/SentimentScore.d.ts +9 -0
- package/dist/api/types/SentimentScore.js +5 -0
- package/dist/api/types/SortBy.d.ts +9 -0
- package/dist/api/types/SortBy.js +11 -0
- package/dist/api/types/Source.d.ts +13 -0
- package/dist/api/types/Source.js +5 -0
- package/dist/api/types/SourceFile.d.ts +5 -0
- package/dist/api/types/SourceFile.js +5 -0
- package/dist/api/types/SourceResult.d.ts +10 -0
- package/dist/api/types/SourceResult.js +5 -0
- package/dist/api/types/SourceUrl.d.ts +5 -0
- package/dist/api/types/SourceUrl.js +5 -0
- package/dist/api/types/State.d.ts +19 -0
- package/dist/api/types/State.js +5 -0
- package/dist/api/types/StateCompleted.d.ts +5 -0
- package/dist/api/types/StateCompleted.js +5 -0
- package/dist/api/types/StateFailed.d.ts +5 -0
- package/dist/api/types/StateFailed.js +5 -0
- package/dist/api/types/StateInProgress.d.ts +5 -0
- package/dist/api/types/StateInProgress.js +5 -0
- package/dist/api/types/StateQueued.d.ts +5 -0
- package/dist/api/types/StateQueued.js +5 -0
- package/dist/api/types/Status.d.ts +10 -0
- package/dist/api/types/Status.js +12 -0
- package/dist/api/types/TextPosition.d.ts +13 -0
- package/dist/api/types/TextPosition.js +5 -0
- package/dist/api/types/TimeInterval.d.ts +12 -0
- package/dist/api/types/TimeInterval.js +5 -0
- package/dist/api/types/TimeRange.d.ts +12 -0
- package/dist/api/types/TimeRange.js +5 -0
- package/dist/api/types/Toxicity.d.ts +8 -0
- package/dist/api/types/Toxicity.js +5 -0
- package/dist/api/types/ToxicityItem.d.ts +9 -0
- package/dist/api/types/ToxicityItem.js +5 -0
- package/dist/api/types/ToxicityScore.d.ts +9 -0
- package/dist/api/types/ToxicityScore.js +5 -0
- package/dist/api/types/Transcription.d.ts +7 -0
- package/dist/api/types/Transcription.js +5 -0
- package/dist/api/types/TranscriptionMetadata.d.ts +12 -0
- package/dist/api/types/TranscriptionMetadata.js +5 -0
- package/dist/api/types/Url.d.ts +7 -0
- package/dist/api/types/Url.js +5 -0
- package/dist/api/types/When.d.ts +8 -0
- package/dist/api/types/When.js +10 -0
- package/dist/api/types/Window.d.ts +9 -0
- package/dist/api/types/Window.js +5 -0
- package/dist/api/types/index.d.ts +89 -0
- package/dist/api/types/index.js +105 -0
- package/dist/core/fetcher/APIResponse.d.ts +9 -0
- package/dist/core/fetcher/APIResponse.js +2 -0
- package/dist/core/fetcher/Fetcher.d.ts +38 -0
- package/dist/core/fetcher/Fetcher.js +129 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +22 -0
- package/dist/core/fetcher/index.d.ts +4 -0
- package/dist/core/fetcher/index.js +7 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +32 -0
- package/dist/core/schemas/Schema.d.ts +81 -0
- package/dist/core/schemas/Schema.js +21 -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 +13 -0
- package/dist/core/schemas/builders/index.js +29 -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 +36 -0
- package/dist/core/schemas/builders/lazy/lazyObject.d.ts +3 -0
- package/dist/core/schemas/builders/lazy/lazyObject.js +21 -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 +68 -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 +258 -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 +63 -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 +106 -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 +85 -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 +53 -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 +51 -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 +141 -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 +24 -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 +37 -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 +14 -0
- package/dist/core/streaming-fetcher/Stream.js +75 -0
- package/dist/core/streaming-fetcher/StreamingFetcher.d.ts +24 -0
- package/dist/core/streaming-fetcher/StreamingFetcher.js +58 -0
- package/dist/core/streaming-fetcher/getHeader.d.ts +2 -0
- package/dist/core/streaming-fetcher/getHeader.js +12 -0
- package/dist/core/streaming-fetcher/index.d.ts +4 -0
- package/dist/core/streaming-fetcher/index.js +9 -0
- package/dist/environments.d.ts +7 -0
- package/dist/environments.js +9 -0
- package/dist/errors/HumeError.d.ts +12 -0
- package/dist/errors/HumeError.js +32 -0
- package/dist/errors/HumeTimeoutError.d.ts +6 -0
- package/dist/errors/HumeTimeoutError.js +13 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +38 -0
- package/dist/serialization/client/getJobPredictions.d.ts +10 -0
- package/dist/serialization/client/getJobPredictions.js +40 -0
- package/dist/serialization/client/index.d.ts +3 -0
- package/dist/serialization/client/index.js +32 -0
- package/dist/serialization/client/listJobs.d.ts +10 -0
- package/dist/serialization/client/listJobs.js +40 -0
- package/dist/serialization/client/requests/BaseRequest.d.ts +16 -0
- package/dist/serialization/client/requests/BaseRequest.js +46 -0
- package/dist/serialization/client/requests/index.d.ts +1 -0
- package/dist/serialization/client/requests/index.js +5 -0
- package/dist/serialization/index.d.ts +2 -0
- package/dist/serialization/index.js +18 -0
- package/dist/serialization/types/Bcp47Tag.d.ts +10 -0
- package/dist/serialization/types/Bcp47Tag.js +61 -0
- package/dist/serialization/types/BoundingBox.d.ts +15 -0
- package/dist/serialization/types/BoundingBox.js +36 -0
- package/dist/serialization/types/BurstPrediction.d.ts +14 -0
- package/dist/serialization/types/BurstPrediction.js +44 -0
- package/dist/serialization/types/BurstResponse.d.ts +12 -0
- package/dist/serialization/types/BurstResponse.js +44 -0
- package/dist/serialization/types/Completed.d.ts +16 -0
- package/dist/serialization/types/Completed.js +37 -0
- package/dist/serialization/types/DescriptionsScore.d.ts +13 -0
- package/dist/serialization/types/DescriptionsScore.js +34 -0
- package/dist/serialization/types/Direction.d.ts +10 -0
- package/dist/serialization/types/Direction.js +31 -0
- package/dist/serialization/types/EmotionEmbedding.d.ts +10 -0
- package/dist/serialization/types/EmotionEmbedding.js +40 -0
- package/dist/serialization/types/EmotionEmbeddingItem.d.ts +13 -0
- package/dist/serialization/types/EmotionEmbeddingItem.js +34 -0
- package/dist/serialization/types/EmotionScore.d.ts +13 -0
- package/dist/serialization/types/EmotionScore.js +34 -0
- package/dist/serialization/types/Empty.d.ts +10 -0
- package/dist/serialization/types/Empty.js +31 -0
- package/dist/serialization/types/Error_.d.ts +13 -0
- package/dist/serialization/types/Error_.js +34 -0
- package/dist/serialization/types/Face.d.ts +18 -0
- package/dist/serialization/types/Face.js +48 -0
- package/dist/serialization/types/FaceModelConfig.d.ts +17 -0
- package/dist/serialization/types/FaceModelConfig.js +38 -0
- package/dist/serialization/types/FacePrediction.d.ts +18 -0
- package/dist/serialization/types/FacePrediction.js +52 -0
- package/dist/serialization/types/FaceResponse.d.ts +12 -0
- package/dist/serialization/types/FaceResponse.js +44 -0
- package/dist/serialization/types/FacemeshPrediction.d.ts +12 -0
- package/dist/serialization/types/FacemeshPrediction.js +42 -0
- package/dist/serialization/types/FacemeshResponse.d.ts +12 -0
- package/dist/serialization/types/FacemeshResponse.js +44 -0
- package/dist/serialization/types/FacsScore.d.ts +13 -0
- package/dist/serialization/types/FacsScore.js +34 -0
- package/dist/serialization/types/Failed.d.ts +15 -0
- package/dist/serialization/types/Failed.js +36 -0
- package/dist/serialization/types/File_.d.ts +14 -0
- package/dist/serialization/types/File_.js +35 -0
- package/dist/serialization/types/Granularity.d.ts +10 -0
- package/dist/serialization/types/Granularity.js +31 -0
- package/dist/serialization/types/GroupedPredictionsBurstPrediction.d.ts +13 -0
- package/dist/serialization/types/GroupedPredictionsBurstPrediction.js +43 -0
- package/dist/serialization/types/GroupedPredictionsFacePrediction.d.ts +13 -0
- package/dist/serialization/types/GroupedPredictionsFacePrediction.js +43 -0
- package/dist/serialization/types/GroupedPredictionsFacemeshPrediction.d.ts +13 -0
- package/dist/serialization/types/GroupedPredictionsFacemeshPrediction.js +43 -0
- package/dist/serialization/types/GroupedPredictionsLanguagePrediction.d.ts +13 -0
- package/dist/serialization/types/GroupedPredictionsLanguagePrediction.js +43 -0
- package/dist/serialization/types/GroupedPredictionsNerPrediction.d.ts +13 -0
- package/dist/serialization/types/GroupedPredictionsNerPrediction.js +43 -0
- package/dist/serialization/types/GroupedPredictionsProsodyPrediction.d.ts +13 -0
- package/dist/serialization/types/GroupedPredictionsProsodyPrediction.js +43 -0
- package/dist/serialization/types/InProgress.d.ts +13 -0
- package/dist/serialization/types/InProgress.js +34 -0
- package/dist/serialization/types/JobId.d.ts +12 -0
- package/dist/serialization/types/JobId.js +33 -0
- package/dist/serialization/types/JobRequest.d.ts +15 -0
- package/dist/serialization/types/JobRequest.js +45 -0
- package/dist/serialization/types/Language.d.ts +15 -0
- package/dist/serialization/types/Language.js +45 -0
- package/dist/serialization/types/LanguageConfig.d.ts +14 -0
- package/dist/serialization/types/LanguageConfig.js +35 -0
- package/dist/serialization/types/LanguagePrediction.d.ts +19 -0
- package/dist/serialization/types/LanguagePrediction.js +53 -0
- package/dist/serialization/types/LanguageResponse.d.ts +12 -0
- package/dist/serialization/types/LanguageResponse.js +44 -0
- package/dist/serialization/types/ModelConfig.d.ts +16 -0
- package/dist/serialization/types/ModelConfig.js +46 -0
- package/dist/serialization/types/ModelResponse.d.ts +16 -0
- package/dist/serialization/types/ModelResponse.js +46 -0
- package/dist/serialization/types/Models.d.ts +17 -0
- package/dist/serialization/types/Models.js +47 -0
- package/dist/serialization/types/ModelsError.d.ts +13 -0
- package/dist/serialization/types/ModelsError.js +34 -0
- package/dist/serialization/types/ModelsInput.d.ts +18 -0
- package/dist/serialization/types/ModelsInput.js +48 -0
- package/dist/serialization/types/ModelsPredictions.d.ts +17 -0
- package/dist/serialization/types/ModelsPredictions.js +59 -0
- package/dist/serialization/types/ModelsSuccessBurstPredictionsItem.d.ts +13 -0
- package/dist/serialization/types/ModelsSuccessBurstPredictionsItem.js +43 -0
- package/dist/serialization/types/ModelsSuccessFacePredictionsItem.d.ts +19 -0
- package/dist/serialization/types/ModelsSuccessFacePredictionsItem.js +49 -0
- package/dist/serialization/types/ModelsSuccessFacemeshPredictionsItem.d.ts +12 -0
- package/dist/serialization/types/ModelsSuccessFacemeshPredictionsItem.js +42 -0
- package/dist/serialization/types/ModelsSuccessLanguagePredictionsItem.d.ts +16 -0
- package/dist/serialization/types/ModelsSuccessLanguagePredictionsItem.js +46 -0
- package/dist/serialization/types/ModelsSuccessProsodyPredictionsItem.d.ts +13 -0
- package/dist/serialization/types/ModelsSuccessProsodyPredictionsItem.js +43 -0
- package/dist/serialization/types/ModelsWarning.d.ts +13 -0
- package/dist/serialization/types/ModelsWarning.js +34 -0
- package/dist/serialization/types/Ner.d.ts +12 -0
- package/dist/serialization/types/Ner.js +33 -0
- package/dist/serialization/types/NerPrediction.d.ts +21 -0
- package/dist/serialization/types/NerPrediction.js +51 -0
- package/dist/serialization/types/Null.d.ts +10 -0
- package/dist/serialization/types/Null.js +31 -0
- package/dist/serialization/types/PositionInterval.d.ts +13 -0
- package/dist/serialization/types/PositionInterval.js +34 -0
- package/dist/serialization/types/Prediction.d.ts +13 -0
- package/dist/serialization/types/Prediction.js +43 -0
- package/dist/serialization/types/PredictionsOptionalNullBurstPrediction.d.ts +13 -0
- package/dist/serialization/types/PredictionsOptionalNullBurstPrediction.js +43 -0
- package/dist/serialization/types/PredictionsOptionalNullFacePrediction.d.ts +13 -0
- package/dist/serialization/types/PredictionsOptionalNullFacePrediction.js +43 -0
- package/dist/serialization/types/PredictionsOptionalNullFacemeshPrediction.d.ts +13 -0
- package/dist/serialization/types/PredictionsOptionalNullFacemeshPrediction.js +43 -0
- package/dist/serialization/types/PredictionsOptionalTranscriptionMetadataLanguagePrediction.d.ts +13 -0
- package/dist/serialization/types/PredictionsOptionalTranscriptionMetadataLanguagePrediction.js +43 -0
- package/dist/serialization/types/PredictionsOptionalTranscriptionMetadataNerPrediction.d.ts +13 -0
- package/dist/serialization/types/PredictionsOptionalTranscriptionMetadataNerPrediction.js +43 -0
- package/dist/serialization/types/PredictionsOptionalTranscriptionMetadataProsodyPrediction.d.ts +13 -0
- package/dist/serialization/types/PredictionsOptionalTranscriptionMetadataProsodyPrediction.js +43 -0
- package/dist/serialization/types/Prosody.d.ts +14 -0
- package/dist/serialization/types/Prosody.js +44 -0
- package/dist/serialization/types/ProsodyPrediction.d.ts +16 -0
- package/dist/serialization/types/ProsodyPrediction.js +46 -0
- package/dist/serialization/types/ProsodyResponse.d.ts +12 -0
- package/dist/serialization/types/ProsodyResponse.js +44 -0
- package/dist/serialization/types/Queued.d.ts +12 -0
- package/dist/serialization/types/Queued.js +33 -0
- package/dist/serialization/types/Request.d.ts +17 -0
- package/dist/serialization/types/Request.js +47 -0
- package/dist/serialization/types/Results.d.ts +13 -0
- package/dist/serialization/types/Results.js +43 -0
- package/dist/serialization/types/Sentiment.d.ts +10 -0
- package/dist/serialization/types/Sentiment.js +40 -0
- package/dist/serialization/types/SentimentItem.d.ts +13 -0
- package/dist/serialization/types/SentimentItem.js +34 -0
- package/dist/serialization/types/SentimentScore.d.ts +13 -0
- package/dist/serialization/types/SentimentScore.js +34 -0
- package/dist/serialization/types/SortBy.d.ts +10 -0
- package/dist/serialization/types/SortBy.js +35 -0
- package/dist/serialization/types/Source.d.ts +16 -0
- package/dist/serialization/types/Source.js +48 -0
- package/dist/serialization/types/SourceFile.d.ts +10 -0
- package/dist/serialization/types/SourceFile.js +40 -0
- package/dist/serialization/types/SourceResult.d.ts +14 -0
- package/dist/serialization/types/SourceResult.js +44 -0
- package/dist/serialization/types/SourceUrl.d.ts +10 -0
- package/dist/serialization/types/SourceUrl.js +40 -0
- package/dist/serialization/types/State.d.ts +22 -0
- package/dist/serialization/types/State.js +50 -0
- package/dist/serialization/types/StateCompleted.d.ts +10 -0
- package/dist/serialization/types/StateCompleted.js +40 -0
- package/dist/serialization/types/StateFailed.d.ts +10 -0
- package/dist/serialization/types/StateFailed.js +40 -0
- package/dist/serialization/types/StateInProgress.d.ts +10 -0
- package/dist/serialization/types/StateInProgress.js +40 -0
- package/dist/serialization/types/StateQueued.d.ts +10 -0
- package/dist/serialization/types/StateQueued.js +40 -0
- package/dist/serialization/types/Status.d.ts +10 -0
- package/dist/serialization/types/Status.js +36 -0
- package/dist/serialization/types/TextPosition.d.ts +13 -0
- package/dist/serialization/types/TextPosition.js +34 -0
- package/dist/serialization/types/TimeInterval.d.ts +13 -0
- package/dist/serialization/types/TimeInterval.js +34 -0
- package/dist/serialization/types/TimeRange.d.ts +13 -0
- package/dist/serialization/types/TimeRange.js +34 -0
- package/dist/serialization/types/Toxicity.d.ts +10 -0
- package/dist/serialization/types/Toxicity.js +40 -0
- package/dist/serialization/types/ToxicityItem.d.ts +13 -0
- package/dist/serialization/types/ToxicityItem.js +34 -0
- package/dist/serialization/types/ToxicityScore.d.ts +13 -0
- package/dist/serialization/types/ToxicityScore.js +34 -0
- package/dist/serialization/types/Transcription.d.ts +12 -0
- package/dist/serialization/types/Transcription.js +42 -0
- package/dist/serialization/types/TranscriptionMetadata.d.ts +13 -0
- package/dist/serialization/types/TranscriptionMetadata.js +43 -0
- package/dist/serialization/types/Url.d.ts +12 -0
- package/dist/serialization/types/Url.js +33 -0
- package/dist/serialization/types/When.d.ts +10 -0
- package/dist/serialization/types/When.js +34 -0
- package/dist/serialization/types/Window.d.ts +13 -0
- package/dist/serialization/types/Window.js +34 -0
- package/dist/serialization/types/index.d.ts +89 -0
- package/dist/serialization/types/index.js +105 -0
- package/dist/wrapper/HumeBatchClient.d.ts +6 -0
- package/dist/wrapper/HumeBatchClient.js +26 -0
- package/dist/wrapper/HumeStreamingClient.d.ts +23 -0
- package/dist/wrapper/HumeStreamingClient.js +125 -0
- package/dist/wrapper/Job.d.ts +8 -0
- package/dist/wrapper/Job.js +87 -0
- package/dist/wrapper/StreamSocket.d.ts +83 -0
- package/dist/wrapper/StreamSocket.js +114 -0
- package/environments.d.ts +7 -0
- package/environments.js +9 -0
- package/errors/HumeError.d.ts +12 -0
- package/errors/HumeError.js +32 -0
- package/errors/HumeTimeoutError.d.ts +6 -0
- package/errors/HumeTimeoutError.js +13 -0
- package/errors/index.d.ts +2 -0
- package/errors/index.js +7 -0
- package/index.d.ts +6 -0
- package/index.js +38 -0
- package/package.json +26 -41
- package/serialization/client/getJobPredictions.d.ts +10 -0
- package/serialization/client/getJobPredictions.js +40 -0
- package/serialization/client/index.d.ts +3 -0
- package/serialization/client/index.js +32 -0
- package/serialization/client/listJobs.d.ts +10 -0
- package/serialization/client/listJobs.js +40 -0
- package/serialization/client/requests/BaseRequest.d.ts +16 -0
- package/serialization/client/requests/BaseRequest.js +46 -0
- package/serialization/client/requests/index.d.ts +1 -0
- package/serialization/client/requests/index.js +5 -0
- package/serialization/index.d.ts +2 -0
- package/serialization/index.js +18 -0
- package/serialization/types/Bcp47Tag.d.ts +10 -0
- package/serialization/types/Bcp47Tag.js +61 -0
- package/serialization/types/BoundingBox.d.ts +15 -0
- package/serialization/types/BoundingBox.js +36 -0
- package/serialization/types/BurstPrediction.d.ts +14 -0
- package/serialization/types/BurstPrediction.js +44 -0
- package/serialization/types/BurstResponse.d.ts +12 -0
- package/serialization/types/BurstResponse.js +44 -0
- package/serialization/types/Completed.d.ts +16 -0
- package/serialization/types/Completed.js +37 -0
- package/serialization/types/DescriptionsScore.d.ts +13 -0
- package/serialization/types/DescriptionsScore.js +34 -0
- package/serialization/types/Direction.d.ts +10 -0
- package/serialization/types/Direction.js +31 -0
- package/serialization/types/EmotionEmbedding.d.ts +10 -0
- package/serialization/types/EmotionEmbedding.js +40 -0
- package/serialization/types/EmotionEmbeddingItem.d.ts +13 -0
- package/serialization/types/EmotionEmbeddingItem.js +34 -0
- package/serialization/types/EmotionScore.d.ts +13 -0
- package/serialization/types/EmotionScore.js +34 -0
- package/serialization/types/Empty.d.ts +10 -0
- package/serialization/types/Empty.js +31 -0
- package/serialization/types/Error_.d.ts +13 -0
- package/serialization/types/Error_.js +34 -0
- package/serialization/types/Face.d.ts +18 -0
- package/serialization/types/Face.js +48 -0
- package/serialization/types/FaceModelConfig.d.ts +17 -0
- package/serialization/types/FaceModelConfig.js +38 -0
- package/serialization/types/FacePrediction.d.ts +18 -0
- package/serialization/types/FacePrediction.js +52 -0
- package/serialization/types/FaceResponse.d.ts +12 -0
- package/serialization/types/FaceResponse.js +44 -0
- package/serialization/types/FacemeshPrediction.d.ts +12 -0
- package/serialization/types/FacemeshPrediction.js +42 -0
- package/serialization/types/FacemeshResponse.d.ts +12 -0
- package/serialization/types/FacemeshResponse.js +44 -0
- package/serialization/types/FacsScore.d.ts +13 -0
- package/serialization/types/FacsScore.js +34 -0
- package/serialization/types/Failed.d.ts +15 -0
- package/serialization/types/Failed.js +36 -0
- package/serialization/types/File_.d.ts +14 -0
- package/serialization/types/File_.js +35 -0
- package/serialization/types/Granularity.d.ts +10 -0
- package/serialization/types/Granularity.js +31 -0
- package/serialization/types/GroupedPredictionsBurstPrediction.d.ts +13 -0
- package/serialization/types/GroupedPredictionsBurstPrediction.js +43 -0
- package/serialization/types/GroupedPredictionsFacePrediction.d.ts +13 -0
- package/serialization/types/GroupedPredictionsFacePrediction.js +43 -0
- package/serialization/types/GroupedPredictionsFacemeshPrediction.d.ts +13 -0
- package/serialization/types/GroupedPredictionsFacemeshPrediction.js +43 -0
- package/serialization/types/GroupedPredictionsLanguagePrediction.d.ts +13 -0
- package/serialization/types/GroupedPredictionsLanguagePrediction.js +43 -0
- package/serialization/types/GroupedPredictionsNerPrediction.d.ts +13 -0
- package/serialization/types/GroupedPredictionsNerPrediction.js +43 -0
- package/serialization/types/GroupedPredictionsProsodyPrediction.d.ts +13 -0
- package/serialization/types/GroupedPredictionsProsodyPrediction.js +43 -0
- package/serialization/types/InProgress.d.ts +13 -0
- package/serialization/types/InProgress.js +34 -0
- package/serialization/types/JobId.d.ts +12 -0
- package/serialization/types/JobId.js +33 -0
- package/serialization/types/JobRequest.d.ts +15 -0
- package/serialization/types/JobRequest.js +45 -0
- package/serialization/types/Language.d.ts +15 -0
- package/serialization/types/Language.js +45 -0
- package/serialization/types/LanguageConfig.d.ts +14 -0
- package/serialization/types/LanguageConfig.js +35 -0
- package/serialization/types/LanguagePrediction.d.ts +19 -0
- package/serialization/types/LanguagePrediction.js +53 -0
- package/serialization/types/LanguageResponse.d.ts +12 -0
- package/serialization/types/LanguageResponse.js +44 -0
- package/serialization/types/ModelConfig.d.ts +16 -0
- package/serialization/types/ModelConfig.js +46 -0
- package/serialization/types/ModelResponse.d.ts +16 -0
- package/serialization/types/ModelResponse.js +46 -0
- package/serialization/types/Models.d.ts +17 -0
- package/serialization/types/Models.js +47 -0
- package/serialization/types/ModelsError.d.ts +13 -0
- package/serialization/types/ModelsError.js +34 -0
- package/serialization/types/ModelsInput.d.ts +18 -0
- package/serialization/types/ModelsInput.js +48 -0
- package/serialization/types/ModelsPredictions.d.ts +17 -0
- package/serialization/types/ModelsPredictions.js +59 -0
- package/serialization/types/ModelsSuccessBurstPredictionsItem.d.ts +13 -0
- package/serialization/types/ModelsSuccessBurstPredictionsItem.js +43 -0
- package/serialization/types/ModelsSuccessFacePredictionsItem.d.ts +19 -0
- package/serialization/types/ModelsSuccessFacePredictionsItem.js +49 -0
- package/serialization/types/ModelsSuccessFacemeshPredictionsItem.d.ts +12 -0
- package/serialization/types/ModelsSuccessFacemeshPredictionsItem.js +42 -0
- package/serialization/types/ModelsSuccessLanguagePredictionsItem.d.ts +16 -0
- package/serialization/types/ModelsSuccessLanguagePredictionsItem.js +46 -0
- package/serialization/types/ModelsSuccessProsodyPredictionsItem.d.ts +13 -0
- package/serialization/types/ModelsSuccessProsodyPredictionsItem.js +43 -0
- package/serialization/types/ModelsWarning.d.ts +13 -0
- package/serialization/types/ModelsWarning.js +34 -0
- package/serialization/types/Ner.d.ts +12 -0
- package/serialization/types/Ner.js +33 -0
- package/serialization/types/NerPrediction.d.ts +21 -0
- package/serialization/types/NerPrediction.js +51 -0
- package/serialization/types/Null.d.ts +10 -0
- package/serialization/types/Null.js +31 -0
- package/serialization/types/PositionInterval.d.ts +13 -0
- package/serialization/types/PositionInterval.js +34 -0
- package/serialization/types/Prediction.d.ts +13 -0
- package/serialization/types/Prediction.js +43 -0
- package/serialization/types/PredictionsOptionalNullBurstPrediction.d.ts +13 -0
- package/serialization/types/PredictionsOptionalNullBurstPrediction.js +43 -0
- package/serialization/types/PredictionsOptionalNullFacePrediction.d.ts +13 -0
- package/serialization/types/PredictionsOptionalNullFacePrediction.js +43 -0
- package/serialization/types/PredictionsOptionalNullFacemeshPrediction.d.ts +13 -0
- package/serialization/types/PredictionsOptionalNullFacemeshPrediction.js +43 -0
- package/serialization/types/PredictionsOptionalTranscriptionMetadataLanguagePrediction.d.ts +13 -0
- package/serialization/types/PredictionsOptionalTranscriptionMetadataLanguagePrediction.js +43 -0
- package/serialization/types/PredictionsOptionalTranscriptionMetadataNerPrediction.d.ts +13 -0
- package/serialization/types/PredictionsOptionalTranscriptionMetadataNerPrediction.js +43 -0
- package/serialization/types/PredictionsOptionalTranscriptionMetadataProsodyPrediction.d.ts +13 -0
- package/serialization/types/PredictionsOptionalTranscriptionMetadataProsodyPrediction.js +43 -0
- package/serialization/types/Prosody.d.ts +14 -0
- package/serialization/types/Prosody.js +44 -0
- package/serialization/types/ProsodyPrediction.d.ts +16 -0
- package/serialization/types/ProsodyPrediction.js +46 -0
- package/serialization/types/ProsodyResponse.d.ts +12 -0
- package/serialization/types/ProsodyResponse.js +44 -0
- package/serialization/types/Queued.d.ts +12 -0
- package/serialization/types/Queued.js +33 -0
- package/serialization/types/Request.d.ts +17 -0
- package/serialization/types/Request.js +47 -0
- package/serialization/types/Results.d.ts +13 -0
- package/serialization/types/Results.js +43 -0
- package/serialization/types/Sentiment.d.ts +10 -0
- package/serialization/types/Sentiment.js +40 -0
- package/serialization/types/SentimentItem.d.ts +13 -0
- package/serialization/types/SentimentItem.js +34 -0
- package/serialization/types/SentimentScore.d.ts +13 -0
- package/serialization/types/SentimentScore.js +34 -0
- package/serialization/types/SortBy.d.ts +10 -0
- package/serialization/types/SortBy.js +35 -0
- package/serialization/types/Source.d.ts +16 -0
- package/serialization/types/Source.js +48 -0
- package/serialization/types/SourceFile.d.ts +10 -0
- package/serialization/types/SourceFile.js +40 -0
- package/serialization/types/SourceResult.d.ts +14 -0
- package/serialization/types/SourceResult.js +44 -0
- package/serialization/types/SourceUrl.d.ts +10 -0
- package/serialization/types/SourceUrl.js +40 -0
- package/serialization/types/State.d.ts +22 -0
- package/serialization/types/State.js +50 -0
- package/serialization/types/StateCompleted.d.ts +10 -0
- package/serialization/types/StateCompleted.js +40 -0
- package/serialization/types/StateFailed.d.ts +10 -0
- package/serialization/types/StateFailed.js +40 -0
- package/serialization/types/StateInProgress.d.ts +10 -0
- package/serialization/types/StateInProgress.js +40 -0
- package/serialization/types/StateQueued.d.ts +10 -0
- package/serialization/types/StateQueued.js +40 -0
- package/serialization/types/Status.d.ts +10 -0
- package/serialization/types/Status.js +36 -0
- package/serialization/types/TextPosition.d.ts +13 -0
- package/serialization/types/TextPosition.js +34 -0
- package/serialization/types/TimeInterval.d.ts +13 -0
- package/serialization/types/TimeInterval.js +34 -0
- package/serialization/types/TimeRange.d.ts +13 -0
- package/serialization/types/TimeRange.js +34 -0
- package/serialization/types/Toxicity.d.ts +10 -0
- package/serialization/types/Toxicity.js +40 -0
- package/serialization/types/ToxicityItem.d.ts +13 -0
- package/serialization/types/ToxicityItem.js +34 -0
- package/serialization/types/ToxicityScore.d.ts +13 -0
- package/serialization/types/ToxicityScore.js +34 -0
- package/serialization/types/Transcription.d.ts +12 -0
- package/serialization/types/Transcription.js +42 -0
- package/serialization/types/TranscriptionMetadata.d.ts +13 -0
- package/serialization/types/TranscriptionMetadata.js +43 -0
- package/serialization/types/Url.d.ts +12 -0
- package/serialization/types/Url.js +33 -0
- package/serialization/types/When.d.ts +10 -0
- package/serialization/types/When.js +34 -0
- package/serialization/types/Window.d.ts +13 -0
- package/serialization/types/Window.js +34 -0
- package/serialization/types/index.d.ts +89 -0
- package/serialization/types/index.js +105 -0
- package/wrapper/HumeBatchClient.d.ts +6 -0
- package/wrapper/HumeBatchClient.js +26 -0
- package/wrapper/HumeStreamingClient.d.ts +23 -0
- package/wrapper/HumeStreamingClient.js +125 -0
- package/wrapper/Job.d.ts +8 -0
- package/wrapper/Job.js +87 -0
- package/wrapper/StreamSocket.d.ts +83 -0
- package/wrapper/StreamSocket.js +114 -0
- package/postcss.config.js +0 -7
- package/src/components/HumeWidget.tsx +0 -37
- package/src/index.ts +0 -3
- package/tailwind.config.js +0 -8
- package/tsconfig.json +0 -23
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BaseSchema, Schema } from "../../Schema";
|
|
2
|
+
export declare type SchemaGetter<SchemaType extends Schema<any, any>> = () => SchemaType | Promise<SchemaType>;
|
|
3
|
+
export declare function lazy<Raw, Parsed>(getter: SchemaGetter<Schema<Raw, Parsed>>): Schema<Raw, Parsed>;
|
|
4
|
+
export declare function constructLazyBaseSchema<Raw, Parsed>(getter: SchemaGetter<Schema<Raw, Parsed>>): BaseSchema<Raw, Parsed>;
|
|
5
|
+
export declare function getMemoizedSchema<SchemaType extends Schema<any, any>>(getter: SchemaGetter<SchemaType>): Promise<SchemaType>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getMemoizedSchema = exports.constructLazyBaseSchema = exports.lazy = void 0;
|
|
13
|
+
const schema_utils_1 = require("../schema-utils");
|
|
14
|
+
function lazy(getter) {
|
|
15
|
+
const baseSchema = constructLazyBaseSchema(getter);
|
|
16
|
+
return Object.assign(Object.assign({}, baseSchema), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
17
|
+
}
|
|
18
|
+
exports.lazy = lazy;
|
|
19
|
+
function constructLazyBaseSchema(getter) {
|
|
20
|
+
return {
|
|
21
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () { return (yield getMemoizedSchema(getter)).parse(raw, opts); }),
|
|
22
|
+
json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () { return (yield getMemoizedSchema(getter)).json(parsed, opts); }),
|
|
23
|
+
getType: () => __awaiter(this, void 0, void 0, function* () { return (yield getMemoizedSchema(getter)).getType(); }),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.constructLazyBaseSchema = constructLazyBaseSchema;
|
|
27
|
+
function getMemoizedSchema(getter) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const castedGetter = getter;
|
|
30
|
+
if (castedGetter.__zurg_memoized == null) {
|
|
31
|
+
castedGetter.__zurg_memoized = yield getter();
|
|
32
|
+
}
|
|
33
|
+
return castedGetter.__zurg_memoized;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.getMemoizedSchema = getMemoizedSchema;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.lazyObject = void 0;
|
|
13
|
+
const object_1 = require("../object");
|
|
14
|
+
const object_like_1 = require("../object-like");
|
|
15
|
+
const schema_utils_1 = require("../schema-utils");
|
|
16
|
+
const lazy_1 = require("./lazy");
|
|
17
|
+
function lazyObject(getter) {
|
|
18
|
+
const baseSchema = Object.assign(Object.assign({}, (0, lazy_1.constructLazyBaseSchema)(getter)), { _getRawProperties: () => __awaiter(this, void 0, void 0, function* () { return (yield (0, lazy_1.getMemoizedSchema)(getter))._getRawProperties(); }), _getParsedProperties: () => __awaiter(this, void 0, void 0, function* () { return (yield (0, lazy_1.getMemoizedSchema)(getter))._getParsedProperties(); }) });
|
|
19
|
+
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));
|
|
20
|
+
}
|
|
21
|
+
exports.lazyObject = lazyObject;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { list } from "./list";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.list = void 0;
|
|
13
|
+
const Schema_1 = require("../../Schema");
|
|
14
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
15
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
16
|
+
const schema_utils_1 = require("../schema-utils");
|
|
17
|
+
function list(schema) {
|
|
18
|
+
const baseSchema = {
|
|
19
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return validateAndTransformArray(raw, (item, index) => {
|
|
21
|
+
var _a;
|
|
22
|
+
return schema.parse(item, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `[${index}]`] }));
|
|
23
|
+
});
|
|
24
|
+
}),
|
|
25
|
+
json: (parsed, opts) => validateAndTransformArray(parsed, (item, index) => {
|
|
26
|
+
var _a;
|
|
27
|
+
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}]`] }));
|
|
28
|
+
}),
|
|
29
|
+
getType: () => Schema_1.SchemaType.LIST,
|
|
30
|
+
};
|
|
31
|
+
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
32
|
+
}
|
|
33
|
+
exports.list = list;
|
|
34
|
+
function validateAndTransformArray(value, transformItem) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
if (!Array.isArray(value)) {
|
|
37
|
+
return {
|
|
38
|
+
ok: false,
|
|
39
|
+
errors: [
|
|
40
|
+
{
|
|
41
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "list"),
|
|
42
|
+
path: [],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const maybeValidItems = yield Promise.all(value.map((item, index) => transformItem(item, index)));
|
|
48
|
+
return maybeValidItems.reduce((acc, item) => {
|
|
49
|
+
if (acc.ok && item.ok) {
|
|
50
|
+
return {
|
|
51
|
+
ok: true,
|
|
52
|
+
value: [...acc.value, item.value],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const errors = [];
|
|
56
|
+
if (!acc.ok) {
|
|
57
|
+
errors.push(...acc.errors);
|
|
58
|
+
}
|
|
59
|
+
if (!item.ok) {
|
|
60
|
+
errors.push(...item.errors);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
ok: false,
|
|
64
|
+
errors,
|
|
65
|
+
};
|
|
66
|
+
}, { ok: true, value: [] });
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.booleanLiteral = void 0;
|
|
4
|
+
const Schema_1 = require("../../Schema");
|
|
5
|
+
const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
|
|
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 = [] } = {}) => {
|
|
9
|
+
if (value === literal) {
|
|
10
|
+
return {
|
|
11
|
+
ok: true,
|
|
12
|
+
value: literal,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return {
|
|
17
|
+
ok: false,
|
|
18
|
+
errors: [
|
|
19
|
+
{
|
|
20
|
+
path: breadcrumbsPrefix,
|
|
21
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, `${literal.toString()}`),
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return schemaCreator();
|
|
28
|
+
}
|
|
29
|
+
exports.booleanLiteral = booleanLiteral;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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; } });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringLiteral = void 0;
|
|
4
|
+
const Schema_1 = require("../../Schema");
|
|
5
|
+
const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
|
|
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 = [] } = {}) => {
|
|
9
|
+
if (value === literal) {
|
|
10
|
+
return {
|
|
11
|
+
ok: true,
|
|
12
|
+
value: literal,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return {
|
|
17
|
+
ok: false,
|
|
18
|
+
errors: [
|
|
19
|
+
{
|
|
20
|
+
path: breadcrumbsPrefix,
|
|
21
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, `"${literal}"`),
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return schemaCreator();
|
|
28
|
+
}
|
|
29
|
+
exports.stringLiteral = stringLiteral;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { getObjectUtils, object } from "./object";
|
|
2
|
+
export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties";
|
|
3
|
+
export type { inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas, inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas, } from "./objectWithoutOptionalProperties";
|
|
4
|
+
export { isProperty, property } from "./property";
|
|
5
|
+
export type { Property } from "./property";
|
|
6
|
+
export type { BaseObjectSchema, inferObjectSchemaFromPropertySchemas, inferParsedObject, inferParsedObjectFromPropertySchemas, inferParsedPropertySchema, inferRawKey, inferRawObject, inferRawObjectFromPropertySchemas, inferRawPropertySchema, ObjectSchema, ObjectUtils, PropertySchemas, } from "./types";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.property = exports.isProperty = exports.objectWithoutOptionalProperties = exports.object = exports.getObjectUtils = void 0;
|
|
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; } });
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BaseObjectSchema, inferObjectSchemaFromPropertySchemas, ObjectUtils, PropertySchemas } from "./types";
|
|
2
|
+
export declare function object<ParsedKeys extends string, T extends PropertySchemas<ParsedKeys>>(schemas: T): inferObjectSchemaFromPropertySchemas<T>;
|
|
3
|
+
export declare function getObjectUtils<Raw, Parsed>(schema: BaseObjectSchema<Raw, Parsed>): ObjectUtils<Raw, Parsed>;
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getObjectUtils = exports.object = void 0;
|
|
13
|
+
const Schema_1 = require("../../Schema");
|
|
14
|
+
const entries_1 = require("../../utils/entries");
|
|
15
|
+
const filterObject_1 = require("../../utils/filterObject");
|
|
16
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
17
|
+
const isPlainObject_1 = require("../../utils/isPlainObject");
|
|
18
|
+
const keys_1 = require("../../utils/keys");
|
|
19
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
20
|
+
const partition_1 = require("../../utils/partition");
|
|
21
|
+
const object_like_1 = require("../object-like");
|
|
22
|
+
const schema_utils_1 = require("../schema-utils");
|
|
23
|
+
const property_1 = require("./property");
|
|
24
|
+
function object(schemas) {
|
|
25
|
+
const baseSchema = {
|
|
26
|
+
_getRawProperties: () => Promise.resolve(Object.entries(schemas).map(([parsedKey, propertySchema]) => (0, property_1.isProperty)(propertySchema) ? propertySchema.rawKey : parsedKey)),
|
|
27
|
+
_getParsedProperties: () => Promise.resolve((0, keys_1.keys)(schemas)),
|
|
28
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const rawKeyToProperty = {};
|
|
30
|
+
const requiredKeys = [];
|
|
31
|
+
for (const [parsedKey, schemaOrObjectProperty] of (0, entries_1.entries)(schemas)) {
|
|
32
|
+
const rawKey = (0, property_1.isProperty)(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey;
|
|
33
|
+
const valueSchema = (0, property_1.isProperty)(schemaOrObjectProperty)
|
|
34
|
+
? schemaOrObjectProperty.valueSchema
|
|
35
|
+
: schemaOrObjectProperty;
|
|
36
|
+
const property = {
|
|
37
|
+
rawKey,
|
|
38
|
+
parsedKey: parsedKey,
|
|
39
|
+
valueSchema,
|
|
40
|
+
};
|
|
41
|
+
rawKeyToProperty[rawKey] = property;
|
|
42
|
+
if (yield isSchemaRequired(valueSchema)) {
|
|
43
|
+
requiredKeys.push(rawKey);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return validateAndTransformObject({
|
|
47
|
+
value: raw,
|
|
48
|
+
requiredKeys,
|
|
49
|
+
getProperty: (rawKey) => {
|
|
50
|
+
const property = rawKeyToProperty[rawKey];
|
|
51
|
+
if (property == null) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
transformedKey: property.parsedKey,
|
|
56
|
+
transform: (propertyValue) => {
|
|
57
|
+
var _a;
|
|
58
|
+
return property.valueSchema.parse(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), rawKey] }));
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
unrecognizedObjectKeys: opts === null || opts === void 0 ? void 0 : opts.unrecognizedObjectKeys,
|
|
63
|
+
skipValidation: opts === null || opts === void 0 ? void 0 : opts.skipValidation,
|
|
64
|
+
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
65
|
+
});
|
|
66
|
+
}),
|
|
67
|
+
json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const requiredKeys = [];
|
|
69
|
+
for (const [parsedKey, schemaOrObjectProperty] of (0, entries_1.entries)(schemas)) {
|
|
70
|
+
const valueSchema = (0, property_1.isProperty)(schemaOrObjectProperty)
|
|
71
|
+
? schemaOrObjectProperty.valueSchema
|
|
72
|
+
: schemaOrObjectProperty;
|
|
73
|
+
if (yield isSchemaRequired(valueSchema)) {
|
|
74
|
+
requiredKeys.push(parsedKey);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return validateAndTransformObject({
|
|
78
|
+
value: parsed,
|
|
79
|
+
requiredKeys,
|
|
80
|
+
getProperty: (parsedKey) => {
|
|
81
|
+
const property = schemas[parsedKey];
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
83
|
+
if (property == null) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
if ((0, property_1.isProperty)(property)) {
|
|
87
|
+
return {
|
|
88
|
+
transformedKey: property.rawKey,
|
|
89
|
+
transform: (propertyValue) => {
|
|
90
|
+
var _a;
|
|
91
|
+
return property.valueSchema.json(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), parsedKey] }));
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return {
|
|
97
|
+
transformedKey: parsedKey,
|
|
98
|
+
transform: (propertyValue) => {
|
|
99
|
+
var _a;
|
|
100
|
+
return property.json(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), parsedKey] }));
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
unrecognizedObjectKeys: opts === null || opts === void 0 ? void 0 : opts.unrecognizedObjectKeys,
|
|
106
|
+
skipValidation: opts === null || opts === void 0 ? void 0 : opts.skipValidation,
|
|
107
|
+
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
108
|
+
});
|
|
109
|
+
}),
|
|
110
|
+
getType: () => Schema_1.SchemaType.OBJECT,
|
|
111
|
+
};
|
|
112
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema)), getObjectUtils(baseSchema));
|
|
113
|
+
}
|
|
114
|
+
exports.object = object;
|
|
115
|
+
function validateAndTransformObject({ value, requiredKeys, getProperty, unrecognizedObjectKeys = "fail", skipValidation = false, breadcrumbsPrefix = [], }) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
if (!(0, isPlainObject_1.isPlainObject)(value)) {
|
|
118
|
+
return {
|
|
119
|
+
ok: false,
|
|
120
|
+
errors: [
|
|
121
|
+
{
|
|
122
|
+
path: breadcrumbsPrefix,
|
|
123
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const missingRequiredKeys = new Set(requiredKeys);
|
|
129
|
+
const errors = [];
|
|
130
|
+
const transformed = {};
|
|
131
|
+
for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) {
|
|
132
|
+
const property = getProperty(preTransformedKey);
|
|
133
|
+
if (property != null) {
|
|
134
|
+
missingRequiredKeys.delete(preTransformedKey);
|
|
135
|
+
const value = yield property.transform(preTransformedItemValue);
|
|
136
|
+
if (value.ok) {
|
|
137
|
+
transformed[property.transformedKey] = value.value;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
transformed[preTransformedKey] = preTransformedItemValue;
|
|
141
|
+
errors.push(...value.errors);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
switch (unrecognizedObjectKeys) {
|
|
146
|
+
case "fail":
|
|
147
|
+
errors.push({
|
|
148
|
+
path: [...breadcrumbsPrefix, preTransformedKey],
|
|
149
|
+
message: `Unexpected key "${preTransformedKey}"`,
|
|
150
|
+
});
|
|
151
|
+
break;
|
|
152
|
+
case "strip":
|
|
153
|
+
break;
|
|
154
|
+
case "passthrough":
|
|
155
|
+
transformed[preTransformedKey] = preTransformedItemValue;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
errors.push(...requiredKeys
|
|
161
|
+
.filter((key) => missingRequiredKeys.has(key))
|
|
162
|
+
.map((key) => ({
|
|
163
|
+
path: breadcrumbsPrefix,
|
|
164
|
+
message: `Missing required key "${key}"`,
|
|
165
|
+
})));
|
|
166
|
+
if (errors.length === 0 || skipValidation) {
|
|
167
|
+
return {
|
|
168
|
+
ok: true,
|
|
169
|
+
value: transformed,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
return {
|
|
174
|
+
ok: false,
|
|
175
|
+
errors,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function getObjectUtils(schema) {
|
|
181
|
+
return {
|
|
182
|
+
extend: (extension) => {
|
|
183
|
+
const baseSchema = {
|
|
184
|
+
_getParsedProperties: () => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
return [
|
|
186
|
+
...(yield schema._getParsedProperties()),
|
|
187
|
+
...(yield extension._getParsedProperties()),
|
|
188
|
+
];
|
|
189
|
+
}),
|
|
190
|
+
_getRawProperties: () => __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
return [
|
|
192
|
+
...(yield schema._getRawProperties()),
|
|
193
|
+
...(yield extension._getRawProperties()),
|
|
194
|
+
];
|
|
195
|
+
}),
|
|
196
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
return validateAndTransformExtendedObject({
|
|
198
|
+
extensionKeys: yield extension._getRawProperties(),
|
|
199
|
+
value: raw,
|
|
200
|
+
transformBase: (rawBase) => schema.parse(rawBase, opts),
|
|
201
|
+
transformExtension: (rawExtension) => extension.parse(rawExtension, opts),
|
|
202
|
+
});
|
|
203
|
+
}),
|
|
204
|
+
json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
return validateAndTransformExtendedObject({
|
|
206
|
+
extensionKeys: yield extension._getParsedProperties(),
|
|
207
|
+
value: parsed,
|
|
208
|
+
transformBase: (parsedBase) => schema.json(parsedBase, opts),
|
|
209
|
+
transformExtension: (parsedExtension) => extension.json(parsedExtension, opts),
|
|
210
|
+
});
|
|
211
|
+
}),
|
|
212
|
+
getType: () => Schema_1.SchemaType.OBJECT,
|
|
213
|
+
};
|
|
214
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, baseSchema), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema)), getObjectUtils(baseSchema));
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
exports.getObjectUtils = getObjectUtils;
|
|
219
|
+
function validateAndTransformExtendedObject({ extensionKeys, value, transformBase, transformExtension, }) {
|
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
const extensionPropertiesSet = new Set(extensionKeys);
|
|
222
|
+
const [extensionProperties, baseProperties] = (0, partition_1.partition)((0, keys_1.keys)(value), (key) => extensionPropertiesSet.has(key));
|
|
223
|
+
const transformedBase = yield transformBase((0, filterObject_1.filterObject)(value, baseProperties));
|
|
224
|
+
const transformedExtension = yield transformExtension((0, filterObject_1.filterObject)(value, extensionProperties));
|
|
225
|
+
if (transformedBase.ok && transformedExtension.ok) {
|
|
226
|
+
return {
|
|
227
|
+
ok: true,
|
|
228
|
+
value: Object.assign(Object.assign({}, transformedBase.value), transformedExtension.value),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
return {
|
|
233
|
+
ok: false,
|
|
234
|
+
errors: [
|
|
235
|
+
...(transformedBase.ok ? [] : transformedBase.errors),
|
|
236
|
+
...(transformedExtension.ok ? [] : transformedExtension.errors),
|
|
237
|
+
],
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function isSchemaRequired(schema) {
|
|
243
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
244
|
+
return !(yield isSchemaOptional(schema));
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
function isSchemaOptional(schema) {
|
|
248
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
+
switch (yield schema.getType()) {
|
|
250
|
+
case Schema_1.SchemaType.ANY:
|
|
251
|
+
case Schema_1.SchemaType.UNKNOWN:
|
|
252
|
+
case Schema_1.SchemaType.OPTIONAL:
|
|
253
|
+
return true;
|
|
254
|
+
default:
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { inferParsedPropertySchema, inferRawObjectFromPropertySchemas, ObjectSchema, PropertySchemas } from "./types";
|
|
2
|
+
export declare function objectWithoutOptionalProperties<ParsedKeys extends string, T extends PropertySchemas<ParsedKeys>>(schemas: T): inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas<T>;
|
|
3
|
+
export declare type inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas<T extends PropertySchemas<keyof T>> = ObjectSchema<inferRawObjectFromPropertySchemas<T>, inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas<T>>;
|
|
4
|
+
export declare type inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas<T extends PropertySchemas<keyof T>> = {
|
|
5
|
+
[K in keyof T]: inferParsedPropertySchema<T[K]>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.objectWithoutOptionalProperties = void 0;
|
|
4
|
+
const object_1 = require("./object");
|
|
5
|
+
function objectWithoutOptionalProperties(schemas) {
|
|
6
|
+
return (0, object_1.object)(schemas);
|
|
7
|
+
}
|
|
8
|
+
exports.objectWithoutOptionalProperties = objectWithoutOptionalProperties;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Schema } from "../../Schema";
|
|
2
|
+
export declare function property<RawKey extends string, RawValue, ParsedValue>(rawKey: RawKey, valueSchema: Schema<RawValue, ParsedValue>): Property<RawKey, RawValue, ParsedValue>;
|
|
3
|
+
export interface Property<RawKey extends string, RawValue, ParsedValue> {
|
|
4
|
+
rawKey: RawKey;
|
|
5
|
+
valueSchema: Schema<RawValue, ParsedValue>;
|
|
6
|
+
isProperty: true;
|
|
7
|
+
}
|
|
8
|
+
export declare function isProperty<O extends Property<any, any, any>>(maybeProperty: unknown): maybeProperty is O;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isProperty = exports.property = void 0;
|
|
4
|
+
function property(rawKey, valueSchema) {
|
|
5
|
+
return {
|
|
6
|
+
rawKey,
|
|
7
|
+
valueSchema,
|
|
8
|
+
isProperty: true,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
exports.property = property;
|
|
12
|
+
function isProperty(maybeProperty) {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
14
|
+
return maybeProperty.isProperty;
|
|
15
|
+
}
|
|
16
|
+
exports.isProperty = isProperty;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseSchema, inferParsed, inferRaw, Schema } from "../../Schema";
|
|
2
|
+
import { addQuestionMarksToNullableProperties } from "../../utils/addQuestionMarksToNullableProperties";
|
|
3
|
+
import { ObjectLikeUtils } from "../object-like";
|
|
4
|
+
import { SchemaUtils } from "../schema-utils";
|
|
5
|
+
import { Property } from "./property";
|
|
6
|
+
export declare type ObjectSchema<Raw, Parsed> = BaseObjectSchema<Raw, Parsed> & ObjectLikeUtils<Raw, Parsed> & ObjectUtils<Raw, Parsed> & SchemaUtils<Raw, Parsed>;
|
|
7
|
+
export interface BaseObjectSchema<Raw, Parsed> extends BaseSchema<Raw, Parsed> {
|
|
8
|
+
_getRawProperties: () => Promise<(keyof Raw)[]>;
|
|
9
|
+
_getParsedProperties: () => Promise<(keyof Parsed)[]>;
|
|
10
|
+
}
|
|
11
|
+
export interface ObjectUtils<Raw, Parsed> {
|
|
12
|
+
extend: <RawExtension, ParsedExtension>(schemas: ObjectSchema<RawExtension, ParsedExtension>) => ObjectSchema<Raw & RawExtension, Parsed & ParsedExtension>;
|
|
13
|
+
}
|
|
14
|
+
export declare type inferRawObject<O extends ObjectSchema<any, any>> = O extends ObjectSchema<infer Raw, any> ? Raw : never;
|
|
15
|
+
export declare type inferParsedObject<O extends ObjectSchema<any, any>> = O extends ObjectSchema<any, infer Parsed> ? Parsed : never;
|
|
16
|
+
export declare type inferObjectSchemaFromPropertySchemas<T extends PropertySchemas<keyof T>> = ObjectSchema<inferRawObjectFromPropertySchemas<T>, inferParsedObjectFromPropertySchemas<T>>;
|
|
17
|
+
export declare type inferRawObjectFromPropertySchemas<T extends PropertySchemas<keyof T>> = addQuestionMarksToNullableProperties<{
|
|
18
|
+
[ParsedKey in keyof T as inferRawKey<ParsedKey, T[ParsedKey]>]: inferRawPropertySchema<T[ParsedKey]>;
|
|
19
|
+
}>;
|
|
20
|
+
export declare type inferParsedObjectFromPropertySchemas<T extends PropertySchemas<keyof T>> = addQuestionMarksToNullableProperties<{
|
|
21
|
+
[K in keyof T]: inferParsedPropertySchema<T[K]>;
|
|
22
|
+
}>;
|
|
23
|
+
export declare type PropertySchemas<ParsedKeys extends string | number | symbol> = Record<ParsedKeys, Property<any, any, any> | Schema<any, any>>;
|
|
24
|
+
export declare type inferRawPropertySchema<P extends Property<any, any, any> | Schema<any, any>> = P extends Property<any, infer Raw, any> ? Raw : P extends Schema<any, any> ? inferRaw<P> : never;
|
|
25
|
+
export declare type inferParsedPropertySchema<P extends Property<any, any, any> | Schema<any, any>> = P extends Property<any, any, infer Parsed> ? Parsed : P extends Schema<any, any> ? inferParsed<P> : never;
|
|
26
|
+
export declare type inferRawKey<ParsedKey extends string | number | symbol, P extends Property<any, any, any> | Schema<any, any>> = P extends Property<infer Raw, any, any> ? Raw : ParsedKey;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseSchema } from "../../Schema";
|
|
2
|
+
import { ObjectLikeSchema, ObjectLikeUtils } from "./types";
|
|
3
|
+
export declare function getObjectLikeUtils<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): ObjectLikeUtils<Raw, Parsed>;
|
|
4
|
+
/**
|
|
5
|
+
* object-like utils are defined in one file to resolve issues with circular imports
|
|
6
|
+
*/
|
|
7
|
+
export declare function withParsedProperties<RawObjectShape, ParsedObjectShape, Properties>(objectLike: BaseSchema<RawObjectShape, ParsedObjectShape>, properties: {
|
|
8
|
+
[K in keyof Properties]: Properties[K] | ((parsed: ParsedObjectShape) => Properties[K]);
|
|
9
|
+
}): ObjectLikeSchema<RawObjectShape, ParsedObjectShape & Properties>;
|