@azure/ai-text-analytics 5.2.0-beta.1 → 6.0.0-alpha.20220517.2

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 (97) hide show
  1. package/README.md +376 -132
  2. package/dist/index.js +2803 -3497
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/azureKeyCredentialPolicy.js +2 -2
  5. package/dist-esm/src/azureKeyCredentialPolicy.js.map +1 -1
  6. package/dist-esm/src/constants.js +16 -0
  7. package/dist-esm/src/constants.js.map +1 -0
  8. package/dist-esm/src/generated/generatedClient.js +80 -334
  9. package/dist-esm/src/generated/generatedClient.js.map +1 -1
  10. package/dist-esm/src/generated/index.js +1 -1
  11. package/dist-esm/src/generated/index.js.map +1 -1
  12. package/dist-esm/src/generated/models/index.js +106 -35
  13. package/dist-esm/src/generated/models/index.js.map +1 -1
  14. package/dist-esm/src/generated/models/mappers.js +1607 -1464
  15. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  16. package/dist-esm/src/generated/models/parameters.js +18 -104
  17. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  18. package/dist-esm/src/generated/operations/analyzeText.js +105 -0
  19. package/dist-esm/src/generated/operations/analyzeText.js.map +1 -0
  20. package/dist-esm/src/generated/operations/index.js +9 -0
  21. package/dist-esm/src/generated/operations/index.js.map +1 -0
  22. package/dist-esm/src/generated/operationsInterfaces/analyzeText.js +9 -0
  23. package/dist-esm/src/generated/operationsInterfaces/analyzeText.js.map +1 -0
  24. package/dist-esm/src/generated/operationsInterfaces/index.js +9 -0
  25. package/dist-esm/src/generated/operationsInterfaces/index.js.map +1 -0
  26. package/dist-esm/src/index.js +14 -5
  27. package/dist-esm/src/index.js.map +1 -1
  28. package/dist-esm/src/lro.js +195 -0
  29. package/dist-esm/src/lro.js.map +1 -0
  30. package/dist-esm/src/models.js +42 -0
  31. package/dist-esm/src/models.js.map +1 -0
  32. package/dist-esm/src/textAnalysisClient.js +197 -0
  33. package/dist-esm/src/textAnalysisClient.js.map +1 -0
  34. package/dist-esm/src/transforms.js +279 -0
  35. package/dist-esm/src/transforms.js.map +1 -0
  36. package/dist-esm/src/util.js +36 -158
  37. package/dist-esm/src/util.js.map +1 -1
  38. package/package.json +28 -38
  39. package/types/ai-text-analytics.d.ts +1432 -1143
  40. package/CHANGELOG.md +0 -143
  41. package/LICENSE +0 -21
  42. package/dist-esm/src/analyzeActionsResult.js +0 -167
  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 -130
  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 -131
  67. package/dist-esm/src/healthLro.js.map +0 -1
  68. package/dist-esm/src/paging.js +0 -83
  69. package/dist-esm/src/paging.js.map +0 -1
  70. package/dist-esm/src/pollerModels.js +0 -4
  71. package/dist-esm/src/pollerModels.js.map +0 -1
  72. package/dist-esm/src/recognizeCategorizedEntitiesResult.js +0 -17
  73. package/dist-esm/src/recognizeCategorizedEntitiesResult.js.map +0 -1
  74. package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js +0 -11
  75. package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js.map +0 -1
  76. package/dist-esm/src/recognizeLinkedEntitiesResult.js +0 -17
  77. package/dist-esm/src/recognizeLinkedEntitiesResult.js.map +0 -1
  78. package/dist-esm/src/recognizeLinkedEntitiesResultArray.js +0 -11
  79. package/dist-esm/src/recognizeLinkedEntitiesResultArray.js.map +0 -1
  80. package/dist-esm/src/recognizePiiEntitiesResult.js +0 -18
  81. package/dist-esm/src/recognizePiiEntitiesResult.js.map +0 -1
  82. package/dist-esm/src/recognizePiiEntitiesResultArray.js +0 -11
  83. package/dist-esm/src/recognizePiiEntitiesResultArray.js.map +0 -1
  84. package/dist-esm/src/textAnalyticsAction.js +0 -4
  85. package/dist-esm/src/textAnalyticsAction.js.map +0 -1
  86. package/dist-esm/src/textAnalyticsClient.js +0 -523
  87. package/dist-esm/src/textAnalyticsClient.js.map +0 -1
  88. package/dist-esm/src/textAnalyticsOperationOptions.js +0 -4
  89. package/dist-esm/src/textAnalyticsOperationOptions.js.map +0 -1
  90. package/dist-esm/src/textAnalyticsResult.js +0 -78
  91. package/dist-esm/src/textAnalyticsResult.js.map +0 -1
  92. package/dist-esm/src/tracing.js +0 -12
  93. package/dist-esm/src/tracing.js.map +0 -1
  94. package/dist-esm/src/utils/url.browser.js +0 -6
  95. package/dist-esm/src/utils/url.browser.js.map +0 -1
  96. package/dist-esm/src/utils/url.js +0 -4
  97. package/dist-esm/src/utils/url.js.map +0 -1
@@ -1,74 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- import { parseAssessmentIndex } from "./util";
5
- /**
6
- * @param document - A document result coming from the service.
7
- * @internal
8
- */
9
- export function makeAnalyzeSentimentResult(result) {
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)) });
13
- }
14
- /**
15
- * @internal
16
- */
17
- export function makeAnalyzeSentimentErrorResult(id, error) {
18
- return makeTextAnalyticsErrorResult(id, error);
19
- }
20
- /**
21
- * Converts a sentence sentiment object returned by the service to another that
22
- * is user-friendly.
23
- *
24
- * @param sentence - The sentence sentiment object to be converted.
25
- * @param response - The entire response returned by the service.
26
- * @returns The user-friendly sentence sentiment object.
27
- * @internal
28
- */
29
- function convertGeneratedSentenceSentiment(sentence, result) {
30
- return {
31
- confidenceScores: sentence.confidenceScores,
32
- sentiment: sentence.sentiment,
33
- text: sentence.text,
34
- offset: sentence.offset,
35
- length: sentence.length,
36
- opinions: sentence.targets
37
- ? sentence.targets.map((target) => ({
38
- target: {
39
- confidenceScores: target.confidenceScores,
40
- sentiment: target.sentiment,
41
- text: target.text,
42
- offset: target.offset,
43
- length: target.length
44
- },
45
- assessments: target.relations
46
- .filter((relation) => relation.relationType === "assessment")
47
- .map((relation) => convertTargetRelationToAssessmentSentiment(relation, result))
48
- }))
49
- : []
50
- };
51
- }
52
- /**
53
- * Converts a target relation object returned by the service to an assessment
54
- * sentiment object where JSON pointers in the former are realized in the
55
- * latter.
56
- *
57
- * @param targetRelation - The target relation object to be converted.
58
- * @param response - The entire response returned by the service.
59
- * @returns The user-friendly assessment sentiment object.
60
- * @internal
61
- */
62
- function convertTargetRelationToAssessmentSentiment(targetRelation, result) {
63
- var _a, _b;
64
- const assessmentPtr = targetRelation.ref;
65
- 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];
67
- if (assessment !== undefined) {
68
- return assessment;
69
- }
70
- else {
71
- throw new Error(`Pointer "${assessmentPtr}" is not a valid Assessment pointer`);
72
- }
73
- }
74
- //# sourceMappingURL=analyzeSentimentResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analyzeSentimentResult.js","sourceRoot":"","sources":["../../src/analyzeSentimentResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAc/B,OAAO,EAAmB,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAuH/D;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,MAAyB;IAEzB,MAAM,EACJ,EAAE,EACF,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAAE,SAAS,EAC7B,QAAQ,EACR,UAAU,EACX,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,Q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["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport {\n TextAnalyticsError,\n DocumentSentimentLabel,\n SentimentConfidenceScores,\n SentenceSentiment as GeneratedSentenceSentiment,\n SentenceSentimentLabel,\n DocumentSentiment,\n SentenceTarget,\n TargetRelation,\n SentenceAssessment,\n TokenSentimentValue as SentenceTargetSentiment,\n TargetConfidenceScoreLabel\n} from \"./generated/models\";\nimport { AssessmentIndex, parseAssessmentIndex } from \"./util\";\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://docs.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,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeAnalyzeSentimentErrorResult, makeAnalyzeSentimentResult } from "./analyzeSentimentResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeAnalyzeSentimentResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, makeAnalyzeSentimentResult, makeAnalyzeSentimentErrorResult);
10
- }
11
- //# sourceMappingURL=analyzeSentimentResultArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analyzeSentimentResultArray.js","sourceRoot":"","sources":["../../src/analyzeSentimentResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAEL,+BAA+B,EAC/B,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAoB5G;;GAEG;AACH,MAAM,UAAU,+BAA+B,CAC7C,KAA0B,EAC1B,QAA2B;IAE3B,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,0BAA0B,EAC1B,+BAA+B,CAChC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextDocumentBatchStatistics,\n TextDocumentInput,\n SentimentResponse\n} from \"./generated/models\";\nimport {\n AnalyzeSentimentResult,\n makeAnalyzeSentimentErrorResult,\n makeAnalyzeSentimentResult\n} from \"./analyzeSentimentResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `AnalyzeSentimentResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface AnalyzeSentimentResultArray extends Array<AnalyzeSentimentResult> {\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 function makeAnalyzeSentimentResultArray(\n input: TextDocumentInput[],\n response: SentimentResponse\n): AnalyzeSentimentResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeAnalyzeSentimentResult,\n makeAnalyzeSentimentErrorResult\n );\n}\n"]}
@@ -1,17 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- /**
5
- * @internal
6
- */
7
- export function makeDetectLanguageResult(response) {
8
- const { id, warnings, statistics, detectedLanguage } = response;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { primaryLanguage: detectedLanguage });
10
- }
11
- /**
12
- * @internal
13
- */
14
- export function makeDetectLanguageErrorResult(id, error) {
15
- return makeTextAnalyticsErrorResult(id, error);
16
- }
17
- //# sourceMappingURL=detectLanguageResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detectLanguageResult.js","sourceRoot":"","sources":["../../src/detectLanguageResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAwB/B;;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 {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport { DetectedLanguage, TextAnalyticsError, DocumentLanguage } from \"./generated/models\";\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,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeDetectLanguageResult, makeDetectLanguageErrorResult } from "./detectLanguageResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeDetectLanguageResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, makeDetectLanguageResult, makeDetectLanguageErrorResult);
10
- }
11
- //# sourceMappingURL=detectLanguageResultArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detectLanguageResultArray.js","sourceRoot":"","sources":["../../src/detectLanguageResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,wBAAwB,EACxB,6BAA6B,EAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAoB5G;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,KAA0B,EAC1B,QAAwB;IAExB,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,wBAAwB,EACxB,6BAA6B,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TextDocumentBatchStatistics, LanguageResult, TextDocumentInput } from \"./generated/models\";\nimport {\n DetectLanguageResult,\n makeDetectLanguageResult,\n makeDetectLanguageErrorResult\n} from \"./detectLanguageResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `DetectLanguageResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface DetectLanguageResultArray extends Array<DetectLanguageResult> {\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 function makeDetectLanguageResultArray(\n input: TextDocumentInput[],\n response: LanguageResult\n): DetectLanguageResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeDetectLanguageResult,\n makeDetectLanguageErrorResult\n );\n}\n"]}
@@ -1,17 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- /**
5
- * @internal
6
- */
7
- export function makeExtractKeyPhrasesResult(result) {
8
- const { id, warnings, statistics, keyPhrases } = result;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { keyPhrases });
10
- }
11
- /**
12
- * @internal
13
- */
14
- export function makeExtractKeyPhrasesErrorResult(id, error) {
15
- return makeTextAnalyticsErrorResult(id, error);
16
- }
17
- //# sourceMappingURL=extractKeyPhrasesResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractKeyPhrasesResult.js","sourceRoot":"","sources":["../../src/extractKeyPhrasesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAyB/B;;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 {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport { TextAnalyticsError, DocumentKeyPhrases } from \"./generated/models\";\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,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeExtractKeyPhrasesResult, makeExtractKeyPhrasesErrorResult } from "./extractKeyPhrasesResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeExtractKeyPhrasesResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, makeExtractKeyPhrasesResult, makeExtractKeyPhrasesErrorResult);
10
- }
11
- //# sourceMappingURL=extractKeyPhrasesResultArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractKeyPhrasesResultArray.js","sourceRoot":"","sources":["../../src/extractKeyPhrasesResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAEL,2BAA2B,EAC3B,gCAAgC,EACjC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAoB5G;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAA0B,EAC1B,QAAyB;IAEzB,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,2BAA2B,EAC3B,gCAAgC,CACjC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextDocumentBatchStatistics,\n TextDocumentInput,\n KeyPhraseResult\n} from \"./generated/models\";\nimport {\n ExtractKeyPhrasesResult,\n makeExtractKeyPhrasesResult,\n makeExtractKeyPhrasesErrorResult\n} from \"./extractKeyPhrasesResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `ExtractKeyPhrasesResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface ExtractKeyPhrasesResultArray extends Array<ExtractKeyPhrasesResult> {\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 function makeExtractKeyPhrasesResultArray(\n input: TextDocumentInput[],\n response: KeyPhraseResult\n): ExtractKeyPhrasesResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeExtractKeyPhrasesResult,\n makeExtractKeyPhrasesErrorResult\n );\n}\n"]}
@@ -1,17 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- /**
5
- * @internal
6
- */
7
- export function makeExtractSummaryResult(result) {
8
- const { id, warnings, statistics, sentences } = result;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { sentences: sentences.map((sentence) => (Object.assign({}, sentence))) });
10
- }
11
- /**
12
- * @internal
13
- */
14
- export function makeExtractSummaryErrorResult(id, error) {
15
- return makeTextAnalyticsErrorResult(id, error);
16
- }
17
- //# sourceMappingURL=extractSummaryResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractSummaryResult.js","sourceRoot":"","sources":["../../src/extractSummaryResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AA0C/B;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAgC;IAEhC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IACvD,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAmC,EAAE,EAAE,CAAC,mBAC7D,QAAQ,EACX,CAAC,IACH;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 {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport {\n TextAnalyticsError,\n ExtractedDocumentSummary,\n ExtractedSummarySentence as GeneratedSummarySentences\n} from \"./generated/models\";\n\n/**\n * The result of the extract summary operation on a single document.\n */\nexport type ExtractSummaryResult = ExtractSummarySuccessResult | ExtractSummaryErrorResult;\n\n/**\n * The result of the extract summary operation on a single document,\n * containing a collection of the summary identified in that document.\n */\nexport interface ExtractSummarySuccessResult extends TextAnalyticsSuccessResult {\n /**\n * A list of sentences composing a summary of the input document.\n */\n sentences: SummarySentence[];\n}\n\n/**\n * An extracted sentence as part of the summary of a document.\n */\nexport interface SummarySentence {\n /** The extracted sentence text. */\n text: string;\n /** A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. */\n rankScore: number;\n /** The sentence offset from the start of the document, based on the value of the stringIndexType parameter. */\n offset: number;\n /** The length of the sentence. */\n length: number;\n}\n\n/**\n * An error result from the extract summary operation on a single document.\n */\nexport type ExtractSummaryErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeExtractSummaryResult(\n result: ExtractedDocumentSummary\n): ExtractSummarySuccessResult {\n const { id, warnings, statistics, sentences } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n sentences: sentences.map((sentence: GeneratedSummarySentences) => ({\n ...sentence\n }))\n };\n}\n\n/**\n * @internal\n */\nexport function makeExtractSummaryErrorResult(\n id: string,\n error: TextAnalyticsError\n): ExtractSummaryErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -1,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeExtractSummaryResult, makeExtractSummaryErrorResult } from "./extractSummaryResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeExtractSummaryResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, makeExtractSummaryResult, makeExtractSummaryErrorResult);
10
- }
11
- //# sourceMappingURL=extractSummaryResultArray.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractSummaryResultArray.js","sourceRoot":"","sources":["../../src/extractSummaryResultArray.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAEL,wBAAwB,EACxB,6BAA6B,EAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mEAAmE,EAAE,MAAM,uBAAuB,CAAC;AAoB5G;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,KAA0B,EAC1B,QAAuC;IAEvC,OAAO,mEAAmE,CACxE,KAAK,EACL,QAAQ,EACR,wBAAwB,EACxB,6BAA6B,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextDocumentBatchStatistics,\n TextDocumentInput,\n ExtractiveSummarizationResult\n} from \"./generated/models\";\nimport {\n ExtractSummaryResult,\n makeExtractSummaryResult,\n makeExtractSummaryErrorResult\n} from \"./extractSummaryResult\";\nimport { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from \"./textAnalyticsResult\";\n\n/**\n * Array of `ExtractSummaryResult` objects corresponding to a batch of input documents, and\n * annotated with information about the batch operation.\n */\nexport interface ExtractSummaryResultArray extends Array<ExtractSummaryResult> {\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 function makeExtractSummaryResultArray(\n input: TextDocumentInput[],\n response: ExtractiveSummarizationResult\n): ExtractSummaryResultArray {\n return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(\n input,\n response,\n makeExtractSummaryResult,\n makeExtractSummaryErrorResult\n );\n}\n"]}
@@ -1,42 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
- */
8
- import * as coreClient from "@azure/core-client";
9
- /** @internal */
10
- export class GeneratedClientContext extends coreClient.ServiceClient {
11
- /**
12
- * Initializes a new instance of the GeneratedClientContext class.
13
- * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
14
- * https://westus.api.cognitive.microsoft.com).
15
- * @param options The parameter options
16
- */
17
- constructor(endpoint, options) {
18
- if (endpoint === undefined) {
19
- throw new Error("'endpoint' cannot be null");
20
- }
21
- // Initializing default values for options
22
- if (!options) {
23
- options = {};
24
- }
25
- const defaults = {
26
- requestContentType: "application/json; charset=utf-8"
27
- };
28
- const packageDetails = `azsdk-js-ai-text-analytics/5.2.0-beta.1`;
29
- const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
30
- ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
31
- : `${packageDetails}`;
32
- const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
33
- userAgentPrefix
34
- }, baseUri: options.endpoint || "{Endpoint}/text/analytics/{ApiVersion}" });
35
- super(optionsWithDefaults);
36
- // Parameter assignments
37
- this.endpoint = endpoint;
38
- // Assigning values to Constant parameters
39
- this.apiVersion = options.apiVersion || "v3.2-preview.1";
40
- }
41
- }
42
- //# sourceMappingURL=generatedClientContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generatedClientContext.js","sourceRoot":"","sources":["../../../src/generated/generatedClientContext.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAGjD,gBAAgB;AAChB,MAAM,OAAO,sBAAuB,SAAQ,UAAU,CAAC,aAAa;IAIlE;;;;;OAKG;IACH,YAAY,QAAgB,EAAE,OAAuC;QACnE,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,QAAQ,GAAkC;YAC9C,kBAAkB,EAAE,iCAAiC;SACtD,CAAC;QAEF,MAAM,cAAc,GAAG,yCAAyC,CAAC;QACjE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;YAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,cAAc,EAAE;YACjE,CAAC,CAAC,GAAG,cAAc,EAAE,CAAC;QAE1B,MAAM,mBAAmB,iDACpB,QAAQ,GACR,OAAO,KACV,gBAAgB,EAAE;gBAChB,eAAe;aAChB,EACD,OAAO,EAAE,OAAO,CAAC,QAAQ,IAAI,wCAAwC,GACtE,CAAC;QACF,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,wBAAwB;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,0CAA0C;QAC1C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,gBAAgB,CAAC;IAC3D,CAAC;CACF","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 { GeneratedClientOptionalParams } from \"./models\";\n\n/** @internal */\nexport class GeneratedClientContext extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the GeneratedClientContext 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.2.0-beta.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: options.endpoint || \"{Endpoint}/text/analytics/{ApiVersion}\"\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"v3.2-preview.1\";\n }\n}\n"]}
@@ -1,131 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { SpanStatusCode } from "@azure/core-tracing";
4
- import { createSerializer } from "@azure/core-client";
5
- import { makeHealthcareEntitiesErrorResult, makeHealthcareEntitiesResult } from "./analyzeHealthcareEntitiesResult";
6
- import { createSpan } from "./tracing";
7
- import { addStrEncodingParam, getRawResponse, handleInvalidDocumentBatch, sendGetRequest } from "./util";
8
- import * as Mappers from "./generated/models/mappers";
9
- import { accept, apiVersion, endpoint, includeStatistics, skip, top } from "./generated/models/parameters";
10
- import { processAndCombineSuccessfulAndErroneousDocuments } from "./textAnalyticsResult";
11
- import { getPagedAsyncIterator } from "./paging";
12
- const serializer = createSerializer(Mappers, /* isXml */ false);
13
- // Consider whether the spec can be exported by code gen
14
- const healthStatusOperationSpec = {
15
- path: "/entities/health/jobs/{jobId}",
16
- httpMethod: "GET",
17
- responses: {
18
- 200: {
19
- bodyMapper: Mappers.HealthcareJobState
20
- },
21
- default: {
22
- bodyMapper: Mappers.ErrorResponse
23
- }
24
- },
25
- queryParameters: [includeStatistics, top, skip],
26
- urlParameters: [endpoint, apiVersion],
27
- headerParameters: [accept],
28
- serializer
29
- };
30
- /**
31
- * @internal
32
- */
33
- export class HealthLro {
34
- constructor(
35
- // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters
36
- client, baseOptions, initOptions, pollOptions, documents) {
37
- this.client = client;
38
- this.baseOptions = baseOptions;
39
- this.initOptions = initOptions;
40
- this.pollOptions = pollOptions;
41
- this.documents = documents;
42
- this.requestMethod = "POST";
43
- this.requestPath = "/entities/health/jobs";
44
- }
45
- async sendInitialRequest() {
46
- const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-beginAnalyzeHealthcare", Object.assign(Object.assign({}, this.baseOptions), addStrEncodingParam(this.initOptions)));
47
- try {
48
- const { flatResponse, rawResponse } = await getRawResponse((paramOptions) => this.client.health({ documents: this.documents }, paramOptions), finalOptions);
49
- return {
50
- flatResponse: flatResponse,
51
- rawResponse
52
- };
53
- }
54
- catch (e) {
55
- const exception = handleInvalidDocumentBatch(e);
56
- span.setStatus({
57
- code: SpanStatusCode.ERROR,
58
- message: exception.message
59
- });
60
- throw exception;
61
- }
62
- finally {
63
- span.end();
64
- }
65
- }
66
- async sendPollRequest(path) {
67
- return sendGetRequest(this.client, healthStatusOperationSpec, "HealthStatus", Object.assign(Object.assign({}, this.baseOptions), this.pollOptions), path);
68
- }
69
- }
70
- /**
71
- * @internal
72
- */
73
- export function isHealthDone(response) {
74
- var _a;
75
- const castResponse = response;
76
- switch (castResponse.status) {
77
- case "notStarted":
78
- case "running":
79
- return false;
80
- case "failed": {
81
- const errors = (_a = castResponse.errors) === null || _a === void 0 ? void 0 : _a.map((e) => ` code ${e.code}, message: '${e.message}'`).join("\n");
82
- const message = `Healthcare analysis failed. Error(s): ${errors || ""}`;
83
- throw new Error(message);
84
- }
85
- default: {
86
- if (castResponse.results) {
87
- return true;
88
- }
89
- else {
90
- throw new Error("Healthcare action has finished but the there are no results!");
91
- }
92
- }
93
- }
94
- }
95
- /**
96
- * @internal
97
- */
98
- export function processHealthResult(
99
- // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters
100
- client, documents, options) {
101
- const pagedResult = {
102
- sendGetRequest: (path, optionsParam) => sendGetRequest(client, healthStatusOperationSpec, "HealthStatus", optionsParam, path).then((response) => response.flatResponse),
103
- buildPage: (flatResponse) => {
104
- if (flatResponse.results) {
105
- return processAndCombineSuccessfulAndErroneousDocuments(documents, flatResponse.results, makeHealthcareEntitiesResult, makeHealthcareEntitiesErrorResult);
106
- }
107
- else {
108
- throw new Error("Healthcare action has succeeded but there are no results!");
109
- }
110
- }
111
- };
112
- return (result, state) => {
113
- const pollingURL = state.pollingURL;
114
- const pagedIterator = getPagedAsyncIterator(pagedResult, pollingURL, options);
115
- return Object.assign(pagedIterator, {
116
- statistics: result.results.statistics,
117
- modelVersion: result.results.modelVersion
118
- });
119
- };
120
- }
121
- /**
122
- * @internal
123
- */
124
- export function updateHealthState(state, lastResponse) {
125
- const response = lastResponse.body;
126
- state.createdOn = response.createdDateTime;
127
- state.lastModifiedOn = response.lastUpdateDateTime;
128
- state.expiresOn = response.expirationDateTime;
129
- state.status = response.status;
130
- }
131
- //# sourceMappingURL=healthLro.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"healthLro.js","sourceRoot":"","sources":["../../src/healthLro.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAmC,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAGL,iCAAiC,EACjC,4BAA4B,EAE7B,MAAM,mCAAmC,CAAC;AAM3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,0BAA0B,EAC1B,cAAc,EAEf,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACL,MAAM,EACN,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,IAAI,EACJ,GAAG,EACJ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gDAAgD,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAe,MAAM,UAAU,CAAC;AAoC9D,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AAEhE,wDAAwD;AACxD,MAAM,yBAAyB,GAAkB;IAC/C,IAAI,EAAE,+BAA+B;IACrC,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,kBAAkB;SACvC;QAC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yB,EAAE,cAAc,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,CACxF,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAmD,CAC3E;QACH,SAAS,EAAE,CAAC,YAAiD,EAAE,EAAE;YAC/D,IAAI,YAAY,CAAC,OAAO,EAAE;gBACxB,OAAO,gDAAgD,CACrD,SAAS,EACT,YAAY,CAAC,OAAO,EACpB,4BAA4B,EAC5B,iCAAiC,CAClC,CAAC;aACH;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;aAC9E;QACH,CAAC;KACF,CAAC;IACF,OAAO,CACL,MAAe,EACf,KAAsC,EACA,EAAE;QACxC,MAAM,UAAU,GAAI,KAAa,CAAC,UAAU,CAAC;QAC7C,MAAM,aAAa,GAAG,qBAAqB,CAKzC,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE;YAClC,UAAU,EAAG,MAAc,CAAC,OAAO,CAAC,UAAU;YAC9C,YAAY,EAAG,MAAc,CAAC,OAAO,CAAC,YAAa;SACpD,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAsC,EACtC,YAAyB;IAEzB,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAW,CAAC;IAC1C,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC,eAAe,CAAC;IAC3C,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAC,kBAAkB,CAAC;IACnD,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC,kBAAkB,CAAC;IAC9C,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { LongRunningOperation, LroResponse, PollerLike, RawResponse } from \"@azure/core-lro\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { createSerializer, OperationOptions, OperationSpec } from \"@azure/core-client\";\nimport {\n AnalyzeHealthcareEntitiesResult,\n AnalyzeHealthcareEntitiesResultArray,\n makeHealthcareEntitiesErrorResult,\n makeHealthcareEntitiesResult,\n PagedAnalyzeHealthcareEntitiesResult\n} from \"./analyzeHealthcareEntitiesResult\";\nimport {\n GeneratedClient,\n GeneratedClientHealthStatusResponse,\n TextDocumentInput\n} from \"./generated\";\nimport { createSpan } from \"./tracing\";\nimport {\n addStrEncodingParam,\n getRawResponse,\n handleInvalidDocumentBatch,\n sendGetRequest,\n StringIndexType\n} from \"./util\";\nimport * as Mappers from \"./generated/models/mappers\";\nimport {\n accept,\n apiVersion,\n endpoint,\n includeStatistics,\n skip,\n top\n} from \"./generated/models/parameters\";\nimport { processAndCombineSuccessfulAndErroneousDocuments } from \"./textAnalyticsResult\";\nimport { getPagedAsyncIterator, PagedResult } from \"./paging\";\nimport { AnalysisPollOperationState } from \"./pollerModels\";\nimport { TextAnalyticsOperationOptions } from \"./textAnalyticsOperationOptions\";\n\n/**\n * Options for the begin analyze healthcare entities operation.\n */\nexport interface BeginAnalyzeHealthcareEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n stringIndexType?: StringIndexType;\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n updateIntervalInMs?: number;\n /**\n * A serialized poller which can be used to resume an existing paused Long-Running-Operation.\n */\n resumeFrom?: string;\n}\n\n/**\n * Result type of the Health Long-Running-Operation (LRO)\n */\nexport type AnalyzeHealthcareEntitiesPollerLike = PollerLike<\n AnalyzeHealthcareOperationState,\n PagedAnalyzeHealthcareEntitiesResult\n>;\n\n/**\n * The state of the begin analyze healthcare polling operation.\n */\nexport interface AnalyzeHealthcareOperationState\n extends AnalysisPollOperationState<PagedAnalyzeHealthcareEntitiesResult> {}\n\nconst serializer = createSerializer(Mappers, /* isXml */ false);\n\n// Consider whether the spec can be exported by code gen\nconst healthStatusOperationSpec: 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: [includeStatistics, top, skip],\n urlParameters: [endpoint, apiVersion],\n headerParameters: [accept],\n serializer\n};\n\n/**\n * @internal\n */\nexport class HealthLro implements LongRunningOperation<PagedAnalyzeHealthcareEntitiesResult> {\n public requestMethod = \"POST\";\n public requestPath = \"/entities/health/jobs\";\n constructor(\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n private client: GeneratedClient,\n private baseOptions: OperationOptions,\n private initOptions: {\n modelVersion?: string;\n stringIndexType?: StringIndexType;\n loggingOptOut?: boolean;\n },\n private pollOptions: {\n includeStatistics?: boolean;\n },\n private documents: TextDocumentInput[]\n ) {}\n async sendInitialRequest(): Promise<LroResponse<PagedAnalyzeHealthcareEntitiesResult>> {\n const { span, updatedOptions: finalOptions } = createSpan(\n \"TextAnalyticsClient-beginAnalyzeHealthcare\",\n {\n ...this.baseOptions,\n ...addStrEncodingParam(this.initOptions)\n }\n );\n try {\n const { flatResponse, rawResponse } = await getRawResponse(\n (paramOptions) => this.client.health({ documents: this.documents }, paramOptions),\n finalOptions\n );\n return {\n flatResponse: flatResponse as PagedAnalyzeHealthcareEntitiesResult,\n rawResponse\n };\n } catch (e) {\n const exception = handleInvalidDocumentBatch(e);\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: exception.message\n });\n throw exception;\n } finally {\n span.end();\n }\n }\n async sendPollRequest(path: string): Promise<LroResponse<PagedAnalyzeHealthcareEntitiesResult>> {\n return sendGetRequest(\n this.client,\n healthStatusOperationSpec,\n \"HealthStatus\",\n { ...this.baseOptions, ...this.pollOptions },\n path\n ) as Promise<LroResponse<PagedAnalyzeHealthcareEntitiesResult>>;\n }\n}\n\n/**\n * @internal\n */\nexport function isHealthDone(response: unknown): boolean {\n const castResponse = response as GeneratedClientHealthStatusResponse;\n switch (castResponse.status) {\n case \"notStarted\":\n case \"running\":\n return false;\n case \"failed\": {\n const errors = castResponse.errors\n ?.map((e) => ` code ${e.code}, message: '${e.message}'`)\n .join(\"\\n\");\n const message = `Healthcare analysis failed. Error(s): ${errors || \"\"}`;\n throw new Error(message);\n }\n default: {\n if (castResponse.results) {\n return true;\n } else {\n throw new Error(\"Healthcare action has finished but the there are no results!\");\n }\n }\n }\n}\n\n/**\n * @internal\n */\nexport function processHealthResult<TOptions extends OperationOptions>(\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n client: GeneratedClient,\n documents: TextDocumentInput[],\n options: TOptions\n): (\n result: unknown,\n state: AnalyzeHealthcareOperationState\n) => PagedAnalyzeHealthcareEntitiesResult {\n const pagedResult: PagedResult<\n TOptions,\n GeneratedClientHealthStatusResponse,\n AnalyzeHealthcareEntitiesResultArray\n > = {\n sendGetRequest: (path: string, optionsParam: TOptions) =>\n sendGetRequest(client, healthStatusOperationSpec, \"HealthStatus\", optionsParam, path).then(\n (response) => response.flatResponse as GeneratedClientHealthStatusResponse\n ),\n buildPage: (flatResponse: GeneratedClientHealthStatusResponse) => {\n if (flatResponse.results) {\n return processAndCombineSuccessfulAndErroneousDocuments(\n documents,\n flatResponse.results,\n makeHealthcareEntitiesResult,\n makeHealthcareEntitiesErrorResult\n );\n } else {\n throw new Error(\"Healthcare action has succeeded but there are no results!\");\n }\n }\n };\n return (\n result: unknown,\n state: AnalyzeHealthcareOperationState\n ): PagedAnalyzeHealthcareEntitiesResult => {\n const pollingURL = (state as any).pollingURL;\n const pagedIterator = getPagedAsyncIterator<\n TOptions,\n GeneratedClientHealthStatusResponse,\n AnalyzeHealthcareEntitiesResult,\n AnalyzeHealthcareEntitiesResultArray\n >(pagedResult, pollingURL, options);\n return Object.assign(pagedIterator, {\n statistics: (result as any).results.statistics,\n modelVersion: (result as any).results.modelVersion!\n });\n };\n}\n\n/**\n * @internal\n */\nexport function updateHealthState(\n state: AnalyzeHealthcareOperationState,\n lastResponse: RawResponse\n): void {\n const response = lastResponse.body as any;\n state.createdOn = response.createdDateTime;\n state.lastModifiedOn = response.lastUpdateDateTime;\n state.expiresOn = response.expirationDateTime;\n state.status = response.status;\n}\n"]}
@@ -1,83 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
4
- /**
5
- * @internal
6
- *
7
- * returns an async iterator that will retrieve items from the server. It also has a `byPage`
8
- * method that can return pages of items at once.
9
- *
10
- * @param pagedResult - an object that describes how to communicate with the service and how to build a page of items.
11
- * @param path - the path to the resource to retrieve
12
- * @param options - the options to pass to the service
13
- * @returns a paged async iterator that will retrieve items from the server.
14
- */
15
- export function getPagedAsyncIterator(pagedResult, path, options) {
16
- const iter = getItemAsyncIterator(pagedResult, path, options);
17
- return {
18
- next() {
19
- return iter.next();
20
- },
21
- [Symbol.asyncIterator]() {
22
- return this;
23
- },
24
- byPage: (settings) => {
25
- const pageOptions = Object.assign(Object.assign({}, options), { top: settings === null || settings === void 0 ? void 0 : settings.maxPageSize });
26
- return getPageAsyncIterator(pagedResult, path, pageOptions);
27
- }
28
- };
29
- }
30
- function getItemAsyncIterator(pagedResult, path, options) {
31
- return __asyncGenerator(this, arguments, function* getItemAsyncIterator_1() {
32
- var e_1, _a;
33
- const metaInfo = { isArray: false };
34
- const pages = getPageAsyncIterator(pagedResult, path, options, metaInfo);
35
- const firstVal = yield __await(pages.next());
36
- // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is
37
- if (!metaInfo.isArray) {
38
- yield yield __await(firstVal.value);
39
- yield __await(yield* __asyncDelegator(__asyncValues(pages)));
40
- }
41
- else {
42
- yield __await(yield* __asyncDelegator(__asyncValues(firstVal.value)));
43
- try {
44
- for (var pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), !pages_1_1.done;) {
45
- const page = pages_1_1.value;
46
- yield __await(yield* __asyncDelegator(__asyncValues(page)));
47
- }
48
- }
49
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
50
- finally {
51
- try {
52
- if (pages_1_1 && !pages_1_1.done && (_a = pages_1.return)) yield __await(_a.call(pages_1));
53
- }
54
- finally { if (e_1) throw e_1.error; }
55
- }
56
- }
57
- });
58
- }
59
- function getPageAsyncIterator(pagedResult, path, options, metaInfo = { isArray: true }) {
60
- return __asyncGenerator(this, arguments, function* getPageAsyncIterator_1() {
61
- let response = yield __await(retrievePage(pagedResult, path, options));
62
- metaInfo.isArray = Array.isArray(response.result);
63
- yield yield __await(response.result);
64
- while (response.nextLink) {
65
- response = yield __await(retrievePage(pagedResult, response.nextLink, options));
66
- yield yield __await(response.result);
67
- }
68
- });
69
- }
70
- function getDefaultNextLink(response) {
71
- return response.nextLink;
72
- }
73
- async function retrievePage(pagedResult, path, options) {
74
- var _a, _b, _c;
75
- const response = await pagedResult.sendGetRequest(path, options);
76
- const result = (_b = (_a = pagedResult.buildPage) === null || _a === void 0 ? void 0 : _a.call(pagedResult, response)) !== null && _b !== void 0 ? _b : response.results;
77
- const getNextLink = (_c = pagedResult.getNextLink) !== null && _c !== void 0 ? _c : getDefaultNextLink;
78
- return {
79
- result,
80
- nextLink: getNextLink(response)
81
- };
82
- }
83
- //# sourceMappingURL=paging.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"paging.js","sourceRoot":"","sources":["../../src/paging.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAsBlC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CAMnC,WAAoD,EACpD,IAAY,EACZ,OAAiB;IAEjB,MAAM,IAAI,GAAG,oBAAoB,CAC/B,WAAW,EACX,IAAI,EACJ,OAAO,CACR,CAAC;IACF,OAAO;QACL,IAAI;YACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC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,CAAC,CAAA,CAAC;QAC1F,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAClD,oBAAM,QAAQ,CAAC,MAAM,CAAA,CAAC;QACtB,OAAO,QAAQ,CAAC,QAAQ,EAAE;YACxB,QAAQ,GAAG,cAAM,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA,CAAC;YACvE,oBAAM,QAAQ,CAAC,MAAM,CAAA,CAAC;SACvB;IACH,CAAC;CAAA;AAED,SAAS,kBAAkB,CAAY,QAAmB;IACxD,OAAQ,QAAgB,CAAC,QAAQ,CAAC;AACpC,CAAC;AAOD,KAAK,UAAU,YAAY,CACzB,WAAoD,EACpD,IAAY,EACZ,OAAiB;;IAEjB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,MAAM,GAAU,MAAA,MAAA,WAAW,CAAC,SAAS,+CAArB,WAAW,EAAa,QAAQ,CAAC,mCAAK,QAAgB,CAAC,OAAO,CAAC;IACrF,MAAM,WAAW,GAAG,MAAA,WAAW,CAAC,WAAW,mCAAI,kBAAkB,CAAC;IAClE,OAAO;QACL,MAAM;QACN,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC;KAChC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PagedAsyncIterableIterator, PageSettings } from \"@azure/core-paging\";\n\n/**\n * an interface that describes how to communicate with the service and how to build a page of items.\n */\nexport interface PagedResult<TOptions extends Record<string, any>, TResponse, TPage> {\n /**\n * A method that send a GET request to the service and returns a response.\n */\n sendGetRequest: (path: string, options: TOptions) => Promise<TResponse>;\n /**\n * A method that extracts the link to the next page of results from the response.\n */\n getNextLink?: (response: TResponse) => string | undefined;\n /**\n * A method to build a page of items from the response.\n */\n buildPage?: (response: TResponse) => TPage;\n}\n\n/**\n * @internal\n *\n * returns an async iterator that will retrieve items from the server. It also has a `byPage`\n * method that can return pages of items at once.\n *\n * @param pagedResult - an object that describes how to communicate with the service and how to build a page of items.\n * @param path - the path to the resource to retrieve\n * @param options - the options to pass to the service\n * @returns a paged async iterator that will retrieve items from the server.\n */\nexport function getPagedAsyncIterator<\n TOptions extends Record<string, any>,\n TResponse,\n TElement,\n TPage = TElement[]\n>(\n pagedResult: PagedResult<TOptions, TResponse, TPage>,\n path: string,\n options: TOptions\n): PagedAsyncIterableIterator<TElement, TPage> {\n const iter = getItemAsyncIterator<TOptions, TResponse, TElement, TPage>(\n pagedResult,\n path,\n options\n );\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings?: PageSettings) => {\n const pageOptions = { ...options, top: settings?.maxPageSize };\n return getPageAsyncIterator(pagedResult, path, pageOptions);\n }\n };\n}\n\nasync function* getItemAsyncIterator<\n TOptions extends Record<string, unknown>,\n TResponse,\n TElement,\n TPage\n>(\n pagedResult: PagedResult<TOptions, TResponse, TPage>,\n path: string,\n options: TOptions\n): AsyncIterableIterator<TElement> {\n const metaInfo = { isArray: false };\n const pages = getPageAsyncIterator(pagedResult, path, options, metaInfo);\n const firstVal = await pages.next();\n // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is\n if (!metaInfo.isArray) {\n yield firstVal.value;\n yield* (pages as unknown) as AsyncIterableIterator<TElement>;\n } else {\n yield* firstVal.value;\n for await (const page of pages) {\n yield* page as any;\n }\n }\n}\n\nasync function* getPageAsyncIterator<TOptions extends Record<string, unknown>, TResponse, TPage>(\n pagedResult: PagedResult<TOptions, TResponse, TPage>,\n path: string,\n options: TOptions,\n metaInfo: { isArray: boolean } = { isArray: true }\n): AsyncIterableIterator<TPage> {\n let response = await retrievePage<TOptions, TResponse, TPage>(pagedResult, path, options);\n metaInfo.isArray = Array.isArray(response.result);\n yield response.result;\n while (response.nextLink) {\n response = await retrievePage(pagedResult, response.nextLink, options);\n yield response.result;\n }\n}\n\nfunction getDefaultNextLink<TResponse>(response: TResponse): string | undefined {\n return (response as any).nextLink;\n}\n\ninterface ResultWithPaging<TPage> {\n result: TPage;\n nextLink?: string;\n}\n\nasync function retrievePage<TOptions extends Record<string, unknown>, TResponse, TPage>(\n pagedResult: PagedResult<TOptions, TResponse, TPage>,\n path: string,\n options: TOptions\n): Promise<ResultWithPaging<TPage>> {\n const response = await pagedResult.sendGetRequest(path, options);\n const result: TPage = pagedResult.buildPage?.(response) ?? (response as any).results;\n const getNextLink = pagedResult.getNextLink ?? getDefaultNextLink;\n return {\n result,\n nextLink: getNextLink(response)\n };\n}\n"]}
@@ -1,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- export {};
4
- //# sourceMappingURL=pollerModels.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pollerModels.js","sourceRoot":"","sources":["../../src/pollerModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PollOperationState } from \"@azure/core-lro\";\nimport { State } from \"./generated/models\";\n\n/**\n * Metadata information for an analysis poller operation.\n */\nexport interface OperationMetadata {\n /**\n * The date and time the operation was created.\n */\n createdOn: Date;\n /**\n * The date and time when the operation results will expire on the server.\n */\n expiresOn?: Date;\n /**\n * The operation id.\n */\n operationId: string;\n /**\n * The time the operation status was last updated.\n */\n lastModifiedOn: Date;\n /**\n * The current status of the operation.\n */\n status: State;\n}\n\n/**\n * An interface representing the state of an analysis poller operation.\n */\nexport interface AnalysisPollOperationState<TResult>\n extends PollOperationState<TResult>,\n OperationMetadata {}\n"]}
@@ -1,17 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeTextAnalyticsSuccessResult, makeTextAnalyticsErrorResult } from "./textAnalyticsResult";
4
- /**
5
- * @internal
6
- */
7
- export function makeRecognizeCategorizedEntitiesResult(result) {
8
- const { entities, statistics, warnings, id } = result;
9
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { entities });
10
- }
11
- /**
12
- * @internal
13
- */
14
- export function makeRecognizeCategorizedEntitiesErrorResult(id, error) {
15
- return makeTextAnalyticsErrorResult(id, error);
16
- }
17
- //# sourceMappingURL=recognizeCategorizedEntitiesResult.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recognizeCategorizedEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizeCategorizedEntitiesResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,EAG9B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAgC/B;;GAEG;AACH,MAAM,UAAU,sCAAsC,CACpD,MAAwB;IAExB,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;IACtD,uCACK,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,QAAQ,IACR;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2CAA2C,CACzD,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 {\n makeTextAnalyticsSuccessResult,\n TextAnalyticsSuccessResult,\n TextAnalyticsErrorResult,\n makeTextAnalyticsErrorResult\n} from \"./textAnalyticsResult\";\nimport { Entity, TextAnalyticsError, DocumentEntities } from \"./generated/models\";\n\n/**\n * An entity from text analysis with information about its categorical\n * classification.\n */\nexport interface CategorizedEntity extends Entity {}\n\n/**\n * The result of the recognize entities operation on a single document.\n */\nexport type RecognizeCategorizedEntitiesResult =\n | RecognizeCategorizedEntitiesSuccessResult\n | RecognizeCategorizedEntitiesErrorResult;\n\n/**\n * The result of the recognize entities operation on a single document, containing the collection of\n * `Entity` objects identified in that document.\n */\nexport interface RecognizeCategorizedEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: CategorizedEntity[];\n}\n\n/**\n * An error result from the recognize entities operation on a single document.\n */\nexport type RecognizeCategorizedEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesResult(\n result: DocumentEntities\n): RecognizeCategorizedEntitiesSuccessResult {\n const { entities, statistics, warnings, id } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError\n): RecognizeCategorizedEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -1,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { makeRecognizeCategorizedEntitiesResult, makeRecognizeCategorizedEntitiesErrorResult } from "./recognizeCategorizedEntitiesResult";
4
- import { combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion } from "./textAnalyticsResult";
5
- /**
6
- * @internal
7
- */
8
- export function makeRecognizeCategorizedEntitiesResultArray(input, response) {
9
- return combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(input, response, makeRecognizeCategorizedEntitiesResult, makeRecognizeCategorizedEntitiesErrorResult);
10
- }
11
- //# sourceMappingURL=recognizeCategorizedEntitiesResultArray.js.map