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,51 @@
|
|
|
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.undiscriminatedUnion = void 0;
|
|
13
|
+
const Schema_1 = require("../../Schema");
|
|
14
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
15
|
+
const schema_utils_1 = require("../schema-utils");
|
|
16
|
+
function undiscriminatedUnion(schemas) {
|
|
17
|
+
const baseSchema = {
|
|
18
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.parse(raw, opts), schemas, opts);
|
|
20
|
+
}),
|
|
21
|
+
json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return validateAndTransformUndiscriminatedUnion((schema, opts) => schema.json(parsed, opts), schemas, opts);
|
|
23
|
+
}),
|
|
24
|
+
getType: () => Schema_1.SchemaType.UNDISCRIMINATED_UNION,
|
|
25
|
+
};
|
|
26
|
+
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
27
|
+
}
|
|
28
|
+
exports.undiscriminatedUnion = undiscriminatedUnion;
|
|
29
|
+
function validateAndTransformUndiscriminatedUnion(transform, schemas, opts) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const errors = [];
|
|
32
|
+
for (const [index, schema] of schemas.entries()) {
|
|
33
|
+
const transformed = yield transform(schema, Object.assign(Object.assign({}, opts), { skipValidation: false }));
|
|
34
|
+
if (transformed.ok) {
|
|
35
|
+
return transformed;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
for (const error of transformed.errors) {
|
|
39
|
+
errors.push({
|
|
40
|
+
path: error.path,
|
|
41
|
+
message: `[Variant ${index}] ${error.message}`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
errors,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function discriminant<RawDiscriminant extends string, ParsedDiscriminant extends string>(parsedDiscriminant: ParsedDiscriminant, rawDiscriminant: RawDiscriminant): Discriminant<RawDiscriminant, ParsedDiscriminant>;
|
|
2
|
+
export interface Discriminant<RawDiscriminant extends string, ParsedDiscriminant extends string> {
|
|
3
|
+
parsedDiscriminant: ParsedDiscriminant;
|
|
4
|
+
rawDiscriminant: RawDiscriminant;
|
|
5
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discriminant = void 0;
|
|
4
|
+
function discriminant(parsedDiscriminant, rawDiscriminant) {
|
|
5
|
+
return {
|
|
6
|
+
parsedDiscriminant,
|
|
7
|
+
rawDiscriminant,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
exports.discriminant = discriminant;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.union = exports.discriminant = void 0;
|
|
4
|
+
var discriminant_1 = require("./discriminant");
|
|
5
|
+
Object.defineProperty(exports, "discriminant", { enumerable: true, get: function () { return discriminant_1.discriminant; } });
|
|
6
|
+
var union_1 = require("./union");
|
|
7
|
+
Object.defineProperty(exports, "union", { enumerable: true, get: function () { return union_1.union; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { inferParsedObject, inferRawObject, ObjectSchema } from "../object";
|
|
2
|
+
import { Discriminant } from "./discriminant";
|
|
3
|
+
export declare type UnionSubtypes<DiscriminantValues extends string | number | symbol> = {
|
|
4
|
+
[K in DiscriminantValues]: ObjectSchema<any, any>;
|
|
5
|
+
};
|
|
6
|
+
export declare type inferRawUnion<D extends string | Discriminant<any, any>, U extends UnionSubtypes<keyof U>> = {
|
|
7
|
+
[K in keyof U]: Record<inferRawDiscriminant<D>, K> & inferRawObject<U[K]>;
|
|
8
|
+
}[keyof U];
|
|
9
|
+
export declare type inferParsedUnion<D extends string | Discriminant<any, any>, U extends UnionSubtypes<keyof U>> = {
|
|
10
|
+
[K in keyof U]: Record<inferParsedDiscriminant<D>, K> & inferParsedObject<U[K]>;
|
|
11
|
+
}[keyof U];
|
|
12
|
+
export declare type inferRawDiscriminant<D extends string | Discriminant<any, any>> = D extends string ? D : D extends Discriminant<infer Raw, any> ? Raw : never;
|
|
13
|
+
export declare type inferParsedDiscriminant<D extends string | Discriminant<any, any>> = D extends string ? D : D extends Discriminant<any, infer Parsed> ? Parsed : never;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ObjectLikeSchema } from "../object-like";
|
|
2
|
+
import { Discriminant } from "./discriminant";
|
|
3
|
+
import { inferParsedUnion, inferRawUnion, UnionSubtypes } from "./types";
|
|
4
|
+
export declare function union<D extends string | Discriminant<any, any>, U extends UnionSubtypes<any>>(discriminant: D, union: U): ObjectLikeSchema<inferRawUnion<D, U>, inferParsedUnion<D, U>>;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.union = void 0;
|
|
24
|
+
const Schema_1 = require("../../Schema");
|
|
25
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
26
|
+
const isPlainObject_1 = require("../../utils/isPlainObject");
|
|
27
|
+
const keys_1 = require("../../utils/keys");
|
|
28
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
29
|
+
const enum_1 = require("../enum");
|
|
30
|
+
const object_like_1 = require("../object-like");
|
|
31
|
+
const schema_utils_1 = require("../schema-utils");
|
|
32
|
+
function union(discriminant, union) {
|
|
33
|
+
const rawDiscriminant = typeof discriminant === "string" ? discriminant : discriminant.rawDiscriminant;
|
|
34
|
+
const parsedDiscriminant = typeof discriminant === "string"
|
|
35
|
+
? discriminant
|
|
36
|
+
: discriminant.parsedDiscriminant;
|
|
37
|
+
const discriminantValueSchema = (0, enum_1.enum_)((0, keys_1.keys)(union));
|
|
38
|
+
const baseSchema = {
|
|
39
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
return transformAndValidateUnion({
|
|
41
|
+
value: raw,
|
|
42
|
+
discriminant: rawDiscriminant,
|
|
43
|
+
transformedDiscriminant: parsedDiscriminant,
|
|
44
|
+
transformDiscriminantValue: (discriminantValue) => {
|
|
45
|
+
var _a;
|
|
46
|
+
return discriminantValueSchema.parse(discriminantValue, {
|
|
47
|
+
allowUnrecognizedEnumValues: opts === null || opts === void 0 ? void 0 : opts.allowUnrecognizedUnionMembers,
|
|
48
|
+
breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), rawDiscriminant],
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue],
|
|
52
|
+
allowUnrecognizedUnionMembers: opts === null || opts === void 0 ? void 0 : opts.allowUnrecognizedUnionMembers,
|
|
53
|
+
transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.parse(additionalProperties, opts),
|
|
54
|
+
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
55
|
+
});
|
|
56
|
+
}),
|
|
57
|
+
json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return transformAndValidateUnion({
|
|
59
|
+
value: parsed,
|
|
60
|
+
discriminant: parsedDiscriminant,
|
|
61
|
+
transformedDiscriminant: rawDiscriminant,
|
|
62
|
+
transformDiscriminantValue: (discriminantValue) => {
|
|
63
|
+
var _a;
|
|
64
|
+
return discriminantValueSchema.json(discriminantValue, {
|
|
65
|
+
allowUnrecognizedEnumValues: opts === null || opts === void 0 ? void 0 : opts.allowUnrecognizedUnionMembers,
|
|
66
|
+
breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), parsedDiscriminant],
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue],
|
|
70
|
+
allowUnrecognizedUnionMembers: opts === null || opts === void 0 ? void 0 : opts.allowUnrecognizedUnionMembers,
|
|
71
|
+
transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => additionalPropertiesSchema.json(additionalProperties, opts),
|
|
72
|
+
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
73
|
+
});
|
|
74
|
+
}),
|
|
75
|
+
getType: () => Schema_1.SchemaType.UNION,
|
|
76
|
+
};
|
|
77
|
+
return Object.assign(Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema));
|
|
78
|
+
}
|
|
79
|
+
exports.union = union;
|
|
80
|
+
function transformAndValidateUnion({ value, discriminant, transformedDiscriminant, transformDiscriminantValue, getAdditionalPropertiesSchema, allowUnrecognizedUnionMembers = false, transformAdditionalProperties, breadcrumbsPrefix = [], }) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
if (!(0, isPlainObject_1.isPlainObject)(value)) {
|
|
83
|
+
return {
|
|
84
|
+
ok: false,
|
|
85
|
+
errors: [
|
|
86
|
+
{
|
|
87
|
+
path: breadcrumbsPrefix,
|
|
88
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const _a = value, _b = discriminant, discriminantValue = _a[_b], additionalProperties = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
94
|
+
if (discriminantValue == null) {
|
|
95
|
+
return {
|
|
96
|
+
ok: false,
|
|
97
|
+
errors: [
|
|
98
|
+
{
|
|
99
|
+
path: breadcrumbsPrefix,
|
|
100
|
+
message: `Missing discriminant ("${discriminant}")`,
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const transformedDiscriminantValue = yield transformDiscriminantValue(discriminantValue);
|
|
106
|
+
if (!transformedDiscriminantValue.ok) {
|
|
107
|
+
return {
|
|
108
|
+
ok: false,
|
|
109
|
+
errors: transformedDiscriminantValue.errors,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value);
|
|
113
|
+
if (additionalPropertiesSchema == null) {
|
|
114
|
+
if (allowUnrecognizedUnionMembers) {
|
|
115
|
+
return {
|
|
116
|
+
ok: true,
|
|
117
|
+
value: Object.assign({ [transformedDiscriminant]: transformedDiscriminantValue.value }, additionalProperties),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
return {
|
|
122
|
+
ok: false,
|
|
123
|
+
errors: [
|
|
124
|
+
{
|
|
125
|
+
path: [...breadcrumbsPrefix, discriminant],
|
|
126
|
+
message: "Unexpected discriminant value",
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const transformedAdditionalProperties = yield transformAdditionalProperties(additionalProperties, additionalPropertiesSchema);
|
|
133
|
+
if (!transformedAdditionalProperties.ok) {
|
|
134
|
+
return transformedAdditionalProperties;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
ok: true,
|
|
138
|
+
value: Object.assign({ [transformedDiscriminant]: discriminantValue }, transformedAdditionalProperties.value),
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./builders"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type MaybePromise<T> = T | Promise<T>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare type addQuestionMarksToNullableProperties<T> = {
|
|
2
|
+
[K in OptionalKeys<T>]?: T[K];
|
|
3
|
+
} & Pick<T, RequiredKeys<T>>;
|
|
4
|
+
export declare type OptionalKeys<T> = {
|
|
5
|
+
[K in keyof T]-?: undefined extends T[K] ? K : null extends T[K] ? K : 1 extends (any extends T[K] ? 0 : 1) ? never : K;
|
|
6
|
+
}[keyof T];
|
|
7
|
+
export declare type RequiredKeys<T> = Exclude<keyof T, OptionalKeys<T>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createIdentitySchemaCreator = void 0;
|
|
4
|
+
const schema_utils_1 = require("../builders/schema-utils");
|
|
5
|
+
const maybeSkipValidation_1 = require("./maybeSkipValidation");
|
|
6
|
+
function createIdentitySchemaCreator(schemaType, validate) {
|
|
7
|
+
return () => {
|
|
8
|
+
const baseSchema = {
|
|
9
|
+
parse: validate,
|
|
10
|
+
json: validate,
|
|
11
|
+
getType: () => schemaType,
|
|
12
|
+
};
|
|
13
|
+
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.createIdentitySchemaCreator = createIdentitySchemaCreator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function entries<T>(object: T): [keyof T, T[keyof T]][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function filterObject<T, K extends keyof T>(obj: T, keysToInclude: K[]): Pick<T, K>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterObject = void 0;
|
|
4
|
+
function filterObject(obj, keysToInclude) {
|
|
5
|
+
const keysToIncludeSet = new Set(keysToInclude);
|
|
6
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
7
|
+
if (keysToIncludeSet.has(key)) {
|
|
8
|
+
acc[key] = value;
|
|
9
|
+
}
|
|
10
|
+
return acc;
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter
|
|
12
|
+
}, {});
|
|
13
|
+
}
|
|
14
|
+
exports.filterObject = filterObject;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getErrorMessageForIncorrectType(value: unknown, expectedType: string): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getErrorMessageForIncorrectType = void 0;
|
|
4
|
+
function getErrorMessageForIncorrectType(value, expectedType) {
|
|
5
|
+
return `Expected ${expectedType}. Received ${getTypeAsString(value)}.`;
|
|
6
|
+
}
|
|
7
|
+
exports.getErrorMessageForIncorrectType = getErrorMessageForIncorrectType;
|
|
8
|
+
function getTypeAsString(value) {
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
return "list";
|
|
11
|
+
}
|
|
12
|
+
if (value === null) {
|
|
13
|
+
return "null";
|
|
14
|
+
}
|
|
15
|
+
switch (typeof value) {
|
|
16
|
+
case "string":
|
|
17
|
+
return `"${value}"`;
|
|
18
|
+
case "number":
|
|
19
|
+
case "boolean":
|
|
20
|
+
case "undefined":
|
|
21
|
+
return `${value}`;
|
|
22
|
+
}
|
|
23
|
+
return typeof value;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPlainObject = void 0;
|
|
4
|
+
// borrowed from https://github.com/lodash/lodash/blob/master/isPlainObject.js
|
|
5
|
+
function isPlainObject(value) {
|
|
6
|
+
if (typeof value !== "object" || value === null) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (Object.getPrototypeOf(value) === null) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
let proto = value;
|
|
13
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
14
|
+
proto = Object.getPrototypeOf(proto);
|
|
15
|
+
}
|
|
16
|
+
return Object.getPrototypeOf(value) === proto;
|
|
17
|
+
}
|
|
18
|
+
exports.isPlainObject = isPlainObject;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function keys<T>(object: T): (keyof T)[];
|
|
@@ -0,0 +1,37 @@
|
|
|
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.maybeSkipValidation = void 0;
|
|
13
|
+
function maybeSkipValidation(schema) {
|
|
14
|
+
return Object.assign(Object.assign({}, schema), { json: transformAndMaybeSkipValidation(schema.json), parse: transformAndMaybeSkipValidation(schema.parse) });
|
|
15
|
+
}
|
|
16
|
+
exports.maybeSkipValidation = maybeSkipValidation;
|
|
17
|
+
function transformAndMaybeSkipValidation(transform) {
|
|
18
|
+
return (value, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const transformed = yield transform(value, opts);
|
|
20
|
+
const { skipValidation = false } = opts !== null && opts !== void 0 ? opts : {};
|
|
21
|
+
if (!transformed.ok && skipValidation) {
|
|
22
|
+
// eslint-disable-next-line no-console
|
|
23
|
+
console.warn([
|
|
24
|
+
"Failed to validate.",
|
|
25
|
+
...transformed.errors.map((error) => " - " +
|
|
26
|
+
(error.path.length > 0 ? `${error.path.join(".")}: ${error.message}` : error.message)),
|
|
27
|
+
].join("\n"));
|
|
28
|
+
return {
|
|
29
|
+
ok: true,
|
|
30
|
+
value: value,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return transformed;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function partition<T>(items: readonly T[], predicate: (item: T) => boolean): [T[], T[]];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.partition = void 0;
|
|
4
|
+
function partition(items, predicate) {
|
|
5
|
+
const trueItems = [], falseItems = [];
|
|
6
|
+
for (const item of items) {
|
|
7
|
+
if (predicate(item)) {
|
|
8
|
+
trueItems.push(item);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
falseItems.push(item);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return [trueItems, falseItems];
|
|
15
|
+
}
|
|
16
|
+
exports.partition = partition;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Readable } from "stream";
|
|
3
|
+
export declare class Stream<T> implements AsyncIterable<T> {
|
|
4
|
+
private stream;
|
|
5
|
+
private parse;
|
|
6
|
+
private terminator;
|
|
7
|
+
constructor({ stream, parse, terminator, }: {
|
|
8
|
+
stream: Readable;
|
|
9
|
+
parse: (val: unknown) => Promise<T>;
|
|
10
|
+
terminator: string;
|
|
11
|
+
});
|
|
12
|
+
private iterMessages;
|
|
13
|
+
[Symbol.asyncIterator](): AsyncIterator<T, void, unknown>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
+
var m = o[Symbol.asyncIterator], i;
|
|
5
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
6
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
+
};
|
|
9
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
10
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
11
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
12
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
13
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
14
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
15
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
16
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
17
|
+
function fulfill(value) { resume("next", value); }
|
|
18
|
+
function reject(value) { resume("throw", value); }
|
|
19
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.Stream = void 0;
|
|
23
|
+
class Stream {
|
|
24
|
+
constructor({ stream, parse, terminator, }) {
|
|
25
|
+
this.stream = stream;
|
|
26
|
+
this.parse = parse;
|
|
27
|
+
this.terminator = terminator;
|
|
28
|
+
}
|
|
29
|
+
iterMessages() {
|
|
30
|
+
return __asyncGenerator(this, arguments, function* iterMessages_1() {
|
|
31
|
+
var e_1, _a;
|
|
32
|
+
let previous = "";
|
|
33
|
+
try {
|
|
34
|
+
for (var _b = __asyncValues(this.stream), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
35
|
+
const chunk = _c.value;
|
|
36
|
+
const bufferChunk = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
37
|
+
previous += bufferChunk;
|
|
38
|
+
let terminatorIndex;
|
|
39
|
+
while ((terminatorIndex = previous.indexOf(this.terminator)) >= 0) {
|
|
40
|
+
const line = previous.slice(0, terminatorIndex).trimEnd();
|
|
41
|
+
const message = yield __await(this.parse(JSON.parse(line)));
|
|
42
|
+
yield yield __await(message);
|
|
43
|
+
previous = previous.slice(terminatorIndex + 1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
48
|
+
finally {
|
|
49
|
+
try {
|
|
50
|
+
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
|
|
51
|
+
}
|
|
52
|
+
finally { if (e_1) throw e_1.error; }
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
[Symbol.asyncIterator]() {
|
|
57
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
58
|
+
var e_2, _b;
|
|
59
|
+
try {
|
|
60
|
+
for (var _c = __asyncValues(this.iterMessages()), _d; _d = yield __await(_c.next()), !_d.done;) {
|
|
61
|
+
const message = _d.value;
|
|
62
|
+
yield yield __await(message);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
66
|
+
finally {
|
|
67
|
+
try {
|
|
68
|
+
if (_d && !_d.done && (_b = _c.return)) yield __await(_b.call(_c));
|
|
69
|
+
}
|
|
70
|
+
finally { if (e_2) throw e_2.error; }
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.Stream = Stream;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { AxiosAdapter } from "axios";
|
|
3
|
+
import { Readable } from "stream";
|
|
4
|
+
export declare type StreamingFetchFunction = (args: StreamingFetcher.Args) => Promise<StreamingFetcher.Response>;
|
|
5
|
+
export declare namespace StreamingFetcher {
|
|
6
|
+
interface Args {
|
|
7
|
+
url: string;
|
|
8
|
+
method: string;
|
|
9
|
+
headers?: Record<string, string | undefined>;
|
|
10
|
+
queryParameters?: Record<string, string | string[]>;
|
|
11
|
+
body?: unknown;
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
withCredentials?: boolean;
|
|
14
|
+
adapter?: AxiosAdapter;
|
|
15
|
+
onUploadProgress?: (event: ProgressEvent) => void;
|
|
16
|
+
onDownloadProgress?: (event: ProgressEvent) => void;
|
|
17
|
+
abortController?: AbortController;
|
|
18
|
+
}
|
|
19
|
+
interface Response {
|
|
20
|
+
data: Readable;
|
|
21
|
+
headers: Record<string, any>;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export declare const streamingFetcher: StreamingFetchFunction;
|