@azure/ai-text-analytics 5.1.1-alpha.20250618.1 → 5.1.1-alpha.20250721.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.
Files changed (122) hide show
  1. package/dist/browser/analyzeActionsResult.js +6 -7
  2. package/dist/browser/analyzeActionsResult.js.map +1 -1
  3. package/dist/browser/analyzeHealthcareEntitiesResult.js +7 -3
  4. package/dist/browser/analyzeHealthcareEntitiesResult.js.map +1 -1
  5. package/dist/browser/analyzeSentimentResult.js +7 -4
  6. package/dist/browser/analyzeSentimentResult.js.map +1 -1
  7. package/dist/browser/detectLanguageResult.js +4 -1
  8. package/dist/browser/detectLanguageResult.js.map +1 -1
  9. package/dist/browser/extractKeyPhrasesResult.js +4 -1
  10. package/dist/browser/extractKeyPhrasesResult.js.map +1 -1
  11. package/dist/browser/generated/generatedClient.js +12 -4
  12. package/dist/browser/generated/generatedClient.js.map +1 -1
  13. package/dist/browser/generated/models/mappers.js +44 -10
  14. package/dist/browser/generated/models/mappers.js.map +1 -1
  15. package/dist/browser/lro/analyze/operation.js +27 -18
  16. package/dist/browser/lro/analyze/operation.js.map +1 -1
  17. package/dist/browser/lro/health/operation.js +27 -34
  18. package/dist/browser/lro/health/operation.js.map +1 -1
  19. package/dist/browser/lro/poller.js +5 -7
  20. package/dist/browser/lro/poller.js.map +1 -1
  21. package/dist/browser/recognizeCategorizedEntitiesResult.js +4 -1
  22. package/dist/browser/recognizeCategorizedEntitiesResult.js.map +1 -1
  23. package/dist/browser/recognizeLinkedEntitiesResult.js +4 -1
  24. package/dist/browser/recognizeLinkedEntitiesResult.js.map +1 -1
  25. package/dist/browser/recognizePiiEntitiesResult.js +5 -2
  26. package/dist/browser/recognizePiiEntitiesResult.js.map +1 -1
  27. package/dist/browser/textAnalyticsClient.js +38 -16
  28. package/dist/browser/textAnalyticsClient.js.map +1 -1
  29. package/dist/browser/util.js +6 -8
  30. package/dist/browser/util.js.map +1 -1
  31. package/dist/commonjs/analyzeActionsResult.js +6 -7
  32. package/dist/commonjs/analyzeActionsResult.js.map +1 -1
  33. package/dist/commonjs/analyzeHealthcareEntitiesResult.js +7 -3
  34. package/dist/commonjs/analyzeHealthcareEntitiesResult.js.map +1 -1
  35. package/dist/commonjs/analyzeSentimentResult.js +7 -4
  36. package/dist/commonjs/analyzeSentimentResult.js.map +1 -1
  37. package/dist/commonjs/detectLanguageResult.js +4 -1
  38. package/dist/commonjs/detectLanguageResult.js.map +1 -1
  39. package/dist/commonjs/extractKeyPhrasesResult.js +4 -1
  40. package/dist/commonjs/extractKeyPhrasesResult.js.map +1 -1
  41. package/dist/commonjs/generated/generatedClient.js +12 -4
  42. package/dist/commonjs/generated/generatedClient.js.map +1 -1
  43. package/dist/commonjs/generated/models/mappers.js +44 -10
  44. package/dist/commonjs/generated/models/mappers.js.map +1 -1
  45. package/dist/commonjs/lro/analyze/operation.js +27 -18
  46. package/dist/commonjs/lro/analyze/operation.js.map +1 -1
  47. package/dist/commonjs/lro/health/operation.js +27 -34
  48. package/dist/commonjs/lro/health/operation.js.map +1 -1
  49. package/dist/commonjs/lro/poller.js +5 -7
  50. package/dist/commonjs/lro/poller.js.map +1 -1
  51. package/dist/commonjs/recognizeCategorizedEntitiesResult.js +4 -1
  52. package/dist/commonjs/recognizeCategorizedEntitiesResult.js.map +1 -1
  53. package/dist/commonjs/recognizeLinkedEntitiesResult.js +4 -1
  54. package/dist/commonjs/recognizeLinkedEntitiesResult.js.map +1 -1
  55. package/dist/commonjs/recognizePiiEntitiesResult.js +5 -2
  56. package/dist/commonjs/recognizePiiEntitiesResult.js.map +1 -1
  57. package/dist/commonjs/textAnalyticsClient.js +38 -16
  58. package/dist/commonjs/textAnalyticsClient.js.map +1 -1
  59. package/dist/commonjs/tsdoc-metadata.json +11 -11
  60. package/dist/commonjs/util.js +6 -8
  61. package/dist/commonjs/util.js.map +1 -1
  62. package/dist/esm/analyzeActionsResult.js +6 -7
  63. package/dist/esm/analyzeActionsResult.js.map +1 -1
  64. package/dist/esm/analyzeHealthcareEntitiesResult.js +7 -3
  65. package/dist/esm/analyzeHealthcareEntitiesResult.js.map +1 -1
  66. package/dist/esm/analyzeSentimentResult.js +7 -4
  67. package/dist/esm/analyzeSentimentResult.js.map +1 -1
  68. package/dist/esm/detectLanguageResult.js +4 -1
  69. package/dist/esm/detectLanguageResult.js.map +1 -1
  70. package/dist/esm/extractKeyPhrasesResult.js +4 -1
  71. package/dist/esm/extractKeyPhrasesResult.js.map +1 -1
  72. package/dist/esm/generated/generatedClient.js +12 -4
  73. package/dist/esm/generated/generatedClient.js.map +1 -1
  74. package/dist/esm/generated/models/mappers.js +44 -10
  75. package/dist/esm/generated/models/mappers.js.map +1 -1
  76. package/dist/esm/lro/analyze/operation.js +27 -18
  77. package/dist/esm/lro/analyze/operation.js.map +1 -1
  78. package/dist/esm/lro/health/operation.js +27 -34
  79. package/dist/esm/lro/health/operation.js.map +1 -1
  80. package/dist/esm/lro/poller.js +5 -7
  81. package/dist/esm/lro/poller.js.map +1 -1
  82. package/dist/esm/recognizeCategorizedEntitiesResult.js +4 -1
  83. package/dist/esm/recognizeCategorizedEntitiesResult.js.map +1 -1
  84. package/dist/esm/recognizeLinkedEntitiesResult.js +4 -1
  85. package/dist/esm/recognizeLinkedEntitiesResult.js.map +1 -1
  86. package/dist/esm/recognizePiiEntitiesResult.js +5 -2
  87. package/dist/esm/recognizePiiEntitiesResult.js.map +1 -1
  88. package/dist/esm/textAnalyticsClient.js +38 -16
  89. package/dist/esm/textAnalyticsClient.js.map +1 -1
  90. package/dist/esm/util.js +6 -8
  91. package/dist/esm/util.js.map +1 -1
  92. package/dist/react-native/analyzeActionsResult.js +6 -7
  93. package/dist/react-native/analyzeActionsResult.js.map +1 -1
  94. package/dist/react-native/analyzeHealthcareEntitiesResult.js +7 -3
  95. package/dist/react-native/analyzeHealthcareEntitiesResult.js.map +1 -1
  96. package/dist/react-native/analyzeSentimentResult.js +7 -4
  97. package/dist/react-native/analyzeSentimentResult.js.map +1 -1
  98. package/dist/react-native/detectLanguageResult.js +4 -1
  99. package/dist/react-native/detectLanguageResult.js.map +1 -1
  100. package/dist/react-native/extractKeyPhrasesResult.js +4 -1
  101. package/dist/react-native/extractKeyPhrasesResult.js.map +1 -1
  102. package/dist/react-native/generated/generatedClient.js +12 -4
  103. package/dist/react-native/generated/generatedClient.js.map +1 -1
  104. package/dist/react-native/generated/models/mappers.js +44 -10
  105. package/dist/react-native/generated/models/mappers.js.map +1 -1
  106. package/dist/react-native/lro/analyze/operation.js +27 -18
  107. package/dist/react-native/lro/analyze/operation.js.map +1 -1
  108. package/dist/react-native/lro/health/operation.js +27 -34
  109. package/dist/react-native/lro/health/operation.js.map +1 -1
  110. package/dist/react-native/lro/poller.js +5 -7
  111. package/dist/react-native/lro/poller.js.map +1 -1
  112. package/dist/react-native/recognizeCategorizedEntitiesResult.js +4 -1
  113. package/dist/react-native/recognizeCategorizedEntitiesResult.js.map +1 -1
  114. package/dist/react-native/recognizeLinkedEntitiesResult.js +4 -1
  115. package/dist/react-native/recognizeLinkedEntitiesResult.js.map +1 -1
  116. package/dist/react-native/recognizePiiEntitiesResult.js +5 -2
  117. package/dist/react-native/recognizePiiEntitiesResult.js.map +1 -1
  118. package/dist/react-native/textAnalyticsClient.js +38 -16
  119. package/dist/react-native/textAnalyticsClient.js.map +1 -1
  120. package/dist/react-native/util.js +6 -8
  121. package/dist/react-native/util.js.map +1 -1
  122. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"textAnalyticsClient.js","sourceRoot":"","sources":["../../src/textAnalyticsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAIlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,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cAAc;QACrC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,aAAa,EAAE,MAAM,CAAC,kBAAkB;KACzC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,4CAA4C,CACnD,MAAsC;IAEtC,OAAO;QACL,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,aAAa,EAAE,MAAM,CAAC,kBAAkB;QACxC,eAAe,EAAE,wBAAwB,CAAC,MAAM,CAAC,eAAe,CAAC;KAClE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport type { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport { SDK_VERSION } from \"./constants.js\";\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\nimport type {\n DetectLanguageInput,\n JobManifestTasks as GeneratedActions,\n SentimentOptionalParams as GeneratedAnalyzeSentimentOptions,\n LanguagesOptionalParams as GeneratedDetectLanguageOptions,\n KeyPhrasesOptionalParams as GeneratedExtractKeyPhrasesOptions,\n EntitiesRecognitionGeneralOptionalParams as GeneratedRecognizeCategorizedEntitiesOptions,\n EntitiesLinkingOptionalParams as GeneratedRecognizeLinkedEntitiesOptions,\n EntitiesRecognitionPiiOptionalParams as GeneratedRecognizePiiEntitiesOptions,\n PiiCategory,\n TextDocumentInput,\n} from \"./generated/models/index.js\";\nimport type { DetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport { makeDetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport type { RecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport { makeRecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport type { AnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport { makeAnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport type { ExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport { makeExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport type { RecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport { makeRecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport type { RecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport { makeRecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { textAnalyticsAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\nimport {\n StringIndexType,\n addParamsToTask,\n compose,\n setCategoriesFilter,\n setOpinionMining,\n setStrEncodingParam,\n setStrEncodingParamValue,\n throwError,\n} from \"./util.js\";\nimport {\n AnalyzeHealthcareEntitiesPollerLike,\n BeginAnalyzeHealthcarePoller,\n PollerLikeWithCancellation,\n} from \"./lro/health/poller.js\";\nimport {\n AnalyzeHealthcareOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n} from \"./lro/health/operation.js\";\nimport type { TextAnalyticsOperationOptions } from \"./textAnalyticsOperationOptions.js\";\nimport { AnalyzeActionsPollerLike, BeginAnalyzeActionsPoller } from \"./lro/analyze/poller.js\";\nimport {\n AnalyzeActionsOperationMetadata,\n AnalyzeActionsOperationState,\n BeginAnalyzeActionsOptions,\n} from \"./lro/analyze/operation.js\";\nimport { AnalysisPollOperationState, OperationMetadata } from \"./lro/poller.js\";\nimport type { TextAnalyticsAction } from \"./textAnalyticsAction.js\";\n\nexport {\n BeginAnalyzeActionsOptions,\n AnalyzeActionsPollerLike,\n AnalyzeActionsOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n PollerLikeWithCancellation,\n AnalyzeHealthcareEntitiesPollerLike,\n AnalyzeHealthcareOperationState,\n AnalysisPollOperationState,\n OperationMetadata,\n AnalyzeActionsOperationMetadata,\n StringIndexType,\n};\n\nconst DEFAULT_COGNITIVE_SCOPE = \"https://cognitiveservices.azure.com/.default\";\n\n/**\n * Client options used to configure TextAnalytics API requests.\n */\nexport interface TextAnalyticsClientOptions extends CommonClientOptions {\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n defaultCountryHint?: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n defaultLanguage?: string;\n}\n\n/**\n * Options for the detect languages operation.\n */\nexport interface DetectLanguageOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize entities operation.\n */\nexport interface RecognizeCategorizedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for the analyze sentiment operation.\n */\nexport interface AnalyzeSentimentOptions extends TextAnalyticsOperationOptions {\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * The types of PII domains the user can choose from.\n */\nexport enum PiiEntityDomain {\n /**\n * @see {@link https://aka.ms/tanerpii} for more information.\n */\n PROTECTED_HEALTH_INFORMATION = \"PHI\",\n}\n\n/**\n * Options for the recognize PII entities operation.\n */\nexport interface RecognizePiiEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n}\n\n/**\n * Options for the extract key phrases operation.\n */\nexport interface ExtractKeyPhrasesOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize linked entities operation.\n */\nexport interface RecognizeLinkedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for an entities recognition action.\n */\nexport interface RecognizeCategorizedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a Pii entities recognition action.\n */\nexport interface RecognizePiiEntitiesAction extends TextAnalyticsAction {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a key phrases recognition action.\n */\nexport interface ExtractKeyPhrasesAction extends TextAnalyticsAction {\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an entities linking action.\n */\nexport interface RecognizeLinkedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an analyze sentiment action.\n */\nexport interface AnalyzeSentimentAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n}\n\n/**\n * Description of collection of actions for the analyze API to perform on input documents. However, currently, the service can accept up to one action only per action type.\n */\nexport interface TextAnalyticsActions {\n /**\n * A collection of descriptions of entities recognition actions. However, currently, the service can accept up to one action only for `recognizeEntities`.\n */\n recognizeEntitiesActions?: RecognizeCategorizedEntitiesAction[];\n /**\n * A collection of descriptions of Pii entities recognition actions. However, currently, the service can accept up to one action only for `recognizePiiEntities`.\n */\n recognizePiiEntitiesActions?: RecognizePiiEntitiesAction[];\n /**\n * A collection of descriptions of key phrases recognition actions. However, currently, the service can accept up to one action only for `extractKeyPhrases`.\n */\n extractKeyPhrasesActions?: ExtractKeyPhrasesAction[];\n /**\n * A collection of descriptions of entities linking actions. However, currently, the service can accept up to one action only for `recognizeLinkedEntities`.\n */\n recognizeLinkedEntitiesActions?: RecognizeLinkedEntitiesAction[];\n /**\n * A collection of descriptions of sentiment analysis actions. However, currently, the service can accept up to one action only for `analyzeSentiment`.\n */\n analyzeSentimentActions?: AnalyzeSentimentAction[];\n}\n/**\n * Client class for interacting with Azure Text Analytics.\n */\nexport class TextAnalyticsClient {\n /**\n * The URL to the TextAnalytics endpoint\n */\n public readonly endpointUrl: string;\n\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n public defaultCountryHint: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n public defaultLanguage: string;\n\n /**\n * @internal\n * A reference to the auto-generated TextAnalytics HTTP client.\n */\n private readonly client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Creates an instance of TextAnalyticsClient.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateClient_KeyCredential\n * import { TextAnalyticsClient, AzureKeyCredential } from \"@azure/ai-text-analytics\";\n *\n * const client = new TextAnalyticsClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n * ```\n * @param endpointUrl - The URL to the TextAnalytics endpoint\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the TextAnalytics client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential | KeyCredential,\n options: TextAnalyticsClientOptions = {},\n ) {\n this.endpointUrl = endpointUrl;\n const { defaultCountryHint = \"us\", defaultLanguage = \"en\", ...pipelineOptions } = options;\n this.defaultCountryHint = defaultCountryHint;\n this.defaultLanguage = defaultLanguage;\n\n const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`;\n if (!pipelineOptions.userAgentOptions) {\n pipelineOptions.userAgentOptions = {};\n }\n if (pipelineOptions.userAgentOptions.userAgentPrefix) {\n pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`;\n } else {\n pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;\n }\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...pipelineOptions,\n ...{\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-correlation-request-id\", \"x-ms-request-id\"],\n },\n },\n };\n\n this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : textAnalyticsAzureKeyCredentialPolicy(credential);\n\n this.client.pipeline.addPolicy(authPolicy);\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-text-analytics\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n }\n\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input strings are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input strings to analyze.\n * @param countryHint - Indicates the country of origin for all of\n * the input strings to assist the text analytics model in predicting\n * the language they are written in. If unspecified, this value will be\n * set to the default country hint in `TextAnalyticsClientOptions`.\n * If set to an empty string, or the string \"none\", the service will apply a\n * model where the country is explicitly unset.\n * The same country hint is applied to all strings in the input collection.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: string[],\n countryHint?: string,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input document are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: DetectLanguageInput[],\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n public async detectLanguage(\n documents: string[] | DetectLanguageInput[],\n countryHintOrOptions?: string | DetectLanguageOptions,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray> {\n let realOptions: DetectLanguageOptions;\n let realInputs: DetectLanguageInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const countryHint = (countryHintOrOptions as string) || this.defaultCountryHint;\n realInputs = convertToDetectLanguageInput(documents, countryHint);\n realOptions = options || {};\n } else {\n // Replace \"none\" hints with \"\"\n realInputs = documents.map((input) => ({\n ...input,\n countryHint: input.countryHint === \"none\" ? \"\" : input.countryHint,\n }));\n realOptions = (countryHintOrOptions as DetectLanguageOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-detectLanguages\",\n makeGeneratedDetectLanguageOptions(realOptions),\n (finalOptions) =>\n this.client\n .languages(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeDetectLanguageResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input strings, and categorize those entities into types\n * such as person, location, or organization. For more information on \n * available categories, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: string[],\n language?: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input documents, and categorize those entities into types\n * such as person, location, or organization. For more information on\n * available categories, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: TextDocumentInput[],\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n public async recognizeEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeCategorizedEntitiesOptions,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray> {\n let realOptions: RecognizeCategorizedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeCategorizedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeEntities\",\n makeGeneratedRecognizeCategorizedEntitiesOptions(realOptions),\n (finalOptions) =>\n throwError(\n this.client.entitiesRecognitionGeneral(\n {\n documents: realInputs,\n },\n finalOptions,\n ),\n ).then((result) => makeRecognizeCategorizedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify the positive, negative, neutral, or mixed\n * sentiment contained in the input strings, as well as scores indicating\n * the model's confidence in each of the predicted sentiments. Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the lanuage is explicitly set to \"None\".\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: string[],\n language?: string,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n /**\n * Runs a predictive model to identify the positive, negative or neutral, or mixed\n * sentiment contained in the input documents, as well as scores indicating\n * the model's confidence in each of the predicted sentiments.Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: TextDocumentInput[],\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n public async analyzeSentiment(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | AnalyzeSentimentOptions,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray> {\n let realOptions: AnalyzeSentimentOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as AnalyzeSentimentOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-analyzeSentiment\",\n makeGeneratedAnalyzeSentimentOptions(realOptions),\n (finalOptions) =>\n this.client\n .sentiment(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeAnalyzeSentimentResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input strings.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: string[],\n language?: string,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input documents.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: TextDocumentInput[],\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n public async extractKeyPhrases(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | ExtractKeyPhrasesOptions,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray> {\n let realOptions: ExtractKeyPhrasesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as ExtractKeyPhrasesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-extractKeyPhrases\",\n makeGeneratedExtractKeyPhrasesOptions(realOptions),\n (finalOptions) =>\n this.client\n .keyPhrases(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeExtractKeyPhrasesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input strings,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizePiiEntities(\n inputs: string[],\n language?: string,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input documents,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizePiiEntities(\n inputs: TextDocumentInput[],\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n public async recognizePiiEntities(\n inputs: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizePiiEntitiesOptions,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray> {\n let realOptions: RecognizePiiEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (isStringArray(inputs)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(inputs, language);\n realOptions = options || {};\n } else {\n realInputs = inputs;\n realOptions = (languageOrOptions as RecognizePiiEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizePiiEntities\",\n makeGeneratedRecognizePiiEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesRecognitionPii(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizePiiEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input strings, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: string[],\n language?: string,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input documents, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: TextDocumentInput[],\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n public async recognizeLinkedEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeLinkedEntitiesOptions,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray> {\n let realOptions: RecognizeLinkedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeLinkedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeLinkedEntities\",\n makeGeneratedRecognizeLinkingEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesLinking(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizeLinkedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: string[],\n language?: string,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: TextDocumentInput[],\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n\n async beginAnalyzeHealthcareEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | BeginAnalyzeHealthcareEntitiesOptions,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike> {\n let realOptions: BeginAnalyzeHealthcareEntitiesOptions;\n let realInputs: TextDocumentInput[];\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeHealthcareEntitiesOptions) || {};\n }\n\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeHealthcarePoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n options: restOptions,\n updateIntervalInMs: updateIntervalInMs,\n resumeFrom: resumeFrom,\n });\n\n await poller.poll();\n return poller;\n }\n\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: string[],\n actions: TextAnalyticsActions,\n language?: string,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: TextDocumentInput[],\n actions: TextAnalyticsActions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n public async beginAnalyzeActions(\n documents: string[] | TextDocumentInput[],\n actions: TextAnalyticsActions,\n languageOrOptions?: string | BeginAnalyzeActionsOptions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike> {\n let realOptions: BeginAnalyzeActionsOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeActionsOptions) || {};\n }\n const compiledActions = compileAnalyzeInput(actions);\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeActionsPoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n actions: compiledActions,\n options: restOptions,\n resumeFrom: resumeFrom,\n updateIntervalInMs: updateIntervalInMs,\n });\n\n await poller.poll();\n return poller;\n }\n}\n\n/**\n * @internal\n */\nfunction compileAnalyzeInput(actions: TextAnalyticsActions): GeneratedActions {\n return {\n entityRecognitionPiiTasks: actions.recognizePiiEntitiesActions?.map(\n compose(setStrEncodingParam, compose(setCategoriesFilter, addParamsToTask)),\n ),\n entityRecognitionTasks: actions.recognizeEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n keyPhraseExtractionTasks: actions.extractKeyPhrasesActions?.map(addParamsToTask),\n entityLinkingTasks: actions.recognizeLinkedEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n sentimentAnalysisTasks: actions.analyzeSentimentActions?.map(\n compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask)),\n ),\n };\n}\n\nfunction isStringArray(documents: any[]): documents is string[] {\n return typeof documents[0] === \"string\";\n}\n\n/**\n * @internal\n */\nfunction convertToDetectLanguageInput(\n inputs: string[],\n countryHint: string,\n): DetectLanguageInput[] {\n if (countryHint === \"none\") {\n countryHint = \"\";\n }\n return inputs.map((text: string, index): DetectLanguageInput => {\n return {\n id: String(index),\n countryHint,\n text,\n };\n });\n}\n\n/**\n * @internal\n */\nfunction convertToTextDocumentInput(inputs: string[], language: string): TextDocumentInput[] {\n return inputs.map((text: string, index): TextDocumentInput => {\n return {\n id: String(index),\n language,\n text,\n };\n });\n}\n\n/**\n * Creates the options the service expects for the analyze sentiment API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedAnalyzeSentimentOptions(\n params: AnalyzeSentimentOptions,\n): GeneratedAnalyzeSentimentOptions {\n return {\n abortSignal: params.abortSignal,\n opinionMining: params.includeOpinionMining,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize pii entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizePiiEntitiesOptions(\n params: RecognizePiiEntitiesOptions,\n): GeneratedRecognizePiiEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n domain: params.domainFilter,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n piiCategories: params.categoriesFilter,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeCategorizedEntitiesOptions(\n params: RecognizeCategorizedEntitiesOptions,\n): GeneratedRecognizeCategorizedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the detect language API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedDetectLanguageOptions(\n params: DetectLanguageOptions,\n): GeneratedDetectLanguageOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the extract key phrases API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedExtractKeyPhrasesOptions(\n params: ExtractKeyPhrasesOptions,\n): GeneratedExtractKeyPhrasesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize linked entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeLinkingEntitiesOptions(\n params: RecognizeLinkedEntitiesOptions,\n): GeneratedRecognizeLinkedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n };\n}\n"]}
1
+ {"version":3,"file":"textAnalyticsClient.js","sourceRoot":"","sources":["../../src/textAnalyticsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,EAAE,2CAA2C,EAAE,MAAM,8CAA8C,CAAC;AAE3G,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAErF,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAE3F,OAAO,EAAE,sCAAsC,EAAE,MAAM,yCAAyC,CAAC;AAEjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAEL,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,4BAA4B,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;KAClE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport type { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport { SDK_VERSION } from \"./constants.js\";\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\nimport type {\n DetectLanguageInput,\n JobManifestTasks as GeneratedActions,\n SentimentOptionalParams as GeneratedAnalyzeSentimentOptions,\n LanguagesOptionalParams as GeneratedDetectLanguageOptions,\n KeyPhrasesOptionalParams as GeneratedExtractKeyPhrasesOptions,\n EntitiesRecognitionGeneralOptionalParams as GeneratedRecognizeCategorizedEntitiesOptions,\n EntitiesLinkingOptionalParams as GeneratedRecognizeLinkedEntitiesOptions,\n EntitiesRecognitionPiiOptionalParams as GeneratedRecognizePiiEntitiesOptions,\n PiiCategory,\n TextDocumentInput,\n} from \"./generated/models/index.js\";\nimport type { DetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport { makeDetectLanguageResultArray } from \"./detectLanguageResultArray.js\";\nimport type { RecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport { makeRecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport type { AnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport { makeAnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport type { ExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport { makeExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport type { RecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport { makeRecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport type { RecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport { makeRecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { textAnalyticsAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\nimport {\n StringIndexType,\n addParamsToTask,\n compose,\n setCategoriesFilter,\n setOpinionMining,\n setStrEncodingParam,\n setStrEncodingParamValue,\n throwError,\n} from \"./util.js\";\nimport {\n AnalyzeHealthcareEntitiesPollerLike,\n BeginAnalyzeHealthcarePoller,\n PollerLikeWithCancellation,\n} from \"./lro/health/poller.js\";\nimport {\n AnalyzeHealthcareOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n} from \"./lro/health/operation.js\";\nimport type { TextAnalyticsOperationOptions } from \"./textAnalyticsOperationOptions.js\";\nimport { AnalyzeActionsPollerLike, BeginAnalyzeActionsPoller } from \"./lro/analyze/poller.js\";\nimport {\n AnalyzeActionsOperationMetadata,\n AnalyzeActionsOperationState,\n BeginAnalyzeActionsOptions,\n} from \"./lro/analyze/operation.js\";\nimport { AnalysisPollOperationState, OperationMetadata } from \"./lro/poller.js\";\nimport type { TextAnalyticsAction } from \"./textAnalyticsAction.js\";\n\nexport {\n BeginAnalyzeActionsOptions,\n AnalyzeActionsPollerLike,\n AnalyzeActionsOperationState,\n BeginAnalyzeHealthcareEntitiesOptions,\n PollerLikeWithCancellation,\n AnalyzeHealthcareEntitiesPollerLike,\n AnalyzeHealthcareOperationState,\n AnalysisPollOperationState,\n OperationMetadata,\n AnalyzeActionsOperationMetadata,\n StringIndexType,\n};\n\nconst DEFAULT_COGNITIVE_SCOPE = \"https://cognitiveservices.azure.com/.default\";\n\n/**\n * Client options used to configure TextAnalytics API requests.\n */\nexport interface TextAnalyticsClientOptions extends CommonClientOptions {\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n defaultCountryHint?: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n defaultLanguage?: string;\n}\n\n/**\n * Options for the detect languages operation.\n */\nexport interface DetectLanguageOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize entities operation.\n */\nexport interface RecognizeCategorizedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for the analyze sentiment operation.\n */\nexport interface AnalyzeSentimentOptions extends TextAnalyticsOperationOptions {\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * The types of PII domains the user can choose from.\n */\nexport enum PiiEntityDomain {\n /**\n * @see {@link https://aka.ms/tanerpii} for more information.\n */\n PROTECTED_HEALTH_INFORMATION = \"PHI\",\n}\n\n/**\n * Options for the recognize PII entities operation.\n */\nexport interface RecognizePiiEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n}\n\n/**\n * Options for the extract key phrases operation.\n */\nexport interface ExtractKeyPhrasesOptions extends TextAnalyticsOperationOptions {}\n\n/**\n * Options for the recognize linked entities operation.\n */\nexport interface RecognizeLinkedEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n}\n\n/**\n * Options for an entities recognition action.\n */\nexport interface RecognizeCategorizedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a Pii entities recognition action.\n */\nexport interface RecognizePiiEntitiesAction extends TextAnalyticsAction {\n /**\n * Filters entities to ones only included in the specified domain (e.g., if\n * set to 'PHI', entities in the Protected Healthcare Information domain will\n * only be returned). @see {@link https://aka.ms/tanerpii} for more information.\n */\n domainFilter?: PiiEntityDomain;\n /**\n * Filters entities to ones only included in the specified array of categories\n */\n categoriesFilter?: PiiCategory[];\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for a key phrases recognition action.\n */\nexport interface ExtractKeyPhrasesAction extends TextAnalyticsAction {\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for pii entities recognition. Setting this parameter to false,\n * enables input logging.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an entities linking action.\n */\nexport interface RecognizeLinkedEntitiesAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n}\n\n/**\n * Options for an analyze sentiment action.\n */\nexport interface AnalyzeSentimentAction extends TextAnalyticsAction {\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,\n * disables input logging and may limit our ability to remediate issues that occur.\n */\n disableServiceLogs?: boolean;\n /**\n * Whether to mine the opinions of a sentence and conduct more granular\n * analysis around the aspects of a product or service (also known as\n * aspect-based sentiment analysis). If set to true, the returned\n * `SentenceSentiment` objects will have property `opinions` containing\n * the result of this analysis.\n * More information about the feature can be found here: {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis?tabs=version-3-1#opinion-mining}\n */\n includeOpinionMining?: boolean;\n}\n\n/**\n * Description of collection of actions for the analyze API to perform on input documents. However, currently, the service can accept up to one action only per action type.\n */\nexport interface TextAnalyticsActions {\n /**\n * A collection of descriptions of entities recognition actions. However, currently, the service can accept up to one action only for `recognizeEntities`.\n */\n recognizeEntitiesActions?: RecognizeCategorizedEntitiesAction[];\n /**\n * A collection of descriptions of Pii entities recognition actions. However, currently, the service can accept up to one action only for `recognizePiiEntities`.\n */\n recognizePiiEntitiesActions?: RecognizePiiEntitiesAction[];\n /**\n * A collection of descriptions of key phrases recognition actions. However, currently, the service can accept up to one action only for `extractKeyPhrases`.\n */\n extractKeyPhrasesActions?: ExtractKeyPhrasesAction[];\n /**\n * A collection of descriptions of entities linking actions. However, currently, the service can accept up to one action only for `recognizeLinkedEntities`.\n */\n recognizeLinkedEntitiesActions?: RecognizeLinkedEntitiesAction[];\n /**\n * A collection of descriptions of sentiment analysis actions. However, currently, the service can accept up to one action only for `analyzeSentiment`.\n */\n analyzeSentimentActions?: AnalyzeSentimentAction[];\n}\n/**\n * Client class for interacting with Azure Text Analytics.\n */\nexport class TextAnalyticsClient {\n /**\n * The URL to the TextAnalytics endpoint\n */\n public readonly endpointUrl: string;\n\n /**\n * The default country hint to use. Defaults to \"us\".\n */\n public defaultCountryHint: string;\n\n /**\n * The default language to use. Defaults to \"en\".\n */\n public defaultLanguage: string;\n\n /**\n * @internal\n * A reference to the auto-generated TextAnalytics HTTP client.\n */\n private readonly client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Creates an instance of TextAnalyticsClient.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateClient_KeyCredential\n * import { TextAnalyticsClient, AzureKeyCredential } from \"@azure/ai-text-analytics\";\n *\n * const client = new TextAnalyticsClient(\"<endpoint>\", new AzureKeyCredential(\"<API key>\"));\n * ```\n * @param endpointUrl - The URL to the TextAnalytics endpoint\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the TextAnalytics client.\n */\n constructor(\n endpointUrl: string,\n credential: TokenCredential | KeyCredential,\n options: TextAnalyticsClientOptions = {},\n ) {\n this.endpointUrl = endpointUrl;\n const { defaultCountryHint = \"us\", defaultLanguage = \"en\", ...pipelineOptions } = options;\n this.defaultCountryHint = defaultCountryHint;\n this.defaultLanguage = defaultLanguage;\n\n const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`;\n if (!pipelineOptions.userAgentOptions) {\n pipelineOptions.userAgentOptions = {};\n }\n if (pipelineOptions.userAgentOptions.userAgentPrefix) {\n pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`;\n } else {\n pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;\n }\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...pipelineOptions,\n ...{\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\"x-ms-correlation-request-id\", \"x-ms-request-id\"],\n },\n },\n };\n\n this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : textAnalyticsAzureKeyCredentialPolicy(credential);\n\n this.client.pipeline.addPolicy(authPolicy);\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-text-analytics\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n }\n\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input strings are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input strings to analyze.\n * @param countryHint - Indicates the country of origin for all of\n * the input strings to assist the text analytics model in predicting\n * the language they are written in. If unspecified, this value will be\n * set to the default country hint in `TextAnalyticsClientOptions`.\n * If set to an empty string, or the string \"none\", the service will apply a\n * model where the country is explicitly unset.\n * The same country hint is applied to all strings in the input collection.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: string[],\n countryHint?: string,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n /**\n * Runs a predictive model to determine the language that the passed-in\n * input document are written in, and returns, for each one, the detected\n * language as well as a score indicating the model's confidence that the\n * inferred language is correct. Scores close to 1 indicate high certainty in\n * the result. 120 languages are supported.\n * @param documents - A collection of input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async detectLanguage(\n documents: DetectLanguageInput[],\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray>;\n public async detectLanguage(\n documents: string[] | DetectLanguageInput[],\n countryHintOrOptions?: string | DetectLanguageOptions,\n options?: DetectLanguageOptions,\n ): Promise<DetectLanguageResultArray> {\n let realOptions: DetectLanguageOptions;\n let realInputs: DetectLanguageInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const countryHint = (countryHintOrOptions as string) || this.defaultCountryHint;\n realInputs = convertToDetectLanguageInput(documents, countryHint);\n realOptions = options || {};\n } else {\n // Replace \"none\" hints with \"\"\n realInputs = documents.map((input) => ({\n ...input,\n countryHint: input.countryHint === \"none\" ? \"\" : input.countryHint,\n }));\n realOptions = (countryHintOrOptions as DetectLanguageOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-detectLanguages\",\n makeGeneratedDetectLanguageOptions(realOptions),\n (finalOptions) =>\n this.client\n .languages(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeDetectLanguageResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input strings, and categorize those entities into types\n * such as person, location, or organization. For more information on \n * available categories, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: string[],\n language?: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of named entities\n * in the passed-in input documents, and categorize those entities into types\n * such as person, location, or organization. For more information on\n * available categories, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/named-entity-types}.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizeEntities(\n documents: TextDocumentInput[],\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray>;\n public async recognizeEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeCategorizedEntitiesOptions,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options?: RecognizeCategorizedEntitiesOptions,\n ): Promise<RecognizeCategorizedEntitiesResultArray> {\n let realOptions: RecognizeCategorizedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeCategorizedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeEntities\",\n makeGeneratedRecognizeCategorizedEntitiesOptions(realOptions),\n (finalOptions) =>\n throwError(\n this.client.entitiesRecognitionGeneral(\n {\n documents: realInputs,\n },\n finalOptions,\n ),\n ).then((result) => makeRecognizeCategorizedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify the positive, negative, neutral, or mixed\n * sentiment contained in the input strings, as well as scores indicating\n * the model's confidence in each of the predicted sentiments. Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the lanuage is explicitly set to \"None\".\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: string[],\n language?: string,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n /**\n * Runs a predictive model to identify the positive, negative or neutral, or mixed\n * sentiment contained in the input documents, as well as scores indicating\n * the model's confidence in each of the predicted sentiments.Optionally it\n * can also identify targets in the text and assessments about it through\n * opinion mining. For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Optional parameters that includes enabling opinion mining.\n */\n public async analyzeSentiment(\n documents: TextDocumentInput[],\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray>;\n public async analyzeSentiment(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | AnalyzeSentimentOptions,\n options?: AnalyzeSentimentOptions,\n ): Promise<AnalyzeSentimentResultArray> {\n let realOptions: AnalyzeSentimentOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as AnalyzeSentimentOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-analyzeSentiment\",\n makeGeneratedAnalyzeSentimentOptions(realOptions),\n (finalOptions) =>\n this.client\n .sentiment(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeAnalyzeSentimentResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input strings.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: string[],\n language?: string,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n /**\n * Runs a model to identify a collection of significant phrases\n * found in the passed-in input documents.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async extractKeyPhrases(\n documents: TextDocumentInput[],\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray>;\n public async extractKeyPhrases(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | ExtractKeyPhrasesOptions,\n options?: ExtractKeyPhrasesOptions,\n ): Promise<ExtractKeyPhrasesResultArray> {\n let realOptions: ExtractKeyPhrasesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as ExtractKeyPhrasesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-extractKeyPhrases\",\n makeGeneratedExtractKeyPhrasesOptions(realOptions),\n (finalOptions) =>\n this.client\n .keyPhrases(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeExtractKeyPhrasesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input strings,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizePiiEntities(\n inputs: string[],\n language?: string,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities containing\n * personally identifiable information found in the passed-in input documents,\n * and categorize those entities into types such as US social security\n * number, drivers license number, or credit card number.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param inputs - The input documents to analyze.\n * @param options - Optional parameters for the operation.\n */\n public async recognizePiiEntities(\n inputs: TextDocumentInput[],\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray>;\n public async recognizePiiEntities(\n inputs: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizePiiEntitiesOptions,\n options?: RecognizePiiEntitiesOptions,\n ): Promise<RecognizePiiEntitiesResultArray> {\n let realOptions: RecognizePiiEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (isStringArray(inputs)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(inputs, language);\n realOptions = options || {};\n } else {\n realInputs = inputs;\n realOptions = (languageOrOptions as RecognizePiiEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizePiiEntities\",\n makeGeneratedRecognizePiiEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesRecognitionPii(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizePiiEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input strings, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input strings to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`. \n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: string[],\n language?: string,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n /**\n * Runs a predictive model to identify a collection of entities\n * found in the passed-in input documents, and include information linking the\n * entities to their corresponding entries in a well-known knowledge base.\n * For a list of languages supported by this operation, @see\n * {@link https://learn.microsoft.com/azure/cognitive-services/text-analytics/language-support}.\n * @param documents - The input documents to analyze.\n * @param options - Options for the operation.\n */\n public async recognizeLinkedEntities(\n documents: TextDocumentInput[],\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray>;\n public async recognizeLinkedEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | RecognizeLinkedEntitiesOptions,\n options?: RecognizeLinkedEntitiesOptions,\n ): Promise<RecognizeLinkedEntitiesResultArray> {\n let realOptions: RecognizeLinkedEntitiesOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as RecognizeLinkedEntitiesOptions) || {};\n }\n\n return this._tracing.withSpan(\n \"TextAnalyticsClient-recognizeLinkedEntities\",\n makeGeneratedRecognizeLinkingEntitiesOptions(realOptions),\n (finalOptions) =>\n this.client\n .entitiesLinking(\n {\n documents: realInputs,\n },\n finalOptions,\n )\n .then((result) => makeRecognizeLinkedEntitiesResultArray(realInputs, result)),\n );\n }\n\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: string[],\n language?: string,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n /**\n * Start a healthcare analysis operation to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param documents - Collection of documents to analyze.\n * @param options - Options for the operation.\n */\n async beginAnalyzeHealthcareEntities(\n documents: TextDocumentInput[],\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike>;\n\n async beginAnalyzeHealthcareEntities(\n documents: string[] | TextDocumentInput[],\n languageOrOptions?: string | BeginAnalyzeHealthcareEntitiesOptions,\n options?: BeginAnalyzeHealthcareEntitiesOptions,\n ): Promise<AnalyzeHealthcareEntitiesPollerLike> {\n let realOptions: BeginAnalyzeHealthcareEntitiesOptions;\n let realInputs: TextDocumentInput[];\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeHealthcareEntitiesOptions) || {};\n }\n\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeHealthcarePoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n options: restOptions,\n updateIntervalInMs: updateIntervalInMs,\n resumeFrom: resumeFrom,\n });\n\n await poller.poll();\n return poller;\n }\n\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param language - The language that all the input strings are\n written in. If unspecified, this value will be set to the default\n language in `TextAnalyticsClientOptions`.\n If set to an empty string, the service will apply a model\n where the language is explicitly set to \"None\".\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: string[],\n actions: TextAnalyticsActions,\n language?: string,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique actions to be executed.\n * @param documents - Collection of documents to analyze\n * @param actions - TextAnalyticsActions to execute.\n * @param options - Options for the operation.\n */\n public async beginAnalyzeActions(\n documents: TextDocumentInput[],\n actions: TextAnalyticsActions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike>;\n public async beginAnalyzeActions(\n documents: string[] | TextDocumentInput[],\n actions: TextAnalyticsActions,\n languageOrOptions?: string | BeginAnalyzeActionsOptions,\n options?: BeginAnalyzeActionsOptions,\n ): Promise<AnalyzeActionsPollerLike> {\n let realOptions: BeginAnalyzeActionsOptions;\n let realInputs: TextDocumentInput[];\n\n if (!Array.isArray(documents) || documents.length === 0) {\n throw new Error(\"'documents' must be a non-empty array\");\n }\n\n if (isStringArray(documents)) {\n const language = (languageOrOptions as string) || this.defaultLanguage;\n realInputs = convertToTextDocumentInput(documents, language);\n realOptions = options || {};\n } else {\n realInputs = documents;\n realOptions = (languageOrOptions as BeginAnalyzeActionsOptions) || {};\n }\n const compiledActions = compileAnalyzeInput(actions);\n const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;\n const poller = new BeginAnalyzeActionsPoller({\n client: this.client,\n tracing: this._tracing,\n documents: realInputs,\n actions: compiledActions,\n options: restOptions,\n resumeFrom: resumeFrom,\n updateIntervalInMs: updateIntervalInMs,\n });\n\n await poller.poll();\n return poller;\n }\n}\n\n/**\n * @internal\n */\nfunction compileAnalyzeInput(actions: TextAnalyticsActions): GeneratedActions {\n return {\n entityRecognitionPiiTasks: actions.recognizePiiEntitiesActions?.map(\n compose(setStrEncodingParam, compose(setCategoriesFilter, addParamsToTask)),\n ),\n entityRecognitionTasks: actions.recognizeEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n keyPhraseExtractionTasks: actions.extractKeyPhrasesActions?.map(addParamsToTask),\n entityLinkingTasks: actions.recognizeLinkedEntitiesActions?.map(\n compose(setStrEncodingParam, addParamsToTask),\n ),\n sentimentAnalysisTasks: actions.analyzeSentimentActions?.map(\n compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask)),\n ),\n };\n}\n\nfunction isStringArray(documents: any[]): documents is string[] {\n return typeof documents[0] === \"string\";\n}\n\n/**\n * @internal\n */\nfunction convertToDetectLanguageInput(\n inputs: string[],\n countryHint: string,\n): DetectLanguageInput[] {\n if (countryHint === \"none\") {\n countryHint = \"\";\n }\n return inputs.map((text: string, index): DetectLanguageInput => {\n return {\n id: String(index),\n countryHint,\n text,\n };\n });\n}\n\n/**\n * @internal\n */\nfunction convertToTextDocumentInput(inputs: string[], language: string): TextDocumentInput[] {\n return inputs.map((text: string, index): TextDocumentInput => {\n return {\n id: String(index),\n language,\n text,\n };\n });\n}\n\n/**\n * Creates the options the service expects for the analyze sentiment API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedAnalyzeSentimentOptions(\n params: AnalyzeSentimentOptions,\n): GeneratedAnalyzeSentimentOptions {\n return {\n abortSignal: params.abortSignal,\n opinionMining: params.includeOpinionMining,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize pii entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizePiiEntitiesOptions(\n params: RecognizePiiEntitiesOptions,\n): GeneratedRecognizePiiEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n domain: params.domainFilter,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n piiCategories: params.categoriesFilter,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeCategorizedEntitiesOptions(\n params: RecognizeCategorizedEntitiesOptions,\n): GeneratedRecognizeCategorizedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the detect language API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedDetectLanguageOptions(\n params: DetectLanguageOptions,\n): GeneratedDetectLanguageOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the extract key phrases API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedExtractKeyPhrasesOptions(\n params: ExtractKeyPhrasesOptions,\n): GeneratedExtractKeyPhrasesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n };\n}\n\n/**\n * Creates the options the service expects for the recognize linked entities API from the user friendly ones.\n * @param params - the user friendly parameters\n * @internal\n */\nfunction makeGeneratedRecognizeLinkingEntitiesOptions(\n params: RecognizeLinkedEntitiesOptions,\n): GeneratedRecognizeLinkedEntitiesOptions {\n return {\n abortSignal: params.abortSignal,\n includeStatistics: params.includeStatistics,\n modelVersion: params.modelVersion,\n requestOptions: params.requestOptions,\n tracingOptions: params.tracingOptions,\n onResponse: params.onResponse,\n serializerOptions: params.serializerOptions,\n loggingOptOut: params.disableServiceLogs,\n stringIndexType: setStrEncodingParamValue(params.stringIndexType),\n };\n}\n"]}
package/dist/esm/util.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { __rest } from "tslib";
4
3
  import { RestError } from "@azure/core-rest-pipeline";
5
4
  import { logger } from "./logger.js";
6
5
  /**
@@ -67,7 +66,7 @@ const jsEncodingUnit = "Utf16CodeUnit";
67
66
  * @internal
68
67
  */
69
68
  export function addStrEncodingParam(options) {
70
- return Object.assign(Object.assign({}, options), { stringIndexType: options.stringIndexType || jsEncodingUnit });
69
+ return { ...options, stringIndexType: options.stringIndexType || jsEncodingUnit };
71
70
  }
72
71
  /**
73
72
  * Set the stringIndexType property with default if it does not exist in x.
@@ -75,7 +74,7 @@ export function addStrEncodingParam(options) {
75
74
  * @internal
76
75
  */
77
76
  export function setStrEncodingParam(x) {
78
- return Object.assign(Object.assign({}, x), { stringIndexType: x.stringIndexType || jsEncodingUnit });
77
+ return { ...x, stringIndexType: x.stringIndexType || jsEncodingUnit };
79
78
  }
80
79
  export function setStrEncodingParamValue(stringIndexType) {
81
80
  return stringIndexType || jsEncodingUnit;
@@ -85,20 +84,20 @@ export function setStrEncodingParamValue(stringIndexType) {
85
84
  * @internal
86
85
  */
87
86
  export function setOpinionMining(x) {
88
- return Object.assign(Object.assign({}, x), { opinionMining: x.includeOpinionMining });
87
+ return { ...x, opinionMining: x.includeOpinionMining };
89
88
  }
90
89
  /**
91
90
  * Set the pii categories property
92
91
  * @internal
93
92
  */
94
93
  export function setCategoriesFilter(x) {
95
- return Object.assign(Object.assign({}, x), { piiCategories: x.categoriesFilter });
94
+ return { ...x, piiCategories: x.categoriesFilter };
96
95
  }
97
96
  /**
98
97
  * @internal
99
98
  */
100
99
  export function addParamsToTask(action) {
101
- const { actionName } = action, params = __rest(action, ["actionName"]);
100
+ const { actionName, ...params } = action;
102
101
  return { parameters: params, taskName: actionName };
103
102
  }
104
103
  /**
@@ -146,12 +145,11 @@ function appendReadableErrorMessage(currentMessage, innerMessage) {
146
145
  * @param error - the incoming error
147
146
  */
148
147
  function transformError(errorResponse) {
149
- var _a;
150
148
  const strongErrorResponse = errorResponse;
151
149
  if (!strongErrorResponse.response) {
152
150
  throw errorResponse;
153
151
  }
154
- const topLevelError = (_a = strongErrorResponse.response.parsedBody) === null || _a === void 0 ? void 0 : _a.error;
152
+ const topLevelError = strongErrorResponse.response.parsedBody?.error;
155
153
  if (!topLevelError)
156
154
  return errorResponse;
157
155
  let errorMessage = topLevelError.message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AC;QAC5B,CAAC;QACD,OAAO,KAA2B,CAAC;IACrC,CAAC;IACD,MAAM,CAAC,aAAa,CAAC,CAAC;IACtB,OAAO,IAAI,SAAS,CAAC,YAAY,EAAE;QACjC,IAAI,EAAE,IAAI,KAAK,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI;QACjE,UAAU,EAAE,mBAAmB,CAAC,UAAU;KAC3C,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAI,CAAa;IAC/C,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,CAAC;IACjB,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACpB,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAgB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAa,GAAkB,EAAE,GAAkB;IACxE,OAAO,CAAC,KAAS,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { logger } from \"./logger.js\";\nimport type {\n ErrorResponse,\n StringIndexType as GeneratedStringIndexType,\n InnerError,\n TextAnalyticsError,\n} from \"./generated/index.js\";\nimport type { TextAnalyticsAction } from \"./textAnalyticsAction.js\";\n\n/**\n * @internal\n */\ninterface IdObject {\n id: string;\n}\n\n/**\n * Given a sorted array of input objects (with a unique ID) and an unsorted array of results,\n * return a sorted array of results.\n *\n * @internal\n * @param sortedArray - An array of entries sorted by `id`\n * @param unsortedArray - An array of entries that contain `id` but are not sorted\n */\nexport function sortResponseIdObjects<T extends IdObject, U extends IdObject>(\n sortedArray: T[],\n unsortedArray: U[],\n): U[] {\n const unsortedMap = new Map<string, U>();\n for (const item of unsortedArray) {\n unsortedMap.set(item.id, item);\n }\n\n if (unsortedArray.length !== sortedArray.length) {\n const ordinal = unsortedArray.length > sortedArray.length ? \"more\" : \"fewer\";\n logger.warning(\n `The service returned ${ordinal} responses than inputs. Some errors may be treated as fatal.`,\n );\n }\n\n const result: U[] = [];\n for (const sortedItem of sortedArray) {\n const item = unsortedMap.get(sortedItem.id);\n if (item) {\n result.push(item);\n }\n }\n return result;\n}\n\n/**\n * @internal\n */\nexport interface AssessmentIndex {\n document: number;\n sentence: number;\n assessment: number;\n}\n\n/**\n * @internal\n */\nexport function parseAssessmentIndex(pointer: string): AssessmentIndex {\n const regex = new RegExp(/#\\/documents\\/(\\d+)\\/sentences\\/(\\d+)\\/assessments\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n const assessmentIndex: AssessmentIndex = {\n document: parseInt(res[1]),\n sentence: parseInt(res[2]),\n assessment: parseInt(res[3]),\n };\n return assessmentIndex;\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid Assessment pointer`);\n }\n}\n\n/**\n * Parses the index of the healthcare entity from a JSON pointer.\n * @param pointer - a JSON pointer representing an entity\n * @internal\n */\nexport function parseHealthcareEntityIndex(pointer: string): number {\n const regex = new RegExp(/#\\/results\\/documents\\/(\\d+)\\/entities\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n return parseInt(res[2]);\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid healthcare entity pointer`);\n }\n}\n\nconst jsEncodingUnit = \"Utf16CodeUnit\";\n\n/**\n * Measurement units that can used to calculate the offset and length properties.\n */\nexport type StringIndexType = \"TextElement_v8\" | \"UnicodeCodePoint\" | \"Utf16CodeUnit\";\n\n/**\n * @internal\n */\nexport function addStrEncodingParam<Options extends { stringIndexType?: StringIndexType }>(\n options: Options,\n): Options & { stringIndexType: StringIndexType } {\n return { ...options, stringIndexType: options.stringIndexType || jsEncodingUnit };\n}\n\n/**\n * Set the stringIndexType property with default if it does not exist in x.\n * @param options - operation options bag that has a {@link StringIndexType}\n * @internal\n */\nexport function setStrEncodingParam<X extends { stringIndexType?: GeneratedStringIndexType }>(\n x: X,\n): X & { stringIndexType: GeneratedStringIndexType } {\n return { ...x, stringIndexType: x.stringIndexType || jsEncodingUnit };\n}\n\nexport function setStrEncodingParamValue(\n stringIndexType?: GeneratedStringIndexType,\n): GeneratedStringIndexType {\n return stringIndexType || jsEncodingUnit;\n}\n\n/**\n * Set the opinion mining property\n * @internal\n */\nexport function setOpinionMining<X extends { includeOpinionMining?: boolean }>(\n x: X,\n): X & { opinionMining?: boolean } {\n return { ...x, opinionMining: x.includeOpinionMining };\n}\n\n/**\n * Set the pii categories property\n * @internal\n */\nexport function setCategoriesFilter<X extends { categoriesFilter?: string[] }>(\n x: X,\n): X & { piiCategories?: string[] } {\n return { ...x, piiCategories: x.categoriesFilter };\n}\n\n/**\n * @internal\n */\nexport function addParamsToTask<X extends TextAnalyticsAction>(\n action: X,\n): { parameters?: Omit<X, \"actionName\">; taskName?: string } {\n const { actionName, ...params } = action;\n return { parameters: params, taskName: actionName };\n}\n\n/**\n * @internal\n */\ninterface PageParam {\n top: number;\n skip: number;\n}\n\n/**\n * @internal\n */\nexport function nextLinkToTopAndSkip(nextLink: string): PageParam {\n const url = new URL(nextLink);\n const searchParams = new URLSearchParams(url.searchParams);\n let top: number;\n if (searchParams.has(\"$top\")) {\n top = parseInt(searchParams.get(\"$top\")!);\n } else {\n throw new Error(`nextLink URL does not have the $top param: ${nextLink}`);\n }\n let skip: number;\n if (searchParams.has(\"$skip\")) {\n skip = parseInt(searchParams.get(\"$skip\")!);\n } else {\n throw new Error(`nextLink URL does not have the $skip param: ${nextLink}`);\n }\n return {\n skip: skip,\n top: top,\n };\n}\n\n/**\n * @internal\n */\nexport function getOperationId(operationLocation: string): string {\n const lastSlashIndex = operationLocation.lastIndexOf(\"/\");\n return operationLocation.substring(lastSlashIndex + 1);\n}\n\nfunction appendReadableErrorMessage(currentMessage: string, innerMessage: string): string {\n let message = currentMessage;\n if (message.slice(-1) !== \".\") {\n message = message + \".\";\n }\n return message + \" \" + innerMessage;\n}\n\n/**\n * @internal\n * parses incoming errors from the service/\n * @param error - the incoming error\n */\nfunction transformError(errorResponse: unknown): any {\n const strongErrorResponse = errorResponse as {\n response: {\n parsedBody?: ErrorResponse;\n };\n statusCode: number;\n };\n if (!strongErrorResponse.response) {\n throw errorResponse;\n }\n const topLevelError = strongErrorResponse.response.parsedBody?.error;\n if (!topLevelError) return errorResponse;\n let errorMessage = topLevelError.message;\n let code = topLevelError.code;\n function unwrap(error: TextAnalyticsError | InnerError): TextAnalyticsError {\n const innerError = error.innererror;\n if (innerError) {\n if (innerError.message) {\n errorMessage = appendReadableErrorMessage(errorMessage, innerError.message);\n }\n if (innerError.code) {\n code = innerError.code;\n }\n return unwrap(innerError);\n }\n return error as TextAnalyticsError;\n }\n unwrap(topLevelError);\n return new RestError(errorMessage, {\n code: code === \"InvalidDocumentBatch\" ? code : topLevelError.code,\n statusCode: strongErrorResponse.statusCode,\n });\n}\n\nexport async function throwError<T>(p: Promise<T>): Promise<T> {\n try {\n return await p;\n } catch (e: unknown) {\n throw transformError(e);\n }\n}\n\n/**\n * A wrapper for setTimeout that resolves a promise after t milliseconds.\n * @internal\n * @param timeInMs - The number of milliseconds to be delayed.\n * @returns Resolved promise\n */\nexport function delay(timeInMs: number): Promise<void> {\n return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));\n}\n\n/**\n * @internal\n */\nexport function compose<T1, T2, T3>(fn1: (x: T1) => T2, fn2: (y: T2) => T3): (x: T1) => T3 {\n return (value: T1) => fn2(fn1(value));\n}\n"]}
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAA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CAAC;IACD,MAAM,CAAC,aAAa,CAAC,CAAC;IACtB,OAAO,IAAI,SAAS,CAAC,YAAY,EAAE;QACjC,IAAI,EAAE,IAAI,KAAK,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI;QACjE,UAAU,EAAE,mBAAmB,CAAC,UAAU;KAC3C,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAI,CAAa;IAC/C,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,CAAC;IACjB,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACpB,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,QAAgB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAa,GAAkB,EAAE,GAAkB;IACxE,OAAO,CAAC,KAAS,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { logger } from \"./logger.js\";\nimport type {\n ErrorResponse,\n StringIndexType as GeneratedStringIndexType,\n InnerError,\n TextAnalyticsError,\n} from \"./generated/index.js\";\nimport type { TextAnalyticsAction } from \"./textAnalyticsAction.js\";\n\n/**\n * @internal\n */\ninterface IdObject {\n id: string;\n}\n\n/**\n * Given a sorted array of input objects (with a unique ID) and an unsorted array of results,\n * return a sorted array of results.\n *\n * @internal\n * @param sortedArray - An array of entries sorted by `id`\n * @param unsortedArray - An array of entries that contain `id` but are not sorted\n */\nexport function sortResponseIdObjects<T extends IdObject, U extends IdObject>(\n sortedArray: T[],\n unsortedArray: U[],\n): U[] {\n const unsortedMap = new Map<string, U>();\n for (const item of unsortedArray) {\n unsortedMap.set(item.id, item);\n }\n\n if (unsortedArray.length !== sortedArray.length) {\n const ordinal = unsortedArray.length > sortedArray.length ? \"more\" : \"fewer\";\n logger.warning(\n `The service returned ${ordinal} responses than inputs. Some errors may be treated as fatal.`,\n );\n }\n\n const result: U[] = [];\n for (const sortedItem of sortedArray) {\n const item = unsortedMap.get(sortedItem.id);\n if (item) {\n result.push(item);\n }\n }\n return result;\n}\n\n/**\n * @internal\n */\nexport interface AssessmentIndex {\n document: number;\n sentence: number;\n assessment: number;\n}\n\n/**\n * @internal\n */\nexport function parseAssessmentIndex(pointer: string): AssessmentIndex {\n const regex = new RegExp(/#\\/documents\\/(\\d+)\\/sentences\\/(\\d+)\\/assessments\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n const assessmentIndex: AssessmentIndex = {\n document: parseInt(res[1]),\n sentence: parseInt(res[2]),\n assessment: parseInt(res[3]),\n };\n return assessmentIndex;\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid Assessment pointer`);\n }\n}\n\n/**\n * Parses the index of the healthcare entity from a JSON pointer.\n * @param pointer - a JSON pointer representing an entity\n * @internal\n */\nexport function parseHealthcareEntityIndex(pointer: string): number {\n const regex = new RegExp(/#\\/results\\/documents\\/(\\d+)\\/entities\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n return parseInt(res[2]);\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid healthcare entity pointer`);\n }\n}\n\nconst jsEncodingUnit = \"Utf16CodeUnit\";\n\n/**\n * Measurement units that can used to calculate the offset and length properties.\n */\nexport type StringIndexType = \"TextElement_v8\" | \"UnicodeCodePoint\" | \"Utf16CodeUnit\";\n\n/**\n * @internal\n */\nexport function addStrEncodingParam<Options extends { stringIndexType?: StringIndexType }>(\n options: Options,\n): Options & { stringIndexType: StringIndexType } {\n return { ...options, stringIndexType: options.stringIndexType || jsEncodingUnit };\n}\n\n/**\n * Set the stringIndexType property with default if it does not exist in x.\n * @param options - operation options bag that has a {@link StringIndexType}\n * @internal\n */\nexport function setStrEncodingParam<X extends { stringIndexType?: GeneratedStringIndexType }>(\n x: X,\n): X & { stringIndexType: GeneratedStringIndexType } {\n return { ...x, stringIndexType: x.stringIndexType || jsEncodingUnit };\n}\n\nexport function setStrEncodingParamValue(\n stringIndexType?: GeneratedStringIndexType,\n): GeneratedStringIndexType {\n return stringIndexType || jsEncodingUnit;\n}\n\n/**\n * Set the opinion mining property\n * @internal\n */\nexport function setOpinionMining<X extends { includeOpinionMining?: boolean }>(\n x: X,\n): X & { opinionMining?: boolean } {\n return { ...x, opinionMining: x.includeOpinionMining };\n}\n\n/**\n * Set the pii categories property\n * @internal\n */\nexport function setCategoriesFilter<X extends { categoriesFilter?: string[] }>(\n x: X,\n): X & { piiCategories?: string[] } {\n return { ...x, piiCategories: x.categoriesFilter };\n}\n\n/**\n * @internal\n */\nexport function addParamsToTask<X extends TextAnalyticsAction>(\n action: X,\n): { parameters?: Omit<X, \"actionName\">; taskName?: string } {\n const { actionName, ...params } = action;\n return { parameters: params, taskName: actionName };\n}\n\n/**\n * @internal\n */\ninterface PageParam {\n top: number;\n skip: number;\n}\n\n/**\n * @internal\n */\nexport function nextLinkToTopAndSkip(nextLink: string): PageParam {\n const url = new URL(nextLink);\n const searchParams = new URLSearchParams(url.searchParams);\n let top: number;\n if (searchParams.has(\"$top\")) {\n top = parseInt(searchParams.get(\"$top\")!);\n } else {\n throw new Error(`nextLink URL does not have the $top param: ${nextLink}`);\n }\n let skip: number;\n if (searchParams.has(\"$skip\")) {\n skip = parseInt(searchParams.get(\"$skip\")!);\n } else {\n throw new Error(`nextLink URL does not have the $skip param: ${nextLink}`);\n }\n return {\n skip: skip,\n top: top,\n };\n}\n\n/**\n * @internal\n */\nexport function getOperationId(operationLocation: string): string {\n const lastSlashIndex = operationLocation.lastIndexOf(\"/\");\n return operationLocation.substring(lastSlashIndex + 1);\n}\n\nfunction appendReadableErrorMessage(currentMessage: string, innerMessage: string): string {\n let message = currentMessage;\n if (message.slice(-1) !== \".\") {\n message = message + \".\";\n }\n return message + \" \" + innerMessage;\n}\n\n/**\n * @internal\n * parses incoming errors from the service/\n * @param error - the incoming error\n */\nfunction transformError(errorResponse: unknown): any {\n const strongErrorResponse = errorResponse as {\n response: {\n parsedBody?: ErrorResponse;\n };\n statusCode: number;\n };\n if (!strongErrorResponse.response) {\n throw errorResponse;\n }\n const topLevelError = strongErrorResponse.response.parsedBody?.error;\n if (!topLevelError) return errorResponse;\n let errorMessage = topLevelError.message;\n let code = topLevelError.code;\n function unwrap(error: TextAnalyticsError | InnerError): TextAnalyticsError {\n const innerError = error.innererror;\n if (innerError) {\n if (innerError.message) {\n errorMessage = appendReadableErrorMessage(errorMessage, innerError.message);\n }\n if (innerError.code) {\n code = innerError.code;\n }\n return unwrap(innerError);\n }\n return error as TextAnalyticsError;\n }\n unwrap(topLevelError);\n return new RestError(errorMessage, {\n code: code === \"InvalidDocumentBatch\" ? code : topLevelError.code,\n statusCode: strongErrorResponse.statusCode,\n });\n}\n\nexport async function throwError<T>(p: Promise<T>): Promise<T> {\n try {\n return await p;\n } catch (e: unknown) {\n throw transformError(e);\n }\n}\n\n/**\n * A wrapper for setTimeout that resolves a promise after t milliseconds.\n * @internal\n * @param timeInMs - The number of milliseconds to be delayed.\n * @returns Resolved promise\n */\nexport function delay(timeInMs: number): Promise<void> {\n return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));\n}\n\n/**\n * @internal\n */\nexport function compose<T1, T2, T3>(fn1: (x: T1) => T2, fn2: (y: T2) => T3): (x: T1) => T3 {\n return (value: T1) => fn2(fn1(value));\n}\n"]}
@@ -139,19 +139,18 @@ function makeActionResult(documents, makeResultsArray, succeededTasks, erredActi
139
139
  * @internal
140
140
  */
141
141
  export function createAnalyzeActionsResult(response, documents) {
142
- var _a, _b, _c, _d, _e, _f;
143
142
  const recognizeEntitiesActionErrors = [];
144
143
  const recognizePiiEntitiesActionErrors = [];
145
144
  const extractKeyPhrasesActionErrors = [];
146
145
  const recognizeLinkedEntitiesActionErrors = [];
147
146
  const analyzeSentimentActionErrors = [];
148
- categorizeActionErrors((_a = response === null || response === void 0 ? void 0 : response.errors) !== null && _a !== void 0 ? _a : [], recognizeEntitiesActionErrors, recognizePiiEntitiesActionErrors, extractKeyPhrasesActionErrors, recognizeLinkedEntitiesActionErrors, analyzeSentimentActionErrors);
147
+ categorizeActionErrors(response?.errors ?? [], recognizeEntitiesActionErrors, recognizePiiEntitiesActionErrors, extractKeyPhrasesActionErrors, recognizeLinkedEntitiesActionErrors, analyzeSentimentActionErrors);
149
148
  return {
150
- recognizeEntitiesResults: makeActionResult(documents, makeRecognizeCategorizedEntitiesResultArray, (_b = response.tasks.entityRecognitionTasks) !== null && _b !== void 0 ? _b : [], recognizeEntitiesActionErrors),
151
- recognizePiiEntitiesResults: makeActionResult(documents, makeRecognizePiiEntitiesResultArray, (_c = response.tasks.entityRecognitionPiiTasks) !== null && _c !== void 0 ? _c : [], recognizePiiEntitiesActionErrors),
152
- extractKeyPhrasesResults: makeActionResult(documents, makeExtractKeyPhrasesResultArray, (_d = response.tasks.keyPhraseExtractionTasks) !== null && _d !== void 0 ? _d : [], extractKeyPhrasesActionErrors),
153
- recognizeLinkedEntitiesResults: makeActionResult(documents, makeRecognizeLinkedEntitiesResultArray, (_e = response.tasks.entityLinkingTasks) !== null && _e !== void 0 ? _e : [], recognizeLinkedEntitiesActionErrors),
154
- analyzeSentimentResults: makeActionResult(documents, makeAnalyzeSentimentResultArray, (_f = response.tasks.sentimentAnalysisTasks) !== null && _f !== void 0 ? _f : [], analyzeSentimentActionErrors),
149
+ recognizeEntitiesResults: makeActionResult(documents, makeRecognizeCategorizedEntitiesResultArray, response.tasks.entityRecognitionTasks ?? [], recognizeEntitiesActionErrors),
150
+ recognizePiiEntitiesResults: makeActionResult(documents, makeRecognizePiiEntitiesResultArray, response.tasks.entityRecognitionPiiTasks ?? [], recognizePiiEntitiesActionErrors),
151
+ extractKeyPhrasesResults: makeActionResult(documents, makeExtractKeyPhrasesResultArray, response.tasks.keyPhraseExtractionTasks ?? [], extractKeyPhrasesActionErrors),
152
+ recognizeLinkedEntitiesResults: makeActionResult(documents, makeRecognizeLinkedEntitiesResultArray, response.tasks.entityLinkingTasks ?? [], recognizeLinkedEntitiesActionErrors),
153
+ analyzeSentimentResults: makeActionResult(documents, makeAnalyzeSentimentResultArray, response.tasks.sentimentAnalysisTasks ?? [], analyzeSentimentActionErrors),
155
154
  };
156
155
  }
157
156
  //# sourceMappingURL=analyzeActionsResult.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"analyzeActionsResult.js","sourceRoot":"","sources":["../../src/analyzeActionsResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAMrF,OAAO,EAAE,2CAA2C,EAAE,MAAM,8CAA8C,CAAC;AAE3G,OAAO,EAAE,sCAAsC,EAAE,MAAM,yCAAyC,CAAC;AAEjG,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAE3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAiOlE;;;;;GAKG;AACH,SAAS,2BAA2B,CAAC,QAAgB;IACnD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,wBAAwB,CAAC,CAAC,CAAC;YAC9B,OAAO,8BAA8B,CAAC;QACxC,CAAC;QACD,KAAK,2BAA2B,CAAC,CAAC,CAAC;YACjC,OAAO,sBAAsB,CAAC;QAChC,CAAC;QACD,KAAK,0BAA0B,CAAC,CAAC,CAAC;YAChC,OAAO,mBAAmB,CAAC;QAC7B,CAAC;QACD,KAAK,oBAAoB,CA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AkB,mCAAI,EAAE,EACvC,mCAAmC,CACpC;QACD,uBAAuB,EAAE,gBAAgB,CACvC,SAAS,EACT,+BAA+B,EAC/B,MAAA,QAAQ,CAAC,KAAK,CAAC,sBAAsB,mCAAI,EAAE,EAC3C,4BAA4B,CAC7B;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport type { AnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport { makeAnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport type { ExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport { makeExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport type {\n AnalyzeJobState as GeneratedResponse,\n TextDocumentInput,\n} from \"./generated/models/index.js\";\nimport type { RecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport { makeRecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport type { RecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport { makeRecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport type { RecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport { makeRecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport type { ErrorCode, TextAnalyticsError } from \"./textAnalyticsResult.js\";\nimport { intoTextAnalyticsError } from \"./textAnalyticsResult.js\";\n\n/**\n * The results of an analyze Actions operation.\n */\nexport interface AnalyzeActionsResult {\n /**\n * Array of the results for each categorized entities recognition action.\n */\n recognizeEntitiesResults: RecognizeCategorizedEntitiesActionResult[];\n /**\n * Array of the results for each Pii entities recognition action.\n */\n recognizePiiEntitiesResults: RecognizePiiEntitiesActionResult[];\n /**\n * Array of the results for each key phrases extraction action.\n */\n extractKeyPhrasesResults: ExtractKeyPhrasesActionResult[];\n /**\n * Array of the results for each linked entities recognition action.\n */\n recognizeLinkedEntitiesResults: RecognizeLinkedEntitiesActionResult[];\n /**\n * Array of the results for each analyze sentiment action.\n */\n analyzeSentimentResults: AnalyzeSentimentActionResult[];\n}\n\n/**\n * The state of a succeeded action.\n */\nexport interface TextAnalyticsActionSuccessState {\n /**\n * When this action was completed by the service.\n */\n readonly completedOn: Date;\n /**\n * Discriminant to determine if that this is an error result.\n */\n readonly error?: undefined;\n}\n\n/**\n * The error of an analyze batch action.\n */\nexport interface TextAnalyticsActionErrorResult {\n /**\n * When this action was completed by the service.\n */\n readonly failedOn: Date;\n /**\n * The Error for this action result.\n */\n readonly error: TextAnalyticsError;\n}\n\n/**\n * The error of a recognize categorized entities action.\n */\nexport type RecognizeCategorizedEntitiesActionErrorResult = TextAnalyticsActionErrorResult;\n\n/**\n * The results of a succeeded recognize categorized entities action.\n */\nexport interface RecognizeCategorizedEntitiesActionSuccessResult\n extends TextAnalyticsActionSuccessState {\n /**\n * Array of the results for each categorized entities recognition action.\n */\n results: RecognizeCategorizedEntitiesResultArray;\n}\n\n/**\n * The result of a recognize categorized entities action.\n */\nexport type RecognizeCategorizedEntitiesActionResult =\n | RecognizeCategorizedEntitiesActionSuccessResult\n | RecognizeCategorizedEntitiesActionErrorResult;\n\n/**\n * The error of a recognize pii entities action.\n */\nexport type RecognizePiiEntitiesActionErrorResult = TextAnalyticsActionErrorResult;\n\n/**\n * The results of a succeeded recognize pii entities action.\n */\nexport interface RecognizePiiEntitiesActionSuccessResult extends TextAnalyticsActionSuccessState {\n /**\n * Array of the results for each pii entities recognition action.\n */\n results: RecognizePiiEntitiesResultArray;\n}\n\n/**\n * The result of a recognize pii entities action.\n */\nexport type RecognizePiiEntitiesActionResult =\n | RecognizePiiEntitiesActionSuccessResult\n | RecognizePiiEntitiesActionErrorResult;\n\n/**\n * The error of a extract key phrases action.\n */\nexport type ExtractKeyPhrasesActionErrorResult = TextAnalyticsActionErrorResult;\n\n/**\n * The results of a succeeded extract key phrases action.\n */\nexport interface ExtractKeyPhrasesActionSuccessResult extends TextAnalyticsActionSuccessState {\n /**\n * Array of the results for each extract key phrases action.\n */\n results: ExtractKeyPhrasesResultArray;\n}\n\n/**\n * The result of a extract key phrases action.\n */\nexport type ExtractKeyPhrasesActionResult =\n | ExtractKeyPhrasesActionSuccessResult\n | ExtractKeyPhrasesActionErrorResult;\n\n/**\n * The error of a recognize linked entities action.\n */\nexport type RecognizeLinkedEntitiesActionErrorResult = TextAnalyticsActionErrorResult;\n\n/**\n * The results of a succeeded recognize linked entities action.\n */\nexport interface RecognizeLinkedEntitiesActionSuccessResult\n extends TextAnalyticsActionSuccessState {\n /**\n * Array of the results for each linked entities recognition action.\n */\n results: RecognizeLinkedEntitiesResultArray;\n}\n\n/**\n * The result of a recognize linked entities action.\n */\nexport type RecognizeLinkedEntitiesActionResult =\n | RecognizeLinkedEntitiesActionSuccessResult\n | RecognizeLinkedEntitiesActionErrorResult;\n\n/**\n * The error of an analyze sentiment action.\n */\nexport type AnalyzeSentimentActionErrorResult = TextAnalyticsActionErrorResult;\n\n/**\n * The results of a succeeded analyze sentiment action.\n */\nexport interface AnalyzeSentimentActionSuccessResult extends TextAnalyticsActionSuccessState {\n /**\n * Array of the results for each analyze sentiment action.\n */\n results: AnalyzeSentimentResultArray;\n}\n\n/**\n * The result of an analyze sentiment action.\n */\nexport type AnalyzeSentimentActionResult =\n | AnalyzeSentimentActionSuccessResult\n | AnalyzeSentimentActionErrorResult;\n\n/**\n * The results of an analyze Actions operation represented as a paged iterator that\n * iterates over the results of the requested actions.\n */\nexport type PagedAsyncIterableAnalyzeActionsResult = PagedAsyncIterableIterator<\n AnalyzeActionsResult,\n AnalyzeActionsResult\n>;\n\n/**\n * The results of an analyze actions operation represented as a paged iterator that\n * iterates over the results of the requested actions.\n */\nexport interface PagedAnalyzeActionsResult extends PagedAsyncIterableAnalyzeActionsResult {\n // /**\n // * Statistics about the input document batch and how it was processed\n // * by the service. This property will have a value when includeStatistics is set to true\n // * in the client call.\n // */\n // statistics?: TextDocumentBatchStatistics;\n}\n\n/**\n * The type of different actions supported by the begin analyze actions operation.\n * @internal\n */\ntype TextAnalyticsActionType =\n | \"RecognizeCategorizedEntities\"\n | \"RecognizePiiEntities\"\n | \"ExtractKeyPhrases\"\n | \"RecognizeLinkedEntities\"\n | \"AnalyzeSentiment\";\n\n/**\n * The type of an action error with the type of the action that erred and its\n * index in the list of input actions.\n * @internal\n */\ninterface TextAnalyticsActionError {\n /**\n * A code describing the kind of error produced\n */\n readonly code: ErrorCode;\n /**\n * A message from the service explaining the error\n */\n readonly message: string;\n /**\n * The type of the action that erred\n */\n readonly type: TextAnalyticsActionType;\n /**\n * The index of the action that erred in the list of input actions\n */\n readonly index: number;\n}\n\n/**\n * Converts the service task name (in the JSON pointer in an action error) to an action type name.\n * @param serviceActionType - The task type name the service uses.\n * @returns the action type name that the package uses\n * @internal\n */\nfunction convertTaskTypeToActionType(taskType: string): TextAnalyticsActionType {\n switch (taskType) {\n case \"entityRecognitionTasks\": {\n return \"RecognizeCategorizedEntities\";\n }\n case \"entityRecognitionPiiTasks\": {\n return \"RecognizePiiEntities\";\n }\n case \"keyPhraseExtractionTasks\": {\n return \"ExtractKeyPhrases\";\n }\n case \"entityLinkingTasks\": {\n return \"RecognizeLinkedEntities\";\n }\n case \"sentimentAnalysisTasks\": {\n return \"AnalyzeSentiment\";\n }\n default: {\n throw new Error(`unexpected action type from the service: ${taskType}`);\n }\n }\n}\n\n/**\n * Converts a service action error to one with the JSON pointer converted to an action index.\n * @param erredActions - the action error the service sent\n * @returns an action error with an action type and index\n * @internal\n */\nexport function parseActionError(erredActions: TextAnalyticsError): TextAnalyticsActionError {\n if (erredActions.target) {\n const regex = new RegExp(\n /#\\/tasks\\/(entityRecognitionTasks|entityRecognitionPiiTasks|keyPhraseExtractionTasks|entityLinkingTasks|sentimentAnalysisTasks)\\/(\\d+)/,\n );\n const result = regex.exec(erredActions.target);\n if (result !== null) {\n return {\n code: erredActions.code,\n message: erredActions.message,\n index: parseInt(result[2]),\n type: convertTaskTypeToActionType(result[1]),\n };\n } else {\n throw new Error(`Pointer \"${erredActions.target}\" is not a valid action pointer`);\n }\n } else {\n throw new Error(\n \"expected an error with a target field referencing an action but did not get one\",\n );\n }\n}\n\n/**\n * Categorize each action error into a bucket according to its action type.\n * @param erredActions - list of action errors\n * @param recognizeEntitiesActionErrors - a list of recognize entities action errors to be filled from the errors list\n * @param recognizePiiEntitiesActionErrors - a list of recognize pii entities action errors to be filled from the errors list\n * @param extractKeyPhrasesActionErrors - a list of extract key phrases action errors to be filled from the errors list\n * @internal\n */\nfunction categorizeActionErrors(\n erredActions: TextAnalyticsError[],\n recognizeEntitiesActionErrors: TextAnalyticsActionError[],\n recognizePiiEntitiesActionErrors: TextAnalyticsActionError[],\n extractKeyPhrasesActionErrors: TextAnalyticsActionError[],\n recognizeLinkedEntitiesActionErrors: TextAnalyticsActionError[],\n analyzeSentimentActionErrors: TextAnalyticsActionError[],\n): void {\n for (const error of erredActions) {\n const actionError = parseActionError(error);\n switch (actionError.type) {\n case \"RecognizeCategorizedEntities\": {\n recognizeEntitiesActionErrors.push(actionError);\n break;\n }\n case \"RecognizePiiEntities\": {\n recognizePiiEntitiesActionErrors.push(actionError);\n break;\n }\n case \"ExtractKeyPhrases\": {\n extractKeyPhrasesActionErrors.push(actionError);\n break;\n }\n case \"RecognizeLinkedEntities\": {\n recognizeLinkedEntitiesActionErrors.push(actionError);\n break;\n }\n case \"AnalyzeSentiment\": {\n analyzeSentimentActionErrors.push(actionError);\n break;\n }\n }\n }\n}\n\n/**\n * @internal\n * @param error - the error the service sent for a task\n * @param lastUpdateDateTime - the time when this task failed\n */\nfunction createErredAction(\n error: TextAnalyticsActionError,\n lastUpdateDateTime: Date,\n): TextAnalyticsActionErrorResult {\n return { error: intoTextAnalyticsError(error), failedOn: lastUpdateDateTime };\n}\n\ninterface TaskSuccessResult<T> {\n results?: T;\n lastUpdateDateTime: Date;\n}\n\ntype ActionResult<TSuccess> =\n | {\n results: TSuccess;\n completedOn: Date;\n }\n | TextAnalyticsActionErrorResult;\n\n/**\n * Creates a list of results for any action.\n * @param documents - list of input documents\n * @param makeResultsArray - a function to convert the results of a service response to the SDK's one\n * @param succeededTasks - list of succeeded action results\n * @param erredActions - list of erred actions\n * @internal\n */\nfunction makeActionResult<TTaskResult, TActionResult>(\n documents: TextDocumentInput[],\n makeResultsArray: (docs: TextDocumentInput[], x: TTaskResult) => TActionResult,\n succeededTasks: TaskSuccessResult<TTaskResult>[],\n erredActions: TextAnalyticsActionError[],\n): ActionResult<TActionResult>[] {\n let errorIndex = 0;\n function convertTasksToActions(\n actions: ActionResult<TActionResult>[],\n task: TaskSuccessResult<TTaskResult>,\n ): ActionResult<TActionResult>[] {\n const { results: actionResults, lastUpdateDateTime } = task;\n if (actionResults !== undefined) {\n const recognizeEntitiesResults = makeResultsArray(documents, actionResults);\n return [\n ...actions,\n {\n results: recognizeEntitiesResults,\n completedOn: lastUpdateDateTime,\n },\n ];\n } else {\n return [...actions, createErredAction(erredActions[errorIndex++], lastUpdateDateTime)];\n }\n }\n return succeededTasks.reduce(convertTasksToActions, []);\n}\n\n/**\n * Creates the user-friendly action results object for the begin analyze actions operation.\n * @param response - the begin analyze actions operation response\n * @param documents - the list of input documents\n * @returns - the user-friendly action results object\n * @internal\n */\nexport function createAnalyzeActionsResult(\n response: GeneratedResponse,\n documents: TextDocumentInput[],\n): AnalyzeActionsResult {\n const recognizeEntitiesActionErrors: TextAnalyticsActionError[] = [];\n const recognizePiiEntitiesActionErrors: TextAnalyticsActionError[] = [];\n const extractKeyPhrasesActionErrors: TextAnalyticsActionError[] = [];\n const recognizeLinkedEntitiesActionErrors: TextAnalyticsActionError[] = [];\n const analyzeSentimentActionErrors: TextAnalyticsActionError[] = [];\n categorizeActionErrors(\n response?.errors ?? [],\n recognizeEntitiesActionErrors,\n recognizePiiEntitiesActionErrors,\n extractKeyPhrasesActionErrors,\n recognizeLinkedEntitiesActionErrors,\n analyzeSentimentActionErrors,\n );\n return {\n recognizeEntitiesResults: makeActionResult(\n documents,\n makeRecognizeCategorizedEntitiesResultArray,\n response.tasks.entityRecognitionTasks ?? [],\n recognizeEntitiesActionErrors,\n ),\n recognizePiiEntitiesResults: makeActionResult(\n documents,\n makeRecognizePiiEntitiesResultArray,\n response.tasks.entityRecognitionPiiTasks ?? [],\n recognizePiiEntitiesActionErrors,\n ),\n extractKeyPhrasesResults: makeActionResult(\n documents,\n makeExtractKeyPhrasesResultArray,\n response.tasks.keyPhraseExtractionTasks ?? [],\n extractKeyPhrasesActionErrors,\n ),\n recognizeLinkedEntitiesResults: makeActionResult(\n documents,\n makeRecognizeLinkedEntitiesResultArray,\n response.tasks.entityLinkingTasks ?? [],\n recognizeLinkedEntitiesActionErrors,\n ),\n analyzeSentimentResults: makeActionResult(\n documents,\n makeAnalyzeSentimentResultArray,\n response.tasks.sentimentAnalysisTasks ?? [],\n analyzeSentimentActionErrors,\n ),\n };\n}\n"]}
1
+ {"version":3,"file":"analyzeActionsResult.js","sourceRoot":"","sources":["../../src/analyzeActionsResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAMrF,OAAO,EAAE,2CAA2C,EAAE,MAAM,8CAA8C,CAAC;AAE3G,OAAO,EAAE,sCAAsC,EAAE,MAAM,yCAAyC,CAAC;AAEjG,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAE3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAiOlE;;;;;GAKG;AACH,SAAS,2BAA2B,CAAC,QAAgB;IACnD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,wBAAwB,CAAC,CAAC,CAAC;YAC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C,KAAK,CAAC,wBAAwB,IAAI,EAAE,EAC7C,6BAA6B,CAC9B;QACD,8BAA8B,EAAE,gBAAgB,CAC9C,SAAS,EACT,sCAAsC,EACtC,QAAQ,CAAC,KAAK,CAAC,kBAAkB,IAAI,EAAE,EACvC,mCAAmC,CACpC;QACD,uBAAuB,EAAE,gBAAgB,CACvC,SAAS,EACT,+BAA+B,EAC/B,QAAQ,CAAC,KAAK,CAAC,sBAAsB,IAAI,EAAE,EAC3C,4BAA4B,CAC7B;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport type { AnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport { makeAnalyzeSentimentResultArray } from \"./analyzeSentimentResultArray.js\";\nimport type { ExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport { makeExtractKeyPhrasesResultArray } from \"./extractKeyPhrasesResultArray.js\";\nimport type {\n AnalyzeJobState as GeneratedResponse,\n TextDocumentInput,\n} from \"./generated/models/index.js\";\nimport type { RecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport { makeRecognizeCategorizedEntitiesResultArray } from \"./recognizeCategorizedEntitiesResultArray.js\";\nimport type { RecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport { makeRecognizeLinkedEntitiesResultArray } from \"./recognizeLinkedEntitiesResultArray.js\";\nimport type { RecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport { makeRecognizePiiEntitiesResultArray } from \"./recognizePiiEntitiesResultArray.js\";\nimport type { ErrorCode, TextAnalyticsError } from \"./textAnalyticsResult.js\";\nimport { intoTextAnalyticsError } from \"./textAnalyticsResult.js\";\n\n/**\n * The results of an analyze Actions operation.\n */\nexport interface AnalyzeActionsResult {\n /**\n * Array of the results for each categorized entities recognition action.\n */\n recognizeEntitiesResults: RecognizeCategorizedEntitiesActionResult[];\n /**\n * Array of the results for each Pii entities recognition action.\n */\n recognizePiiEntitiesResults: RecognizePiiEntitiesActionResult[];\n /**\n * Array of the results for each key phrases extraction action.\n */\n extractKeyPhrasesResults: ExtractKeyPhrasesActionResult[];\n /**\n * Array of the results for each linked entities recognition action.\n */\n recognizeLinkedEntitiesResults: RecognizeLinkedEntitiesActionResult[];\n /**\n * Array of the results for each analyze sentiment action.\n */\n analyzeSentimentResults: AnalyzeSentimentActionResult[];\n}\n\n/**\n * The state of a succeeded action.\n */\nexport interface TextAnalyticsActionSuccessState {\n /**\n * When this action was completed by the service.\n */\n readonly completedOn: Date;\n /**\n * Discriminant to determine if that this is an error result.\n */\n readonly error?: undefined;\n}\n\n/**\n * The error of an analyze batch action.\n */\nexport interface TextAnalyticsActionErrorResult {\n /**\n * When this action was completed by the service.\n */\n readonly failedOn: Date;\n /**\n * The Error for this action result.\n */\n readonly error: TextAnalyticsError;\n}\n\n/**\n * The error of a recognize categorized entities action.\n */\nexport type RecognizeCategorizedEntitiesActionErrorResult = TextAnalyticsActionErrorResult;\n\n/**\n * The results of a succeeded recognize categorized entities action.\n */\nexport interface RecognizeCategorizedEntitiesActionSuccessResult\n extends TextAnalyticsActionSuccessState {\n /**\n * Array of the results for each categorized entities recognition action.\n */\n results: RecognizeCategorizedEntitiesResultArray;\n}\n\n/**\n * The result of a recognize categorized entities action.\n */\nexport type RecognizeCategorizedEntitiesActionResult =\n | RecognizeCategorizedEntitiesActionSuccessResult\n | RecognizeCategorizedEntitiesActionErrorResult;\n\n/**\n * The error of a recognize pii entities action.\n */\nexport type RecognizePiiEntitiesActionErrorResult = TextAnalyticsActionErrorResult;\n\n/**\n * The results of a succeeded recognize pii entities action.\n */\nexport interface RecognizePiiEntitiesActionSuccessResult extends TextAnalyticsActionSuccessState {\n /**\n * Array of the results for each pii entities recognition action.\n */\n results: RecognizePiiEntitiesResultArray;\n}\n\n/**\n * The result of a recognize pii entities action.\n */\nexport type RecognizePiiEntitiesActionResult =\n | RecognizePiiEntitiesActionSuccessResult\n | RecognizePiiEntitiesActionErrorResult;\n\n/**\n * The error of a extract key phrases action.\n */\nexport type ExtractKeyPhrasesActionErrorResult = TextAnalyticsActionErrorResult;\n\n/**\n * The results of a succeeded extract key phrases action.\n */\nexport interface ExtractKeyPhrasesActionSuccessResult extends TextAnalyticsActionSuccessState {\n /**\n * Array of the results for each extract key phrases action.\n */\n results: ExtractKeyPhrasesResultArray;\n}\n\n/**\n * The result of a extract key phrases action.\n */\nexport type ExtractKeyPhrasesActionResult =\n | ExtractKeyPhrasesActionSuccessResult\n | ExtractKeyPhrasesActionErrorResult;\n\n/**\n * The error of a recognize linked entities action.\n */\nexport type RecognizeLinkedEntitiesActionErrorResult = TextAnalyticsActionErrorResult;\n\n/**\n * The results of a succeeded recognize linked entities action.\n */\nexport interface RecognizeLinkedEntitiesActionSuccessResult\n extends TextAnalyticsActionSuccessState {\n /**\n * Array of the results for each linked entities recognition action.\n */\n results: RecognizeLinkedEntitiesResultArray;\n}\n\n/**\n * The result of a recognize linked entities action.\n */\nexport type RecognizeLinkedEntitiesActionResult =\n | RecognizeLinkedEntitiesActionSuccessResult\n | RecognizeLinkedEntitiesActionErrorResult;\n\n/**\n * The error of an analyze sentiment action.\n */\nexport type AnalyzeSentimentActionErrorResult = TextAnalyticsActionErrorResult;\n\n/**\n * The results of a succeeded analyze sentiment action.\n */\nexport interface AnalyzeSentimentActionSuccessResult extends TextAnalyticsActionSuccessState {\n /**\n * Array of the results for each analyze sentiment action.\n */\n results: AnalyzeSentimentResultArray;\n}\n\n/**\n * The result of an analyze sentiment action.\n */\nexport type AnalyzeSentimentActionResult =\n | AnalyzeSentimentActionSuccessResult\n | AnalyzeSentimentActionErrorResult;\n\n/**\n * The results of an analyze Actions operation represented as a paged iterator that\n * iterates over the results of the requested actions.\n */\nexport type PagedAsyncIterableAnalyzeActionsResult = PagedAsyncIterableIterator<\n AnalyzeActionsResult,\n AnalyzeActionsResult\n>;\n\n/**\n * The results of an analyze actions operation represented as a paged iterator that\n * iterates over the results of the requested actions.\n */\nexport interface PagedAnalyzeActionsResult extends PagedAsyncIterableAnalyzeActionsResult {\n // /**\n // * Statistics about the input document batch and how it was processed\n // * by the service. This property will have a value when includeStatistics is set to true\n // * in the client call.\n // */\n // statistics?: TextDocumentBatchStatistics;\n}\n\n/**\n * The type of different actions supported by the begin analyze actions operation.\n * @internal\n */\ntype TextAnalyticsActionType =\n | \"RecognizeCategorizedEntities\"\n | \"RecognizePiiEntities\"\n | \"ExtractKeyPhrases\"\n | \"RecognizeLinkedEntities\"\n | \"AnalyzeSentiment\";\n\n/**\n * The type of an action error with the type of the action that erred and its\n * index in the list of input actions.\n * @internal\n */\ninterface TextAnalyticsActionError {\n /**\n * A code describing the kind of error produced\n */\n readonly code: ErrorCode;\n /**\n * A message from the service explaining the error\n */\n readonly message: string;\n /**\n * The type of the action that erred\n */\n readonly type: TextAnalyticsActionType;\n /**\n * The index of the action that erred in the list of input actions\n */\n readonly index: number;\n}\n\n/**\n * Converts the service task name (in the JSON pointer in an action error) to an action type name.\n * @param serviceActionType - The task type name the service uses.\n * @returns the action type name that the package uses\n * @internal\n */\nfunction convertTaskTypeToActionType(taskType: string): TextAnalyticsActionType {\n switch (taskType) {\n case \"entityRecognitionTasks\": {\n return \"RecognizeCategorizedEntities\";\n }\n case \"entityRecognitionPiiTasks\": {\n return \"RecognizePiiEntities\";\n }\n case \"keyPhraseExtractionTasks\": {\n return \"ExtractKeyPhrases\";\n }\n case \"entityLinkingTasks\": {\n return \"RecognizeLinkedEntities\";\n }\n case \"sentimentAnalysisTasks\": {\n return \"AnalyzeSentiment\";\n }\n default: {\n throw new Error(`unexpected action type from the service: ${taskType}`);\n }\n }\n}\n\n/**\n * Converts a service action error to one with the JSON pointer converted to an action index.\n * @param erredActions - the action error the service sent\n * @returns an action error with an action type and index\n * @internal\n */\nexport function parseActionError(erredActions: TextAnalyticsError): TextAnalyticsActionError {\n if (erredActions.target) {\n const regex = new RegExp(\n /#\\/tasks\\/(entityRecognitionTasks|entityRecognitionPiiTasks|keyPhraseExtractionTasks|entityLinkingTasks|sentimentAnalysisTasks)\\/(\\d+)/,\n );\n const result = regex.exec(erredActions.target);\n if (result !== null) {\n return {\n code: erredActions.code,\n message: erredActions.message,\n index: parseInt(result[2]),\n type: convertTaskTypeToActionType(result[1]),\n };\n } else {\n throw new Error(`Pointer \"${erredActions.target}\" is not a valid action pointer`);\n }\n } else {\n throw new Error(\n \"expected an error with a target field referencing an action but did not get one\",\n );\n }\n}\n\n/**\n * Categorize each action error into a bucket according to its action type.\n * @param erredActions - list of action errors\n * @param recognizeEntitiesActionErrors - a list of recognize entities action errors to be filled from the errors list\n * @param recognizePiiEntitiesActionErrors - a list of recognize pii entities action errors to be filled from the errors list\n * @param extractKeyPhrasesActionErrors - a list of extract key phrases action errors to be filled from the errors list\n * @internal\n */\nfunction categorizeActionErrors(\n erredActions: TextAnalyticsError[],\n recognizeEntitiesActionErrors: TextAnalyticsActionError[],\n recognizePiiEntitiesActionErrors: TextAnalyticsActionError[],\n extractKeyPhrasesActionErrors: TextAnalyticsActionError[],\n recognizeLinkedEntitiesActionErrors: TextAnalyticsActionError[],\n analyzeSentimentActionErrors: TextAnalyticsActionError[],\n): void {\n for (const error of erredActions) {\n const actionError = parseActionError(error);\n switch (actionError.type) {\n case \"RecognizeCategorizedEntities\": {\n recognizeEntitiesActionErrors.push(actionError);\n break;\n }\n case \"RecognizePiiEntities\": {\n recognizePiiEntitiesActionErrors.push(actionError);\n break;\n }\n case \"ExtractKeyPhrases\": {\n extractKeyPhrasesActionErrors.push(actionError);\n break;\n }\n case \"RecognizeLinkedEntities\": {\n recognizeLinkedEntitiesActionErrors.push(actionError);\n break;\n }\n case \"AnalyzeSentiment\": {\n analyzeSentimentActionErrors.push(actionError);\n break;\n }\n }\n }\n}\n\n/**\n * @internal\n * @param error - the error the service sent for a task\n * @param lastUpdateDateTime - the time when this task failed\n */\nfunction createErredAction(\n error: TextAnalyticsActionError,\n lastUpdateDateTime: Date,\n): TextAnalyticsActionErrorResult {\n return { error: intoTextAnalyticsError(error), failedOn: lastUpdateDateTime };\n}\n\ninterface TaskSuccessResult<T> {\n results?: T;\n lastUpdateDateTime: Date;\n}\n\ntype ActionResult<TSuccess> =\n | {\n results: TSuccess;\n completedOn: Date;\n }\n | TextAnalyticsActionErrorResult;\n\n/**\n * Creates a list of results for any action.\n * @param documents - list of input documents\n * @param makeResultsArray - a function to convert the results of a service response to the SDK's one\n * @param succeededTasks - list of succeeded action results\n * @param erredActions - list of erred actions\n * @internal\n */\nfunction makeActionResult<TTaskResult, TActionResult>(\n documents: TextDocumentInput[],\n makeResultsArray: (docs: TextDocumentInput[], x: TTaskResult) => TActionResult,\n succeededTasks: TaskSuccessResult<TTaskResult>[],\n erredActions: TextAnalyticsActionError[],\n): ActionResult<TActionResult>[] {\n let errorIndex = 0;\n function convertTasksToActions(\n actions: ActionResult<TActionResult>[],\n task: TaskSuccessResult<TTaskResult>,\n ): ActionResult<TActionResult>[] {\n const { results: actionResults, lastUpdateDateTime } = task;\n if (actionResults !== undefined) {\n const recognizeEntitiesResults = makeResultsArray(documents, actionResults);\n return [\n ...actions,\n {\n results: recognizeEntitiesResults,\n completedOn: lastUpdateDateTime,\n },\n ];\n } else {\n return [...actions, createErredAction(erredActions[errorIndex++], lastUpdateDateTime)];\n }\n }\n return succeededTasks.reduce(convertTasksToActions, []);\n}\n\n/**\n * Creates the user-friendly action results object for the begin analyze actions operation.\n * @param response - the begin analyze actions operation response\n * @param documents - the list of input documents\n * @returns - the user-friendly action results object\n * @internal\n */\nexport function createAnalyzeActionsResult(\n response: GeneratedResponse,\n documents: TextDocumentInput[],\n): AnalyzeActionsResult {\n const recognizeEntitiesActionErrors: TextAnalyticsActionError[] = [];\n const recognizePiiEntitiesActionErrors: TextAnalyticsActionError[] = [];\n const extractKeyPhrasesActionErrors: TextAnalyticsActionError[] = [];\n const recognizeLinkedEntitiesActionErrors: TextAnalyticsActionError[] = [];\n const analyzeSentimentActionErrors: TextAnalyticsActionError[] = [];\n categorizeActionErrors(\n response?.errors ?? [],\n recognizeEntitiesActionErrors,\n recognizePiiEntitiesActionErrors,\n extractKeyPhrasesActionErrors,\n recognizeLinkedEntitiesActionErrors,\n analyzeSentimentActionErrors,\n );\n return {\n recognizeEntitiesResults: makeActionResult(\n documents,\n makeRecognizeCategorizedEntitiesResultArray,\n response.tasks.entityRecognitionTasks ?? [],\n recognizeEntitiesActionErrors,\n ),\n recognizePiiEntitiesResults: makeActionResult(\n documents,\n makeRecognizePiiEntitiesResultArray,\n response.tasks.entityRecognitionPiiTasks ?? [],\n recognizePiiEntitiesActionErrors,\n ),\n extractKeyPhrasesResults: makeActionResult(\n documents,\n makeExtractKeyPhrasesResultArray,\n response.tasks.keyPhraseExtractionTasks ?? [],\n extractKeyPhrasesActionErrors,\n ),\n recognizeLinkedEntitiesResults: makeActionResult(\n documents,\n makeRecognizeLinkedEntitiesResultArray,\n response.tasks.entityLinkingTasks ?? [],\n recognizeLinkedEntitiesActionErrors,\n ),\n analyzeSentimentResults: makeActionResult(\n documents,\n makeAnalyzeSentimentResultArray,\n response.tasks.sentimentAnalysisTasks ?? [],\n analyzeSentimentActionErrors,\n ),\n };\n}\n"]}
@@ -8,7 +8,6 @@ import { parseHealthcareEntityIndex } from "./util.js";
8
8
  * @internal
9
9
  */
10
10
  function makeHealthcareEntitiesWithoutNeighbors(entity) {
11
- var _a;
12
11
  const { category, confidenceScore, assertion, offset, text, links, subcategory, length, name } = entity;
13
12
  return {
14
13
  category,
@@ -19,7 +18,8 @@ function makeHealthcareEntitiesWithoutNeighbors(entity) {
19
18
  text,
20
19
  normalizedText: name,
21
20
  subCategory: subcategory,
22
- dataSources: (_a = links === null || links === void 0 ? void 0 : links.map(({ dataSource, id }) => ({ name: dataSource, entityId: id }))) !== null && _a !== void 0 ? _a : [],
21
+ dataSources: links?.map(({ dataSource, id }) => ({ name: dataSource, entityId: id })) ??
22
+ [],
23
23
  };
24
24
  }
25
25
  /**
@@ -42,7 +42,11 @@ function makeHealthcareRelations(entities, relations) {
42
42
  export function makeHealthcareEntitiesResult(document) {
43
43
  const { id, entities, relations, warnings, statistics } = document;
44
44
  const newEntities = entities.map(makeHealthcareEntitiesWithoutNeighbors);
45
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { entities: newEntities, entityRelations: makeHealthcareRelations(newEntities, relations) });
45
+ return {
46
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
47
+ entities: newEntities,
48
+ entityRelations: makeHealthcareRelations(newEntities, relations),
49
+ };
46
50
  }
47
51
  /**
48
52
  * @internal