@language-weaver/lw-sdk-js 1.2.0 → 2.0.1
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/lib/common/configurations/ClientConfiguration.d.ts +2 -2
- package/lib/common/configurations/ClientConfiguration.js +0 -2
- package/lib/common/configurations/ClientConfiguration.js.map +1 -1
- package/lib/common/configurations/CredentialsConfiguration.js +2 -6
- package/lib/common/configurations/CredentialsConfiguration.js.map +1 -1
- package/lib/{translation/feedback/cloud/model → common/constants}/CloudFeedbackSortCriteria.d.ts +0 -0
- package/lib/{translation/feedback/cloud/model → common/constants}/CloudFeedbackSortCriteria.js +0 -0
- package/lib/common/constants/CloudFeedbackSortCriteria.js.map +1 -0
- package/lib/common/constants/Statuses.d.ts +6 -0
- package/lib/common/constants/Statuses.js +7 -1
- package/lib/common/constants/Statuses.js.map +1 -1
- package/lib/common/constants/TranslationConstants.d.ts +17 -8
- package/lib/common/constants/TranslationConstants.js +22 -11
- package/lib/common/constants/TranslationConstants.js.map +1 -1
- package/lib/common/exceptions/ContentInsightsException.d.ts +4 -0
- package/lib/common/exceptions/ContentInsightsException.js +17 -0
- package/lib/common/exceptions/ContentInsightsException.js.map +1 -0
- package/lib/common/external/communication/RestClient.js +9 -7
- package/lib/common/external/communication/RestClient.js.map +1 -1
- package/lib/common/utils/Utils.d.ts +8 -1
- package/lib/common/utils/Utils.js +133 -31
- package/lib/common/utils/Utils.js.map +1 -1
- package/lib/index.d.ts +45 -17
- package/lib/index.js +74 -20
- package/lib/index.js.map +1 -1
- package/lib/translation/common/LanguageWeaverClient.d.ts +10 -2
- package/lib/translation/common/cloud/CloudLanguageWeaverClient.d.ts +28 -4
- package/lib/translation/common/cloud/CloudLanguageWeaverClient.js +209 -112
- package/lib/translation/common/cloud/CloudLanguageWeaverClient.js.map +1 -1
- package/lib/translation/common/edge/EdgeLanguageWeaverClient.d.ts +26 -6
- package/lib/translation/common/edge/EdgeLanguageWeaverClient.js +204 -132
- package/lib/translation/common/edge/EdgeLanguageWeaverClient.js.map +1 -1
- package/lib/translation/common/edge/utils/EdgeLanguagePairUtil.d.ts +1 -1
- package/lib/translation/common/edge/utils/EdgeLanguagePairUtil.js +1 -1
- package/lib/translation/common/edge/utils/EdgeLanguagePairUtil.js.map +1 -1
- package/lib/translation/content-insights/cloud/api/CloudContentInsightsResponse.d.ts +23 -0
- package/lib/translation/content-insights/cloud/api/CloudContentInsightsResponse.js +69 -0
- package/lib/translation/content-insights/cloud/api/CloudContentInsightsResponse.js.map +1 -0
- package/lib/translation/content-insights/cloud/api/CloudContentInsightsStatisticsApiModel.d.ts +10 -0
- package/lib/translation/content-insights/cloud/api/CloudContentInsightsStatisticsApiModel.js +39 -0
- package/lib/translation/content-insights/cloud/api/CloudContentInsightsStatisticsApiModel.js.map +1 -0
- package/lib/translation/content-insights/cloud/api/CloudCreateContentInsightsResponse.d.ts +12 -0
- package/lib/translation/content-insights/cloud/api/CloudCreateContentInsightsResponse.js +32 -0
- package/lib/translation/content-insights/cloud/api/CloudCreateContentInsightsResponse.js.map +1 -0
- package/lib/translation/content-insights/cloud/api/CloudCreateContentInsightsStatusResponse.d.ts +16 -0
- package/lib/translation/content-insights/cloud/api/CloudCreateContentInsightsStatusResponse.js +42 -0
- package/lib/translation/content-insights/cloud/api/CloudCreateContentInsightsStatusResponse.js.map +1 -0
- package/lib/translation/content-insights/cloud/api/CloudDocumentApiModel.d.ts +12 -0
- package/lib/translation/content-insights/cloud/api/CloudDocumentApiModel.js +39 -0
- package/lib/translation/content-insights/cloud/api/CloudDocumentApiModel.js.map +1 -0
- package/lib/translation/content-insights/cloud/api/CloudSegmentApiModel.d.ts +15 -0
- package/lib/translation/content-insights/cloud/api/CloudSegmentApiModel.js +57 -0
- package/lib/translation/content-insights/cloud/api/CloudSegmentApiModel.js.map +1 -0
- package/lib/translation/content-insights/cloud/api/CloudSummarizationApiModel.d.ts +13 -0
- package/lib/translation/content-insights/cloud/api/CloudSummarizationApiModel.js +46 -0
- package/lib/translation/content-insights/cloud/api/CloudSummarizationApiModel.js.map +1 -0
- package/lib/translation/content-insights/cloud/request/CloudContentInsightsRequest.d.ts +3 -0
- package/lib/translation/content-insights/cloud/request/CloudContentInsightsRequest.js +30 -0
- package/lib/translation/content-insights/cloud/request/CloudContentInsightsRequest.js.map +1 -0
- package/lib/translation/content-insights/cloud/request/CloudFileContentInsightsRequest.d.ts +8 -0
- package/lib/translation/content-insights/cloud/request/CloudFileContentInsightsRequest.js +29 -0
- package/lib/translation/content-insights/cloud/request/CloudFileContentInsightsRequest.js.map +1 -0
- package/lib/translation/content-insights/cloud/result/CloudContentInsightsResult.d.ts +16 -0
- package/lib/translation/content-insights/cloud/result/CloudContentInsightsResult.js +49 -0
- package/lib/translation/content-insights/cloud/result/CloudContentInsightsResult.js.map +1 -0
- package/lib/translation/content-insights/cloud/result/CloudContentInsightsStatistics.d.ts +8 -0
- package/lib/translation/content-insights/cloud/result/CloudContentInsightsStatistics.js +29 -0
- package/lib/translation/content-insights/cloud/result/CloudContentInsightsStatistics.js.map +1 -0
- package/lib/translation/content-insights/cloud/result/CloudSegment.d.ts +6 -0
- package/lib/translation/content-insights/cloud/result/CloudSegment.js +40 -0
- package/lib/translation/content-insights/cloud/result/CloudSegment.js.map +1 -0
- package/lib/translation/content-insights/cloud/result/CloudSummarization.d.ts +6 -0
- package/lib/translation/content-insights/cloud/result/CloudSummarization.js +19 -0
- package/lib/translation/content-insights/cloud/result/CloudSummarization.js.map +1 -0
- package/lib/translation/content-insights/cloud/service/CloudContentInsightsService.d.ts +20 -0
- package/lib/translation/content-insights/cloud/service/CloudContentInsightsService.js +248 -0
- package/lib/translation/content-insights/cloud/service/CloudContentInsightsService.js.map +1 -0
- package/lib/translation/content-insights/common/request/ContentInsightsRequest.d.ts +7 -0
- package/lib/translation/content-insights/common/request/ContentInsightsRequest.js +23 -0
- package/lib/translation/content-insights/common/request/ContentInsightsRequest.js.map +1 -0
- package/lib/translation/content-insights/common/result/ContentInsightsResult.d.ts +6 -0
- package/lib/translation/content-insights/common/result/ContentInsightsResult.js +19 -0
- package/lib/translation/content-insights/common/result/ContentInsightsResult.js.map +1 -0
- package/lib/translation/content-insights/common/result/Segment.d.ts +8 -0
- package/lib/translation/content-insights/common/result/Segment.js +29 -0
- package/lib/translation/content-insights/common/result/Segment.js.map +1 -0
- package/lib/translation/content-insights/common/result/Summarization.d.ts +8 -0
- package/lib/translation/content-insights/common/result/Summarization.js +25 -0
- package/lib/translation/content-insights/common/result/Summarization.js.map +1 -0
- package/lib/translation/content-insights/common/utils/ContentInsightsUtils.d.ts +4 -0
- package/lib/translation/content-insights/common/utils/ContentInsightsUtils.js +145 -0
- package/lib/translation/content-insights/common/utils/ContentInsightsUtils.js.map +1 -0
- package/lib/translation/content-insights/edge/api/EdgeContentInsightsResponse.d.ts +13 -0
- package/lib/translation/content-insights/edge/api/EdgeContentInsightsResponse.js +53 -0
- package/lib/translation/content-insights/edge/api/EdgeContentInsightsResponse.js.map +1 -0
- package/lib/translation/content-insights/edge/api/EdgeSegmentApiModel.d.ts +12 -0
- package/lib/translation/content-insights/edge/api/EdgeSegmentApiModel.js +46 -0
- package/lib/translation/content-insights/edge/api/EdgeSegmentApiModel.js.map +1 -0
- package/lib/translation/content-insights/edge/request/EdgeContentInsightsRequest.d.ts +5 -0
- package/lib/translation/content-insights/edge/request/EdgeContentInsightsRequest.js +19 -0
- package/lib/translation/content-insights/edge/request/EdgeContentInsightsRequest.js.map +1 -0
- package/lib/translation/content-insights/edge/result/EdgeContentInsightsResult.d.ts +9 -0
- package/lib/translation/content-insights/edge/result/EdgeContentInsightsResult.js +29 -0
- package/lib/translation/content-insights/edge/result/EdgeContentInsightsResult.js.map +1 -0
- package/lib/translation/content-insights/edge/result/EdgeSegment.d.ts +3 -0
- package/lib/translation/content-insights/edge/result/EdgeSegment.js +30 -0
- package/lib/translation/content-insights/edge/result/EdgeSegment.js.map +1 -0
- package/lib/translation/content-insights/edge/result/EdgeSummarization.d.ts +6 -0
- package/lib/translation/content-insights/edge/result/EdgeSummarization.js +19 -0
- package/lib/translation/content-insights/edge/result/EdgeSummarization.js.map +1 -0
- package/lib/translation/content-insights/edge/service/EdgeContentInsightsService.d.ts +14 -0
- package/lib/translation/content-insights/edge/service/EdgeContentInsightsService.js +96 -0
- package/lib/translation/content-insights/edge/service/EdgeContentInsightsService.js.map +1 -0
- package/lib/translation/dictionaries/cloud/api/CloudDictionariesResponse.d.ts +14 -0
- package/lib/translation/dictionaries/cloud/api/CloudDictionariesResponse.js +72 -0
- package/lib/translation/dictionaries/cloud/api/CloudDictionariesResponse.js.map +1 -0
- package/lib/translation/dictionaries/cloud/api/CloudDictionaryApiModel.d.ts +36 -0
- package/lib/translation/dictionaries/cloud/api/CloudDictionaryApiModel.js +136 -0
- package/lib/translation/dictionaries/cloud/api/CloudDictionaryApiModel.js.map +1 -0
- package/lib/translation/{translate → dictionaries}/cloud/result/CloudDictionariesResult.d.ts +3 -3
- package/lib/translation/{translate → dictionaries}/cloud/result/CloudDictionariesResult.js +0 -0
- package/lib/translation/dictionaries/cloud/result/CloudDictionariesResult.js.map +1 -0
- package/lib/translation/{translate/cloud/api/CloudDictionaryResponse.d.ts → dictionaries/cloud/result/CloudDictionary.d.ts} +1 -1
- package/lib/translation/{translate/cloud/api/CloudDictionaryResponse.js → dictionaries/cloud/result/CloudDictionary.js} +15 -15
- package/lib/translation/dictionaries/cloud/result/CloudDictionary.js.map +1 -0
- package/lib/translation/dictionaries/cloud/service/CloudDictionariesService.d.ts +15 -0
- package/lib/translation/dictionaries/cloud/service/CloudDictionariesService.js +51 -0
- package/lib/translation/dictionaries/cloud/service/CloudDictionariesService.js.map +1 -0
- package/lib/translation/dictionaries/common/result/DictionariesResult.d.ts +7 -0
- package/lib/translation/{translate → dictionaries}/common/result/DictionariesResult.js +0 -0
- package/lib/translation/dictionaries/common/result/DictionariesResult.js.map +1 -0
- package/lib/translation/{translate/common/api/DictionaryResponse.d.ts → dictionaries/common/result/Dictionary.d.ts} +1 -1
- package/lib/translation/{translate/common/api/DictionaryResponse.js → dictionaries/common/result/Dictionary.js} +8 -8
- package/lib/translation/dictionaries/common/result/Dictionary.js.map +1 -0
- package/lib/translation/dictionaries/edge/api/EdgeDictionariesResponse.d.ts +22 -0
- package/lib/translation/dictionaries/edge/api/EdgeDictionariesResponse.js +84 -0
- package/lib/translation/dictionaries/edge/api/EdgeDictionariesResponse.js.map +1 -0
- package/lib/translation/dictionaries/edge/api/EdgeDictionaryApiModel.d.ts +15 -0
- package/lib/translation/dictionaries/edge/api/EdgeDictionaryApiModel.js +58 -0
- package/lib/translation/dictionaries/edge/api/EdgeDictionaryApiModel.js.map +1 -0
- package/lib/translation/{translate → dictionaries}/edge/result/EdgeDictionariesResult.d.ts +3 -3
- package/lib/translation/{translate → dictionaries}/edge/result/EdgeDictionariesResult.js +0 -0
- package/lib/translation/dictionaries/edge/result/EdgeDictionariesResult.js.map +1 -0
- package/lib/translation/{translate/edge/api/EdgeDictionaryResponse.d.ts → dictionaries/edge/result/EdgeDictionary.d.ts} +1 -1
- package/lib/translation/{translate/edge/api/EdgeDictionaryResponse.js → dictionaries/edge/result/EdgeDictionary.js} +8 -8
- package/lib/translation/dictionaries/edge/result/EdgeDictionary.js.map +1 -0
- package/lib/translation/dictionaries/edge/service/EdgeDictionariesService.d.ts +12 -0
- package/lib/translation/dictionaries/edge/service/EdgeDictionariesService.js +51 -0
- package/lib/translation/dictionaries/edge/service/EdgeDictionariesService.js.map +1 -0
- package/lib/translation/feedback/cloud/api/CloudFeedbackApiModel.js +2 -2
- package/lib/translation/feedback/cloud/api/CloudFeedbackApiModel.js.map +1 -1
- package/lib/translation/feedback/cloud/request/CloudFeedbackSortRequest.d.ts +1 -1
- package/lib/translation/feedback/cloud/{model → result}/CloudAuditData.d.ts +1 -1
- package/lib/translation/feedback/cloud/{model → result}/CloudAuditData.js +1 -1
- package/lib/translation/feedback/cloud/result/CloudAuditData.js.map +1 -0
- package/lib/translation/feedback/cloud/result/CloudFeedbackResult.d.ts +1 -1
- package/lib/translation/feedback/cloud/service/CloudFeedbackService.js +1 -1
- package/lib/translation/feedback/cloud/service/CloudFeedbackService.js.map +1 -1
- package/lib/translation/feedback/cloud/{validators → validator}/CloudFeedbackValidator.d.ts +1 -1
- package/lib/translation/feedback/cloud/{validators → validator}/CloudFeedbackValidator.js +1 -1
- package/lib/translation/feedback/cloud/validator/CloudFeedbackValidator.js.map +1 -0
- package/lib/translation/feedback/common/{model → result}/AuditData.d.ts +0 -0
- package/lib/translation/feedback/common/{model → result}/AuditData.js +0 -0
- package/lib/translation/feedback/common/result/AuditData.js.map +1 -0
- package/lib/translation/feedback/common/result/FeedbackResult.d.ts +1 -1
- package/lib/translation/feedback/common/{validators → validator}/FeedbackValidator.d.ts +0 -0
- package/lib/translation/feedback/common/{validators → validator}/FeedbackValidator.js +0 -0
- package/lib/translation/feedback/common/validator/FeedbackValidator.js.map +1 -0
- package/lib/translation/feedback/edge/api/EdgeFeedbackApiModel.d.ts +1 -1
- package/lib/translation/feedback/edge/api/EdgeFeedbackApiModel.js +1 -1
- package/lib/translation/feedback/edge/api/EdgeFeedbackApiModel.js.map +1 -1
- package/lib/translation/feedback/edge/service/EdgeFeedbackService.d.ts +1 -1
- package/lib/translation/feedback/edge/service/EdgeFeedbackService.js +1 -1
- package/lib/translation/feedback/edge/service/EdgeFeedbackService.js.map +1 -1
- package/lib/translation/feedback/edge/validator/EdgeFeedbackValidator.d.ts +3 -0
- package/lib/translation/feedback/edge/{validators → validator}/EdgeFeedbackValidator.js +1 -1
- package/lib/translation/feedback/edge/validator/EdgeFeedbackValidator.js.map +1 -0
- package/lib/translation/language-pairs/cloud/api/CloudLanguagePairApiModel.d.ts +21 -0
- package/lib/translation/language-pairs/cloud/api/CloudLanguagePairApiModel.js +81 -0
- package/lib/translation/language-pairs/cloud/api/CloudLanguagePairApiModel.js.map +1 -0
- package/lib/translation/language-pairs/cloud/api/CloudLanguagePairsResponse.d.ts +13 -0
- package/lib/translation/language-pairs/cloud/api/CloudLanguagePairsResponse.js +47 -0
- package/lib/translation/language-pairs/cloud/api/CloudLanguagePairsResponse.js.map +1 -0
- package/lib/translation/{translate/cloud/api → language-pairs/cloud/result}/CloudLanguagePair.d.ts +2 -0
- package/lib/translation/{translate/cloud/api → language-pairs/cloud/result}/CloudLanguagePair.js +11 -0
- package/lib/translation/language-pairs/cloud/result/CloudLanguagePair.js.map +1 -0
- package/lib/translation/{translate → language-pairs}/cloud/result/CloudLanguagePairsResult.d.ts +1 -1
- package/lib/translation/{translate → language-pairs}/cloud/result/CloudLanguagePairsResult.js +0 -0
- package/lib/translation/language-pairs/cloud/result/CloudLanguagePairsResult.js.map +1 -0
- package/lib/translation/language-pairs/cloud/service/CloudLanguagePairsService.d.ts +15 -0
- package/lib/translation/language-pairs/cloud/service/CloudLanguagePairsService.js +45 -0
- package/lib/translation/language-pairs/cloud/service/CloudLanguagePairsService.js.map +1 -0
- package/lib/translation/language-pairs/common/result/LanguagePair.d.ts +16 -0
- package/lib/translation/{translate/common/api → language-pairs/common/result}/LanguagePair.js +11 -0
- package/lib/translation/language-pairs/common/result/LanguagePair.js.map +1 -0
- package/lib/translation/{translate → language-pairs}/common/result/LanguagePairsResult.d.ts +1 -1
- package/lib/translation/{translate → language-pairs}/common/result/LanguagePairsResult.js +0 -0
- package/lib/translation/language-pairs/common/result/LanguagePairsResult.js.map +1 -0
- package/lib/translation/language-pairs/edge/api/EdgeLanguagePairApiModel.d.ts +17 -0
- package/lib/translation/language-pairs/edge/api/EdgeLanguagePairApiModel.js +89 -0
- package/lib/translation/language-pairs/edge/api/EdgeLanguagePairApiModel.js.map +1 -0
- package/lib/translation/language-pairs/edge/api/EdgeLanguagePairsApiModel.d.ts +10 -0
- package/lib/translation/language-pairs/edge/api/EdgeLanguagePairsApiModel.js +37 -0
- package/lib/translation/language-pairs/edge/api/EdgeLanguagePairsApiModel.js.map +1 -0
- package/lib/translation/language-pairs/edge/api/MemberPairApiModel.d.ts +31 -0
- package/lib/translation/language-pairs/edge/api/MemberPairApiModel.js +116 -0
- package/lib/translation/language-pairs/edge/api/MemberPairApiModel.js.map +1 -0
- package/lib/translation/language-pairs/edge/result/EdgeLanguagePair.d.ts +15 -0
- package/lib/translation/{translate/edge/api → language-pairs/edge/result}/EdgeLanguagePair.js +20 -0
- package/lib/translation/language-pairs/edge/result/EdgeLanguagePair.js.map +1 -0
- package/lib/translation/{translate → language-pairs}/edge/result/EdgeLanguagePairsResult.d.ts +1 -1
- package/lib/translation/{translate → language-pairs}/edge/result/EdgeLanguagePairsResult.js +0 -0
- package/lib/translation/language-pairs/edge/result/EdgeLanguagePairsResult.js.map +1 -0
- package/lib/translation/{translate/edge/api → language-pairs/edge/result}/MemberPair.d.ts +0 -0
- package/lib/translation/{translate/edge/api → language-pairs/edge/result}/MemberPair.js +0 -0
- package/lib/translation/language-pairs/edge/result/MemberPair.js.map +1 -0
- package/lib/translation/language-pairs/edge/service/EdgeLanguagePairsService.d.ts +14 -0
- package/lib/translation/language-pairs/edge/service/EdgeLanguagePairsService.js +80 -0
- package/lib/translation/language-pairs/edge/service/EdgeLanguagePairsService.js.map +1 -0
- package/lib/translation/linguistic-options/cloud/api/CloudLinguisticOptionApiModel.d.ts +13 -0
- package/lib/translation/linguistic-options/cloud/api/CloudLinguisticOptionApiModel.js +68 -0
- package/lib/translation/linguistic-options/cloud/api/CloudLinguisticOptionApiModel.js.map +1 -0
- package/lib/translation/linguistic-options/cloud/api/CloudLinguisticOptionsResponse.d.ts +6 -0
- package/lib/translation/linguistic-options/cloud/api/CloudLinguisticOptionsResponse.js +19 -0
- package/lib/translation/linguistic-options/cloud/api/CloudLinguisticOptionsResponse.js.map +1 -0
- package/lib/translation/linguistic-options/cloud/request/CloudGetLinguisticOptionsRequest.d.ts +3 -0
- package/lib/translation/linguistic-options/cloud/request/CloudGetLinguisticOptionsRequest.js +30 -0
- package/lib/translation/linguistic-options/cloud/request/CloudGetLinguisticOptionsRequest.js.map +1 -0
- package/lib/translation/linguistic-options/cloud/result/CloudLinguisticOption.d.ts +10 -0
- package/lib/translation/linguistic-options/cloud/result/CloudLinguisticOption.js +57 -0
- package/lib/translation/linguistic-options/cloud/result/CloudLinguisticOption.js.map +1 -0
- package/lib/translation/linguistic-options/cloud/result/CloudLinguisticOptionsResult.d.ts +6 -0
- package/lib/translation/linguistic-options/cloud/result/CloudLinguisticOptionsResult.js +19 -0
- package/lib/translation/linguistic-options/cloud/result/CloudLinguisticOptionsResult.js.map +1 -0
- package/lib/translation/linguistic-options/cloud/service/CloudLinguisticOptionsService.d.ts +19 -0
- package/lib/translation/linguistic-options/cloud/service/CloudLinguisticOptionsService.js +72 -0
- package/lib/translation/linguistic-options/cloud/service/CloudLinguisticOptionsService.js.map +1 -0
- package/lib/translation/linguistic-options/cloud/validator/CloudLinguisticOptionsValidator.d.ts +3 -0
- package/lib/translation/linguistic-options/cloud/validator/CloudLinguisticOptionsValidator.js +30 -0
- package/lib/translation/linguistic-options/cloud/validator/CloudLinguisticOptionsValidator.js.map +1 -0
- package/lib/translation/linguistic-options/common/api/LinguisticOptionApiModel.d.ts +11 -0
- package/lib/translation/linguistic-options/common/api/LinguisticOptionApiModel.js +39 -0
- package/lib/translation/linguistic-options/common/api/LinguisticOptionApiModel.js.map +1 -0
- package/lib/translation/{translate/common/api/LanguagePair.d.ts → linguistic-options/common/request/GetLinguisticOptionsRequest.d.ts} +1 -4
- package/lib/translation/linguistic-options/common/request/GetLinguisticOptionsRequest.js +39 -0
- package/lib/translation/linguistic-options/common/request/GetLinguisticOptionsRequest.js.map +1 -0
- package/lib/translation/linguistic-options/common/result/LinguisticOption.d.ts +11 -0
- package/lib/translation/linguistic-options/common/result/LinguisticOption.js +39 -0
- package/lib/translation/linguistic-options/common/result/LinguisticOption.js.map +1 -0
- package/lib/translation/linguistic-options/common/result/LinguisticOptionsResult.d.ts +6 -0
- package/lib/translation/linguistic-options/common/result/LinguisticOptionsResult.js +19 -0
- package/lib/translation/linguistic-options/common/result/LinguisticOptionsResult.js.map +1 -0
- package/lib/translation/linguistic-options/common/validator/LinguisticOptionsValidator.d.ts +4 -0
- package/lib/translation/linguistic-options/common/validator/LinguisticOptionsValidator.js +25 -0
- package/lib/translation/linguistic-options/common/validator/LinguisticOptionsValidator.js.map +1 -0
- package/lib/translation/linguistic-options/edge/api/EdgeLinguisticOptionApiModel.d.ts +7 -0
- package/lib/translation/linguistic-options/edge/api/EdgeLinguisticOptionApiModel.js +46 -0
- package/lib/translation/linguistic-options/edge/api/EdgeLinguisticOptionApiModel.js.map +1 -0
- package/lib/translation/linguistic-options/edge/api/EdgeLinguisticOptionsResponse.d.ts +6 -0
- package/lib/translation/linguistic-options/edge/api/EdgeLinguisticOptionsResponse.js +19 -0
- package/lib/translation/linguistic-options/edge/api/EdgeLinguisticOptionsResponse.js.map +1 -0
- package/lib/translation/linguistic-options/edge/request/EdgeGetLinguisticOptionsRequest.d.ts +9 -0
- package/lib/translation/linguistic-options/edge/request/EdgeGetLinguisticOptionsRequest.js +50 -0
- package/lib/translation/linguistic-options/edge/request/EdgeGetLinguisticOptionsRequest.js.map +1 -0
- package/lib/translation/linguistic-options/edge/result/EdgeLinguisticOption.d.ts +4 -0
- package/lib/translation/linguistic-options/edge/result/EdgeLinguisticOption.js +37 -0
- package/lib/translation/linguistic-options/edge/result/EdgeLinguisticOption.js.map +1 -0
- package/lib/translation/linguistic-options/edge/result/EdgeLinguisticOptionsResult.d.ts +6 -0
- package/lib/translation/linguistic-options/edge/result/EdgeLinguisticOptionsResult.js +19 -0
- package/lib/translation/linguistic-options/edge/result/EdgeLinguisticOptionsResult.js.map +1 -0
- package/lib/translation/linguistic-options/edge/service/EdgeLinguisticOptionsService.d.ts +18 -0
- package/lib/translation/linguistic-options/edge/service/EdgeLinguisticOptionsService.js +101 -0
- package/lib/translation/linguistic-options/edge/service/EdgeLinguisticOptionsService.js.map +1 -0
- package/lib/translation/linguistic-options/edge/validator/EdgeLinguisticOptionsValidator.d.ts +3 -0
- package/lib/translation/linguistic-options/edge/validator/EdgeLinguisticOptionsValidator.js +30 -0
- package/lib/translation/linguistic-options/edge/validator/EdgeLinguisticOptionsValidator.js.map +1 -0
- package/lib/translation/translate/cloud/request/CloudRetrieveFileRequest.d.ts +3 -0
- package/lib/translation/translate/cloud/request/CloudRetrieveFileRequest.js +30 -0
- package/lib/translation/translate/cloud/request/CloudRetrieveFileRequest.js.map +1 -0
- package/lib/translation/translate/cloud/request/CloudTranslateTextRequest.d.ts +3 -0
- package/lib/translation/translate/cloud/request/CloudTranslateTextRequest.js +21 -0
- package/lib/translation/translate/cloud/request/CloudTranslateTextRequest.js.map +1 -1
- package/lib/translation/translate/cloud/request/CloudTranslateTextRequestApiModel.d.ts +26 -0
- package/lib/translation/translate/cloud/request/CloudTranslateTextRequestApiModel.js +80 -0
- package/lib/translation/translate/cloud/request/CloudTranslateTextRequestApiModel.js.map +1 -0
- package/lib/translation/translate/cloud/result/CloudTranslationFileResult.d.ts +0 -3
- package/lib/translation/translate/cloud/result/CloudTranslationFileResult.js +0 -10
- package/lib/translation/translate/cloud/result/CloudTranslationFileResult.js.map +1 -1
- package/lib/translation/translate/cloud/result/CloudTranslationTextResult.d.ts +3 -3
- package/lib/translation/translate/cloud/result/CloudTranslationTextResult.js +3 -3
- package/lib/translation/translate/cloud/result/CloudTranslationTextResult.js.map +1 -1
- package/lib/translation/translate/common/request/RetrieveFileRequest.d.ts +11 -0
- package/lib/translation/translate/common/request/RetrieveFileRequest.js +39 -0
- package/lib/translation/translate/common/request/RetrieveFileRequest.js.map +1 -0
- package/lib/translation/translate/common/request/TranslateBatchFileRequest.d.ts +3 -0
- package/lib/translation/translate/common/request/TranslateBatchFileRequest.js +10 -0
- package/lib/translation/translate/common/request/TranslateBatchFileRequest.js.map +1 -1
- package/lib/translation/translate/common/request/TranslateRequest.d.ts +3 -0
- package/lib/translation/translate/common/request/TranslateRequest.js +10 -0
- package/lib/translation/translate/common/request/TranslateRequest.js.map +1 -1
- package/lib/translation/translate/common/result/TranslationFileResult.d.ts +6 -0
- package/lib/translation/translate/common/result/TranslationFileResult.js +20 -0
- package/lib/translation/translate/common/result/TranslationFileResult.js.map +1 -1
- package/lib/translation/translate/common/utils/TranslateFileUtil.d.ts +3 -1
- package/lib/translation/translate/common/utils/TranslateFileUtil.js +26 -53
- package/lib/translation/translate/common/utils/TranslateFileUtil.js.map +1 -1
- package/lib/translation/translate/edge/request/EdgeRetrieveFileRequest.d.ts +7 -0
- package/lib/translation/translate/edge/request/EdgeRetrieveFileRequest.js +40 -0
- package/lib/translation/translate/edge/request/EdgeRetrieveFileRequest.js.map +1 -0
- package/lib/translation/translate/edge/request/EdgeTranslateFileRequest.d.ts +2 -2
- package/lib/translation/translate/edge/request/EdgeTranslateFileRequest.js +15 -14
- package/lib/translation/translate/edge/request/EdgeTranslateFileRequest.js.map +1 -1
- package/lib/translation/translate/edge/request/{EdgeTranslateApiModel.d.ts → EdgeTranslateRequest.d.ts} +1 -1
- package/lib/translation/translate/edge/request/{EdgeTranslateApiModel.js → EdgeTranslateRequest.js} +14 -14
- package/lib/translation/translate/edge/request/EdgeTranslateRequest.js.map +1 -0
- package/lib/translation/translate/edge/request/EdgeTranslateTextRequest.d.ts +2 -2
- package/lib/translation/translate/edge/request/EdgeTranslateTextRequest.js +15 -14
- package/lib/translation/translate/edge/request/EdgeTranslateTextRequest.js.map +1 -1
- package/lib/translation/translate/edge/result/EdgeTranslationFileResult.d.ts +0 -3
- package/lib/translation/translate/edge/result/EdgeTranslationFileResult.js +0 -10
- package/lib/translation/translate/edge/result/EdgeTranslationFileResult.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/lib/translation/feedback/cloud/model/CloudAuditData.js.map +0 -1
- package/lib/translation/feedback/cloud/model/CloudFeedbackSortCriteria.js.map +0 -1
- package/lib/translation/feedback/cloud/validators/CloudFeedbackValidator.js.map +0 -1
- package/lib/translation/feedback/common/model/AuditData.js.map +0 -1
- package/lib/translation/feedback/common/validators/FeedbackValidator.js.map +0 -1
- package/lib/translation/feedback/edge/validators/EdgeFeedbackValidator.d.ts +0 -3
- package/lib/translation/feedback/edge/validators/EdgeFeedbackValidator.js.map +0 -1
- package/lib/translation/translate/cloud/api/CloudDictionaryResponse.js.map +0 -1
- package/lib/translation/translate/cloud/api/CloudLanguagePair.js.map +0 -1
- package/lib/translation/translate/cloud/result/CloudDictionariesResult.js.map +0 -1
- package/lib/translation/translate/cloud/result/CloudLanguagePairsResult.js.map +0 -1
- package/lib/translation/translate/common/api/DictionaryResponse.js.map +0 -1
- package/lib/translation/translate/common/api/LanguagePair.js.map +0 -1
- package/lib/translation/translate/common/result/DictionariesResult.d.ts +0 -7
- package/lib/translation/translate/common/result/DictionariesResult.js.map +0 -1
- package/lib/translation/translate/common/result/LanguagePairsResult.js.map +0 -1
- package/lib/translation/translate/edge/api/EdgeDictionaryResponse.js.map +0 -1
- package/lib/translation/translate/edge/api/EdgeLanguagePair.d.ts +0 -9
- package/lib/translation/translate/edge/api/EdgeLanguagePair.js.map +0 -1
- package/lib/translation/translate/edge/api/MemberPair.js.map +0 -1
- package/lib/translation/translate/edge/request/EdgeTranslateApiModel.js.map +0 -1
- package/lib/translation/translate/edge/result/EdgeDictionariesResult.js.map +0 -1
- package/lib/translation/translate/edge/result/EdgeLanguagePairsResult.js.map +0 -1
|
@@ -10,14 +10,14 @@ import TranslateFileRequest from '../../translate/common/request/TranslateFileRe
|
|
|
10
10
|
import TranslationFileResult from '../../translate/common/result/TranslationFileResult';
|
|
11
11
|
import CloudTranslateFileRequest from '../../translate/cloud/request/CloudTranslateFileRequest';
|
|
12
12
|
import CloudTranslationFileResult from '../../translate/cloud/result/CloudTranslationFileResult';
|
|
13
|
-
import LanguagePairsResult from '../../
|
|
14
|
-
import CloudLanguagePairsResult from '../../
|
|
13
|
+
import LanguagePairsResult from '../../language-pairs/common/result/LanguagePairsResult';
|
|
14
|
+
import CloudLanguagePairsResult from '../../language-pairs/cloud/result/CloudLanguagePairsResult';
|
|
15
15
|
import TranslationBatchFileResult from '../../translate/common/result/TranslationBatchFileResult';
|
|
16
16
|
import TranslateBatchFileRequest from '../../translate/common/request/TranslateBatchFileRequest';
|
|
17
17
|
import CloudTranslateBatchFileRequest from '../../translate/cloud/request/CloudTranslateBatchFileRequest';
|
|
18
18
|
import CloudTranslationBatchFileResult from '../../translate/cloud/result/CloudTranslationBatchFileResult';
|
|
19
|
-
import DictionariesResult from '../../
|
|
20
|
-
import CloudDictionariesResult from '../../
|
|
19
|
+
import DictionariesResult from '../../dictionaries/common/result/DictionariesResult';
|
|
20
|
+
import CloudDictionariesResult from '../../dictionaries/cloud/result/CloudDictionariesResult';
|
|
21
21
|
import FilterFeedbackRequest from '../../feedback/common/request/FilterFeedbackRequest';
|
|
22
22
|
import FeedbackListResult from '../../feedback/common/result/FeedbackListResult';
|
|
23
23
|
import CloudFeedbackListResult from '../../feedback/cloud/result/CloudFeedbackListResult';
|
|
@@ -32,6 +32,17 @@ import UpdateFeedbackApprovalRequest from '../../feedback/common/request/UpdateF
|
|
|
32
32
|
import CloudUpdateFeedbackApprovalRequest from '../../feedback/cloud/request/CloudUpdateFeedbackApprovalRequest';
|
|
33
33
|
import DeleteFeedbackRequest from '../../feedback/common/request/DeleteFeedbackRequest';
|
|
34
34
|
import CloudDeleteFeedbackRequest from '../../feedback/cloud/request/CloudDeleteFeedbackRequest';
|
|
35
|
+
import RetrieveFileRequest from '../../translate/common/request/RetrieveFileRequest';
|
|
36
|
+
import CloudRetrieveFileRequest from '../../translate/cloud/request/CloudRetrieveFileRequest';
|
|
37
|
+
import GetLinguisticOptionsRequest from '../../linguistic-options/common/request/GetLinguisticOptionsRequest';
|
|
38
|
+
import LinguisticOptionsResult from '../../linguistic-options/common/result/LinguisticOptionsResult';
|
|
39
|
+
import CloudContentInsightsResult from '../../content-insights/cloud/result/CloudContentInsightsResult';
|
|
40
|
+
import CloudGetLinguisticOptionsRequest from '../../linguistic-options/cloud/request/CloudGetLinguisticOptionsRequest';
|
|
41
|
+
import CloudLinguisticOptionsResult from '../../linguistic-options/cloud/result/CloudLinguisticOptionsResult';
|
|
42
|
+
import ContentInsightsResult from '../../content-insights/common/result/ContentInsightsResult';
|
|
43
|
+
import CloudFileContentInsightsRequest from '../../content-insights/cloud/request/CloudFileContentInsightsRequest';
|
|
44
|
+
import ContentInsightsRequest from '../../content-insights/common/request/ContentInsightsRequest';
|
|
45
|
+
import CloudContentInsightsRequest from '../../content-insights/cloud/request/CloudContentInsightsRequest';
|
|
35
46
|
export default class CloudLanguageWeaverClient implements LanguageWeaverClient {
|
|
36
47
|
private _clientConfiguration;
|
|
37
48
|
private _region;
|
|
@@ -42,6 +53,10 @@ export default class CloudLanguageWeaverClient implements LanguageWeaverClient {
|
|
|
42
53
|
private _languageWeaverAuthentication;
|
|
43
54
|
private _client;
|
|
44
55
|
private _feedbackService;
|
|
56
|
+
private _linguisticOptionsService;
|
|
57
|
+
private _contentInsightsService;
|
|
58
|
+
private _languagePairsService;
|
|
59
|
+
private _dictionariesService;
|
|
45
60
|
constructor();
|
|
46
61
|
withConfigurations(clientConfiguration: ClientConfiguration): CloudLanguageWeaverClient;
|
|
47
62
|
withTokenConfigurations(tokenConfiguration: TokenConfiguration): CloudLanguageWeaverClient;
|
|
@@ -54,8 +69,12 @@ export default class CloudLanguageWeaverClient implements LanguageWeaverClient {
|
|
|
54
69
|
translateText(translateTextRequest: TranslateTextRequest): Promise<TranslateTextResult>;
|
|
55
70
|
translateFile(translateFileRequest: TranslateFileRequest): Promise<TranslationFileResult>;
|
|
56
71
|
translateBatchFile(translateBatchFileRequest: TranslateBatchFileRequest): Promise<TranslationBatchFileResult>;
|
|
72
|
+
retrieveFileTranslation(retrieveFileRequest: RetrieveFileRequest): Promise<TranslationFileResult>;
|
|
73
|
+
retrieveCloudFileTranslation(retrieveFileRequest: CloudRetrieveFileRequest): Promise<CloudTranslationFileResult>;
|
|
57
74
|
getLanguagePairs(): Promise<LanguagePairsResult>;
|
|
58
75
|
getCloudLanguagePairs(): Promise<CloudLanguagePairsResult>;
|
|
76
|
+
getLinguisticOptions(getLinguisticOptionsRequest: GetLinguisticOptionsRequest): Promise<LinguisticOptionsResult>;
|
|
77
|
+
getCloudLinguisticOptions(getLinguisticOptionsRequest: CloudGetLinguisticOptionsRequest): Promise<CloudLinguisticOptionsResult>;
|
|
59
78
|
getDictionaries(pageNumber: number, pageSize?: number): Promise<DictionariesResult>;
|
|
60
79
|
getCloudDictionaries(pageNumber: number, pageSize?: number): Promise<CloudDictionariesResult>;
|
|
61
80
|
getFeedback(pageNumber: number, pageSize?: number, filterRequest?: FilterFeedbackRequest): Promise<FeedbackListResult>;
|
|
@@ -68,12 +87,16 @@ export default class CloudLanguageWeaverClient implements LanguageWeaverClient {
|
|
|
68
87
|
updateCloudFeedbackApproval(updateCloudFeedbackApprovalRequest: CloudUpdateFeedbackApprovalRequest): Promise<CloudFeedbackResult>;
|
|
69
88
|
deleteFeedback(deleteFeedbackRequest: DeleteFeedbackRequest): Promise<null>;
|
|
70
89
|
deleteCloudFeedback(deleteCloudFeedbackRequest: CloudDeleteFeedbackRequest): Promise<null>;
|
|
90
|
+
getCloudContentInsights(cloudContentInsightsRequest: CloudFileContentInsightsRequest): Promise<CloudContentInsightsResult>;
|
|
91
|
+
getContentInsightsForTranslations(contentInsightsRequest: ContentInsightsRequest): Promise<ContentInsightsResult>;
|
|
92
|
+
getCloudContentInsightsForTranslations(cloudContentInsightsRequest: CloudContentInsightsRequest): Promise<CloudContentInsightsResult>;
|
|
71
93
|
private getSelfInfo;
|
|
72
94
|
private requestTranslateText;
|
|
73
95
|
private translateSyncText;
|
|
74
96
|
private translateAsyncText;
|
|
75
97
|
private getTranslationResponse;
|
|
76
98
|
private getTranslationFileResponse;
|
|
99
|
+
private retrieveFileTranslationResponse;
|
|
77
100
|
private requestTranslateBatchFile;
|
|
78
101
|
private translateFileFromBatch;
|
|
79
102
|
private requestTranslateFile;
|
|
@@ -82,5 +105,6 @@ export default class CloudLanguageWeaverClient implements LanguageWeaverClient {
|
|
|
82
105
|
private obtainFinalStatus;
|
|
83
106
|
private hasToken;
|
|
84
107
|
private hasCredentialsConfiguration;
|
|
108
|
+
private handleCredentialsConfiguration;
|
|
85
109
|
private setRegion;
|
|
86
110
|
}
|
|
@@ -52,15 +52,12 @@ var TranslationException_1 = __importDefault(require("../../../common/exceptions
|
|
|
52
52
|
var ErrorResponse_1 = __importDefault(require("../../../common/api/ErrorResponse"));
|
|
53
53
|
var Product_1 = require("../../../common/constants/Product");
|
|
54
54
|
var Regions_1 = require("../../../common/constants/Regions");
|
|
55
|
+
var TranslationFileResult_1 = __importDefault(require("../../translate/common/result/TranslationFileResult"));
|
|
55
56
|
var CloudTranslateFileRequest_1 = __importDefault(require("../../translate/cloud/request/CloudTranslateFileRequest"));
|
|
56
57
|
var CloudTranslationFileResult_1 = __importDefault(require("../../translate/cloud/result/CloudTranslationFileResult"));
|
|
57
58
|
var TranslateFileUtil_1 = require("../../translate/common/utils/TranslateFileUtil");
|
|
58
|
-
var LanguagePairsResult_1 = __importDefault(require("../../translate/common/result/LanguagePairsResult"));
|
|
59
|
-
var LanguagePair_1 = __importDefault(require("../../translate/common/api/LanguagePair"));
|
|
60
59
|
var CloudTranslateBatchFileRequest_1 = __importDefault(require("../../translate/cloud/request/CloudTranslateBatchFileRequest"));
|
|
61
60
|
var CloudTranslationBatchFileResult_1 = __importDefault(require("../../translate/cloud/result/CloudTranslationBatchFileResult"));
|
|
62
|
-
var DictionariesResult_1 = __importDefault(require("../../translate/common/result/DictionariesResult"));
|
|
63
|
-
var DictionaryResponse_1 = __importDefault(require("../../translate/common/api/DictionaryResponse"));
|
|
64
61
|
var CredentialsConfiguration_1 = __importDefault(require("../../../common/configurations/CredentialsConfiguration"));
|
|
65
62
|
var Format_1 = require("../../../common/constants/Format");
|
|
66
63
|
var FormatToMimeType_1 = require("../../../common/constants/FormatToMimeType");
|
|
@@ -68,6 +65,13 @@ var FilterFeedbackRequest_1 = __importDefault(require("../../feedback/common/req
|
|
|
68
65
|
var CloudFilterFeedbackRequest_1 = __importDefault(require("../../feedback/cloud/request/CloudFilterFeedbackRequest"));
|
|
69
66
|
var CloudFeedbackService_1 = __importDefault(require("../../feedback/cloud/service/CloudFeedbackService"));
|
|
70
67
|
var PdfConverter_1 = require("../../../common/constants/PdfConverter");
|
|
68
|
+
var RetrieveFileRequest_1 = __importDefault(require("../../translate/common/request/RetrieveFileRequest"));
|
|
69
|
+
var GetLinguisticOptionsRequest_1 = __importDefault(require("../../linguistic-options/common/request/GetLinguisticOptionsRequest"));
|
|
70
|
+
var CloudLinguisticOptionsService_1 = __importDefault(require("../../linguistic-options/cloud/service/CloudLinguisticOptionsService"));
|
|
71
|
+
var CloudContentInsightsService_1 = __importDefault(require("../../content-insights/cloud/service/CloudContentInsightsService"));
|
|
72
|
+
var CloudGetLinguisticOptionsRequest_1 = __importDefault(require("../../linguistic-options/cloud/request/CloudGetLinguisticOptionsRequest"));
|
|
73
|
+
var CloudLanguagePairsService_1 = __importDefault(require("../../language-pairs/cloud/service/CloudLanguagePairsService"));
|
|
74
|
+
var CloudDictionariesService_1 = __importDefault(require("../../dictionaries/cloud/service/CloudDictionariesService"));
|
|
71
75
|
var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
72
76
|
function CloudLanguageWeaverClient() {
|
|
73
77
|
this._clientConfiguration = new ClientConfiguration_1.default();
|
|
@@ -88,37 +92,46 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
88
92
|
return this;
|
|
89
93
|
};
|
|
90
94
|
CloudLanguageWeaverClient.prototype.build = function () {
|
|
91
|
-
var _a;
|
|
92
95
|
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
-
var
|
|
94
|
-
return __generator(this, function (
|
|
95
|
-
switch (
|
|
96
|
+
var _a, _b, e_1;
|
|
97
|
+
return __generator(this, function (_c) {
|
|
98
|
+
switch (_c.label) {
|
|
96
99
|
case 0:
|
|
97
100
|
this.setRegion();
|
|
98
101
|
this._languageWeaverAuthentication = new LanguageWeaverAuthentication_1.default(this._client);
|
|
99
|
-
|
|
100
|
-
_b = this;
|
|
101
|
-
return [4 /*yield*/, this._languageWeaverAuthentication.requestCredentialsToken(((_a = this._clientConfiguration) === null || _a === void 0 ? void 0 : _a.credentialsConfiguration) || new CredentialsConfiguration_1.default())];
|
|
102
|
+
_c.label = 1;
|
|
102
103
|
case 1:
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
_c.trys.push([1, 8, , 9]);
|
|
105
|
+
if (!!this.hasToken()) return [3 /*break*/, 3];
|
|
106
|
+
return [4 /*yield*/, this.handleCredentialsConfiguration(this._languageWeaverAuthentication)];
|
|
105
107
|
case 2:
|
|
106
|
-
|
|
107
|
-
_c =
|
|
108
|
-
return [4 /*yield*/, this._languageWeaverAuthentication.getSelfInformation(this._token)];
|
|
108
|
+
_c.sent();
|
|
109
|
+
_c.label = 3;
|
|
109
110
|
case 3:
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
if (!(this.hasToken() && Utils_1.default.isCloudCredentialsToken(this._token))) return [3 /*break*/, 5];
|
|
112
|
+
_a = this;
|
|
113
|
+
return [4 /*yield*/, this._languageWeaverAuthentication.getSelfInformation(this._token)];
|
|
112
114
|
case 4:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return [4 /*yield*/, this._languageWeaverAuthentication.getUserSelfInformation(this._token)];
|
|
115
|
+
_a._selfInformation = _c.sent();
|
|
116
|
+
return [3 /*break*/, 7];
|
|
116
117
|
case 5:
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
if (!this.hasToken()) return [3 /*break*/, 7];
|
|
119
|
+
_b = this;
|
|
120
|
+
return [4 /*yield*/, this._languageWeaverAuthentication.getUserSelfInformation(this._token)];
|
|
119
121
|
case 6:
|
|
122
|
+
_b._userSelfInformation = _c.sent();
|
|
123
|
+
_c.label = 7;
|
|
124
|
+
case 7:
|
|
120
125
|
this._feedbackService = new CloudFeedbackService_1.default(this._client, this._token, this.getSelfInfo());
|
|
126
|
+
this._linguisticOptionsService = new CloudLinguisticOptionsService_1.default(this._client, this._token, this.getSelfInfo());
|
|
127
|
+
this._contentInsightsService = new CloudContentInsightsService_1.default(this._client, this._token);
|
|
128
|
+
this._languagePairsService = new CloudLanguagePairsService_1.default(this._client, this._token, this.getSelfInfo());
|
|
129
|
+
this._dictionariesService = new CloudDictionariesService_1.default(this._client, this._token, this.getSelfInfo());
|
|
121
130
|
return [2 /*return*/, this];
|
|
131
|
+
case 8:
|
|
132
|
+
e_1 = _c.sent();
|
|
133
|
+
return [2 /*return*/, Promise.reject(e_1)];
|
|
134
|
+
case 9: return [2 /*return*/];
|
|
122
135
|
}
|
|
123
136
|
});
|
|
124
137
|
});
|
|
@@ -157,6 +170,7 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
157
170
|
request.model = translateTextRequest.model;
|
|
158
171
|
request.inputFormat = translateTextRequest.inputFormat;
|
|
159
172
|
request.dictionaries = translateTextRequest.dictionaries;
|
|
173
|
+
request.linguisticOptions = translateTextRequest.linguisticOptions;
|
|
160
174
|
return this.requestTranslateText(request)
|
|
161
175
|
.then(function (response) {
|
|
162
176
|
var _a;
|
|
@@ -177,6 +191,7 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
177
191
|
request.inputFormat = translateFileRequest.inputFormat;
|
|
178
192
|
request.dictionaries = translateFileRequest.dictionaries;
|
|
179
193
|
request.pdfConverter = translateFileRequest.pdfConverter;
|
|
194
|
+
request.linguisticOptions = translateFileRequest.linguisticOptions;
|
|
180
195
|
return this.requestTranslateFile(request);
|
|
181
196
|
};
|
|
182
197
|
CloudLanguageWeaverClient.prototype.translateBatchFile = function (translateBatchFileRequest) {
|
|
@@ -188,95 +203,107 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
188
203
|
request.outputDir = translateBatchFileRequest.outputDir;
|
|
189
204
|
request.dictionaries = translateBatchFileRequest.dictionaries;
|
|
190
205
|
request.pdfConverter = translateBatchFileRequest.pdfConverter;
|
|
206
|
+
request.linguisticOptions = translateBatchFileRequest.linguisticOptions;
|
|
191
207
|
return this.requestTranslateBatchFile(request);
|
|
192
208
|
};
|
|
193
|
-
CloudLanguageWeaverClient.prototype.
|
|
194
|
-
var _a;
|
|
209
|
+
CloudLanguageWeaverClient.prototype.retrieveFileTranslation = function (retrieveFileRequest) {
|
|
195
210
|
return __awaiter(this, void 0, void 0, function () {
|
|
196
|
-
var
|
|
197
|
-
return __generator(this, function (
|
|
198
|
-
switch (
|
|
211
|
+
var response, translationFileResult, e_2;
|
|
212
|
+
return __generator(this, function (_a) {
|
|
213
|
+
switch (_a.label) {
|
|
199
214
|
case 0:
|
|
200
|
-
|
|
201
|
-
return [4 /*yield*/, this.
|
|
215
|
+
_a.trys.push([0, 2, , 3]);
|
|
216
|
+
return [4 /*yield*/, this.retrieveCloudFileTranslation(retrieveFileRequest)];
|
|
202
217
|
case 1:
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
languagePair.model = lp.model;
|
|
210
|
-
languagePair.name = lp.name;
|
|
211
|
-
languagePairs_1.push(languagePair);
|
|
212
|
-
});
|
|
213
|
-
return [2 /*return*/, new Promise(function (resolve) {
|
|
214
|
-
var result = new LanguagePairsResult_1.default();
|
|
215
|
-
result.languagePairs = languagePairs_1;
|
|
216
|
-
resolve(result);
|
|
217
|
-
})];
|
|
218
|
+
response = _a.sent();
|
|
219
|
+
translationFileResult = new TranslationFileResult_1.default();
|
|
220
|
+
translationFileResult.fileContent = response.fileContent;
|
|
221
|
+
translationFileResult.filename = response.filename;
|
|
222
|
+
translationFileResult.mimeType = response.mimeType;
|
|
223
|
+
return [2 /*return*/, Promise.resolve(translationFileResult)];
|
|
218
224
|
case 2:
|
|
219
|
-
|
|
220
|
-
return [2 /*return*/, Promise.reject(
|
|
225
|
+
e_2 = _a.sent();
|
|
226
|
+
return [2 /*return*/, Promise.reject(e_2)];
|
|
221
227
|
case 3: return [2 /*return*/];
|
|
222
228
|
}
|
|
223
229
|
});
|
|
224
230
|
});
|
|
225
231
|
};
|
|
232
|
+
CloudLanguageWeaverClient.prototype.retrieveCloudFileTranslation = function (retrieveFileRequest) {
|
|
233
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
234
|
+
var validationError, statusPromise;
|
|
235
|
+
var _this = this;
|
|
236
|
+
return __generator(this, function (_a) {
|
|
237
|
+
validationError = (0, TranslateFileUtil_1.validateInputDataForRetrieveFileTranslation)(retrieveFileRequest);
|
|
238
|
+
if (validationError) {
|
|
239
|
+
return [2 /*return*/, Promise.reject({ message: validationError })];
|
|
240
|
+
}
|
|
241
|
+
statusPromise = this.obtainFinalStatus(retrieveFileRequest.translationId);
|
|
242
|
+
return [2 /*return*/, this.handleStatusResponse(retrieveFileRequest.translationId, statusPromise, function () {
|
|
243
|
+
return _this.getTranslationFileResponse(retrieveFileRequest);
|
|
244
|
+
})];
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
CloudLanguageWeaverClient.prototype.getLanguagePairs = function () {
|
|
249
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
250
|
+
return __generator(this, function (_a) {
|
|
251
|
+
if (this._languagePairsService) {
|
|
252
|
+
return [2 /*return*/, this._languagePairsService.getLanguagePairs()];
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
return [2 /*return*/, Promise.reject({ message: TranslationConstants_1.GENERIC_ERROR + 'getting the language pairs' })];
|
|
256
|
+
}
|
|
257
|
+
return [2 /*return*/];
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
};
|
|
226
261
|
CloudLanguageWeaverClient.prototype.getCloudLanguagePairs = function () {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return Promise.
|
|
232
|
-
}
|
|
233
|
-
|
|
262
|
+
if (this._languagePairsService) {
|
|
263
|
+
return this._languagePairsService.getCloudLanguagePairs();
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
return Promise.reject({ message: TranslationConstants_1.GENERIC_ERROR + 'getting the language pairs' });
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
CloudLanguageWeaverClient.prototype.getLinguisticOptions = function (getLinguisticOptionsRequest) {
|
|
270
|
+
if (this._linguisticOptionsService) {
|
|
271
|
+
return this._linguisticOptionsService.getLinguisticOptionsForLanguagePair(getLinguisticOptionsRequest || new GetLinguisticOptionsRequest_1.default());
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
return Promise.reject({ message: TranslationConstants_1.GENERIC_ERROR + 'getting the linguistic options' });
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
CloudLanguageWeaverClient.prototype.getCloudLinguisticOptions = function (getLinguisticOptionsRequest) {
|
|
278
|
+
if (this._linguisticOptionsService) {
|
|
279
|
+
return this._linguisticOptionsService.getCloudLinguisticOptionsForLanguagePair(getLinguisticOptionsRequest || new CloudGetLinguisticOptionsRequest_1.default());
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
return Promise.reject({ message: TranslationConstants_1.GENERIC_ERROR + 'getting the linguistic options' });
|
|
283
|
+
}
|
|
234
284
|
};
|
|
235
285
|
CloudLanguageWeaverClient.prototype.getDictionaries = function (pageNumber, pageSize) {
|
|
236
|
-
var _a;
|
|
237
286
|
if (pageSize === void 0) { pageSize = TranslationConstants_1.DEFAULT_DICTIONARIES_PAGE_SIZE; }
|
|
238
287
|
return __awaiter(this, void 0, void 0, function () {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
case 1:
|
|
246
|
-
cloudDictionariesResult_1 = _b.sent();
|
|
247
|
-
dictionaries_1 = [];
|
|
248
|
-
(_a = cloudDictionariesResult_1.dictionaries) === null || _a === void 0 ? void 0 : _a.forEach(function (dictionary) {
|
|
249
|
-
var dictionaryResponse = new DictionaryResponse_1.default();
|
|
250
|
-
dictionaryResponse.id = dictionary.dictionaryId;
|
|
251
|
-
dictionaryResponse.source = dictionary.source;
|
|
252
|
-
dictionaryResponse.target = dictionary.target;
|
|
253
|
-
dictionaries_1.push(dictionaryResponse);
|
|
254
|
-
});
|
|
255
|
-
return [2 /*return*/, new Promise(function (resolve) {
|
|
256
|
-
var result = new DictionariesResult_1.default();
|
|
257
|
-
result.dictionaries = dictionaries_1;
|
|
258
|
-
result.pageNumber = cloudDictionariesResult_1.pageNumber;
|
|
259
|
-
result.totalCount = cloudDictionariesResult_1.totalCount;
|
|
260
|
-
result.pageSize = cloudDictionariesResult_1.pageSize;
|
|
261
|
-
resolve(result);
|
|
262
|
-
})];
|
|
263
|
-
case 2:
|
|
264
|
-
e_2 = _b.sent();
|
|
265
|
-
return [2 /*return*/, Promise.reject(e_2)];
|
|
266
|
-
case 3: return [2 /*return*/];
|
|
288
|
+
return __generator(this, function (_a) {
|
|
289
|
+
if (this._dictionariesService) {
|
|
290
|
+
return [2 /*return*/, this._dictionariesService.getDictionaries(pageNumber, pageSize)];
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
return [2 /*return*/, Promise.reject({ message: TranslationConstants_1.GENERIC_ERROR + 'getting the dictionaries' })];
|
|
267
294
|
}
|
|
295
|
+
return [2 /*return*/];
|
|
268
296
|
});
|
|
269
297
|
});
|
|
270
298
|
};
|
|
271
299
|
CloudLanguageWeaverClient.prototype.getCloudDictionaries = function (pageNumber, pageSize) {
|
|
272
|
-
var _a;
|
|
273
300
|
if (pageSize === void 0) { pageSize = TranslationConstants_1.DEFAULT_DICTIONARIES_PAGE_SIZE; }
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
301
|
+
if (this._dictionariesService) {
|
|
302
|
+
return this._dictionariesService.getCloudDictionaries(pageNumber, pageSize);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
return Promise.reject({ message: TranslationConstants_1.GENERIC_ERROR + 'getting the dictionaries' });
|
|
306
|
+
}
|
|
280
307
|
};
|
|
281
308
|
CloudLanguageWeaverClient.prototype.getFeedback = function (pageNumber, pageSize, filterRequest) {
|
|
282
309
|
if (this._feedbackService) {
|
|
@@ -362,6 +389,30 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
362
389
|
return Promise.reject({ message: TranslationConstants_1.GENERIC_ERROR + 'deleting the feedback' });
|
|
363
390
|
}
|
|
364
391
|
};
|
|
392
|
+
CloudLanguageWeaverClient.prototype.getCloudContentInsights = function (cloudContentInsightsRequest) {
|
|
393
|
+
if (this._contentInsightsService) {
|
|
394
|
+
return this._contentInsightsService.getCloudContentInsightsResult(cloudContentInsightsRequest);
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
return Promise.reject({ message: TranslationConstants_1.GENERIC_ERROR + 'requesting content insights' });
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
CloudLanguageWeaverClient.prototype.getContentInsightsForTranslations = function (contentInsightsRequest) {
|
|
401
|
+
if (this._contentInsightsService) {
|
|
402
|
+
return this._contentInsightsService.getContentInsightsResultForTranslations(contentInsightsRequest);
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
return Promise.reject({ message: TranslationConstants_1.GENERIC_ERROR + 'requesting content insights for translations' });
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
CloudLanguageWeaverClient.prototype.getCloudContentInsightsForTranslations = function (cloudContentInsightsRequest) {
|
|
409
|
+
if (this._contentInsightsService) {
|
|
410
|
+
return this._contentInsightsService.getCloudContentInsightsResultForTranslations(cloudContentInsightsRequest);
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
return Promise.reject({ message: TranslationConstants_1.GENERIC_ERROR + 'requesting content insights for translations' });
|
|
414
|
+
}
|
|
415
|
+
};
|
|
365
416
|
CloudLanguageWeaverClient.prototype.getSelfInfo = function () {
|
|
366
417
|
return Utils_1.default.isCloudCredentialsToken(this._token) ? this._selfInformation : this._userSelfInformation;
|
|
367
418
|
};
|
|
@@ -370,14 +421,14 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
370
421
|
translateTextRequest.targetLanguageId = Utils_1.default.getLanguageCode3(translateTextRequest.targetLanguageId);
|
|
371
422
|
if (translateTextRequest.input.length === 1 &&
|
|
372
423
|
Utils_1.default.getInputSize(translateTextRequest.input) < TranslationConstants_1.SYNC_SIZE_LIMIT) {
|
|
373
|
-
return this.translateSyncText(translateTextRequest);
|
|
424
|
+
return this.translateSyncText(translateTextRequest.toCloudTranslateTextRequestApiModel());
|
|
374
425
|
}
|
|
375
426
|
else {
|
|
376
427
|
var inputSize = Utils_1.default.getInputBytesSize(translateTextRequest.input);
|
|
377
428
|
if (inputSize > TranslationConstants_1.MAX_ASYNC_TEXT_SIZE_LIMIT) {
|
|
378
429
|
return Promise.reject("Input text size exceeds maximum permitted size of ".concat(TranslationConstants_1.MAX_ASYNC_TEXT_SIZE_LIMIT, " bytes."));
|
|
379
430
|
}
|
|
380
|
-
return this.translateAsyncText(translateTextRequest);
|
|
431
|
+
return this.translateAsyncText(translateTextRequest.toCloudTranslateTextRequestApiModel());
|
|
381
432
|
}
|
|
382
433
|
};
|
|
383
434
|
CloudLanguageWeaverClient.prototype.translateSyncText = function (translateTextRequest) {
|
|
@@ -410,23 +461,22 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
410
461
|
.catch(function (error) { return reject(error); });
|
|
411
462
|
});
|
|
412
463
|
};
|
|
413
|
-
CloudLanguageWeaverClient.prototype.getTranslationFileResponse = function (
|
|
464
|
+
CloudLanguageWeaverClient.prototype.getTranslationFileResponse = function (request, translationResponse) {
|
|
414
465
|
var _this = this;
|
|
415
466
|
return new Promise(function (resolve, reject) {
|
|
416
|
-
|
|
417
|
-
|
|
467
|
+
var requestId = request instanceof RetrieveFileRequest_1.default ? request.translationId : translationResponse === null || translationResponse === void 0 ? void 0 : translationResponse.requestId;
|
|
468
|
+
_this.retrieveFileTranslationResponse(requestId)
|
|
418
469
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
|
419
470
|
var translationFileResult, fs, once, stream;
|
|
420
471
|
return __generator(this, function (_a) {
|
|
421
472
|
switch (_a.label) {
|
|
422
473
|
case 0:
|
|
423
474
|
translationFileResult = constructFileTranslationResponse(response);
|
|
424
|
-
if (!(
|
|
475
|
+
if (!(request.outputDir && !Utils_1.default.isBrowser())) return [3 /*break*/, 2];
|
|
425
476
|
if (!(response.data && typeof response.data.pipe === 'function')) return [3 /*break*/, 2];
|
|
426
477
|
fs = require('fs');
|
|
427
478
|
once = require('events').once;
|
|
428
|
-
stream = response.data.pipe(fs.createWriteStream(Utils_1.default.getFullPath(
|
|
429
|
-
(0, TranslateFileUtil_1.getFileNameFromHeaders)(response, translateFileRequest))));
|
|
479
|
+
stream = response.data.pipe(fs.createWriteStream(Utils_1.default.getFullPath(request.outputDir, request.outputFile || (0, TranslateFileUtil_1.getFileNameFromHeaders)(response, request))));
|
|
430
480
|
return [4 /*yield*/, once(stream, 'finish')];
|
|
431
481
|
case 1:
|
|
432
482
|
_a.sent();
|
|
@@ -442,21 +492,26 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
442
492
|
function constructFileTranslationResponse(response) {
|
|
443
493
|
var translationFileResult = new CloudTranslationFileResult_1.default();
|
|
444
494
|
translationFileResult.fileContent = response.data;
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
495
|
+
if (translationResponse) {
|
|
496
|
+
translationFileResult.sourceLanguageId = translationResponse.sourceLanguageId;
|
|
497
|
+
translationFileResult.targetLanguageId = translationResponse.targetLanguageId;
|
|
498
|
+
translationFileResult.inputFormat = translationResponse.inputFormat
|
|
499
|
+
? (0, Format_1.getFormatByKey)(translationResponse.inputFormat.toUpperCase())
|
|
500
|
+
: Format_1.Format.UNK;
|
|
501
|
+
translationFileResult.model = translationResponse.model;
|
|
502
|
+
translationFileResult.translationId = translationResponse.requestId;
|
|
503
|
+
}
|
|
504
|
+
if (Utils_1.default.isBrowser()) {
|
|
505
|
+
translationFileResult.filename = request.outputFile || (0, TranslateFileUtil_1.getFileNameFromHeaders)(response, request);
|
|
454
506
|
translationFileResult.mimeType =
|
|
455
507
|
FormatToMimeType_1.formatToMimeType[Utils_1.default.getFormatForFile(translationFileResult.filename)];
|
|
456
508
|
}
|
|
457
509
|
return translationFileResult;
|
|
458
510
|
}
|
|
459
511
|
};
|
|
512
|
+
CloudLanguageWeaverClient.prototype.retrieveFileTranslationResponse = function (requestId) {
|
|
513
|
+
return this._client.requestJson(this._token, 'GET', TranslationConstants_1.ASYNC_TRANSLATION_PATH + '/' + requestId + '/content', undefined, undefined, { hasStreamResponse: true, headersNeeded: true });
|
|
514
|
+
};
|
|
460
515
|
CloudLanguageWeaverClient.prototype.requestTranslateBatchFile = function (translateBatchFileRequest) {
|
|
461
516
|
return __awaiter(this, void 0, void 0, function () {
|
|
462
517
|
var validationError, files, promises;
|
|
@@ -503,6 +558,7 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
503
558
|
}
|
|
504
559
|
request.dictionaries = translateBatchFileRequest.dictionaries;
|
|
505
560
|
request.pdfConverter = translateBatchFileRequest.pdfConverter;
|
|
561
|
+
request.linguisticOptions = translateBatchFileRequest.linguisticOptions;
|
|
506
562
|
return this.requestTranslateFile(request);
|
|
507
563
|
};
|
|
508
564
|
CloudLanguageWeaverClient.prototype.requestTranslateFile = function (translateFileRequest) {
|
|
@@ -517,7 +573,7 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
517
573
|
.then(function (response) {
|
|
518
574
|
var statusPromise = _this.obtainFinalStatus(response.requestId, fileSize);
|
|
519
575
|
return _this.handleStatusResponse(response.requestId, statusPromise, function () {
|
|
520
|
-
return _this.getTranslationFileResponse(
|
|
576
|
+
return _this.getTranslationFileResponse(translateFileRequest, response);
|
|
521
577
|
});
|
|
522
578
|
})
|
|
523
579
|
.catch(function (error) { return Promise.reject(error); });
|
|
@@ -534,7 +590,7 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
534
590
|
return Promise.reject(TranslationException_1.default.getTranslationException(statusResponse.translationStatus, requestId));
|
|
535
591
|
case Statuses_1.INIT_TRANSLATION_STATUS:
|
|
536
592
|
case Statuses_1.TRANSLATING_TRANSLATION_STATUS:
|
|
537
|
-
var errorResponse = new ErrorResponse_1.default(-1, TranslationConstants_1.
|
|
593
|
+
var errorResponse = new ErrorResponse_1.default(-1, TranslationConstants_1.TRANSLATION_TIMEOUT_ERROR_MESSAGE);
|
|
538
594
|
return Promise.reject(TranslationException_1.default.getTranslationException(statusResponse.translationStatus, requestId, [
|
|
539
595
|
errorResponse,
|
|
540
596
|
]));
|
|
@@ -574,12 +630,17 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
574
630
|
if (translateFileRequest.pdfConverter) {
|
|
575
631
|
formData.append(TranslationConstants_1.PDF_CONVERTER, PdfConverter_1.PdfConverterCloud[translateFileRequest.pdfConverter]);
|
|
576
632
|
}
|
|
633
|
+
if (translateFileRequest.linguisticOptions) {
|
|
634
|
+
formData.append(TranslationConstants_1.LINGUISTIC_OPTIONS, JSON.stringify(Object.fromEntries(translateFileRequest.linguisticOptions)));
|
|
635
|
+
}
|
|
577
636
|
return this._client.requestMultipart(this._token, 'POST', TranslationConstants_1.ASYNC_TRANSLATION_PATH, formData);
|
|
578
637
|
};
|
|
579
638
|
CloudLanguageWeaverClient.prototype.obtainFinalStatus = function (requestId, fileSize) {
|
|
580
639
|
var self = this;
|
|
581
|
-
return new Promise(function (resolve) {
|
|
582
|
-
var delay = fileSize
|
|
640
|
+
return new Promise(function (resolve, reject) {
|
|
641
|
+
var delay = fileSize !== undefined && fileSize < 500
|
|
642
|
+
? TranslationConstants_1.SMALL_INPUT_GET_TRANSLATION_STATUS_DELAY
|
|
643
|
+
: TranslationConstants_1.LARGE_INPUT_GET_TRANSLATION_STATUS_DELAY;
|
|
583
644
|
var startTime = new Date().getTime();
|
|
584
645
|
getStatus();
|
|
585
646
|
function getStatus() {
|
|
@@ -595,7 +656,8 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
595
656
|
else {
|
|
596
657
|
resolve(statusResponse);
|
|
597
658
|
}
|
|
598
|
-
})
|
|
659
|
+
})
|
|
660
|
+
.catch(function (e) { return reject(e); });
|
|
599
661
|
}
|
|
600
662
|
});
|
|
601
663
|
};
|
|
@@ -608,6 +670,41 @@ var CloudLanguageWeaverClient = /** @class */ (function () {
|
|
|
608
670
|
this._clientConfiguration.credentialsConfiguration.clientId &&
|
|
609
671
|
this._clientConfiguration.credentialsConfiguration.clientSecret);
|
|
610
672
|
};
|
|
673
|
+
CloudLanguageWeaverClient.prototype.handleCredentialsConfiguration = function (authentication) {
|
|
674
|
+
var _a, _b;
|
|
675
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
676
|
+
var _c, clientId, clientSecret, credentialsConfiguration, clientConfiguration, _d;
|
|
677
|
+
return __generator(this, function (_e) {
|
|
678
|
+
switch (_e.label) {
|
|
679
|
+
case 0:
|
|
680
|
+
if (!(((_a = this._clientConfiguration) === null || _a === void 0 ? void 0 : _a.credentialsConfiguration) && this.hasCredentialsConfiguration())) return [3 /*break*/, 2];
|
|
681
|
+
_c = this;
|
|
682
|
+
return [4 /*yield*/, authentication.requestCredentialsToken((_b = this._clientConfiguration) === null || _b === void 0 ? void 0 : _b.credentialsConfiguration)];
|
|
683
|
+
case 1:
|
|
684
|
+
_c._token = _e.sent();
|
|
685
|
+
return [3 /*break*/, 5];
|
|
686
|
+
case 2:
|
|
687
|
+
clientId = Utils_1.default.getClientIdEnvVar();
|
|
688
|
+
clientSecret = Utils_1.default.getCloudClientSecretEnvVar();
|
|
689
|
+
if (!(clientId && clientSecret)) return [3 /*break*/, 4];
|
|
690
|
+
credentialsConfiguration = new CredentialsConfiguration_1.default(clientId, clientSecret);
|
|
691
|
+
clientConfiguration = new ClientConfiguration_1.default();
|
|
692
|
+
clientConfiguration.credentialsConfiguration = credentialsConfiguration;
|
|
693
|
+
this._client.clientConfiguration = clientConfiguration;
|
|
694
|
+
this._clientConfiguration = clientConfiguration;
|
|
695
|
+
_d = this;
|
|
696
|
+
return [4 /*yield*/, authentication.requestCredentialsToken(credentialsConfiguration)];
|
|
697
|
+
case 3:
|
|
698
|
+
_d._token = _e.sent();
|
|
699
|
+
return [3 /*break*/, 5];
|
|
700
|
+
case 4: return [2 /*return*/, Promise.reject({
|
|
701
|
+
message: 'ClientId and ClientSecret are required for credentials configuration',
|
|
702
|
+
})];
|
|
703
|
+
case 5: return [2 /*return*/];
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
});
|
|
707
|
+
};
|
|
611
708
|
CloudLanguageWeaverClient.prototype.setRegion = function () {
|
|
612
709
|
var overwriteCloudRegion = Utils_1.default.getCloudRegionEnvVar();
|
|
613
710
|
if (overwriteCloudRegion) {
|