@azure/ai-text-analytics 5.1.1-alpha.20250619.1 → 5.1.1-alpha.20250730.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
@@ -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,CAAC,CAAC,CAAC;YAC1B,OAAO,yBAAyB,CAAC;QACnC,CAAC;QACD,KAAK,wBAAwB,CAAC,CAAC,CAAC;YAC9B,OAAO,kBAAkB,CAAC;QAC5B,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,4CAA4C,QAAQ,E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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;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,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gB,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
@@ -1 +1 @@
1
- {"version":3,"file":"analyzeHealthcareEntitiesResult.js","sourceRoot":"","sources":["../../src/analyzeHealthcareEntitiesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAmBlC,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAoKvD;;;;GAIG;AACH,SAAS,sCAAsC,CAC7C,MAAiC;;IAEjC,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,GAC5F,MAAM,CAAC;IACT,OAAO;QACL,QAAQ;QACR,eAAe;QACf,SAAS;QACT,MAAM;QACN,MAAM;QACN,IAAI;QACJ,cAAc,EAAE,IAAI;QACpB,WAAW,EAAE,WAAW;QACxB,WAAW,EACT,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,EAAoB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,mCAC1F,EAAE;KACL,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,uBAAuB,CAC9B,QAA4B,EAC5B,SAA+B;IAE/B,OAAO,SAAS,CAAC,GAAG,CAClB,CAAC,QAA4B,EAA4B,EAAE,CAAC,CAAC;QAC3D,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAC1B,CAAC,IAA8B,EAAgC,EAAE,CAAC,CAAC;YACjE,MAAM,EAAE,QAAQ,CAAC,0BAA0B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACtD,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC,CACH;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,QAAoC;IAEpC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;IACnE,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IACzE,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,QAAQ,EAAE,WAAW,EACrB,eAAe,EAAE,uBAAuB,CAAC,WAAW,EAAE,SAAS,CAAC,IAChE;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iCAAiC,CAC/C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport type {\n DocumentHealthcareEntities,\n Entity,\n HealthcareEntity as GeneratedHealthcareEntity,\n HealthcareAssertion,\n HealthcareEntityCategory,\n HealthcareRelation,\n HealthcareRelationEntity,\n RelationType,\n TextAnalyticsError,\n TextDocumentBatchStatistics,\n} from \"./generated/models/index.js\";\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport { parseHealthcareEntityIndex } from \"./util.js\";\n\n/**\n * A type representing a reference for the healthcare entity into a specific\n * entity catalog.\n */\nexport interface EntityDataSource {\n /**\n * Entity Catalog. Examples include: UMLS, CHV, MSH, etc.\n */\n name: string;\n /**\n * Entity id in the given source catalog.\n */\n entityId: string;\n}\n\n/**\n * A healthcare entity represented as a node in a directed graph where the edges are\n * a particular type of relationship between the source and target nodes.\n */\nexport interface HealthcareEntity extends Entity {\n /**\n * Normalized name for the entity. For example, the normalized text for \"histologically\" is \"histologic\".\n */\n normalizedText?: string;\n /**\n * Whether the entity is negated.\n */\n assertion?: HealthcareAssertion;\n /**\n * Entity references in known data sources.\n */\n dataSources: EntityDataSource[];\n /**\n * Defines values for HealthcareEntityCategory.\n * {@link KnownHealthcareEntityCategory} can be used interchangeably with HealthcareEntityCategory,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **BODY_STRUCTURE**\n * **AGE**\n * **GENDER**\n * **EXAMINATION_NAME**\n * **DATE**\n * **DIRECTION**\n * **FREQUENCY**\n * **MEASUREMENT_VALUE**\n * **MEASUREMENT_UNIT**\n * **RELATIONAL_OPERATOR**\n * **TIME**\n * **GENE_OR_PROTEIN**\n * **VARIANT**\n * **ADMINISTRATIVE_EVENT**\n * **CARE_ENVIRONMENT**\n * **HEALTHCARE_PROFESSION**\n * **DIAGNOSIS**\n * **SYMPTOM_OR_SIGN**\n * **CONDITION_QUALIFIER**\n * **MEDICATION_CLASS**\n * **MEDICATION_NAME**\n * **DOSAGE**\n * **MEDICATION_FORM**\n * **MEDICATION_ROUTE**\n * **FAMILY_RELATION**\n * **TREATMENT_NAME**\n */\n category: HealthcareEntityCategory;\n}\n\n/**\n * The type of different roles a healthcare entity can play in a relation.\n */\nexport type HealthcareEntityRelationRoleType = string;\n\n/**\n * A healthcare entity that plays a specific role in a relation.\n */\nexport interface HealthcareEntityRelationRole {\n /**\n * A healthcare entity\n */\n entity: HealthcareEntity;\n /**\n * The role of the healthcare entity in a particular relation.\n */\n name: HealthcareEntityRelationRoleType;\n}\n\n/**\n * A relationship between two or more healthcare entities.\n */\nexport interface HealthcareEntityRelation {\n /**\n * The type of the healthcare relation.\n */\n relationType: RelationType;\n /**\n * The list of healthcare entities and their roles in the healthcare relation.\n */\n roles: HealthcareEntityRelationRole[];\n}\n\n/**\n * The results of a successful healthcare operation for a single document.\n */\nexport interface AnalyzeHealthcareEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * Healthcare entities.\n */\n entities: HealthcareEntity[];\n /**\n * Relations between healthcare entities.\n */\n entityRelations: HealthcareEntityRelation[];\n}\n\n/**\n * An error result from the healthcare operation on a single document.\n */\nexport type AnalyzeHealthcareEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * The result of the healthcare operation on a single document.\n */\nexport type AnalyzeHealthcareEntitiesResult =\n | AnalyzeHealthcareEntitiesSuccessResult\n | AnalyzeHealthcareEntitiesErrorResult;\n\n/**\n * Array of {@link AnalyzeHealthcareEntitiesResult}\n */\nexport interface AnalyzeHealthcareEntitiesResultArray\n extends Array<AnalyzeHealthcareEntitiesResult> {}\n\n/**\n * The results of a healthcare operation represented as a paged iterator that can\n * either iterate over the results on a document-by-document basis or, by\n * byPage(), can iterate over pages of documents.\n */\nexport type PagedAsyncIterableAnalyzeHealthcareEntitiesResult = PagedAsyncIterableIterator<\n AnalyzeHealthcareEntitiesResult,\n AnalyzeHealthcareEntitiesResultArray\n>;\n\n/**\n * The results of a healthcare operation represented as a paged iterator that can\n * either iterate over the results on a document-by-document basis or, by\n * byPage(), can iterate over pages of documents.\n */\nexport interface PagedAnalyzeHealthcareEntitiesResult\n extends PagedAsyncIterableAnalyzeHealthcareEntitiesResult {\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 * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion: string;\n}\n\n/**\n * Creates a user-friendly healthcare entity represented as a node in a graph\n * @param entity - the healthcare entity returned by the service\n * @internal\n */\nfunction makeHealthcareEntitiesWithoutNeighbors(\n entity: GeneratedHealthcareEntity,\n): HealthcareEntity {\n const { category, confidenceScore, assertion, offset, text, links, subcategory, length, name } =\n entity;\n return {\n category,\n confidenceScore,\n assertion,\n offset,\n length,\n text,\n normalizedText: name,\n subCategory: subcategory,\n dataSources:\n links?.map(({ dataSource, id }): EntityDataSource => ({ name: dataSource, entityId: id })) ??\n [],\n };\n}\n\n/**\n * @internal\n */\nfunction makeHealthcareRelations(\n entities: HealthcareEntity[],\n relations: HealthcareRelation[],\n): HealthcareEntityRelation[] {\n return relations.map(\n (relation: HealthcareRelation): HealthcareEntityRelation => ({\n relationType: relation.relationType,\n roles: relation.entities.map(\n (role: HealthcareRelationEntity): HealthcareEntityRelationRole => ({\n entity: entities[parseHealthcareEntityIndex(role.ref)],\n name: role.role,\n }),\n ),\n }),\n );\n}\n\n/**\n * Creates a healthcare entity in the convenience layer from the one sent by the service.\n * @param document - incoming results sent by the service for a particular document\n * @internal\n */\nexport function makeHealthcareEntitiesResult(\n document: DocumentHealthcareEntities,\n): AnalyzeHealthcareEntitiesSuccessResult {\n const { id, entities, relations, warnings, statistics } = document;\n const newEntities = entities.map(makeHealthcareEntitiesWithoutNeighbors);\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities: newEntities,\n entityRelations: makeHealthcareRelations(newEntities, relations),\n };\n}\n\n/**\n * @internal\n */\nexport function makeHealthcareEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError,\n): AnalyzeHealthcareEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
1
+ {"version":3,"file":"analyzeHealthcareEntitiesResult.js","sourceRoot":"","sources":["../../src/analyzeHealthcareEntitiesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAmBlC,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,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;QACL,GAAG,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC;QAC3D,QAAQ,EAAE,WAAW;QACrB,eAAe,EAAE,uBAAuB,CAAC,WAAW,EAAE,SAAS,CAAC;KACjE,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iCAAiC,CAC/C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport type {\n DocumentHealthcareEntities,\n Entity,\n HealthcareEntity as GeneratedHealthcareEntity,\n HealthcareAssertion,\n HealthcareEntityCategory,\n HealthcareRelation,\n HealthcareRelationEntity,\n RelationType,\n TextAnalyticsError,\n TextDocumentBatchStatistics,\n} from \"./generated/models/index.js\";\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport { parseHealthcareEntityIndex } from \"./util.js\";\n\n/**\n * A type representing a reference for the healthcare entity into a specific\n * entity catalog.\n */\nexport interface EntityDataSource {\n /**\n * Entity Catalog. Examples include: UMLS, CHV, MSH, etc.\n */\n name: string;\n /**\n * Entity id in the given source catalog.\n */\n entityId: string;\n}\n\n/**\n * A healthcare entity represented as a node in a directed graph where the edges are\n * a particular type of relationship between the source and target nodes.\n */\nexport interface HealthcareEntity extends Entity {\n /**\n * Normalized name for the entity. For example, the normalized text for \"histologically\" is \"histologic\".\n */\n normalizedText?: string;\n /**\n * Whether the entity is negated.\n */\n assertion?: HealthcareAssertion;\n /**\n * Entity references in known data sources.\n */\n dataSources: EntityDataSource[];\n /**\n * Defines values for HealthcareEntityCategory.\n * {@link KnownHealthcareEntityCategory} can be used interchangeably with HealthcareEntityCategory,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **BODY_STRUCTURE**\n * **AGE**\n * **GENDER**\n * **EXAMINATION_NAME**\n * **DATE**\n * **DIRECTION**\n * **FREQUENCY**\n * **MEASUREMENT_VALUE**\n * **MEASUREMENT_UNIT**\n * **RELATIONAL_OPERATOR**\n * **TIME**\n * **GENE_OR_PROTEIN**\n * **VARIANT**\n * **ADMINISTRATIVE_EVENT**\n * **CARE_ENVIRONMENT**\n * **HEALTHCARE_PROFESSION**\n * **DIAGNOSIS**\n * **SYMPTOM_OR_SIGN**\n * **CONDITION_QUALIFIER**\n * **MEDICATION_CLASS**\n * **MEDICATION_NAME**\n * **DOSAGE**\n * **MEDICATION_FORM**\n * **MEDICATION_ROUTE**\n * **FAMILY_RELATION**\n * **TREATMENT_NAME**\n */\n category: HealthcareEntityCategory;\n}\n\n/**\n * The type of different roles a healthcare entity can play in a relation.\n */\nexport type HealthcareEntityRelationRoleType = string;\n\n/**\n * A healthcare entity that plays a specific role in a relation.\n */\nexport interface HealthcareEntityRelationRole {\n /**\n * A healthcare entity\n */\n entity: HealthcareEntity;\n /**\n * The role of the healthcare entity in a particular relation.\n */\n name: HealthcareEntityRelationRoleType;\n}\n\n/**\n * A relationship between two or more healthcare entities.\n */\nexport interface HealthcareEntityRelation {\n /**\n * The type of the healthcare relation.\n */\n relationType: RelationType;\n /**\n * The list of healthcare entities and their roles in the healthcare relation.\n */\n roles: HealthcareEntityRelationRole[];\n}\n\n/**\n * The results of a successful healthcare operation for a single document.\n */\nexport interface AnalyzeHealthcareEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * Healthcare entities.\n */\n entities: HealthcareEntity[];\n /**\n * Relations between healthcare entities.\n */\n entityRelations: HealthcareEntityRelation[];\n}\n\n/**\n * An error result from the healthcare operation on a single document.\n */\nexport type AnalyzeHealthcareEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * The result of the healthcare operation on a single document.\n */\nexport type AnalyzeHealthcareEntitiesResult =\n | AnalyzeHealthcareEntitiesSuccessResult\n | AnalyzeHealthcareEntitiesErrorResult;\n\n/**\n * Array of {@link AnalyzeHealthcareEntitiesResult}\n */\nexport interface AnalyzeHealthcareEntitiesResultArray\n extends Array<AnalyzeHealthcareEntitiesResult> {}\n\n/**\n * The results of a healthcare operation represented as a paged iterator that can\n * either iterate over the results on a document-by-document basis or, by\n * byPage(), can iterate over pages of documents.\n */\nexport type PagedAsyncIterableAnalyzeHealthcareEntitiesResult = PagedAsyncIterableIterator<\n AnalyzeHealthcareEntitiesResult,\n AnalyzeHealthcareEntitiesResultArray\n>;\n\n/**\n * The results of a healthcare operation represented as a paged iterator that can\n * either iterate over the results on a document-by-document basis or, by\n * byPage(), can iterate over pages of documents.\n */\nexport interface PagedAnalyzeHealthcareEntitiesResult\n extends PagedAsyncIterableAnalyzeHealthcareEntitiesResult {\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 * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion: string;\n}\n\n/**\n * Creates a user-friendly healthcare entity represented as a node in a graph\n * @param entity - the healthcare entity returned by the service\n * @internal\n */\nfunction makeHealthcareEntitiesWithoutNeighbors(\n entity: GeneratedHealthcareEntity,\n): HealthcareEntity {\n const { category, confidenceScore, assertion, offset, text, links, subcategory, length, name } =\n entity;\n return {\n category,\n confidenceScore,\n assertion,\n offset,\n length,\n text,\n normalizedText: name,\n subCategory: subcategory,\n dataSources:\n links?.map(({ dataSource, id }): EntityDataSource => ({ name: dataSource, entityId: id })) ??\n [],\n };\n}\n\n/**\n * @internal\n */\nfunction makeHealthcareRelations(\n entities: HealthcareEntity[],\n relations: HealthcareRelation[],\n): HealthcareEntityRelation[] {\n return relations.map(\n (relation: HealthcareRelation): HealthcareEntityRelation => ({\n relationType: relation.relationType,\n roles: relation.entities.map(\n (role: HealthcareRelationEntity): HealthcareEntityRelationRole => ({\n entity: entities[parseHealthcareEntityIndex(role.ref)],\n name: role.role,\n }),\n ),\n }),\n );\n}\n\n/**\n * Creates a healthcare entity in the convenience layer from the one sent by the service.\n * @param document - incoming results sent by the service for a particular document\n * @internal\n */\nexport function makeHealthcareEntitiesResult(\n document: DocumentHealthcareEntities,\n): AnalyzeHealthcareEntitiesSuccessResult {\n const { id, entities, relations, warnings, statistics } = document;\n const newEntities = entities.map(makeHealthcareEntitiesWithoutNeighbors);\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities: newEntities,\n entityRelations: makeHealthcareRelations(newEntities, relations),\n };\n}\n\n/**\n * @internal\n */\nexport function makeHealthcareEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError,\n): AnalyzeHealthcareEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -8,8 +8,12 @@ import { parseAssessmentIndex } from "./util.js";
8
8
  */
9
9
  export function makeAnalyzeSentimentResult(result) {
10
10
  const { id, sentiment, confidenceScores, sentenceSentiments: sentences, warnings, statistics, } = result;
11
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { sentiment,
12
- confidenceScores, sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)) });
11
+ return {
12
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
13
+ sentiment,
14
+ confidenceScores,
15
+ sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)),
16
+ };
13
17
  }
14
18
  /**
15
19
  * @internal
@@ -60,10 +64,9 @@ function convertGeneratedSentenceSentiment(sentence, result) {
60
64
  * @internal
61
65
  */
62
66
  function convertTargetRelationToAssessmentSentiment(targetRelation, result) {
63
- var _a, _b;
64
67
  const assessmentPtr = targetRelation.ref;
65
68
  const assessmentIndex = parseAssessmentIndex(assessmentPtr);
66
- const assessment = (_b = (_a = result.sentenceSentiments) === null || _a === void 0 ? void 0 : _a[assessmentIndex.sentence].assessments) === null || _b === void 0 ? void 0 : _b[assessmentIndex.assessment];
69
+ const assessment = result.sentenceSentiments?.[assessmentIndex.sentence].assessments?.[assessmentIndex.assessment];
67
70
  if (assessment !== undefined) {
68
71
  return assessment;
69
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"analyzeSentimentResult.js","sourceRoot":"","sources":["../../src/analyzeSentimentResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAelC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAuHjD;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,MAAyB;IAEzB,MAAM,EACJ,EAAE,EACF,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAAE,SAAS,EAC7B,QAAQ,EACR,UAAU,GACX,GAAG,MAAM,CAAC;IACX,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,SAAS;QACT,gBAAgB,EAChB,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,iCAAiC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAC3F;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,+BAA+B,CAC7C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,iCAAiC,CACxC,QAAoC,EACpC,MAAyB;IAEzB,OAAO;QACL,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,QAAQ,EAAE,QAAQ,CAAC,OAAO;YACxB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAClB,CAAC,MAAsB,EAAW,EAAE,CAAC,CAAC;gBACpC,MAAM,EAAE;oBACN,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;oBACzC,SAAS,EAAE,MAAM,CAAC,SAAS;oBAC3B,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB;gBACD,WAAW,EAAE,MAAM,CAAC,SAAS;qBAC1B,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,KAAK,YAAY,CAAC;qBAC5D,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,0CAA0C,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;aACnF,CAAC,CACH;YACH,CAAC,CAAC,EAAE;KACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,0CAA0C,CACjD,cAA8B,EAC9B,MAAyB;;IAEzB,MAAM,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC;IACzC,MAAM,eAAe,GAAoB,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC7E,MAAM,UAAU,GACd,MAAA,MAAA,MAAM,CAAC,kBAAkB,0CAAG,eAAe,CAAC,QAAQ,EAAE,WAAW,0CAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAClG,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,YAAY,aAAa,qCAAqC,CAAC,CAAC;IAClF,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type {\n DocumentSentiment,\n DocumentSentimentLabel,\n SentenceSentiment as GeneratedSentenceSentiment,\n SentenceAssessment,\n SentenceSentimentLabel,\n SentenceTarget,\n TokenSentimentValue as SentenceTargetSentiment,\n SentimentConfidenceScores,\n TargetConfidenceScoreLabel,\n TargetRelation,\n TextAnalyticsError,\n} from \"./generated/models/index.js\";\nimport type { AssessmentIndex } from \"./util.js\";\nimport { parseAssessmentIndex } from \"./util.js\";\n\n/**\n * The result of the analyze sentiment operation on a single document.\n */\nexport type AnalyzeSentimentResult = AnalyzeSentimentSuccessResult | AnalyzeSentimentErrorResult;\n\n/**\n * The result of the analyze sentiment operation on a single document,\n * containing the predicted sentiment for each sentence as well as for the full document.\n */\nexport interface AnalyzeSentimentSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * Predicted sentiment for document. Possible values\n * include: 'positive', 'neutral', 'negative', 'mixed'\n */\n sentiment: DocumentSentimentLabel;\n /**\n * Document level sentiment confidence scores between 0 and 1 for each sentiment class.\n */\n confidenceScores: SentimentConfidenceScores;\n /**\n * The predicted sentiment for each sentence in the corresponding document.\n */\n sentences: SentenceSentiment[];\n}\n\n/**\n * The predicted sentiment for a given span of text. For more information regarding text sentiment, see https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/how-tos/text-analytics-how-to-sentiment-analysis.\n */\nexport interface SentenceSentiment {\n /**\n * The sentence text.\n */\n text: string;\n /**\n * The predicted Sentiment for the sentence.\n */\n sentiment: SentenceSentimentLabel;\n /**\n * The sentiment confidence score between 0 and 1 for the sentence for all classes.\n */\n confidenceScores: SentimentConfidenceScores;\n /**\n * The sentence text offset from the start of the document.\n */\n offset: number;\n /**\n * The length of the sentence text.\n */\n length: number;\n /**\n * The list of opinions mined from this sentence. For example in \"The food is\n * good, but the service is bad\", we would mine these two opinions \"food is\n * good\", \"service is bad\". Only returned if `includeOpinionMining` is set to\n * True in the call to `analyzeSentiment`.\n */\n opinions: Opinion[];\n}\n\n/**\n * TargetSentiment contains the predicted sentiment, confidence scores and other\n * information about an target of a product. A target of a product/service is a\n * key component of that product/service. For example in \"The food at Hotel Foo\n * is good\", \"food\" is a target of \"Hotel Foo\".\n */\nexport interface TargetSentiment {\n /**\n * The sentiment confidence score between 0 and 1 for the target for\n * 'positive' and 'negative' labels.\n */\n confidenceScores: TargetConfidenceScoreLabel;\n /**\n * The predicted Sentiment for the Target. Possible values include 'positive',\n * 'mixed', and 'negative'.\n */\n sentiment: SentenceTargetSentiment;\n /**\n * The target text.\n */\n text: string;\n /**\n * The Target text offset from the start of the sentence.\n */\n offset: number;\n /**\n * The length of the Target text.\n */\n length: number;\n}\n\n/**\n * AssessmentSentiment contains the predicted sentiment, confidence scores and\n * other information about an assessment of a target. For example, in the sentence\n * \"The food is good\", the assessment of the target 'food' is 'good'.\n */\nexport interface AssessmentSentiment extends SentenceAssessment {}\n\n/**\n * A mined opinion object represents an opinion we've extracted from a sentence.\n * It consists of both a target that these assessments are about, and the actual\n * assessments themselves.\n */\nexport interface Opinion {\n /**\n * The target of a product/service that this assessment is about.\n */\n target: TargetSentiment;\n /**\n * The actual assessments of the target.\n */\n assessments: AssessmentSentiment[];\n}\n\n/**\n * An error result from the analyze sentiment operation on a single document.\n */\nexport type AnalyzeSentimentErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @param document - A document result coming from the service.\n * @internal\n */\nexport function makeAnalyzeSentimentResult(\n result: DocumentSentiment,\n): AnalyzeSentimentSuccessResult {\n const {\n id,\n sentiment,\n confidenceScores,\n sentenceSentiments: sentences,\n warnings,\n statistics,\n } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n sentiment,\n confidenceScores,\n sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)),\n };\n}\n\n/**\n * @internal\n */\nexport function makeAnalyzeSentimentErrorResult(\n id: string,\n error: TextAnalyticsError,\n): AnalyzeSentimentErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n\n/**\n * Converts a sentence sentiment object returned by the service to another that\n * is user-friendly.\n *\n * @param sentence - The sentence sentiment object to be converted.\n * @param response - The entire response returned by the service.\n * @returns The user-friendly sentence sentiment object.\n * @internal\n */\nfunction convertGeneratedSentenceSentiment(\n sentence: GeneratedSentenceSentiment,\n result: DocumentSentiment,\n): SentenceSentiment {\n return {\n confidenceScores: sentence.confidenceScores,\n sentiment: sentence.sentiment,\n text: sentence.text,\n offset: sentence.offset,\n length: sentence.length,\n opinions: sentence.targets\n ? sentence.targets.map(\n (target: SentenceTarget): Opinion => ({\n target: {\n confidenceScores: target.confidenceScores,\n sentiment: target.sentiment,\n text: target.text,\n offset: target.offset,\n length: target.length,\n },\n assessments: target.relations\n .filter((relation) => relation.relationType === \"assessment\")\n .map((relation) => convertTargetRelationToAssessmentSentiment(relation, result)),\n }),\n )\n : [],\n };\n}\n\n/**\n * Converts a target relation object returned by the service to an assessment\n * sentiment object where JSON pointers in the former are realized in the\n * latter.\n *\n * @param targetRelation - The target relation object to be converted.\n * @param response - The entire response returned by the service.\n * @returns The user-friendly assessment sentiment object.\n * @internal\n */\nfunction convertTargetRelationToAssessmentSentiment(\n targetRelation: TargetRelation,\n result: DocumentSentiment,\n): AssessmentSentiment {\n const assessmentPtr = targetRelation.ref;\n const assessmentIndex: AssessmentIndex = parseAssessmentIndex(assessmentPtr);\n const assessment: SentenceAssessment | undefined =\n result.sentenceSentiments?.[assessmentIndex.sentence].assessments?.[assessmentIndex.assessment];\n if (assessment !== undefined) {\n return assessment;\n } else {\n throw new Error(`Pointer \"${assessmentPtr}\" is not a valid Assessment pointer`);\n }\n}\n"]}
1
+ {"version":3,"file":"analyzeSentimentResult.js","sourceRoot":"","sources":["../../src/analyzeSentimentResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAelC,OAA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E,MAAM,CAAC,SAAS;qBAC1B,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,KAAK,YAAY,CAAC;qBAC5D,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,0CAA0C,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;aACnF,CAAC,CACH;YACH,CAAC,CAAC,EAAE;KACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,0CAA0C,CACjD,cAA8B,EAC9B,MAAyB;IAEzB,MAAM,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC;IACzC,MAAM,eAAe,GAAoB,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC7E,MAAM,UAAU,GACd,MAAM,CAAC,kBAAkB,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IAClG,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,YAAY,aAAa,qCAAqC,CAAC,CAAC;IAClF,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type {\n DocumentSentiment,\n DocumentSentimentLabel,\n SentenceSentiment as GeneratedSentenceSentiment,\n SentenceAssessment,\n SentenceSentimentLabel,\n SentenceTarget,\n TokenSentimentValue as SentenceTargetSentiment,\n SentimentConfidenceScores,\n TargetConfidenceScoreLabel,\n TargetRelation,\n TextAnalyticsError,\n} from \"./generated/models/index.js\";\nimport type { AssessmentIndex } from \"./util.js\";\nimport { parseAssessmentIndex } from \"./util.js\";\n\n/**\n * The result of the analyze sentiment operation on a single document.\n */\nexport type AnalyzeSentimentResult = AnalyzeSentimentSuccessResult | AnalyzeSentimentErrorResult;\n\n/**\n * The result of the analyze sentiment operation on a single document,\n * containing the predicted sentiment for each sentence as well as for the full document.\n */\nexport interface AnalyzeSentimentSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * Predicted sentiment for document. Possible values\n * include: 'positive', 'neutral', 'negative', 'mixed'\n */\n sentiment: DocumentSentimentLabel;\n /**\n * Document level sentiment confidence scores between 0 and 1 for each sentiment class.\n */\n confidenceScores: SentimentConfidenceScores;\n /**\n * The predicted sentiment for each sentence in the corresponding document.\n */\n sentences: SentenceSentiment[];\n}\n\n/**\n * The predicted sentiment for a given span of text. For more information regarding text sentiment, see https://learn.microsoft.com/azure/cognitive-services/Text-Analytics/how-tos/text-analytics-how-to-sentiment-analysis.\n */\nexport interface SentenceSentiment {\n /**\n * The sentence text.\n */\n text: string;\n /**\n * The predicted Sentiment for the sentence.\n */\n sentiment: SentenceSentimentLabel;\n /**\n * The sentiment confidence score between 0 and 1 for the sentence for all classes.\n */\n confidenceScores: SentimentConfidenceScores;\n /**\n * The sentence text offset from the start of the document.\n */\n offset: number;\n /**\n * The length of the sentence text.\n */\n length: number;\n /**\n * The list of opinions mined from this sentence. For example in \"The food is\n * good, but the service is bad\", we would mine these two opinions \"food is\n * good\", \"service is bad\". Only returned if `includeOpinionMining` is set to\n * True in the call to `analyzeSentiment`.\n */\n opinions: Opinion[];\n}\n\n/**\n * TargetSentiment contains the predicted sentiment, confidence scores and other\n * information about an target of a product. A target of a product/service is a\n * key component of that product/service. For example in \"The food at Hotel Foo\n * is good\", \"food\" is a target of \"Hotel Foo\".\n */\nexport interface TargetSentiment {\n /**\n * The sentiment confidence score between 0 and 1 for the target for\n * 'positive' and 'negative' labels.\n */\n confidenceScores: TargetConfidenceScoreLabel;\n /**\n * The predicted Sentiment for the Target. Possible values include 'positive',\n * 'mixed', and 'negative'.\n */\n sentiment: SentenceTargetSentiment;\n /**\n * The target text.\n */\n text: string;\n /**\n * The Target text offset from the start of the sentence.\n */\n offset: number;\n /**\n * The length of the Target text.\n */\n length: number;\n}\n\n/**\n * AssessmentSentiment contains the predicted sentiment, confidence scores and\n * other information about an assessment of a target. For example, in the sentence\n * \"The food is good\", the assessment of the target 'food' is 'good'.\n */\nexport interface AssessmentSentiment extends SentenceAssessment {}\n\n/**\n * A mined opinion object represents an opinion we've extracted from a sentence.\n * It consists of both a target that these assessments are about, and the actual\n * assessments themselves.\n */\nexport interface Opinion {\n /**\n * The target of a product/service that this assessment is about.\n */\n target: TargetSentiment;\n /**\n * The actual assessments of the target.\n */\n assessments: AssessmentSentiment[];\n}\n\n/**\n * An error result from the analyze sentiment operation on a single document.\n */\nexport type AnalyzeSentimentErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @param document - A document result coming from the service.\n * @internal\n */\nexport function makeAnalyzeSentimentResult(\n result: DocumentSentiment,\n): AnalyzeSentimentSuccessResult {\n const {\n id,\n sentiment,\n confidenceScores,\n sentenceSentiments: sentences,\n warnings,\n statistics,\n } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n sentiment,\n confidenceScores,\n sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)),\n };\n}\n\n/**\n * @internal\n */\nexport function makeAnalyzeSentimentErrorResult(\n id: string,\n error: TextAnalyticsError,\n): AnalyzeSentimentErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n\n/**\n * Converts a sentence sentiment object returned by the service to another that\n * is user-friendly.\n *\n * @param sentence - The sentence sentiment object to be converted.\n * @param response - The entire response returned by the service.\n * @returns The user-friendly sentence sentiment object.\n * @internal\n */\nfunction convertGeneratedSentenceSentiment(\n sentence: GeneratedSentenceSentiment,\n result: DocumentSentiment,\n): SentenceSentiment {\n return {\n confidenceScores: sentence.confidenceScores,\n sentiment: sentence.sentiment,\n text: sentence.text,\n offset: sentence.offset,\n length: sentence.length,\n opinions: sentence.targets\n ? sentence.targets.map(\n (target: SentenceTarget): Opinion => ({\n target: {\n confidenceScores: target.confidenceScores,\n sentiment: target.sentiment,\n text: target.text,\n offset: target.offset,\n length: target.length,\n },\n assessments: target.relations\n .filter((relation) => relation.relationType === \"assessment\")\n .map((relation) => convertTargetRelationToAssessmentSentiment(relation, result)),\n }),\n )\n : [],\n };\n}\n\n/**\n * Converts a target relation object returned by the service to an assessment\n * sentiment object where JSON pointers in the former are realized in the\n * latter.\n *\n * @param targetRelation - The target relation object to be converted.\n * @param response - The entire response returned by the service.\n * @returns The user-friendly assessment sentiment object.\n * @internal\n */\nfunction convertTargetRelationToAssessmentSentiment(\n targetRelation: TargetRelation,\n result: DocumentSentiment,\n): AssessmentSentiment {\n const assessmentPtr = targetRelation.ref;\n const assessmentIndex: AssessmentIndex = parseAssessmentIndex(assessmentPtr);\n const assessment: SentenceAssessment | undefined =\n result.sentenceSentiments?.[assessmentIndex.sentence].assessments?.[assessmentIndex.assessment];\n if (assessment !== undefined) {\n return assessment;\n } else {\n throw new Error(`Pointer \"${assessmentPtr}\" is not a valid Assessment pointer`);\n }\n}\n"]}
@@ -6,7 +6,10 @@ import { makeTextAnalyticsErrorResult, makeTextAnalyticsSuccessResult, } from ".
6
6
  */
7
7
  export function makeDetectLanguageResult(response) {
8
8
  const { id, warnings, statistics, detectedLanguage } = response;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { primaryLanguage: detectedLanguage });
9
+ return {
10
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
11
+ primaryLanguage: detectedLanguage,
12
+ };
10
13
  }
11
14
  /**
12
15
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"detectLanguageResult.js","sourceRoot":"","sources":["../../src/detectLanguageResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AA4BlC;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAA0B;IACjE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,QAAQ,CAAC;IAChE,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,eAAe,EAAE,gBAAgB,IACjC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type {\n DetectedLanguage,\n DocumentLanguage,\n TextAnalyticsError,\n} from \"./generated/models/index.js\";\n\n/**\n * The result of the detect language operation on a single document.\n */\nexport type DetectLanguageResult = DetectLanguageSuccessResult | DetectLanguageErrorResult;\n\n/**\n * The result of the detect language operation on a single document,\n * containing a prediction of what language the document is written in.\n */\nexport interface DetectLanguageSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The top detected language by confidence score.\n */\n readonly primaryLanguage: DetectedLanguage;\n}\n\n/**\n * An error result from the detect languge operation on a single document.\n */\nexport type DetectLanguageErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeDetectLanguageResult(response: DocumentLanguage): DetectLanguageSuccessResult {\n const { id, warnings, statistics, detectedLanguage } = response;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n primaryLanguage: detectedLanguage,\n };\n}\n\n/**\n * @internal\n */\nexport function makeDetectLanguageErrorResult(\n id: string,\n error: TextAnalyticsError,\n): DetectLanguageErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
1
+ {"version":3,"file":"detectLanguageResult.js","sourceRoot":"","sources":["../../src/detectLanguageResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AA4BlC;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAA0B;IACjE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,QAAQ,CAAC;IAChE,OAAO;QACL,GAAG,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC;QAC3D,eAAe,EAAE,gBAAgB;KAClC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type {\n DetectedLanguage,\n DocumentLanguage,\n TextAnalyticsError,\n} from \"./generated/models/index.js\";\n\n/**\n * The result of the detect language operation on a single document.\n */\nexport type DetectLanguageResult = DetectLanguageSuccessResult | DetectLanguageErrorResult;\n\n/**\n * The result of the detect language operation on a single document,\n * containing a prediction of what language the document is written in.\n */\nexport interface DetectLanguageSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The top detected language by confidence score.\n */\n readonly primaryLanguage: DetectedLanguage;\n}\n\n/**\n * An error result from the detect languge operation on a single document.\n */\nexport type DetectLanguageErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeDetectLanguageResult(response: DocumentLanguage): DetectLanguageSuccessResult {\n const { id, warnings, statistics, detectedLanguage } = response;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n primaryLanguage: detectedLanguage,\n };\n}\n\n/**\n * @internal\n */\nexport function makeDetectLanguageErrorResult(\n id: string,\n error: TextAnalyticsError,\n): DetectLanguageErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -6,7 +6,10 @@ import { makeTextAnalyticsErrorResult, makeTextAnalyticsSuccessResult, } from ".
6
6
  */
7
7
  export function makeExtractKeyPhrasesResult(result) {
8
8
  const { id, warnings, statistics, keyPhrases } = result;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { keyPhrases });
9
+ return {
10
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
11
+ keyPhrases,
12
+ };
10
13
  }
11
14
  /**
12
15
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"extractKeyPhrasesResult.js","sourceRoot":"","sources":["../../src/extractKeyPhrasesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAyBlC;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAA0B;IAE1B,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACxD,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,UAAU,IACV;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAC9C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type { DocumentKeyPhrases, TextAnalyticsError } from \"./generated/models/index.js\";\n\n/**\n * The result of the extract key phrases operation on a single document.\n */\nexport type ExtractKeyPhrasesResult = ExtractKeyPhrasesSuccessResult | ExtractKeyPhrasesErrorResult;\n\n/**\n * The result of the extract key phrases operation on a single document,\n * containing a collection of the key phrases identified in that document.\n */\nexport interface ExtractKeyPhrasesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * A list of representative words or phrases. The number of key phrases returned is proportional\n * to the number of words in the input document.\n */\n keyPhrases: string[];\n}\n\n/**\n * An error result from the extract key phrases operation on a single document.\n */\nexport type ExtractKeyPhrasesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeExtractKeyPhrasesResult(\n result: DocumentKeyPhrases,\n): ExtractKeyPhrasesSuccessResult {\n const { id, warnings, statistics, keyPhrases } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n keyPhrases,\n };\n}\n\n/**\n * @internal\n */\nexport function makeExtractKeyPhrasesErrorResult(\n id: string,\n error: TextAnalyticsError,\n): ExtractKeyPhrasesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
1
+ {"version":3,"file":"extractKeyPhrasesResult.js","sourceRoot":"","sources":["../../src/extractKeyPhrasesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAyBlC;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAA0B;IAE1B,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACxD,OAAO;QACL,GAAG,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC;QAC3D,UAAU;KACX,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAC9C,EAAU,EACV,KAAyB;IAEzB,OAAO,4BAA4B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type { DocumentKeyPhrases, TextAnalyticsError } from \"./generated/models/index.js\";\n\n/**\n * The result of the extract key phrases operation on a single document.\n */\nexport type ExtractKeyPhrasesResult = ExtractKeyPhrasesSuccessResult | ExtractKeyPhrasesErrorResult;\n\n/**\n * The result of the extract key phrases operation on a single document,\n * containing a collection of the key phrases identified in that document.\n */\nexport interface ExtractKeyPhrasesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * A list of representative words or phrases. The number of key phrases returned is proportional\n * to the number of words in the input document.\n */\n keyPhrases: string[];\n}\n\n/**\n * An error result from the extract key phrases operation on a single document.\n */\nexport type ExtractKeyPhrasesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeExtractKeyPhrasesResult(\n result: DocumentKeyPhrases,\n): ExtractKeyPhrasesSuccessResult {\n const { id, warnings, statistics, keyPhrases } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n keyPhrases,\n };\n}\n\n/**\n * @internal\n */\nexport function makeExtractKeyPhrasesErrorResult(\n id: string,\n error: TextAnalyticsError,\n): ExtractKeyPhrasesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -11,6 +11,8 @@ import * as Parameters from "./models/parameters.js";
11
11
  import * as Mappers from "./models/mappers.js";
12
12
  /** @internal */
13
13
  export class GeneratedClient extends coreClient.ServiceClient {
14
+ endpoint;
15
+ apiVersion;
14
16
  /**
15
17
  * Initializes a new instance of the GeneratedClient class.
16
18
  * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
@@ -18,7 +20,6 @@ export class GeneratedClient extends coreClient.ServiceClient {
18
20
  * @param options The parameter options
19
21
  */
20
22
  constructor(endpoint, options) {
21
- var _a, _b;
22
23
  if (endpoint === undefined) {
23
24
  throw new Error("'endpoint' cannot be null");
24
25
  }
@@ -33,11 +34,18 @@ export class GeneratedClient extends coreClient.ServiceClient {
33
34
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
34
35
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
35
36
  : `${packageDetails}`;
36
- const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
37
+ const optionsWithDefaults = {
38
+ ...defaults,
39
+ ...options,
40
+ userAgentOptions: {
37
41
  userAgentPrefix
38
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{Endpoint}/text/analytics/{ApiVersion}" });
42
+ },
43
+ baseUri: options.endpoint ??
44
+ options.baseUri ??
45
+ "{Endpoint}/text/analytics/{ApiVersion}"
46
+ };
39
47
  super(optionsWithDefaults);
40
- if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
48
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
41
49
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
42
50
  const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
43
51
  coreRestPipeline.bearerTokenAuthenticationPolicyName);
@@ -1 +1 @@
1
- {"version":3,"file":"generatedClient.js","sourceRoot":"","sources":["../../../src/generated/generatedClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,U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EAAE;QACf,UAAU,CAAC,iBAAiB;QAC5B,UAAU,CAAC,YAAY;QACvB,UAAU,CAAC,aAAa;KACzB;IACD,aAAa,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC;IAC3D,gBAAgB,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC;AACF,MAAM,sBAAsB,GAA6B;IACvD,IAAI,EAAE,YAAY;IAClB,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,iBAAiB;SACtC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,WAAW,EAAE,UAAU,CAAC,KAAK;IAC7B,eAAe,EAAE;QACf,UAAU,CAAC,iBAAiB;QAC5B,UAAU,CAAC,YAAY;QACvB,UAAU,CAAC,eAAe;QAC1B,UAAU,CAAC,aAAa;QACxB,UAAU,CAAC,aAAa;KACzB;IACD,aAAa,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC;IAC3D,gBAAgB,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport * as Parameters from \"./models/parameters.js\";\nimport * as Mappers from \"./models/mappers.js\";\nimport {\n GeneratedClientOptionalParams,\n AnalyzeOptionalParams,\n AnalyzeResponse,\n AnalyzeStatusOptionalParams,\n AnalyzeStatusResponse,\n HealthStatusOptionalParams,\n HealthStatusResponse,\n CancelHealthJobOptionalParams,\n CancelHealthJobResponse,\n MultiLanguageBatchInput,\n HealthOptionalParams,\n HealthResponse,\n EntitiesRecognitionGeneralOptionalParams,\n EntitiesRecognitionGeneralResponse,\n EntitiesRecognitionPiiOptionalParams,\n EntitiesRecognitionPiiResponse,\n EntitiesLinkingOptionalParams,\n EntitiesLinkingResponse,\n KeyPhrasesOptionalParams,\n KeyPhrasesResponse,\n LanguageBatchInput,\n LanguagesOptionalParams,\n LanguagesResponse,\n SentimentOptionalParams,\n SentimentOperationResponse\n} from \"./models/index.js\";\n\n/** @internal */\nexport class GeneratedClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the GeneratedClient class.\n * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:\n * https://westus.api.cognitive.microsoft.com).\n * @param options The parameter options\n */\n constructor(endpoint: string, options?: GeneratedClientOptionalParams) {\n if (endpoint === undefined) {\n throw new Error(\"'endpoint' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: GeneratedClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-ai-text-analytics/5.1.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n baseUri:\n options.endpoint ??\n options.baseUri ??\n \"{Endpoint}/text/analytics/{ApiVersion}\"\n };\n super(optionsWithDefaults);\n\n if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {\n const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();\n const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(\n (pipelinePolicy) =>\n pipelinePolicy.name ===\n coreRestPipeline.bearerTokenAuthenticationPolicyName\n );\n if (!bearerTokenAuthenticationPolicyFound) {\n this.pipeline.removePolicy({\n name: coreRestPipeline.bearerTokenAuthenticationPolicyName\n });\n this.pipeline.addPolicy(\n coreRestPipeline.bearerTokenAuthenticationPolicy({\n scopes: `${optionsWithDefaults.baseUri}/.default`,\n challengeCallbacks: {\n authorizeRequestOnChallenge:\n coreClient.authorizeRequestOnClaimChallenge\n }\n })\n );\n }\n }\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"v3.1\";\n }\n\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed.\n * @param options The options parameters.\n */\n analyze(options?: AnalyzeOptionalParams): Promise<AnalyzeResponse> {\n return this.sendOperationRequest({ options }, analyzeOperationSpec);\n }\n\n /**\n * Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are\n * completed, the job will transition to the completed state and results will be available for each\n * task.\n * @param jobId Job ID for Analyze\n * @param options The options parameters.\n */\n analyzeStatus(\n jobId: string,\n options?: AnalyzeStatusOptionalParams\n ): Promise<AnalyzeStatusResponse> {\n return this.sendOperationRequest(\n { jobId, options },\n analyzeStatusOperationSpec\n );\n }\n\n /**\n * Get details of the healthcare prediction job specified by the jobId.\n * @param jobId Job ID\n * @param options The options parameters.\n */\n healthStatus(\n jobId: string,\n options?: HealthStatusOptionalParams\n ): Promise<HealthStatusResponse> {\n return this.sendOperationRequest(\n { jobId, options },\n healthStatusOperationSpec\n );\n }\n\n /**\n * Cancel healthcare prediction job.\n * @param jobId Job ID\n * @param options The options parameters.\n */\n cancelHealthJob(\n jobId: string,\n options?: CancelHealthJobOptionalParams\n ): Promise<CancelHealthJobResponse> {\n return this.sendOperationRequest(\n { jobId, options },\n cancelHealthJobOperationSpec\n );\n }\n\n /**\n * Start a healthcare analysis job to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n health(\n input: MultiLanguageBatchInput,\n options?: HealthOptionalParams\n ): Promise<HealthResponse> {\n return this.sendOperationRequest({ input, options }, healthOperationSpec);\n }\n\n /**\n * The API returns a list of general named entities in a given document. For the list of supported\n * entity types, check <a href=\"https://aka.ms/taner\">Supported Entity Types in Text Analytics API</a>.\n * See the <a href=\"https://aka.ms/talangs\">Supported languages in Text Analytics API</a> for the list\n * of enabled languages.\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n entitiesRecognitionGeneral(\n input: MultiLanguageBatchInput,\n options?: EntitiesRecognitionGeneralOptionalParams\n ): Promise<EntitiesRecognitionGeneralResponse> {\n return this.sendOperationRequest(\n { input, options },\n entitiesRecognitionGeneralOperationSpec\n );\n }\n\n /**\n * The API returns a list of entities with personal information (\\\"SSN\\\", \\\"Bank Account\\\" etc) in the\n * document. For the list of supported entity types, check <a href=\"https://aka.ms/tanerpii\">Supported\n * Entity Types in Text Analytics API</a>. See the <a href=\"https://aka.ms/talangs\">Supported languages\n * in Text Analytics API</a> for the list of enabled languages.\n *\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n entitiesRecognitionPii(\n input: MultiLanguageBatchInput,\n options?: EntitiesRecognitionPiiOptionalParams\n ): Promise<EntitiesRecognitionPiiResponse> {\n return this.sendOperationRequest(\n { input, options },\n entitiesRecognitionPiiOperationSpec\n );\n }\n\n /**\n * The API returns a list of recognized entities with links to a well known knowledge base. See the <a\n * href=\"https://aka.ms/talangs\">Supported languages in Text Analytics API</a> for the list of enabled\n * languages.\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n entitiesLinking(\n input: MultiLanguageBatchInput,\n options?: EntitiesLinkingOptionalParams\n ): Promise<EntitiesLinkingResponse> {\n return this.sendOperationRequest(\n { input, options },\n entitiesLinkingOperationSpec\n );\n }\n\n /**\n * The API returns a list of strings denoting the key phrases in the input text. See the <a\n * href=\"https://aka.ms/talangs\">Supported languages in Text Analytics API</a> for the list of enabled\n * languages.\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n keyPhrases(\n input: MultiLanguageBatchInput,\n options?: KeyPhrasesOptionalParams\n ): Promise<KeyPhrasesResponse> {\n return this.sendOperationRequest(\n { input, options },\n keyPhrasesOperationSpec\n );\n }\n\n /**\n * The API returns the detected language and a numeric score between 0 and 1. Scores close to 1\n * indicate 100% certainty that the identified language is true. See the <a\n * href=\"https://aka.ms/talangs\">Supported languages in Text Analytics API</a> for the list of enabled\n * languages.\n * @param input Collection of documents to analyze for language endpoint.\n * @param options The options parameters.\n */\n languages(\n input: LanguageBatchInput,\n options?: LanguagesOptionalParams\n ): Promise<LanguagesResponse> {\n return this.sendOperationRequest(\n { input, options },\n languagesOperationSpec\n );\n }\n\n /**\n * The API returns a detailed sentiment analysis for the input text. The analysis is done in multiple\n * levels of granularity, start from the a document level, down to sentence and key terms (targets and\n * assessments).\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n sentiment(\n input: MultiLanguageBatchInput,\n options?: SentimentOptionalParams\n ): Promise<SentimentOperationResponse> {\n return this.sendOperationRequest(\n { input, options },\n sentimentOperationSpec\n );\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst analyzeOperationSpec: coreClient.OperationSpec = {\n path: \"/analyze\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n headersMapper: Mappers.GeneratedClientAnalyzeHeaders\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.body,\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst analyzeStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/analyze/jobs/{jobId}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeJobState\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.top,\n Parameters.skip\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion, Parameters.jobId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst healthStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/health/jobs/{jobId}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.HealthcareJobState\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.top,\n Parameters.skip\n ],\n urlParameters: [\n Parameters.endpoint,\n Parameters.apiVersion,\n Parameters.jobId1\n ],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst cancelHealthJobOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/health/jobs/{jobId}\",\n httpMethod: \"DELETE\",\n responses: {\n 202: {\n headersMapper: Mappers.GeneratedClientCancelHealthJobHeaders\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n urlParameters: [\n Parameters.endpoint,\n Parameters.apiVersion,\n Parameters.jobId1\n ],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst healthOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/health/jobs\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n headersMapper: Mappers.GeneratedClientHealthHeaders\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.modelVersion,\n Parameters.stringIndexType,\n Parameters.loggingOptOut\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst entitiesRecognitionGeneralOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/recognition/general\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.EntitiesResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.stringIndexType,\n Parameters.loggingOptOut\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst entitiesRecognitionPiiOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/recognition/pii\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.PiiResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.stringIndexType,\n Parameters.loggingOptOut,\n Parameters.domain,\n Parameters.piiCategories\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst entitiesLinkingOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/linking\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.EntityLinkingResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.stringIndexType,\n Parameters.loggingOptOut\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst keyPhrasesOperationSpec: coreClient.OperationSpec = {\n path: \"/keyPhrases\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.KeyPhraseResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.loggingOptOut\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst languagesOperationSpec: coreClient.OperationSpec = {\n path: \"/languages\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.LanguageResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input1,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.loggingOptOut\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst sentimentOperationSpec: coreClient.OperationSpec = {\n path: \"/sentiment\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.SentimentResponse\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.stringIndexType,\n Parameters.loggingOptOut,\n Parameters.opinionMining\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\n"]}
1
+ {"version":3,"file":"generatedClient.js","sourceRoot":"","sources":["../../../src/generated/generatedClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AA6B/C,gBAAgB;AAChB,MAAM,OAAO,eAAgB,SAAQ,UAAU,CAAC,aAAa;IAC3D,QAAQ,CAAS;IACjB,UAAU,CAAS;IAEnB;;;;;OAKG;IACH,YAAY,QAAgB,EAAE,OAAuC;QACnE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,EAAE,CAAC;QAC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EAAE,OAAO,CAAC,iBAAiB;SACtC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,WAAW,EAAE,UAAU,CAAC,KAAK;IAC7B,eAAe,EAAE;QACf,UAAU,CAAC,iBAAiB;QAC5B,UAAU,CAAC,YAAY;QACvB,UAAU,CAAC,eAAe;QAC1B,UAAU,CAAC,aAAa;QACxB,UAAU,CAAC,aAAa;KACzB;IACD,aAAa,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC;IAC3D,gBAAgB,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport * as Parameters from \"./models/parameters.js\";\nimport * as Mappers from \"./models/mappers.js\";\nimport {\n GeneratedClientOptionalParams,\n AnalyzeOptionalParams,\n AnalyzeResponse,\n AnalyzeStatusOptionalParams,\n AnalyzeStatusResponse,\n HealthStatusOptionalParams,\n HealthStatusResponse,\n CancelHealthJobOptionalParams,\n CancelHealthJobResponse,\n MultiLanguageBatchInput,\n HealthOptionalParams,\n HealthResponse,\n EntitiesRecognitionGeneralOptionalParams,\n EntitiesRecognitionGeneralResponse,\n EntitiesRecognitionPiiOptionalParams,\n EntitiesRecognitionPiiResponse,\n EntitiesLinkingOptionalParams,\n EntitiesLinkingResponse,\n KeyPhrasesOptionalParams,\n KeyPhrasesResponse,\n LanguageBatchInput,\n LanguagesOptionalParams,\n LanguagesResponse,\n SentimentOptionalParams,\n SentimentOperationResponse\n} from \"./models/index.js\";\n\n/** @internal */\nexport class GeneratedClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the GeneratedClient class.\n * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:\n * https://westus.api.cognitive.microsoft.com).\n * @param options The parameter options\n */\n constructor(endpoint: string, options?: GeneratedClientOptionalParams) {\n if (endpoint === undefined) {\n throw new Error(\"'endpoint' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: GeneratedClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-ai-text-analytics/5.1.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n baseUri:\n options.endpoint ??\n options.baseUri ??\n \"{Endpoint}/text/analytics/{ApiVersion}\"\n };\n super(optionsWithDefaults);\n\n if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {\n const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();\n const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(\n (pipelinePolicy) =>\n pipelinePolicy.name ===\n coreRestPipeline.bearerTokenAuthenticationPolicyName\n );\n if (!bearerTokenAuthenticationPolicyFound) {\n this.pipeline.removePolicy({\n name: coreRestPipeline.bearerTokenAuthenticationPolicyName\n });\n this.pipeline.addPolicy(\n coreRestPipeline.bearerTokenAuthenticationPolicy({\n scopes: `${optionsWithDefaults.baseUri}/.default`,\n challengeCallbacks: {\n authorizeRequestOnChallenge:\n coreClient.authorizeRequestOnClaimChallenge\n }\n })\n );\n }\n }\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"v3.1\";\n }\n\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed.\n * @param options The options parameters.\n */\n analyze(options?: AnalyzeOptionalParams): Promise<AnalyzeResponse> {\n return this.sendOperationRequest({ options }, analyzeOperationSpec);\n }\n\n /**\n * Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are\n * completed, the job will transition to the completed state and results will be available for each\n * task.\n * @param jobId Job ID for Analyze\n * @param options The options parameters.\n */\n analyzeStatus(\n jobId: string,\n options?: AnalyzeStatusOptionalParams\n ): Promise<AnalyzeStatusResponse> {\n return this.sendOperationRequest(\n { jobId, options },\n analyzeStatusOperationSpec\n );\n }\n\n /**\n * Get details of the healthcare prediction job specified by the jobId.\n * @param jobId Job ID\n * @param options The options parameters.\n */\n healthStatus(\n jobId: string,\n options?: HealthStatusOptionalParams\n ): Promise<HealthStatusResponse> {\n return this.sendOperationRequest(\n { jobId, options },\n healthStatusOperationSpec\n );\n }\n\n /**\n * Cancel healthcare prediction job.\n * @param jobId Job ID\n * @param options The options parameters.\n */\n cancelHealthJob(\n jobId: string,\n options?: CancelHealthJobOptionalParams\n ): Promise<CancelHealthJobResponse> {\n return this.sendOperationRequest(\n { jobId, options },\n cancelHealthJobOperationSpec\n );\n }\n\n /**\n * Start a healthcare analysis job to recognize healthcare related entities (drugs, conditions,\n * symptoms, etc) and their relations.\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n health(\n input: MultiLanguageBatchInput,\n options?: HealthOptionalParams\n ): Promise<HealthResponse> {\n return this.sendOperationRequest({ input, options }, healthOperationSpec);\n }\n\n /**\n * The API returns a list of general named entities in a given document. For the list of supported\n * entity types, check <a href=\"https://aka.ms/taner\">Supported Entity Types in Text Analytics API</a>.\n * See the <a href=\"https://aka.ms/talangs\">Supported languages in Text Analytics API</a> for the list\n * of enabled languages.\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n entitiesRecognitionGeneral(\n input: MultiLanguageBatchInput,\n options?: EntitiesRecognitionGeneralOptionalParams\n ): Promise<EntitiesRecognitionGeneralResponse> {\n return this.sendOperationRequest(\n { input, options },\n entitiesRecognitionGeneralOperationSpec\n );\n }\n\n /**\n * The API returns a list of entities with personal information (\\\"SSN\\\", \\\"Bank Account\\\" etc) in the\n * document. For the list of supported entity types, check <a href=\"https://aka.ms/tanerpii\">Supported\n * Entity Types in Text Analytics API</a>. See the <a href=\"https://aka.ms/talangs\">Supported languages\n * in Text Analytics API</a> for the list of enabled languages.\n *\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n entitiesRecognitionPii(\n input: MultiLanguageBatchInput,\n options?: EntitiesRecognitionPiiOptionalParams\n ): Promise<EntitiesRecognitionPiiResponse> {\n return this.sendOperationRequest(\n { input, options },\n entitiesRecognitionPiiOperationSpec\n );\n }\n\n /**\n * The API returns a list of recognized entities with links to a well known knowledge base. See the <a\n * href=\"https://aka.ms/talangs\">Supported languages in Text Analytics API</a> for the list of enabled\n * languages.\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n entitiesLinking(\n input: MultiLanguageBatchInput,\n options?: EntitiesLinkingOptionalParams\n ): Promise<EntitiesLinkingResponse> {\n return this.sendOperationRequest(\n { input, options },\n entitiesLinkingOperationSpec\n );\n }\n\n /**\n * The API returns a list of strings denoting the key phrases in the input text. See the <a\n * href=\"https://aka.ms/talangs\">Supported languages in Text Analytics API</a> for the list of enabled\n * languages.\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n keyPhrases(\n input: MultiLanguageBatchInput,\n options?: KeyPhrasesOptionalParams\n ): Promise<KeyPhrasesResponse> {\n return this.sendOperationRequest(\n { input, options },\n keyPhrasesOperationSpec\n );\n }\n\n /**\n * The API returns the detected language and a numeric score between 0 and 1. Scores close to 1\n * indicate 100% certainty that the identified language is true. See the <a\n * href=\"https://aka.ms/talangs\">Supported languages in Text Analytics API</a> for the list of enabled\n * languages.\n * @param input Collection of documents to analyze for language endpoint.\n * @param options The options parameters.\n */\n languages(\n input: LanguageBatchInput,\n options?: LanguagesOptionalParams\n ): Promise<LanguagesResponse> {\n return this.sendOperationRequest(\n { input, options },\n languagesOperationSpec\n );\n }\n\n /**\n * The API returns a detailed sentiment analysis for the input text. The analysis is done in multiple\n * levels of granularity, start from the a document level, down to sentence and key terms (targets and\n * assessments).\n * @param input Collection of documents to analyze.\n * @param options The options parameters.\n */\n sentiment(\n input: MultiLanguageBatchInput,\n options?: SentimentOptionalParams\n ): Promise<SentimentOperationResponse> {\n return this.sendOperationRequest(\n { input, options },\n sentimentOperationSpec\n );\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst analyzeOperationSpec: coreClient.OperationSpec = {\n path: \"/analyze\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n headersMapper: Mappers.GeneratedClientAnalyzeHeaders\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.body,\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst analyzeStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/analyze/jobs/{jobId}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeJobState\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.top,\n Parameters.skip\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion, Parameters.jobId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst healthStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/health/jobs/{jobId}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.HealthcareJobState\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.top,\n Parameters.skip\n ],\n urlParameters: [\n Parameters.endpoint,\n Parameters.apiVersion,\n Parameters.jobId1\n ],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst cancelHealthJobOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/health/jobs/{jobId}\",\n httpMethod: \"DELETE\",\n responses: {\n 202: {\n headersMapper: Mappers.GeneratedClientCancelHealthJobHeaders\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n urlParameters: [\n Parameters.endpoint,\n Parameters.apiVersion,\n Parameters.jobId1\n ],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst healthOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/health/jobs\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n headersMapper: Mappers.GeneratedClientHealthHeaders\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.modelVersion,\n Parameters.stringIndexType,\n Parameters.loggingOptOut\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst entitiesRecognitionGeneralOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/recognition/general\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.EntitiesResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.stringIndexType,\n Parameters.loggingOptOut\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst entitiesRecognitionPiiOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/recognition/pii\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.PiiResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.stringIndexType,\n Parameters.loggingOptOut,\n Parameters.domain,\n Parameters.piiCategories\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst entitiesLinkingOperationSpec: coreClient.OperationSpec = {\n path: \"/entities/linking\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.EntityLinkingResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.stringIndexType,\n Parameters.loggingOptOut\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst keyPhrasesOperationSpec: coreClient.OperationSpec = {\n path: \"/keyPhrases\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.KeyPhraseResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.loggingOptOut\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst languagesOperationSpec: coreClient.OperationSpec = {\n path: \"/languages\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.LanguageResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input1,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.loggingOptOut\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst sentimentOperationSpec: coreClient.OperationSpec = {\n path: \"/sentiment\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.SentimentResponse\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.input,\n queryParameters: [\n Parameters.includeStatistics,\n Parameters.modelVersion,\n Parameters.stringIndexType,\n Parameters.loggingOptOut,\n Parameters.opinionMining\n ],\n urlParameters: [Parameters.endpoint, Parameters.apiVersion],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\n"]}