@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.
- package/README.md +376 -132
- package/dist/index.js +2803 -3497
- package/dist/index.js.map +1 -1
- package/dist-esm/src/azureKeyCredentialPolicy.js +2 -2
- package/dist-esm/src/azureKeyCredentialPolicy.js.map +1 -1
- package/dist-esm/src/constants.js +16 -0
- package/dist-esm/src/constants.js.map +1 -0
- package/dist-esm/src/generated/generatedClient.js +80 -334
- package/dist-esm/src/generated/generatedClient.js.map +1 -1
- package/dist-esm/src/generated/index.js +1 -1
- package/dist-esm/src/generated/index.js.map +1 -1
- package/dist-esm/src/generated/models/index.js +106 -35
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +1607 -1464
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/models/parameters.js +18 -104
- package/dist-esm/src/generated/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/operations/analyzeText.js +105 -0
- package/dist-esm/src/generated/operations/analyzeText.js.map +1 -0
- package/dist-esm/src/generated/operations/index.js +9 -0
- package/dist-esm/src/generated/operations/index.js.map +1 -0
- package/dist-esm/src/generated/operationsInterfaces/analyzeText.js +9 -0
- package/dist-esm/src/generated/operationsInterfaces/analyzeText.js.map +1 -0
- package/dist-esm/src/generated/operationsInterfaces/index.js +9 -0
- package/dist-esm/src/generated/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/index.js +14 -5
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/lro.js +195 -0
- package/dist-esm/src/lro.js.map +1 -0
- package/dist-esm/src/models.js +42 -0
- package/dist-esm/src/models.js.map +1 -0
- package/dist-esm/src/textAnalysisClient.js +197 -0
- package/dist-esm/src/textAnalysisClient.js.map +1 -0
- package/dist-esm/src/transforms.js +279 -0
- package/dist-esm/src/transforms.js.map +1 -0
- package/dist-esm/src/util.js +36 -158
- package/dist-esm/src/util.js.map +1 -1
- package/package.json +28 -38
- package/types/ai-text-analytics.d.ts +1432 -1143
- package/CHANGELOG.md +0 -143
- package/LICENSE +0 -21
- package/dist-esm/src/analyzeActionsResult.js +0 -167
- package/dist-esm/src/analyzeActionsResult.js.map +0 -1
- package/dist-esm/src/analyzeHealthcareEntitiesResult.js +0 -53
- package/dist-esm/src/analyzeHealthcareEntitiesResult.js.map +0 -1
- package/dist-esm/src/analyzeLro.js +0 -130
- package/dist-esm/src/analyzeLro.js.map +0 -1
- package/dist-esm/src/analyzeSentimentResult.js +0 -74
- package/dist-esm/src/analyzeSentimentResult.js.map +0 -1
- package/dist-esm/src/analyzeSentimentResultArray.js +0 -11
- package/dist-esm/src/analyzeSentimentResultArray.js.map +0 -1
- package/dist-esm/src/detectLanguageResult.js +0 -17
- package/dist-esm/src/detectLanguageResult.js.map +0 -1
- package/dist-esm/src/detectLanguageResultArray.js +0 -11
- package/dist-esm/src/detectLanguageResultArray.js.map +0 -1
- package/dist-esm/src/extractKeyPhrasesResult.js +0 -17
- package/dist-esm/src/extractKeyPhrasesResult.js.map +0 -1
- package/dist-esm/src/extractKeyPhrasesResultArray.js +0 -11
- package/dist-esm/src/extractKeyPhrasesResultArray.js.map +0 -1
- package/dist-esm/src/extractSummaryResult.js +0 -17
- package/dist-esm/src/extractSummaryResult.js.map +0 -1
- package/dist-esm/src/extractSummaryResultArray.js +0 -11
- package/dist-esm/src/extractSummaryResultArray.js.map +0 -1
- package/dist-esm/src/generated/generatedClientContext.js +0 -42
- package/dist-esm/src/generated/generatedClientContext.js.map +0 -1
- package/dist-esm/src/healthLro.js +0 -131
- package/dist-esm/src/healthLro.js.map +0 -1
- package/dist-esm/src/paging.js +0 -83
- package/dist-esm/src/paging.js.map +0 -1
- package/dist-esm/src/pollerModels.js +0 -4
- package/dist-esm/src/pollerModels.js.map +0 -1
- package/dist-esm/src/recognizeCategorizedEntitiesResult.js +0 -17
- package/dist-esm/src/recognizeCategorizedEntitiesResult.js.map +0 -1
- package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js +0 -11
- package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js.map +0 -1
- package/dist-esm/src/recognizeLinkedEntitiesResult.js +0 -17
- package/dist-esm/src/recognizeLinkedEntitiesResult.js.map +0 -1
- package/dist-esm/src/recognizeLinkedEntitiesResultArray.js +0 -11
- package/dist-esm/src/recognizeLinkedEntitiesResultArray.js.map +0 -1
- package/dist-esm/src/recognizePiiEntitiesResult.js +0 -18
- package/dist-esm/src/recognizePiiEntitiesResult.js.map +0 -1
- package/dist-esm/src/recognizePiiEntitiesResultArray.js +0 -11
- package/dist-esm/src/recognizePiiEntitiesResultArray.js.map +0 -1
- package/dist-esm/src/textAnalyticsAction.js +0 -4
- package/dist-esm/src/textAnalyticsAction.js.map +0 -1
- package/dist-esm/src/textAnalyticsClient.js +0 -523
- package/dist-esm/src/textAnalyticsClient.js.map +0 -1
- package/dist-esm/src/textAnalyticsOperationOptions.js +0 -4
- package/dist-esm/src/textAnalyticsOperationOptions.js.map +0 -1
- package/dist-esm/src/textAnalyticsResult.js +0 -78
- package/dist-esm/src/textAnalyticsResult.js.map +0 -1
- package/dist-esm/src/tracing.js +0 -12
- package/dist-esm/src/tracing.js.map +0 -1
- package/dist-esm/src/utils/url.browser.js +0 -6
- package/dist-esm/src/utils/url.browser.js.map +0 -1
- package/dist-esm/src/utils/url.js +0 -4
- package/dist-esm/src/utils/url.js.map +0 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { AnalyzeAction as AnalyzeActionMapper, AnalyzeTextJobsInput as AnalyzeTextJobsInputMapper } from "../models/mappers";
|
|
9
9
|
export const contentType = {
|
|
10
10
|
parameterPath: ["options", "contentType"],
|
|
11
11
|
mapper: {
|
|
@@ -18,13 +18,13 @@ export const contentType = {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
export const body = {
|
|
21
|
-
parameterPath:
|
|
22
|
-
mapper:
|
|
21
|
+
parameterPath: "body",
|
|
22
|
+
mapper: AnalyzeActionMapper
|
|
23
23
|
};
|
|
24
24
|
export const accept = {
|
|
25
25
|
parameterPath: "accept",
|
|
26
26
|
mapper: {
|
|
27
|
-
defaultValue: "application/json
|
|
27
|
+
defaultValue: "application/json",
|
|
28
28
|
isConstant: true,
|
|
29
29
|
serializedName: "Accept",
|
|
30
30
|
type: {
|
|
@@ -46,20 +46,9 @@ export const endpoint = {
|
|
|
46
46
|
export const apiVersion = {
|
|
47
47
|
parameterPath: "apiVersion",
|
|
48
48
|
mapper: {
|
|
49
|
-
defaultValue: "
|
|
49
|
+
defaultValue: "2022-04-01-preview",
|
|
50
50
|
isConstant: true,
|
|
51
|
-
serializedName: "
|
|
52
|
-
type: {
|
|
53
|
-
name: "String"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
skipEncoding: true
|
|
57
|
-
};
|
|
58
|
-
export const jobId = {
|
|
59
|
-
parameterPath: "jobId",
|
|
60
|
-
mapper: {
|
|
61
|
-
serializedName: "jobId",
|
|
62
|
-
required: true,
|
|
51
|
+
serializedName: "api-version",
|
|
63
52
|
type: {
|
|
64
53
|
name: "String"
|
|
65
54
|
}
|
|
@@ -74,33 +63,11 @@ export const includeStatistics = {
|
|
|
74
63
|
}
|
|
75
64
|
}
|
|
76
65
|
};
|
|
77
|
-
export const
|
|
78
|
-
parameterPath:
|
|
79
|
-
mapper:
|
|
80
|
-
defaultValue: 20,
|
|
81
|
-
constraints: {
|
|
82
|
-
InclusiveMaximum: 50,
|
|
83
|
-
InclusiveMinimum: 1
|
|
84
|
-
},
|
|
85
|
-
serializedName: "$top",
|
|
86
|
-
type: {
|
|
87
|
-
name: "Number"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
66
|
+
export const body1 = {
|
|
67
|
+
parameterPath: "body",
|
|
68
|
+
mapper: AnalyzeTextJobsInputMapper
|
|
90
69
|
};
|
|
91
|
-
export const
|
|
92
|
-
parameterPath: ["options", "skip"],
|
|
93
|
-
mapper: {
|
|
94
|
-
constraints: {
|
|
95
|
-
InclusiveMinimum: 0
|
|
96
|
-
},
|
|
97
|
-
serializedName: "$skip",
|
|
98
|
-
type: {
|
|
99
|
-
name: "Number"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
export const jobId1 = {
|
|
70
|
+
export const jobId = {
|
|
104
71
|
parameterPath: "jobId",
|
|
105
72
|
mapper: {
|
|
106
73
|
serializedName: "jobId",
|
|
@@ -110,74 +77,21 @@ export const jobId1 = {
|
|
|
110
77
|
}
|
|
111
78
|
}
|
|
112
79
|
};
|
|
113
|
-
export const
|
|
114
|
-
parameterPath: "
|
|
115
|
-
mapper: MultiLanguageBatchInputMapper
|
|
116
|
-
};
|
|
117
|
-
export const modelVersion = {
|
|
118
|
-
parameterPath: ["options", "modelVersion"],
|
|
119
|
-
mapper: {
|
|
120
|
-
serializedName: "model-version",
|
|
121
|
-
type: {
|
|
122
|
-
name: "String"
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
export const stringIndexType = {
|
|
127
|
-
parameterPath: ["options", "stringIndexType"],
|
|
128
|
-
mapper: {
|
|
129
|
-
serializedName: "stringIndexType",
|
|
130
|
-
type: {
|
|
131
|
-
name: "String"
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
export const loggingOptOut = {
|
|
136
|
-
parameterPath: ["options", "loggingOptOut"],
|
|
137
|
-
mapper: {
|
|
138
|
-
serializedName: "loggingOptOut",
|
|
139
|
-
type: {
|
|
140
|
-
name: "Boolean"
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
export const domain = {
|
|
145
|
-
parameterPath: ["options", "domain"],
|
|
80
|
+
export const top = {
|
|
81
|
+
parameterPath: ["options", "top"],
|
|
146
82
|
mapper: {
|
|
147
|
-
serializedName: "
|
|
83
|
+
serializedName: "top",
|
|
148
84
|
type: {
|
|
149
|
-
name: "
|
|
85
|
+
name: "Number"
|
|
150
86
|
}
|
|
151
87
|
}
|
|
152
88
|
};
|
|
153
|
-
export const
|
|
154
|
-
parameterPath: ["options", "
|
|
155
|
-
mapper: {
|
|
156
|
-
constraints: {
|
|
157
|
-
UniqueItems: true
|
|
158
|
-
},
|
|
159
|
-
serializedName: "piiCategories",
|
|
160
|
-
type: {
|
|
161
|
-
name: "Sequence",
|
|
162
|
-
element: {
|
|
163
|
-
type: {
|
|
164
|
-
name: "String"
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
collectionFormat: "CSV"
|
|
170
|
-
};
|
|
171
|
-
export const input1 = {
|
|
172
|
-
parameterPath: "input",
|
|
173
|
-
mapper: LanguageBatchInputMapper
|
|
174
|
-
};
|
|
175
|
-
export const opinionMining = {
|
|
176
|
-
parameterPath: ["options", "opinionMining"],
|
|
89
|
+
export const skip = {
|
|
90
|
+
parameterPath: ["options", "skip"],
|
|
177
91
|
mapper: {
|
|
178
|
-
serializedName: "
|
|
92
|
+
serializedName: "skip",
|
|
179
93
|
type: {
|
|
180
|
-
name: "
|
|
94
|
+
name: "Number"
|
|
181
95
|
}
|
|
182
96
|
}
|
|
183
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../../../src/generated/models/parameters.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../../../src/generated/models/parameters.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EACL,aAAa,IAAI,mBAAmB,EACpC,oBAAoB,IAAI,0BAA0B,EACnD,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,WAAW,GAAuB;IAC7C,aAAa,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC;IACzC,MAAM,EAAE;QACN,YAAY,EAAE,kBAAkB;QAChC,UAAU,EAAE,IAAI;QAChB,cAAc,EAAE,cAAc;QAC9B,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;SACf;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAuB;IACtC,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,mBAAmB;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAuB;IACxC,aAAa,EAAE,QAAQ;IACvB,MAAM,EAAE;QACN,YAAY,EAAE,kBAAkB;QAChC,UAAU,EAAE,IAAI;QAChB,cAAc,EAAE,QAAQ;QACxB,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;SACf;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAA0B;IAC7C,aAAa,EAAE,UAAU;IACzB,MAAM,EAAE;QACN,cAAc,EAAE,UAAU;QAC1B,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;SACf;KACF;IACD,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAA4B;IACjD,aAAa,EAAE,YAAY;IAC3B,MAAM,EAAE;QACN,YAAY,EAAE,oBAAoB;QAClC,UAAU,EAAE,IAAI;QAChB,cAAc,EAAE,aAAa;QAC7B,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;SACf;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAA4B;IACxD,aAAa,EAAE,CAAC,SAAS,EAAE,mBAAmB,CAAC;IAC/C,MAAM,EAAE;QACN,cAAc,EAAE,WAAW;QAC3B,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAuB;IACvC,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,0BAA0B;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAA0B;IAC1C,aAAa,EAAE,OAAO;IACtB,MAAM,EAAE;QACN,cAAc,EAAE,OAAO;QACvB,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;SACb;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,GAAG,GAA4B;IAC1C,aAAa,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC;IACjC,MAAM,EAAE;QACN,cAAc,EAAE,KAAK;QACrB,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;SACf;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAA4B;IAC3C,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;IAClC,MAAM,EAAE;QACN,cAAc,EAAE,MAAM;QACtB,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;SACf;KACF;CACF,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport {\n OperationParameter,\n OperationURLParameter,\n OperationQueryParameter\n} from \"@azure/core-client\";\nimport {\n AnalyzeAction as AnalyzeActionMapper,\n AnalyzeTextJobsInput as AnalyzeTextJobsInputMapper\n} from \"../models/mappers\";\n\nexport const contentType: OperationParameter = {\n parameterPath: [\"options\", \"contentType\"],\n mapper: {\n defaultValue: \"application/json\",\n isConstant: true,\n serializedName: \"Content-Type\",\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const body: OperationParameter = {\n parameterPath: \"body\",\n mapper: AnalyzeActionMapper\n};\n\nexport const accept: OperationParameter = {\n parameterPath: \"accept\",\n mapper: {\n defaultValue: \"application/json\",\n isConstant: true,\n serializedName: \"Accept\",\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const endpoint: OperationURLParameter = {\n parameterPath: \"endpoint\",\n mapper: {\n serializedName: \"Endpoint\",\n required: true,\n type: {\n name: \"String\"\n }\n },\n skipEncoding: true\n};\n\nexport const apiVersion: OperationQueryParameter = {\n parameterPath: \"apiVersion\",\n mapper: {\n defaultValue: \"2022-04-01-preview\",\n isConstant: true,\n serializedName: \"api-version\",\n type: {\n name: \"String\"\n }\n }\n};\n\nexport const includeStatistics: OperationQueryParameter = {\n parameterPath: [\"options\", \"includeStatistics\"],\n mapper: {\n serializedName: \"showStats\",\n type: {\n name: \"Boolean\"\n }\n }\n};\n\nexport const body1: OperationParameter = {\n parameterPath: \"body\",\n mapper: AnalyzeTextJobsInputMapper\n};\n\nexport const jobId: OperationURLParameter = {\n parameterPath: \"jobId\",\n mapper: {\n serializedName: \"jobId\",\n required: true,\n type: {\n name: \"Uuid\"\n }\n }\n};\n\nexport const top: OperationQueryParameter = {\n parameterPath: [\"options\", \"top\"],\n mapper: {\n serializedName: \"top\",\n type: {\n name: \"Number\"\n }\n }\n};\n\nexport const skip: OperationQueryParameter = {\n parameterPath: [\"options\", \"skip\"],\n mapper: {\n serializedName: \"skip\",\n type: {\n name: \"Number\"\n }\n }\n};\n"]}
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
import * as Mappers from "../models/mappers";
|
|
10
|
+
import * as Parameters from "../models/parameters";
|
|
11
|
+
/** Class containing AnalyzeText operations. */
|
|
12
|
+
export class AnalyzeTextImpl {
|
|
13
|
+
/**
|
|
14
|
+
* Initialize a new instance of the class AnalyzeText class.
|
|
15
|
+
* @param client Reference to the service client
|
|
16
|
+
*/
|
|
17
|
+
constructor(client) {
|
|
18
|
+
this.client = client;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed
|
|
22
|
+
* as a long-running operation.
|
|
23
|
+
* @param body Collection of documents to analyze and one or more tasks to execute.
|
|
24
|
+
* @param options The options parameters.
|
|
25
|
+
*/
|
|
26
|
+
submitJob(body, options) {
|
|
27
|
+
return this.client.sendOperationRequest({ body, options }, submitJobOperationSpec);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are
|
|
31
|
+
* succeeded, the job will transition to the succeeded state and results will be available for each
|
|
32
|
+
* task.
|
|
33
|
+
* @param jobId Job ID
|
|
34
|
+
* @param options The options parameters.
|
|
35
|
+
*/
|
|
36
|
+
jobStatus(jobId, options) {
|
|
37
|
+
return this.client.sendOperationRequest({ jobId, options }, jobStatusOperationSpec);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Cancel a long-running Text Analysis job.
|
|
41
|
+
* @param jobId Job ID
|
|
42
|
+
* @param options The options parameters.
|
|
43
|
+
*/
|
|
44
|
+
cancelJob(jobId, options) {
|
|
45
|
+
return this.client.sendOperationRequest({ jobId, options }, cancelJobOperationSpec);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Operation Specifications
|
|
49
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
50
|
+
const submitJobOperationSpec = {
|
|
51
|
+
path: "/analyze-text/jobs",
|
|
52
|
+
httpMethod: "POST",
|
|
53
|
+
responses: {
|
|
54
|
+
202: {
|
|
55
|
+
headersMapper: Mappers.AnalyzeTextSubmitJobHeaders
|
|
56
|
+
},
|
|
57
|
+
default: {
|
|
58
|
+
bodyMapper: Mappers.ErrorResponse
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
requestBody: Parameters.body1,
|
|
62
|
+
queryParameters: [Parameters.apiVersion],
|
|
63
|
+
urlParameters: [Parameters.endpoint],
|
|
64
|
+
headerParameters: [Parameters.contentType, Parameters.accept],
|
|
65
|
+
mediaType: "json",
|
|
66
|
+
serializer
|
|
67
|
+
};
|
|
68
|
+
const jobStatusOperationSpec = {
|
|
69
|
+
path: "/analyze-text/jobs/{jobId}",
|
|
70
|
+
httpMethod: "GET",
|
|
71
|
+
responses: {
|
|
72
|
+
200: {
|
|
73
|
+
bodyMapper: Mappers.AnalyzeTextJobState
|
|
74
|
+
},
|
|
75
|
+
default: {
|
|
76
|
+
bodyMapper: Mappers.ErrorResponse
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
queryParameters: [
|
|
80
|
+
Parameters.apiVersion,
|
|
81
|
+
Parameters.includeStatistics,
|
|
82
|
+
Parameters.top,
|
|
83
|
+
Parameters.skip
|
|
84
|
+
],
|
|
85
|
+
urlParameters: [Parameters.endpoint, Parameters.jobId],
|
|
86
|
+
headerParameters: [Parameters.accept],
|
|
87
|
+
serializer
|
|
88
|
+
};
|
|
89
|
+
const cancelJobOperationSpec = {
|
|
90
|
+
path: "/analyze-text/jobs/{jobId}:cancel",
|
|
91
|
+
httpMethod: "POST",
|
|
92
|
+
responses: {
|
|
93
|
+
202: {
|
|
94
|
+
headersMapper: Mappers.AnalyzeTextCancelJobHeaders
|
|
95
|
+
},
|
|
96
|
+
default: {
|
|
97
|
+
bodyMapper: Mappers.ErrorResponse
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
queryParameters: [Parameters.apiVersion],
|
|
101
|
+
urlParameters: [Parameters.endpoint, Parameters.jobId],
|
|
102
|
+
headerParameters: [Parameters.accept],
|
|
103
|
+
serializer
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=analyzeText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzeText.js","sourceRoot":"","sources":["../../../../src/generated/operations/analyzeText.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AAYnD,+CAA+C;AAC/C,MAAM,OAAO,eAAe;IAG1B;;;OAGG;IACH,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,SAAS,CACP,IAA0B,EAC1B,OAA4C;QAE5C,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,EAAE,IAAI,EAAE,OAAO,EAAE,EACjB,sBAAsB,CACvB,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CACP,KAAa,EACb,OAA4C;QAE5C,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,EAAE,KAAK,EAAE,OAAO,EAAE,EAClB,sBAAsB,CACvB,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,SAAS,CACP,KAAa,EACb,OAA4C;QAE5C,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,EAAE,KAAK,EAAE,OAAO,EAAE,EAClB,sBAAsB,CACvB,CAAC;IACJ,CAAC;CACF;AACD,2BAA2B;AAC3B,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AAE3E,MAAM,sBAAsB,GAA6B;IACvD,IAAI,EAAE,oBAAoB;IAC1B,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,aAAa,EAAE,OAAO,CAAC,2BAA2B;SACnD;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,WAAW,EAAE,UAAU,CAAC,KAAK;IAC7B,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;IACxC,aAAa,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;IACpC,gBAAgB,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC;AACF,MAAM,sBAAsB,GAA6B;IACvD,IAAI,EAAE,4BAA4B;IAClC,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,mBAAmB;SACxC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,eAAe,EAAE;QACf,UAAU,CAAC,UAAU;QACrB,UAAU,CAAC,iBAAiB;QAC5B,UAAU,CAAC,GAAG;QACd,UAAU,CAAC,IAAI;KAChB;IACD,aAAa,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC;IACtD,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC;AACF,MAAM,sBAAsB,GAA6B;IACvD,IAAI,EAAE,mCAAmC;IACzC,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,aAAa,EAAE,OAAO,CAAC,2BAA2B;SACnD;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;IACxC,aAAa,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC;IACtD,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport { AnalyzeText } from \"../operationsInterfaces\";\nimport * as coreClient from \"@azure/core-client\";\nimport * as Mappers from \"../models/mappers\";\nimport * as Parameters from \"../models/parameters\";\nimport { GeneratedClient } from \"../generatedClient\";\nimport {\n AnalyzeTextJobsInput,\n AnalyzeTextSubmitJobOptionalParams,\n AnalyzeTextSubmitJobResponse,\n AnalyzeTextJobStatusOptionalParams,\n AnalyzeTextJobStatusResponse,\n AnalyzeTextCancelJobOptionalParams,\n AnalyzeTextCancelJobResponse\n} from \"../models\";\n\n/** Class containing AnalyzeText operations. */\nexport class AnalyzeTextImpl implements AnalyzeText {\n private readonly client: GeneratedClient;\n\n /**\n * Initialize a new instance of the class AnalyzeText class.\n * @param client Reference to the service client\n */\n constructor(client: GeneratedClient) {\n this.client = client;\n }\n\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed\n * as a long-running operation.\n * @param body Collection of documents to analyze and one or more tasks to execute.\n * @param options The options parameters.\n */\n submitJob(\n body: AnalyzeTextJobsInput,\n options?: AnalyzeTextSubmitJobOptionalParams\n ): Promise<AnalyzeTextSubmitJobResponse> {\n return this.client.sendOperationRequest(\n { body, options },\n submitJobOperationSpec\n );\n }\n\n /**\n * Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are\n * succeeded, the job will transition to the succeeded state and results will be available for each\n * task.\n * @param jobId Job ID\n * @param options The options parameters.\n */\n jobStatus(\n jobId: string,\n options?: AnalyzeTextJobStatusOptionalParams\n ): Promise<AnalyzeTextJobStatusResponse> {\n return this.client.sendOperationRequest(\n { jobId, options },\n jobStatusOperationSpec\n );\n }\n\n /**\n * Cancel a long-running Text Analysis job.\n * @param jobId Job ID\n * @param options The options parameters.\n */\n cancelJob(\n jobId: string,\n options?: AnalyzeTextCancelJobOptionalParams\n ): Promise<AnalyzeTextCancelJobResponse> {\n return this.client.sendOperationRequest(\n { jobId, options },\n cancelJobOperationSpec\n );\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst submitJobOperationSpec: coreClient.OperationSpec = {\n path: \"/analyze-text/jobs\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n headersMapper: Mappers.AnalyzeTextSubmitJobHeaders\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.body1,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst jobStatusOperationSpec: coreClient.OperationSpec = {\n path: \"/analyze-text/jobs/{jobId}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeTextJobState\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [\n Parameters.apiVersion,\n Parameters.includeStatistics,\n Parameters.top,\n Parameters.skip\n ],\n urlParameters: [Parameters.endpoint, Parameters.jobId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst cancelJobOperationSpec: coreClient.OperationSpec = {\n path: \"/analyze-text/jobs/{jobId}:cancel\",\n httpMethod: \"POST\",\n responses: {\n 202: {\n headersMapper: Mappers.AnalyzeTextCancelJobHeaders\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint, Parameters.jobId],\n headerParameters: [Parameters.accept],\n serializer\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export * from "./analyzeText";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generated/operations/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,eAAe,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nexport * from \"./analyzeText\";\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=analyzeText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzeText.js","sourceRoot":"","sources":["../../../../src/generated/operationsInterfaces/analyzeText.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","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 {\n AnalyzeTextJobsInput,\n AnalyzeTextSubmitJobOptionalParams,\n AnalyzeTextSubmitJobResponse,\n AnalyzeTextJobStatusOptionalParams,\n AnalyzeTextJobStatusResponse,\n AnalyzeTextCancelJobOptionalParams,\n AnalyzeTextCancelJobResponse\n} from \"../models\";\n\n/** Interface representing a AnalyzeText. */\nexport interface AnalyzeText {\n /**\n * Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed\n * as a long-running operation.\n * @param body Collection of documents to analyze and one or more tasks to execute.\n * @param options The options parameters.\n */\n submitJob(\n body: AnalyzeTextJobsInput,\n options?: AnalyzeTextSubmitJobOptionalParams\n ): Promise<AnalyzeTextSubmitJobResponse>;\n /**\n * Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are\n * succeeded, the job will transition to the succeeded state and results will be available for each\n * task.\n * @param jobId Job ID\n * @param options The options parameters.\n */\n jobStatus(\n jobId: string,\n options?: AnalyzeTextJobStatusOptionalParams\n ): Promise<AnalyzeTextJobStatusResponse>;\n /**\n * Cancel a long-running Text Analysis job.\n * @param jobId Job ID\n * @param options The options parameters.\n */\n cancelJob(\n jobId: string,\n options?: AnalyzeTextCancelJobOptionalParams\n ): Promise<AnalyzeTextCancelJobResponse>;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export * from "./analyzeText";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generated/operationsInterfaces/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,eAAe,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nexport * from \"./analyzeText\";\n"]}
|
package/dist-esm/src/index.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* [Azure Cognitive Language Services](https://docs.microsoft.com/azure/cognitive-services/language-service/overview)
|
|
5
|
+
* is a suite of natural language processing (NLP) skills built with
|
|
6
|
+
* best-in-class Microsoft machine learning algorithms used to analyze
|
|
7
|
+
* unstructured text for actions such as sentiment analysis, key phrase
|
|
8
|
+
* extraction, and language detection.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
5
12
|
export { AzureKeyCredential } from "@azure/core-auth";
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
export {
|
|
13
|
+
export { TextAnalysisClient } from "./textAnalysisClient";
|
|
14
|
+
export * from "./models";
|
|
15
|
+
export {
|
|
16
|
+
/** orphan exports */
|
|
17
|
+
KnownPiiDomain, KnownPiiCategory, KnownStringIndexType, KnownErrorCode, KnownInnerErrorCode, KnownExtractiveSummarizationOrderingCriteria, } from "./generated/models";
|
|
9
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;GAQG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,cAAc,UAAU,CAAC;AACzB,OAAO;AA6CL,qBAAqB;AACrB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,4CAA4C,GAE7C,MAAM,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * [Azure Cognitive Language Services](https://docs.microsoft.com/azure/cognitive-services/language-service/overview)\n * is a suite of natural language processing (NLP) skills built with\n * best-in-class Microsoft machine learning algorithms used to analyze\n * unstructured text for actions such as sentiment analysis, key phrase\n * extraction, and language detection.\n *\n * @packageDocumentation\n */\n\nexport { AzureKeyCredential } from \"@azure/core-auth\";\n\nexport { TextAnalysisClient } from \"./textAnalysisClient\";\nexport * from \"./models\";\nexport {\n AssessmentSentiment,\n SentimentAnalysisAction,\n EntityLinkingAction,\n EntityRecognitionAction,\n KeyPhraseExtractionAction,\n LanguageDetectionAction,\n PiiEntityRecognitionAction,\n StringIndexType,\n LinkedEntity,\n Entity,\n DetectedLanguage,\n PiiCategory,\n PiiDomain,\n SentimentConfidenceScores,\n SentenceSentimentLabel,\n DocumentSentimentLabel,\n TargetConfidenceScores,\n TokenSentimentLabel,\n LanguageDetectionInput,\n TextDocumentInput,\n TextDocumentStatistics,\n DocumentWarning,\n WarningCode,\n Match,\n ActionCommon,\n ActionPrebuilt,\n HealthcareAction,\n CustomEntityRecognitionAction,\n CustomSingleLabelClassificationAction,\n CustomMultiLabelClassificationAction,\n ExtractiveSummarizationAction,\n OperationStatus,\n ActionCustom,\n ClassificationCategory,\n HealthcareAssertion,\n HealthcareEntityCategory,\n ExtractiveSummarizationOrderingCriteria,\n SummarySentence,\n EntityDataSource,\n RelationType,\n Association,\n Certainty,\n Conditionality,\n FhirVersion,\n /** orphan exports */\n KnownPiiDomain,\n KnownPiiCategory,\n KnownStringIndexType,\n KnownErrorCode,\n KnownInnerErrorCode,\n KnownExtractiveSummarizationOrderingCriteria,\n TextDocumentBatchStatistics,\n} from \"./generated/models\";\n"]}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import * as Mappers from "./generated/models/mappers";
|
|
4
|
+
import * as Parameters from "./generated/models/parameters";
|
|
5
|
+
import { createSerializer, } from "@azure/core-client";
|
|
6
|
+
import { getPagedAsyncIterator } from "@azure/core-paging";
|
|
7
|
+
import { transformAnalyzeBatchResults, transformError } from "./transforms";
|
|
8
|
+
import { clientName } from "./constants";
|
|
9
|
+
import { logger } from "./logger";
|
|
10
|
+
const serializer = createSerializer(Mappers, /* isXml */ false);
|
|
11
|
+
const jobStatusOperationSpec = {
|
|
12
|
+
httpMethod: "GET",
|
|
13
|
+
responses: {
|
|
14
|
+
200: {
|
|
15
|
+
bodyMapper: Mappers.AnalyzeTextJobState,
|
|
16
|
+
},
|
|
17
|
+
default: {
|
|
18
|
+
bodyMapper: Mappers.ErrorResponse,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
headerParameters: [Parameters.accept],
|
|
22
|
+
queryParameters: [Parameters.top, Parameters.skip, Parameters.includeStatistics],
|
|
23
|
+
serializer,
|
|
24
|
+
};
|
|
25
|
+
async function getRawResponse(getResponse, options) {
|
|
26
|
+
const { onResponse } = options || {};
|
|
27
|
+
let rawResponse = undefined;
|
|
28
|
+
const flatResponse = await getResponse(Object.assign(Object.assign({}, options), { onResponse: (response, flatResponseParam) => {
|
|
29
|
+
rawResponse = response;
|
|
30
|
+
onResponse === null || onResponse === void 0 ? void 0 : onResponse(response, flatResponseParam);
|
|
31
|
+
} }));
|
|
32
|
+
return {
|
|
33
|
+
flatResponse,
|
|
34
|
+
rawResponse: {
|
|
35
|
+
statusCode: rawResponse.status,
|
|
36
|
+
headers: rawResponse.headers.toJSON(),
|
|
37
|
+
body: rawResponse.parsedBody,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async function sendRequest(settings) {
|
|
42
|
+
const { client, opOptions, path, spanStr, spec, tracing, httpMethod = "GET" } = settings;
|
|
43
|
+
return tracing.withSpan(spanStr, opOptions, async (finalOptions) => {
|
|
44
|
+
try {
|
|
45
|
+
const response = getRawResponse((options) => client.sendOperationRequest({ options }, Object.assign(Object.assign({}, spec), { path,
|
|
46
|
+
httpMethod })), finalOptions);
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
throw transformError(e);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
export function createSendPollRequest(settings) {
|
|
58
|
+
const { client, options, tracing, spanStr } = settings;
|
|
59
|
+
return async (path) => {
|
|
60
|
+
return throwTransformErrors(sendRequest({
|
|
61
|
+
client,
|
|
62
|
+
opOptions: options,
|
|
63
|
+
path,
|
|
64
|
+
spanStr,
|
|
65
|
+
spec: jobStatusOperationSpec,
|
|
66
|
+
tracing,
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
export function createAnalyzeBatchLro(settings) {
|
|
74
|
+
const { client, commonOptions, documents, initialRequestOptions, pollRequestOptions, tasks, tracing, } = settings;
|
|
75
|
+
return {
|
|
76
|
+
requestMethod: "POST",
|
|
77
|
+
requestPath: "/analyze-text/jobs",
|
|
78
|
+
async sendInitialRequest() {
|
|
79
|
+
return tracing.withSpan(`${clientName}.beginAnalyzeBatch`, Object.assign(Object.assign({}, commonOptions), initialRequestOptions), async (finalOptions) => throwTransformErrors(getRawResponse((paramOptions) => client.analyzeText.submitJob({
|
|
80
|
+
tasks,
|
|
81
|
+
analysisInput: {
|
|
82
|
+
documents,
|
|
83
|
+
},
|
|
84
|
+
displayName: initialRequestOptions.displayName,
|
|
85
|
+
}, paramOptions), finalOptions)));
|
|
86
|
+
},
|
|
87
|
+
sendPollRequest: createSendPollRequest({
|
|
88
|
+
client,
|
|
89
|
+
options: Object.assign(Object.assign({}, commonOptions), pollRequestOptions),
|
|
90
|
+
spanStr: `${clientName}.beginAnalyzeBatch`,
|
|
91
|
+
tracing,
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
export function getDocsFromState(serializedState) {
|
|
99
|
+
try {
|
|
100
|
+
const { documents } = JSON.parse(serializedState).state;
|
|
101
|
+
return documents;
|
|
102
|
+
}
|
|
103
|
+
catch (e) {
|
|
104
|
+
logger.error(`Documents are not found in the LRO's state. The results may not be ordered correctly.`);
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
export function createCreateAnalyzeBatchPollerLro(settings) {
|
|
112
|
+
const { client, options, tracing } = settings;
|
|
113
|
+
return {
|
|
114
|
+
requestMethod: "POST",
|
|
115
|
+
requestPath: "/analyze-text/jobs",
|
|
116
|
+
async sendInitialRequest() {
|
|
117
|
+
throw new Error(`The operation has already started`);
|
|
118
|
+
},
|
|
119
|
+
sendPollRequest: createSendPollRequest({
|
|
120
|
+
client,
|
|
121
|
+
options,
|
|
122
|
+
spanStr: `${clientName}.beginAnalyzeBatch`,
|
|
123
|
+
tracing,
|
|
124
|
+
}),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
export function processAnalyzeResult(options) {
|
|
131
|
+
return (_result, state) => {
|
|
132
|
+
const { client, documents, opOptions, tracing, continuationToken } = options;
|
|
133
|
+
const pageURL = continuationToken !== null && continuationToken !== void 0 ? continuationToken : state.pollingURL;
|
|
134
|
+
const pagedResult = {
|
|
135
|
+
firstPageLink: pageURL,
|
|
136
|
+
getPage: async (pageLink, maxPageSize) => {
|
|
137
|
+
const response = await sendRequest({
|
|
138
|
+
client,
|
|
139
|
+
spec: jobStatusOperationSpec,
|
|
140
|
+
spanStr: `${clientName}.beginAnalyzeBatch`,
|
|
141
|
+
// if `top` is set to `undefined`, the default value will not be sent
|
|
142
|
+
// as part of the request.
|
|
143
|
+
opOptions: maxPageSize ? Object.assign(Object.assign({}, opOptions), { top: maxPageSize }) : opOptions,
|
|
144
|
+
path: pageLink,
|
|
145
|
+
tracing,
|
|
146
|
+
});
|
|
147
|
+
const flatResponse = response.flatResponse;
|
|
148
|
+
return {
|
|
149
|
+
page: transformAnalyzeBatchResults(documents, flatResponse.tasks.items),
|
|
150
|
+
nextPageLink: flatResponse.nextLink,
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
return getPagedAsyncIterator(pagedResult);
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* @internal
|
|
159
|
+
*/
|
|
160
|
+
export function createUpdateAnalyzeState(documents) {
|
|
161
|
+
return (state, lastResponse) => {
|
|
162
|
+
const { createdOn, lastModifiedOn, operationId, status, displayName, expiresOn, tasks } = lastResponse.body;
|
|
163
|
+
const mutableState = state;
|
|
164
|
+
mutableState.createdOn = createdOn;
|
|
165
|
+
mutableState.lastModifiedOn = lastModifiedOn;
|
|
166
|
+
mutableState.expiresOn = expiresOn;
|
|
167
|
+
mutableState.displayName = displayName;
|
|
168
|
+
mutableState.operationId = operationId;
|
|
169
|
+
mutableState.status = status;
|
|
170
|
+
mutableState.actionSucceededCount = tasks.completed;
|
|
171
|
+
mutableState.actionFailedCount = tasks.failed;
|
|
172
|
+
mutableState.actionInProgressCount = tasks.inProgress;
|
|
173
|
+
if (mutableState.documents === undefined && documents !== undefined) {
|
|
174
|
+
mutableState.documents = documents;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
async function throwTransformErrors(p) {
|
|
179
|
+
try {
|
|
180
|
+
return await p;
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
throw transformError(e);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* @internal
|
|
188
|
+
*/
|
|
189
|
+
export function createCancelOperation(settings) {
|
|
190
|
+
return async ({ operationId }) => {
|
|
191
|
+
const { client, options, tracing } = settings;
|
|
192
|
+
await tracing.withSpan(`${clientName}.beginAnalyzeBatch`, options, async (finalOptions) => throwTransformErrors(getRawResponse((paramOptions) => client.analyzeText.cancelJob(operationId, paramOptions), finalOptions)));
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=lro.js.map
|