@azure/ai-language-conversations 1.0.0-alpha.20250618.1 → 1.0.0-alpha.20250722.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/dist/browser/conversationAnalysisClient.js +2 -0
- package/dist/browser/conversationAnalysisClient.js.map +1 -1
- package/dist/browser/generated/conversationAnalysisClient.js +21 -10
- package/dist/browser/generated/conversationAnalysisClient.js.map +1 -1
- package/dist/browser/generated/lroImpl.js +11 -3
- package/dist/browser/generated/lroImpl.js.map +1 -1
- package/dist/browser/generated/models/mappers.js +297 -117
- package/dist/browser/generated/models/mappers.js.map +1 -1
- package/dist/commonjs/conversationAnalysisClient.js +2 -0
- package/dist/commonjs/conversationAnalysisClient.js.map +1 -1
- package/dist/commonjs/generated/conversationAnalysisClient.js +21 -10
- package/dist/commonjs/generated/conversationAnalysisClient.js.map +1 -1
- package/dist/commonjs/generated/lroImpl.js +11 -3
- package/dist/commonjs/generated/lroImpl.js.map +1 -1
- package/dist/commonjs/generated/models/mappers.js +297 -117
- package/dist/commonjs/generated/models/mappers.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/esm/conversationAnalysisClient.js +2 -0
- package/dist/esm/conversationAnalysisClient.js.map +1 -1
- package/dist/esm/generated/conversationAnalysisClient.js +21 -10
- package/dist/esm/generated/conversationAnalysisClient.js.map +1 -1
- package/dist/esm/generated/lroImpl.js +11 -3
- package/dist/esm/generated/lroImpl.js.map +1 -1
- package/dist/esm/generated/models/mappers.js +297 -117
- package/dist/esm/generated/models/mappers.js.map +1 -1
- package/dist/react-native/conversationAnalysisClient.js +2 -0
- package/dist/react-native/conversationAnalysisClient.js.map +1 -1
- package/dist/react-native/generated/conversationAnalysisClient.js +21 -10
- package/dist/react-native/generated/conversationAnalysisClient.js.map +1 -1
- package/dist/react-native/generated/lroImpl.js +11 -3
- package/dist/react-native/generated/lroImpl.js.map +1 -1
- package/dist/react-native/generated/models/mappers.js +297 -117
- package/dist/react-native/generated/models/mappers.js.map +1 -1
- package/package.json +2 -2
|
@@ -41,6 +41,8 @@ import { conversationAnalysisAzureKeyCredentialPolicy } from "./azureKeyCredenti
|
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
43
|
export class ConversationAnalysisClient {
|
|
44
|
+
_client;
|
|
45
|
+
_tracing;
|
|
44
46
|
/**
|
|
45
47
|
* Initializes a new instance of the ConversationAnalysisClient class.
|
|
46
48
|
* @param endpoint - Supported Cognitive Services endpoint (e.g.,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,0BAA0B;
|
|
1
|
+
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,M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AC,yBAAyB,CAAC,IAAI,EAAE,cAAc,CAE1D,CACJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type {\n AnalyzeConversationJobsInput,\n AnalyzeConversationOptionalParams,\n AnalyzeConversationResponse,\n AnalyzeConversationTaskUnion,\n ConversationAnalysisClientOptionalParams,\n ConversationAnalysisOptionalParams,\n ConversationAnalysisResponse,\n} from \"./models.js\";\nimport { DEFAULT_COGNITIVE_SCOPE, SDK_VERSION } from \"./constants.js\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport type { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport { createTracingClient } from \"@azure/core-tracing\";\nimport { ConversationAnalysisClient as GeneratedClient } from \"./generated/index.js\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { conversationAnalysisAzureKeyCredentialPolicy } from \"./azureKeyCredentialPolicy.js\";\n\n/**\n * A client for interacting with the conversational language understanding\n * features in Azure Cognitive Language Service.\n *\n * The client needs the endpoint of a Language resource and an authentication\n * method such as an API key or AAD. The API key and endpoint can be found in\n * the Language resource page in the Azure portal. They will be located in the\n * resource's Keys and Endpoint page, under Resource Management.\n *\n * ### Examples for authentication:\n *\n * #### API Key\n *\n * ```ts snippet:ReadmeSampleCreateClient_Key\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n * import { ConversationAnalysisClient } from \"@azure/ai-language-conversations\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new AzureKeyCredential(\"<api key>\");\n * const client = new ConversationAnalysisClient(endpoint, credential);\n * ```\n *\n * #### Azure Active Directory\n *\n * See the [`@azure/identity`](https://npmjs.com/package/\\@azure/identity)\n * package for more information about authenticating with Azure Active Directory.\n *\n * ```ts snippet:ReadmeSampleCreateClient_ActiveDirectory\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { ConversationAnalysisClient } from \"@azure/ai-language-conversations\";\n *\n * const endpoint = \"https://<resource name>.cognitiveservices.azure.com\";\n * const credential = new DefaultAzureCredential();\n * const client = new ConversationAnalysisClient(endpoint, credential);\n * ```\n */\nexport class ConversationAnalysisClient {\n private readonly _client: GeneratedClient;\n private readonly _tracing: TracingClient;\n\n /**\n * Initializes a new instance of the ConversationAnalysisClient class.\n * @param endpoint - Supported Cognitive Services endpoint (e.g.,\n * https://<resource-name>.api.cognitiveservices.azure.com).\n * @param options - The parameter options\n */\n constructor(\n endpoint: string,\n credential: TokenCredential | KeyCredential,\n options: ConversationAnalysisClientOptionalParams = {},\n ) {\n this._client = new GeneratedClient(endpoint, options);\n\n this._tracing = createTracingClient({\n packageName: \"@azure/ai-language-conversations\",\n packageVersion: SDK_VERSION,\n namespace: \"Microsoft.CognitiveServices\",\n });\n\n const authPolicy = isTokenCredential(credential)\n ? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })\n : conversationAnalysisAzureKeyCredentialPolicy(credential);\n\n this._client.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Analyzes the input conversation utterance.\n * @param task - A single conversational task to execute.\n * @param options - The options parameters.\n */\n analyzeConversation(\n task: AnalyzeConversationTaskUnion,\n options?: AnalyzeConversationOptionalParams,\n ): Promise<AnalyzeConversationResponse> {\n return this._tracing.withSpan(\n \"ConversationAnalysisClient.analyzeConversation\",\n options || {},\n (updatedOptions) =>\n this._client.analyzeConversation(\n task,\n updatedOptions,\n ) as Promise<AnalyzeConversationResponse>,\n );\n }\n\n /**\n * Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed.\n * @param task - The collection of conversations to analyze and one or more tasks to execute.\n * @param options - The options parameters.\n */\n async beginConversationAnalysis(\n task: AnalyzeConversationJobsInput,\n options?: ConversationAnalysisOptionalParams,\n ): Promise<\n PollerLike<PollOperationState<ConversationAnalysisResponse>, ConversationAnalysisResponse>\n > {\n return this._tracing.withSpan(\n \"ConversationAnalysisClient.beginConversationAnalysis\",\n options || {},\n (updatedOptions) =>\n this._client.beginConversationAnalysis(task, updatedOptions) as Promise<\n PollerLike<PollOperationState<ConversationAnalysisResponse>, ConversationAnalysisResponse>\n >,\n );\n }\n}\n"]}
|
|
@@ -13,6 +13,8 @@ import * as Parameters from "./models/parameters.js";
|
|
|
13
13
|
import * as Mappers from "./models/mappers.js";
|
|
14
14
|
/** @internal */
|
|
15
15
|
export class ConversationAnalysisClient extends coreClient.ServiceClient {
|
|
16
|
+
endpoint;
|
|
17
|
+
apiVersion;
|
|
16
18
|
/**
|
|
17
19
|
* Initializes a new instance of the ConversationAnalysisClient class.
|
|
18
20
|
* @param endpoint Supported Cognitive Services endpoint (e.g.,
|
|
@@ -20,7 +22,6 @@ export class ConversationAnalysisClient extends coreClient.ServiceClient {
|
|
|
20
22
|
* @param options The parameter options
|
|
21
23
|
*/
|
|
22
24
|
constructor(endpoint, options) {
|
|
23
|
-
var _a, _b;
|
|
24
25
|
if (endpoint === undefined) {
|
|
25
26
|
throw new Error("'endpoint' cannot be null");
|
|
26
27
|
}
|
|
@@ -35,11 +36,16 @@ export class ConversationAnalysisClient extends coreClient.ServiceClient {
|
|
|
35
36
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
36
37
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
37
38
|
: `${packageDetails}`;
|
|
38
|
-
const optionsWithDefaults =
|
|
39
|
+
const optionsWithDefaults = {
|
|
40
|
+
...defaults,
|
|
41
|
+
...options,
|
|
42
|
+
userAgentOptions: {
|
|
39
43
|
userAgentPrefix
|
|
40
|
-
},
|
|
44
|
+
},
|
|
45
|
+
baseUri: options.endpoint ?? options.baseUri ?? "{Endpoint}/language"
|
|
46
|
+
};
|
|
41
47
|
super(optionsWithDefaults);
|
|
42
|
-
if (
|
|
48
|
+
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
|
|
43
49
|
const pipelinePolicies = options.pipeline.getOrderedPolicies();
|
|
44
50
|
const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
|
|
45
51
|
coreRestPipeline.bearerTokenAuthenticationPolicyName);
|
|
@@ -104,14 +110,19 @@ export class ConversationAnalysisClient extends coreClient.ServiceClient {
|
|
|
104
110
|
return this.sendOperationRequest(args, spec);
|
|
105
111
|
};
|
|
106
112
|
const sendOperation = async (args, spec) => {
|
|
107
|
-
var _a;
|
|
108
113
|
let currentRawResponse = undefined;
|
|
109
|
-
const providedCallback =
|
|
114
|
+
const providedCallback = args.options?.onResponse;
|
|
110
115
|
const callback = (rawResponse, flatResponse) => {
|
|
111
116
|
currentRawResponse = rawResponse;
|
|
112
|
-
providedCallback
|
|
117
|
+
providedCallback?.(rawResponse, flatResponse);
|
|
118
|
+
};
|
|
119
|
+
const updatedArgs = {
|
|
120
|
+
...args,
|
|
121
|
+
options: {
|
|
122
|
+
...args.options,
|
|
123
|
+
onResponse: callback
|
|
124
|
+
}
|
|
113
125
|
};
|
|
114
|
-
const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) });
|
|
115
126
|
const flatResponse = await directSendOperation(updatedArgs, spec);
|
|
116
127
|
return {
|
|
117
128
|
flatResponse,
|
|
@@ -124,8 +135,8 @@ export class ConversationAnalysisClient extends coreClient.ServiceClient {
|
|
|
124
135
|
};
|
|
125
136
|
const lro = new LroImpl(sendOperation, { task, options }, conversationAnalysisOperationSpec);
|
|
126
137
|
const poller = new LroEngine(lro, {
|
|
127
|
-
resumeFrom: options
|
|
128
|
-
intervalInMs: options
|
|
138
|
+
resumeFrom: options?.resumeFrom,
|
|
139
|
+
intervalInMs: options?.updateIntervalInMs
|
|
129
140
|
});
|
|
130
141
|
await poller.poll();
|
|
131
142
|
return poller;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationAnalys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n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport {\n PipelineRequest,\n PipelineResponse,\n SendRequest\n} from \"@azure/core-rest-pipeline\";\nimport { PollerLike, PollOperationState, LroEngine } from \"@azure/core-lro\";\nimport { LroImpl } from \"./lroImpl.js\";\nimport * as Parameters from \"./models/parameters.js\";\nimport * as Mappers from \"./models/mappers.js\";\nimport {\n ConversationAnalysisClientOptionalParams,\n AnalyzeConversationTaskUnion,\n AnalyzeConversationOptionalParams,\n AnalyzeConversationResponse,\n AnalyzeConversationJobsInput,\n ConversationAnalysisOptionalParams,\n ConversationAnalysisResponse\n} from \"./models/index.js\";\n\n/** @internal */\nexport class ConversationAnalysisClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the ConversationAnalysisClient class.\n * @param endpoint Supported Cognitive Services endpoint (e.g.,\n * https://<resource-name>.api.cognitiveservices.azure.com).\n * @param options The parameter options\n */\n constructor(\n endpoint: string,\n options?: ConversationAnalysisClientOptionalParams\n ) {\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: ConversationAnalysisClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-ai-language-conversations/1.0.0-beta.2`;\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 ?? options.baseUri ?? \"{Endpoint}/language\"\n };\n super(optionsWithDefaults);\n\n if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {\n const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();\n const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(\n (pipelinePolicy) =>\n pipelinePolicy.name ===\n coreRestPipeline.bearerTokenAuthenticationPolicyName\n );\n if (!bearerTokenAuthenticationPolicyFound) {\n this.pipeline.removePolicy({\n name: coreRestPipeline.bearerTokenAuthenticationPolicyName\n });\n this.pipeline.addPolicy(\n coreRestPipeline.bearerTokenAuthenticationPolicy({\n scopes: `${optionsWithDefaults.baseUri}/.default`,\n challengeCallbacks: {\n authorizeRequestOnChallenge:\n coreClient.authorizeRequestOnClaimChallenge\n }\n })\n );\n }\n }\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2022-05-15-preview\";\n this.addCustomApiVersionPolicy(options.apiVersion);\n }\n\n /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */\n private addCustomApiVersionPolicy(apiVersion?: string) {\n if (!apiVersion) {\n return;\n }\n const apiVersionPolicy = {\n name: \"CustomApiVersionPolicy\",\n async sendRequest(\n request: PipelineRequest,\n next: SendRequest\n ): Promise<PipelineResponse> {\n const param = request.url.split(\"?\");\n if (param.length > 1) {\n const newParams = param[1].split(\"&\").map((item) => {\n if (item.indexOf(\"api-version\") > -1) {\n return \"api-version=\" + apiVersion;\n } else {\n return item;\n }\n });\n request.url = param[0] + \"?\" + newParams.join(\"&\");\n }\n return next(request);\n }\n };\n this.pipeline.addPolicy(apiVersionPolicy);\n }\n\n /**\n * Analyzes the input conversation utterance.\n * @param task A single conversational task to execute.\n * @param options The options parameters.\n */\n analyzeConversation(\n task: AnalyzeConversationTaskUnion,\n options?: AnalyzeConversationOptionalParams\n ): Promise<AnalyzeConversationResponse> {\n return this.sendOperationRequest(\n { task, options },\n analyzeConversationOperationSpec\n );\n }\n\n /**\n * Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed.\n * @param task The collection of conversations to analyze and one or more tasks to execute.\n * @param options The options parameters.\n */\n async beginConversationAnalysis(\n task: AnalyzeConversationJobsInput,\n options?: ConversationAnalysisOptionalParams\n ): Promise<\n PollerLike<\n PollOperationState<ConversationAnalysisResponse>,\n ConversationAnalysisResponse\n >\n > {\n const directSendOperation = async (\n args: coreClient.OperationArguments,\n spec: coreClient.OperationSpec\n ): Promise<ConversationAnalysisResponse> => {\n return this.sendOperationRequest(args, spec);\n };\n const sendOperation = async (\n args: coreClient.OperationArguments,\n spec: coreClient.OperationSpec\n ) => {\n let currentRawResponse:\n | coreClient.FullOperationResponse\n | undefined = undefined;\n const providedCallback = args.options?.onResponse;\n const callback: coreClient.RawResponseCallback = (\n rawResponse: coreClient.FullOperationResponse,\n flatResponse: unknown\n ) => {\n currentRawResponse = rawResponse;\n providedCallback?.(rawResponse, flatResponse);\n };\n const updatedArgs = {\n ...args,\n options: {\n ...args.options,\n onResponse: callback\n }\n };\n const flatResponse = await directSendOperation(updatedArgs, spec);\n return {\n flatResponse,\n rawResponse: {\n statusCode: currentRawResponse!.status,\n body: currentRawResponse!.parsedBody,\n headers: currentRawResponse!.headers.toJSON()\n }\n };\n };\n\n const lro = new LroImpl(\n sendOperation,\n { task, options },\n conversationAnalysisOperationSpec\n );\n const poller = new LroEngine(lro, {\n resumeFrom: options?.resumeFrom,\n intervalInMs: options?.updateIntervalInMs\n });\n await poller.poll();\n return poller;\n }\n\n /**\n * Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed.\n * @param task The collection of conversations to analyze and one or more tasks to execute.\n * @param options The options parameters.\n */\n async beginConversationAnalysisAndWait(\n task: AnalyzeConversationJobsInput,\n options?: ConversationAnalysisOptionalParams\n ): Promise<ConversationAnalysisResponse> {\n const poller = await this.beginConversationAnalysis(task, options);\n return poller.pollUntilDone();\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst analyzeConversationOperationSpec: coreClient.OperationSpec = {\n path: \"/:analyze-conversations\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeConversationTaskResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse,\n headersMapper:\n Mappers.ConversationAnalysisClientAnalyzeConversationExceptionHeaders\n }\n },\n requestBody: Parameters.task,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst conversationAnalysisOperationSpec: coreClient.OperationSpec = {\n path: \"/analyze-conversations/jobs\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeConversationJobState\n },\n 201: {\n bodyMapper: Mappers.AnalyzeConversationJobState\n },\n 202: {\n bodyMapper: Mappers.AnalyzeConversationJobState\n },\n 204: {\n bodyMapper: Mappers.AnalyzeConversationJobState\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.task1,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\n"]}
|
|
1
|
+
{"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../../src/generated/conversationAnalysisClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAC;AAM9D,OAAO,EAAkC,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAW/C,gBAAgB;AAChB,MAAM,OAAO,0BAA2B,SAAQ,UAAU,CAAC,aAAa;IACtE,QAAQ,CAAS;IACjB,UAAU,CAAS;IA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IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC;AACF,MAAM,iCAAiC,GAA6B;IAClE,IAAI,EAAE,6BAA6B;IACnC,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,2BAA2B;SAChD;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,2BAA2B;SAChD;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,2BAA2B;SAChD;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,2BAA2B;SAChD;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","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport {\n PipelineRequest,\n PipelineResponse,\n SendRequest\n} from \"@azure/core-rest-pipeline\";\nimport { PollerLike, PollOperationState, LroEngine } from \"@azure/core-lro\";\nimport { LroImpl } from \"./lroImpl.js\";\nimport * as Parameters from \"./models/parameters.js\";\nimport * as Mappers from \"./models/mappers.js\";\nimport {\n ConversationAnalysisClientOptionalParams,\n AnalyzeConversationTaskUnion,\n AnalyzeConversationOptionalParams,\n AnalyzeConversationResponse,\n AnalyzeConversationJobsInput,\n ConversationAnalysisOptionalParams,\n ConversationAnalysisResponse\n} from \"./models/index.js\";\n\n/** @internal */\nexport class ConversationAnalysisClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the ConversationAnalysisClient class.\n * @param endpoint Supported Cognitive Services endpoint (e.g.,\n * https://<resource-name>.api.cognitiveservices.azure.com).\n * @param options The parameter options\n */\n constructor(\n endpoint: string,\n options?: ConversationAnalysisClientOptionalParams\n ) {\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: ConversationAnalysisClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-ai-language-conversations/1.0.0-beta.2`;\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 ?? options.baseUri ?? \"{Endpoint}/language\"\n };\n super(optionsWithDefaults);\n\n if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {\n const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();\n const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(\n (pipelinePolicy) =>\n pipelinePolicy.name ===\n coreRestPipeline.bearerTokenAuthenticationPolicyName\n );\n if (!bearerTokenAuthenticationPolicyFound) {\n this.pipeline.removePolicy({\n name: coreRestPipeline.bearerTokenAuthenticationPolicyName\n });\n this.pipeline.addPolicy(\n coreRestPipeline.bearerTokenAuthenticationPolicy({\n scopes: `${optionsWithDefaults.baseUri}/.default`,\n challengeCallbacks: {\n authorizeRequestOnChallenge:\n coreClient.authorizeRequestOnClaimChallenge\n }\n })\n );\n }\n }\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2022-05-15-preview\";\n this.addCustomApiVersionPolicy(options.apiVersion);\n }\n\n /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */\n private addCustomApiVersionPolicy(apiVersion?: string) {\n if (!apiVersion) {\n return;\n }\n const apiVersionPolicy = {\n name: \"CustomApiVersionPolicy\",\n async sendRequest(\n request: PipelineRequest,\n next: SendRequest\n ): Promise<PipelineResponse> {\n const param = request.url.split(\"?\");\n if (param.length > 1) {\n const newParams = param[1].split(\"&\").map((item) => {\n if (item.indexOf(\"api-version\") > -1) {\n return \"api-version=\" + apiVersion;\n } else {\n return item;\n }\n });\n request.url = param[0] + \"?\" + newParams.join(\"&\");\n }\n return next(request);\n }\n };\n this.pipeline.addPolicy(apiVersionPolicy);\n }\n\n /**\n * Analyzes the input conversation utterance.\n * @param task A single conversational task to execute.\n * @param options The options parameters.\n */\n analyzeConversation(\n task: AnalyzeConversationTaskUnion,\n options?: AnalyzeConversationOptionalParams\n ): Promise<AnalyzeConversationResponse> {\n return this.sendOperationRequest(\n { task, options },\n analyzeConversationOperationSpec\n );\n }\n\n /**\n * Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed.\n * @param task The collection of conversations to analyze and one or more tasks to execute.\n * @param options The options parameters.\n */\n async beginConversationAnalysis(\n task: AnalyzeConversationJobsInput,\n options?: ConversationAnalysisOptionalParams\n ): Promise<\n PollerLike<\n PollOperationState<ConversationAnalysisResponse>,\n ConversationAnalysisResponse\n >\n > {\n const directSendOperation = async (\n args: coreClient.OperationArguments,\n spec: coreClient.OperationSpec\n ): Promise<ConversationAnalysisResponse> => {\n return this.sendOperationRequest(args, spec);\n };\n const sendOperation = async (\n args: coreClient.OperationArguments,\n spec: coreClient.OperationSpec\n ) => {\n let currentRawResponse:\n | coreClient.FullOperationResponse\n | undefined = undefined;\n const providedCallback = args.options?.onResponse;\n const callback: coreClient.RawResponseCallback = (\n rawResponse: coreClient.FullOperationResponse,\n flatResponse: unknown\n ) => {\n currentRawResponse = rawResponse;\n providedCallback?.(rawResponse, flatResponse);\n };\n const updatedArgs = {\n ...args,\n options: {\n ...args.options,\n onResponse: callback\n }\n };\n const flatResponse = await directSendOperation(updatedArgs, spec);\n return {\n flatResponse,\n rawResponse: {\n statusCode: currentRawResponse!.status,\n body: currentRawResponse!.parsedBody,\n headers: currentRawResponse!.headers.toJSON()\n }\n };\n };\n\n const lro = new LroImpl(\n sendOperation,\n { task, options },\n conversationAnalysisOperationSpec\n );\n const poller = new LroEngine(lro, {\n resumeFrom: options?.resumeFrom,\n intervalInMs: options?.updateIntervalInMs\n });\n await poller.poll();\n return poller;\n }\n\n /**\n * Submit a collection of conversations for analysis. Specify one or more unique tasks to be executed.\n * @param task The collection of conversations to analyze and one or more tasks to execute.\n * @param options The options parameters.\n */\n async beginConversationAnalysisAndWait(\n task: AnalyzeConversationJobsInput,\n options?: ConversationAnalysisOptionalParams\n ): Promise<ConversationAnalysisResponse> {\n const poller = await this.beginConversationAnalysis(task, options);\n return poller.pollUntilDone();\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst analyzeConversationOperationSpec: coreClient.OperationSpec = {\n path: \"/:analyze-conversations\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeConversationTaskResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse,\n headersMapper:\n Mappers.ConversationAnalysisClientAnalyzeConversationExceptionHeaders\n }\n },\n requestBody: Parameters.task,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst conversationAnalysisOperationSpec: coreClient.OperationSpec = {\n path: \"/analyze-conversations/jobs\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeConversationJobState\n },\n 201: {\n bodyMapper: Mappers.AnalyzeConversationJobState\n },\n 202: {\n bodyMapper: Mappers.AnalyzeConversationJobState\n },\n 204: {\n bodyMapper: Mappers.AnalyzeConversationJobState\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.task1,\n queryParameters: [Parameters.apiVersion],\n urlParameters: [Parameters.endpoint],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\n"]}
|
|
@@ -5,8 +5,12 @@
|
|
|
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 { __rest } from "tslib";
|
|
9
8
|
export class LroImpl {
|
|
9
|
+
sendOperationFn;
|
|
10
|
+
args;
|
|
11
|
+
spec;
|
|
12
|
+
requestPath;
|
|
13
|
+
requestMethod;
|
|
10
14
|
constructor(sendOperationFn, args, spec, requestPath = spec.path, requestMethod = spec.httpMethod) {
|
|
11
15
|
this.sendOperationFn = sendOperationFn;
|
|
12
16
|
this.args = args;
|
|
@@ -18,8 +22,12 @@ export class LroImpl {
|
|
|
18
22
|
return this.sendOperationFn(this.args, this.spec);
|
|
19
23
|
}
|
|
20
24
|
async sendPollRequest(path) {
|
|
21
|
-
const
|
|
22
|
-
return this.sendOperationFn(this.args,
|
|
25
|
+
const { requestBody, ...restSpec } = this.spec;
|
|
26
|
+
return this.sendOperationFn(this.args, {
|
|
27
|
+
...restSpec,
|
|
28
|
+
path,
|
|
29
|
+
httpMethod: "GET"
|
|
30
|
+
});
|
|
23
31
|
}
|
|
24
32
|
}
|
|
25
33
|
//# sourceMappingURL=lroImpl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../../src/generated/lroImpl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG
|
|
1
|
+
{"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../../src/generated/lroImpl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,OAAO,OAAO;IAER;IACA;IACA;IAKD;IACA;IATT,YACU,eAAkE,EAClE,IAA6B,EAC7B,IAIe,EAChB,cAAsB,IAAI,CAAC,IAAK,EAChC,gBAAwB,IAAI,CAAC,UAAU;QARtC,oBAAe,GAAf,eAAe,CAAmD;QAClE,SAAI,GAAJ,IAAI,CAAyB;QAC7B,SAAI,GAAJ,IAAI,CAIW;QAChB,gBAAW,GAAX,WAAW,CAAqB;QAChC,kBAAa,GAAb,aAAa,CAA0B;IAC7C,CAAC;IACG,KAAK,CAAC,kBAAkB;QAC7B,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IACM,KAAK,CAAC,eAAe,CAAC,IAAY;QACvC,MAAM,EAAE,WAAW,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;QAC/C,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE;YACrC,GAAG,QAAQ;YACX,IAAI;YACJ,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;IACL,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 { LongRunningOperation, LroResponse } from \"@azure/core-lro\";\n\nexport class LroImpl<T> implements LongRunningOperation<T> {\n constructor(\n private sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>,\n private args: Record<string, unknown>,\n private spec: {\n readonly requestBody?: unknown;\n readonly path?: string;\n readonly httpMethod: string;\n } & Record<string, any>,\n public requestPath: string = spec.path!,\n public requestMethod: string = spec.httpMethod\n ) {}\n public async sendInitialRequest(): Promise<LroResponse<T>> {\n return this.sendOperationFn(this.args, this.spec);\n }\n public async sendPollRequest(path: string): Promise<LroResponse<T>> {\n const { requestBody, ...restSpec } = this.spec;\n return this.sendOperationFn(this.args, {\n ...restSpec,\n path,\n httpMethod: \"GET\"\n });\n }\n}\n"]}
|