@azure/ai-text-analytics 5.2.0-beta.2 → 6.0.0-alpha.20220518.3

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 (103) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +375 -133
  3. package/dist/index.js +2797 -4176
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/azureKeyCredentialPolicy.js +2 -2
  6. package/dist-esm/src/azureKeyCredentialPolicy.js.map +1 -1
  7. package/dist-esm/src/constants.js +16 -0
  8. package/dist-esm/src/constants.js.map +1 -0
  9. package/dist-esm/src/generated/generatedClient.js +80 -334
  10. package/dist-esm/src/generated/generatedClient.js.map +1 -1
  11. package/dist-esm/src/generated/index.js +1 -1
  12. package/dist-esm/src/generated/index.js.map +1 -1
  13. package/dist-esm/src/generated/models/index.js +106 -35
  14. package/dist-esm/src/generated/models/index.js.map +1 -1
  15. package/dist-esm/src/generated/models/mappers.js +1625 -2101
  16. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  17. package/dist-esm/src/generated/models/parameters.js +18 -105
  18. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  19. package/dist-esm/src/generated/operations/analyzeText.js +105 -0
  20. package/dist-esm/src/generated/operations/analyzeText.js.map +1 -0
  21. package/dist-esm/src/generated/operations/index.js +9 -0
  22. package/dist-esm/src/generated/operations/index.js.map +1 -0
  23. package/dist-esm/src/generated/operationsInterfaces/analyzeText.js +9 -0
  24. package/dist-esm/src/generated/operationsInterfaces/analyzeText.js.map +1 -0
  25. package/dist-esm/src/generated/operationsInterfaces/index.js +9 -0
  26. package/dist-esm/src/generated/operationsInterfaces/index.js.map +1 -0
  27. package/dist-esm/src/index.js +14 -5
  28. package/dist-esm/src/index.js.map +1 -1
  29. package/dist-esm/src/lro.js +195 -0
  30. package/dist-esm/src/lro.js.map +1 -0
  31. package/dist-esm/src/models.js +42 -0
  32. package/dist-esm/src/models.js.map +1 -0
  33. package/dist-esm/src/textAnalysisClient.js +197 -0
  34. package/dist-esm/src/textAnalysisClient.js.map +1 -0
  35. package/dist-esm/src/transforms.js +279 -0
  36. package/dist-esm/src/transforms.js.map +1 -0
  37. package/dist-esm/src/util.js +35 -141
  38. package/dist-esm/src/util.js.map +1 -1
  39. package/package.json +25 -33
  40. package/types/ai-text-analytics.d.ts +1402 -1421
  41. package/CHANGELOG.md +0 -162
  42. package/dist-esm/src/analyzeActionsResult.js +0 -205
  43. package/dist-esm/src/analyzeActionsResult.js.map +0 -1
  44. package/dist-esm/src/analyzeHealthcareEntitiesResult.js +0 -53
  45. package/dist-esm/src/analyzeHealthcareEntitiesResult.js.map +0 -1
  46. package/dist-esm/src/analyzeLro.js +0 -132
  47. package/dist-esm/src/analyzeLro.js.map +0 -1
  48. package/dist-esm/src/analyzeSentimentResult.js +0 -74
  49. package/dist-esm/src/analyzeSentimentResult.js.map +0 -1
  50. package/dist-esm/src/analyzeSentimentResultArray.js +0 -11
  51. package/dist-esm/src/analyzeSentimentResultArray.js.map +0 -1
  52. package/dist-esm/src/detectLanguageResult.js +0 -17
  53. package/dist-esm/src/detectLanguageResult.js.map +0 -1
  54. package/dist-esm/src/detectLanguageResultArray.js +0 -11
  55. package/dist-esm/src/detectLanguageResultArray.js.map +0 -1
  56. package/dist-esm/src/extractKeyPhrasesResult.js +0 -17
  57. package/dist-esm/src/extractKeyPhrasesResult.js.map +0 -1
  58. package/dist-esm/src/extractKeyPhrasesResultArray.js +0 -11
  59. package/dist-esm/src/extractKeyPhrasesResultArray.js.map +0 -1
  60. package/dist-esm/src/extractSummaryResult.js +0 -17
  61. package/dist-esm/src/extractSummaryResult.js.map +0 -1
  62. package/dist-esm/src/extractSummaryResultArray.js +0 -11
  63. package/dist-esm/src/extractSummaryResultArray.js.map +0 -1
  64. package/dist-esm/src/generated/generatedClientContext.js +0 -42
  65. package/dist-esm/src/generated/generatedClientContext.js.map +0 -1
  66. package/dist-esm/src/healthLro.js +0 -139
  67. package/dist-esm/src/healthLro.js.map +0 -1
  68. package/dist-esm/src/multiCategoryClassifyResult.js +0 -17
  69. package/dist-esm/src/multiCategoryClassifyResult.js.map +0 -1
  70. package/dist-esm/src/multiCategoryClassifyResultArray.js +0 -11
  71. package/dist-esm/src/multiCategoryClassifyResultArray.js.map +0 -1
  72. package/dist-esm/src/pollerModels.js +0 -4
  73. package/dist-esm/src/pollerModels.js.map +0 -1
  74. package/dist-esm/src/recognizeCategorizedEntitiesResult.js +0 -17
  75. package/dist-esm/src/recognizeCategorizedEntitiesResult.js.map +0 -1
  76. package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js +0 -11
  77. package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js.map +0 -1
  78. package/dist-esm/src/recognizeCustomEntitiesResult.js +0 -17
  79. package/dist-esm/src/recognizeCustomEntitiesResult.js.map +0 -1
  80. package/dist-esm/src/recognizeCustomEntitiesResultArray.js +0 -11
  81. package/dist-esm/src/recognizeCustomEntitiesResultArray.js.map +0 -1
  82. package/dist-esm/src/recognizeLinkedEntitiesResult.js +0 -17
  83. package/dist-esm/src/recognizeLinkedEntitiesResult.js.map +0 -1
  84. package/dist-esm/src/recognizeLinkedEntitiesResultArray.js +0 -11
  85. package/dist-esm/src/recognizeLinkedEntitiesResultArray.js.map +0 -1
  86. package/dist-esm/src/recognizePiiEntitiesResult.js +0 -18
  87. package/dist-esm/src/recognizePiiEntitiesResult.js.map +0 -1
  88. package/dist-esm/src/recognizePiiEntitiesResultArray.js +0 -11
  89. package/dist-esm/src/recognizePiiEntitiesResultArray.js.map +0 -1
  90. package/dist-esm/src/singleCategoryClassifyResult.js +0 -17
  91. package/dist-esm/src/singleCategoryClassifyResult.js.map +0 -1
  92. package/dist-esm/src/singleCategoryClassifyResultArray.js +0 -11
  93. package/dist-esm/src/singleCategoryClassifyResultArray.js.map +0 -1
  94. package/dist-esm/src/textAnalyticsAction.js +0 -4
  95. package/dist-esm/src/textAnalyticsAction.js.map +0 -1
  96. package/dist-esm/src/textAnalyticsClient.js +0 -511
  97. package/dist-esm/src/textAnalyticsClient.js.map +0 -1
  98. package/dist-esm/src/textAnalyticsOperationOptions.js +0 -4
  99. package/dist-esm/src/textAnalyticsOperationOptions.js.map +0 -1
  100. package/dist-esm/src/textAnalyticsResult.js +0 -94
  101. package/dist-esm/src/textAnalyticsResult.js.map +0 -1
  102. package/dist-esm/src/tracing.js +0 -12
  103. package/dist-esm/src/tracing.js.map +0 -1
@@ -1,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=textAnalyticsOperationOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"textAnalyticsOperationOptions.js","sourceRoot":"","sources":["../../src/textAnalyticsOperationOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure/core-client\";\n\n/**\n * Options common to all text analytics operations.\n */\nexport interface TextAnalyticsOperationOptions extends OperationOptions {\n /**\n * This value indicates which model will be used for scoring. If a model-version is\n * not specified, the API should default to the latest, non-preview version.\n * For supported model versions, see operation-specific documentation, for example:\n * https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis#model-versioning\n */\n modelVersion?: string;\n /**\n * If set to true, response will contain input and document level statistics.\n */\n includeStatistics?: boolean;\n /**\n * If set to true (the default for `beginAnalyzeHealthcareEntities` and `recognizePiiEntities`),\n * you opt-out of having your text input logged for troubleshooting. By default, Text Analytics\n * logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this\n * parameter to true, disables input logging and may limit our ability to remediate issues that\n * occur.\n */\n disableServiceLogs?: boolean;\n}\n"]}
@@ -1,94 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { sortResponseIdObjects } from "./util";
4
- /**
5
- * Helper function for converting nested service error into
6
- * the unified TextAnalyticsError
7
- * @internal
8
- */
9
- export function intoTextAnalyticsError(errorModel) {
10
- // Return the deepest error. This will always be at most
11
- // one level for TextAnalytics
12
- if (errorModel.innererror !== undefined) {
13
- return intoTextAnalyticsError(errorModel.innererror);
14
- }
15
- return {
16
- code: errorModel.code,
17
- message: errorModel.message,
18
- target: errorModel.target
19
- };
20
- }
21
- /**
22
- * @internal
23
- */
24
- export function makeTextAnalyticsSuccessResult(id, warnings, statistics) {
25
- return {
26
- id,
27
- statistics,
28
- warnings
29
- };
30
- }
31
- /**
32
- * @internal
33
- */
34
- export function makeTextAnalyticsErrorResult(id, error) {
35
- return {
36
- id,
37
- error: intoTextAnalyticsError(error)
38
- };
39
- }
40
- /**
41
- * @internal
42
- * combines successful and erroneous results into a single array of results and
43
- * sort them so that the IDs order match that of the input documents array.
44
- * @param input - the array of documents sent to the service for processing.
45
- * @param response - the response received from the service.
46
- */
47
- export function combineSuccessfulAndErroneousDocuments(input, response) {
48
- return processAndCombineSuccessfulAndErroneousDocuments(input, response, (x) => x, makeTextAnalyticsErrorResult);
49
- }
50
- /**
51
- * @internal
52
- * combines successful and erroneous results into a single array of results and
53
- * sort them so that the IDs order match that of the input documents array.
54
- * @param input - the array of documents sent to the service for processing.
55
- * @param response - the response received from the service.
56
- * @param process - a function to convert the results from one type to another.
57
- */
58
- export function processAndCombineSuccessfulAndErroneousDocuments(input, response, processSuccess, processError) {
59
- const successResults = response.documents.map(processSuccess);
60
- const unsortedResults = successResults.concat(response.errors.map((error) => processError(error.id, error.error)));
61
- return sortResponseIdObjects(input, unsortedResults);
62
- }
63
- /**
64
- * @internal
65
- * combines successful and erroneous results into a single array of results and
66
- * sort them so that the IDs order match that of the input documents array. It
67
- * also attaches statistics and modelVersion to the returned array.
68
- * @param input - the array of documents sent to the service for processing.
69
- * @param response - the response received from the service.
70
- */
71
- export function combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, processSuccess, processError) {
72
- const sorted = processAndCombineSuccessfulAndErroneousDocuments(input, response, processSuccess, processError);
73
- return Object.assign(sorted, {
74
- statistics: response.statistics,
75
- modelVersion: response.modelVersion
76
- });
77
- }
78
- /**
79
- * @internal
80
- * combines successful and erroneous results into a single array of results and
81
- * sort them so that the IDs order match that of the input documents array. It
82
- * also attaches statistics, projectName, and deploymentName to the returned array.
83
- * @param input - the array of documents sent to the service for processing.
84
- * @param response - the response received from the service.
85
- */
86
- export function combineSuccessfulAndErroneousDocumentsWithStatisticsAndCustomProjectInfo(input, response, processSuccess, processError) {
87
- const sorted = processAndCombineSuccessfulAndErroneousDocuments(input, response, processSuccess, processError);
88
- return Object.assign(sorted, {
89
- statistics: response.statistics,
90
- projectName: response.projectName,
91
- deploymentName: response.deploymentName
92
- });
93
- }
94
- //# sourceMappingURL=textAnalyticsResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"textAnalyticsResult.js","sourceRoot":"","sources":["../../src/textAnalyticsResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAalC,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAuK/C;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAyD;IAEzD,wDAAwD;IACxD,8BAA8B;IAC9B,IAAI,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE;QACvC,OAAO,sBAAsB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;KACtD;IAED,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAC5C,EAAU,EACV,QAAgC,EAChC,UAAmC;IAEnC,OAAO;QACL,EAAE;QACF,UAAU;QACV,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC1C,EAAU,EACV,KAAuC;IAEvC,OAAO;QACL,EAAE;QACF,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC;KACrC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sCAAsC,CACpD,KAA0B,EAC1B,QAAiD;IAEjD,OAAO,gDAAgD,CACrD,KAAK,EACL,QAAQ,EACR,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EACR,4BAA4B,CAC7B,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gDAAgD,CAK9D,KAA0B,EAC1B,QAGC,EACD,cAA+D,EAC/D,YAA6E;IAE7E,MAAM,cAAc,GAA+C,QAAQ,CAAC,SAAS,CAAC,GAAG,CACvF,cAAc,CACf,CAAC;IACF,MAAM,eAAe,GAAG,cAAc,CAAC,MAAM,CAC3C,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CACpE,CAAC;IAEF,OAAO,qBAAqB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mEAAmE,CAKjF,KAA0B,EAC1B,QAAwD,EACxD,cAAqD,EACrD,YAA6E;IAE7E,MAAM,MAAM,GAAG,gDAAgD,CAC7D,KAAK,EACL,QAAQ,EACR,cAAc,EACd,YAAY,CACb,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,YAAY,EAAE,QAAQ,CAAC,YAAY;KACpC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wEAAwE,CAKtF,KAA0B,EAC1B,QAAsD,EACtD,cAAqD,EACrD,YAA6E;IAE7E,MAAM,MAAM,GAAG,gDAAgD,CAC7D,KAAK,EACL,QAAQ,EACR,cAAc,EACd,YAAY,CACb,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,cAAc,EAAE,QAAQ,CAAC,cAAc;KACxC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextDocumentStatistics,\n TextAnalyticsError as GeneratedTextAnalyticsErrorModel,\n InnerError,\n ErrorCodeValue,\n InnerErrorCodeValue,\n TextAnalyticsWarning,\n DocumentError,\n TextDocumentBatchStatistics,\n TextDocumentInput\n} from \"./generated/models\";\nimport { sortResponseIdObjects } from \"./util\";\n\n/**\n * The result of a text analytics operation on a single input document.\n * @internal\n */\nexport type TextAnalyticsResult = TextAnalyticsSuccessResult | TextAnalyticsErrorResult;\n\n/**\n * An Error Code returned from the Text Analytics service. Possible\n * values include:\n *\n * For more information about the error, see the `message` property of the associated error.\n */\nexport type ErrorCode = ErrorCodeValue | InnerErrorCodeValue;\n\n/**\n * Type describing an error from the Text Analytics service.\n */\nexport interface TextAnalyticsError {\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 target of the particular error (for example, the name of an invalid parameter)\n */\n readonly target?: string;\n}\n\n/**\n * Base type for results of text analytics operations corresponding to a single\n * input document.\n */\nexport interface TextAnalyticsSuccessResult {\n /**\n * Unique, non-empty document identifier.\n */\n readonly id: string;\n\n /**\n * Statistics about the input document 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 readonly statistics?: TextDocumentStatistics;\n\n /**\n * An array of warning data corresponding to this document.\n *\n * If no warnings were returned, this array will be empty.\n */\n readonly warnings: TextAnalyticsWarning[];\n\n /**\n * Discriminant to determine if that this is an error result.\n */\n readonly error?: undefined;\n}\n\n/**\n * Base type for error results of text analytics operations corresponding to a\n * single document.\n */\nexport interface TextAnalyticsErrorResult {\n /**\n * Unique, non-empty document identifier.\n */\n readonly id: string;\n\n /**\n * The Error for this document result.\n */\n readonly error: TextAnalyticsError;\n}\n\n/**\n * @internal\n */\nexport interface StandardTextAnalyticsResultArray<T1 extends TextAnalyticsSuccessResult>\n extends Array<T1 | TextAnalyticsErrorResult> {\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 * @internal\n */\nexport interface CustomTextAnalyticsResultArray<T1 extends TextAnalyticsSuccessResult>\n extends Array<T1 | TextAnalyticsErrorResult> {\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 * This field indicates the project name for the model.\n */\n projectName: string;\n /**\n * This field indicates the deployment name for the model.\n */\n deploymentName: string;\n}\n\n/**\n * @internal\n */\nexport interface StandardTextAnalyticsResponse<T1 extends TextAnalyticsSuccessResult> {\n /**\n * Response by document\n */\n documents: T1[];\n /**\n * Errors by document id.\n */\n errors: DocumentError[];\n /**\n * if includeStatistics=true was specified in the request this field will contain information about the request payload.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * This field indicates which model is used for scoring.\n */\n modelVersion: string;\n}\n\n/**\n * @internal\n */\nexport interface CustomTextAnalyticsResponse<T1 extends TextAnalyticsSuccessResult> {\n /**\n * Response by document\n */\n documents: T1[];\n /**\n * Errors by document id.\n */\n errors: DocumentError[];\n /**\n * if includeStatistics=true was specified in the request this field will contain information about the request payload.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * This field indicates the project name for the model.\n */\n projectName: string;\n /**\n * This field indicates the deployment name for the model.\n */\n deploymentName: string;\n}\n\n/**\n * Helper function for converting nested service error into\n * the unified TextAnalyticsError\n * @internal\n */\nexport function intoTextAnalyticsError(\n errorModel: GeneratedTextAnalyticsErrorModel | InnerError\n): TextAnalyticsError {\n // Return the deepest error. This will always be at most\n // one level for TextAnalytics\n if (errorModel.innererror !== undefined) {\n return intoTextAnalyticsError(errorModel.innererror);\n }\n\n return {\n code: errorModel.code,\n message: errorModel.message,\n target: errorModel.target\n };\n}\n\n/**\n * @internal\n */\nexport function makeTextAnalyticsSuccessResult(\n id: string,\n warnings: TextAnalyticsWarning[],\n statistics?: TextDocumentStatistics\n): TextAnalyticsSuccessResult {\n return {\n id,\n statistics,\n warnings\n };\n}\n\n/**\n * @internal\n */\nexport function makeTextAnalyticsErrorResult(\n id: string,\n error: GeneratedTextAnalyticsErrorModel\n): TextAnalyticsErrorResult {\n return {\n id,\n error: intoTextAnalyticsError(error)\n };\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n */\nexport function combineSuccessfulAndErroneousDocuments<TSuccess extends TextAnalyticsSuccessResult>(\n input: TextDocumentInput[],\n response: StandardTextAnalyticsResponse<TSuccess>\n): (TSuccess | TextAnalyticsErrorResult)[] {\n return processAndCombineSuccessfulAndErroneousDocuments(\n input,\n response,\n (x) => x,\n makeTextAnalyticsErrorResult\n );\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n * @param process - a function to convert the results from one type to another.\n */\nexport function processAndCombineSuccessfulAndErroneousDocuments<\n TSuccessService extends TextAnalyticsSuccessResult,\n TSuccessSDK extends TextAnalyticsSuccessResult,\n TError extends TextAnalyticsErrorResult\n>(\n input: TextDocumentInput[],\n response: {\n documents: TSuccessService[];\n errors: DocumentError[];\n },\n processSuccess: (successResult: TSuccessService) => TSuccessSDK,\n processError: (id: string, error: GeneratedTextAnalyticsErrorModel) => TError\n): (TSuccessSDK | TextAnalyticsErrorResult)[] {\n const successResults: (TSuccessSDK | TextAnalyticsErrorResult)[] = response.documents.map(\n processSuccess\n );\n const unsortedResults = successResults.concat(\n response.errors.map((error) => processError(error.id, error.error))\n );\n\n return sortResponseIdObjects(input, unsortedResults);\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array. It\n * also attaches statistics and modelVersion to the returned array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n */\nexport function combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion<\n TSuccessService extends TextAnalyticsSuccessResult,\n TSuccessSDK extends TextAnalyticsSuccessResult,\n TError extends TextAnalyticsErrorResult\n>(\n input: TextDocumentInput[],\n response: StandardTextAnalyticsResponse<TSuccessService>,\n processSuccess: (doc: TSuccessService) => TSuccessSDK,\n processError: (id: string, error: GeneratedTextAnalyticsErrorModel) => TError\n): StandardTextAnalyticsResultArray<TSuccessSDK> {\n const sorted = processAndCombineSuccessfulAndErroneousDocuments(\n input,\n response,\n processSuccess,\n processError\n );\n return Object.assign(sorted, {\n statistics: response.statistics,\n modelVersion: response.modelVersion\n });\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array. It\n * also attaches statistics, projectName, and deploymentName to the returned array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n */\nexport function combineSuccessfulAndErroneousDocumentsWithStatisticsAndCustomProjectInfo<\n TSuccessService extends TextAnalyticsSuccessResult,\n TSuccessSDK extends TextAnalyticsSuccessResult,\n TError extends TextAnalyticsErrorResult\n>(\n input: TextDocumentInput[],\n response: CustomTextAnalyticsResponse<TSuccessService>,\n processSuccess: (doc: TSuccessService) => TSuccessSDK,\n processError: (id: string, error: GeneratedTextAnalyticsErrorModel) => TError\n): CustomTextAnalyticsResultArray<TSuccessSDK> {\n const sorted = processAndCombineSuccessfulAndErroneousDocuments(\n input,\n response,\n processSuccess,\n processError\n );\n return Object.assign(sorted, {\n statistics: response.statistics,\n projectName: response.projectName,\n deploymentName: response.deploymentName\n });\n}\n"]}
@@ -1,12 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { createSpanFunction } from "@azure/core-tracing";
4
- /**
5
- * Creates a span using the global tracer.
6
- * @internal
7
- */
8
- export const createSpan = createSpanFunction({
9
- packagePrefix: "Azure.CognitiveServices.TextAnalytics",
10
- namespace: "Microsoft.CognitiveServices"
11
- });
12
- //# sourceMappingURL=tracing.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/tracing.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;IAC3C,aAAa,EAAE,uCAAuC;IACtD,SAAS,EAAE,6BAA6B;CACzC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSpanFunction } from \"@azure/core-tracing\";\n\n/**\n * Creates a span using the global tracer.\n * @internal\n */\nexport const createSpan = createSpanFunction({\n packagePrefix: \"Azure.CognitiveServices.TextAnalytics\",\n namespace: \"Microsoft.CognitiveServices\"\n});\n"]}