@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.
Files changed (34) hide show
  1. package/dist/browser/conversationAnalysisClient.js +2 -0
  2. package/dist/browser/conversationAnalysisClient.js.map +1 -1
  3. package/dist/browser/generated/conversationAnalysisClient.js +21 -10
  4. package/dist/browser/generated/conversationAnalysisClient.js.map +1 -1
  5. package/dist/browser/generated/lroImpl.js +11 -3
  6. package/dist/browser/generated/lroImpl.js.map +1 -1
  7. package/dist/browser/generated/models/mappers.js +297 -117
  8. package/dist/browser/generated/models/mappers.js.map +1 -1
  9. package/dist/commonjs/conversationAnalysisClient.js +2 -0
  10. package/dist/commonjs/conversationAnalysisClient.js.map +1 -1
  11. package/dist/commonjs/generated/conversationAnalysisClient.js +21 -10
  12. package/dist/commonjs/generated/conversationAnalysisClient.js.map +1 -1
  13. package/dist/commonjs/generated/lroImpl.js +11 -3
  14. package/dist/commonjs/generated/lroImpl.js.map +1 -1
  15. package/dist/commonjs/generated/models/mappers.js +297 -117
  16. package/dist/commonjs/generated/models/mappers.js.map +1 -1
  17. package/dist/commonjs/tsdoc-metadata.json +11 -11
  18. package/dist/esm/conversationAnalysisClient.js +2 -0
  19. package/dist/esm/conversationAnalysisClient.js.map +1 -1
  20. package/dist/esm/generated/conversationAnalysisClient.js +21 -10
  21. package/dist/esm/generated/conversationAnalysisClient.js.map +1 -1
  22. package/dist/esm/generated/lroImpl.js +11 -3
  23. package/dist/esm/generated/lroImpl.js.map +1 -1
  24. package/dist/esm/generated/models/mappers.js +297 -117
  25. package/dist/esm/generated/models/mappers.js.map +1 -1
  26. package/dist/react-native/conversationAnalysisClient.js +2 -0
  27. package/dist/react-native/conversationAnalysisClient.js.map +1 -1
  28. package/dist/react-native/generated/conversationAnalysisClient.js +21 -10
  29. package/dist/react-native/generated/conversationAnalysisClient.js.map +1 -1
  30. package/dist/react-native/generated/lroImpl.js +11 -3
  31. package/dist/react-native/generated/lroImpl.js.map +1 -1
  32. package/dist/react-native/generated/models/mappers.js +297 -117
  33. package/dist/react-native/generated/models/mappers.js.map +1 -1
  34. package/package.json +2 -2
@@ -44,6 +44,8 @@ const azureKeyCredentialPolicy_js_1 = require("./azureKeyCredentialPolicy.js");
44
44
  * ```
45
45
  */
46
46
  class ConversationAnalysisClient {
47
+ _client;
48
+ _tracing;
47
49
  /**
48
50
  * Initializes a new instance of the ConversationAnalysisClient class.
49
51
  * @param endpoint - Supported Cognitive Services endpoint (e.g.,
@@ -1 +1 @@
1
- {"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":";;;AAWA,iDAAsE;AAEtE,gDAAqD;AAGrD,sDAA0D;AAC1D,mDAAqF;AACrF,kEAA4E;AAC5E,+EAA6F;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAa,0BAA0B;IAIrC;;;;;OAKG;IACH,YACE,QAAgB,EAChB,UAA2C,EAC3C,UAAoD,EAAE;QAEtD,IAAI,CAAC,OAAO,GAAG,IAAI,qCAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEtD,IAAI,CAAC,QAAQ,GAAG,IAAA,kCAAmB,EAAC;YAClC,WAAW,EAAE,kCAAkC;YAC/C,cAAc,EAAE,0BAAW;YAC3B,SAAS,EAAE,6BAA6B;SACzC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,IAAA,6BAAiB,EAAC,UAAU,CAAC;YAC9C,CAAC,CAAC,IAAA,oDAA+B,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,sCAAuB,EAAE,CAAC;YAClF,CAAC,CAAC,IAAA,0EAA4C,EAAC,UAAU,CAAC,CAAC;QAE7D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CACjB,IAAkC,EAClC,OAA2C;QAE3C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAC9B,IAAI,EACJ,cAAc,CACyB,CAC5C,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,yBAAyB,CAC7B,IAAkC,EAClC,OAA4C;QAI5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,sDAAsD,EACtD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,EAAE,cAAc,CAE1D,CACJ,CAAC;IACJ,CAAC;CACF;AAtED,gEAsEC","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"]}
1
+ {"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../src/conversationAnalysisClient.ts"],"names":[],"mappings":";;;AAWA,iDAAsE;AAEtE,gDAAqD;AAGrD,sDAA0D;AAC1D,mDAAqF;AACrF,kEAA4E;AAC5E,+EAA6F;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAa,0BAA0B;IACpB,OAAO,CAAkB;IACzB,QAAQ,CAAgB;IAEzC;;;;;OAKG;IACH,YACE,QAAgB,EAChB,UAA2C,EAC3C,UAAoD,EAAE;QAEtD,IAAI,CAAC,OAAO,GAAG,IAAI,qCAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEtD,IAAI,CAAC,QAAQ,GAAG,IAAA,kCAAmB,EAAC;YAClC,WAAW,EAAE,kCAAkC;YAC/C,cAAc,EAAE,0BAAW;YAC3B,SAAS,EAAE,6BAA6B;SACzC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,IAAA,6BAAiB,EAAC,UAAU,CAAC;YAC9C,CAAC,CAAC,IAAA,oDAA+B,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,sCAAuB,EAAE,CAAC;YAClF,CAAC,CAAC,IAAA,0EAA4C,EAAC,UAAU,CAAC,CAAC;QAE7D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CACjB,IAAkC,EAClC,OAA2C;QAE3C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,gDAAgD,EAChD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAC9B,IAAI,EACJ,cAAc,CACyB,CAC5C,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,yBAAyB,CAC7B,IAAkC,EAClC,OAA4C;QAI5C,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAC3B,sDAAsD,EACtD,OAAO,IAAI,EAAE,EACb,CAAC,cAAc,EAAE,EAAE,CACjB,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,EAAE,cAAc,CAE1D,CACJ,CAAC;IACJ,CAAC;CACF;AAtED,gEAsEC","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"]}
@@ -17,6 +17,8 @@ const Parameters = tslib_1.__importStar(require("./models/parameters.js"));
17
17
  const Mappers = tslib_1.__importStar(require("./models/mappers.js"));
18
18
  /** @internal */
19
19
  class ConversationAnalysisClient extends coreClient.ServiceClient {
20
+ endpoint;
21
+ apiVersion;
20
22
  /**
21
23
  * Initializes a new instance of the ConversationAnalysisClient class.
22
24
  * @param endpoint Supported Cognitive Services endpoint (e.g.,
@@ -24,7 +26,6 @@ class ConversationAnalysisClient extends coreClient.ServiceClient {
24
26
  * @param options The parameter options
25
27
  */
26
28
  constructor(endpoint, options) {
27
- var _a, _b;
28
29
  if (endpoint === undefined) {
29
30
  throw new Error("'endpoint' cannot be null");
30
31
  }
@@ -39,11 +40,16 @@ class ConversationAnalysisClient extends coreClient.ServiceClient {
39
40
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
40
41
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
41
42
  : `${packageDetails}`;
42
- const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
43
+ const optionsWithDefaults = {
44
+ ...defaults,
45
+ ...options,
46
+ userAgentOptions: {
43
47
  userAgentPrefix
44
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{Endpoint}/language" });
48
+ },
49
+ baseUri: options.endpoint ?? options.baseUri ?? "{Endpoint}/language"
50
+ };
45
51
  super(optionsWithDefaults);
46
- if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
52
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
47
53
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
48
54
  const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
49
55
  coreRestPipeline.bearerTokenAuthenticationPolicyName);
@@ -108,14 +114,19 @@ class ConversationAnalysisClient extends coreClient.ServiceClient {
108
114
  return this.sendOperationRequest(args, spec);
109
115
  };
110
116
  const sendOperation = async (args, spec) => {
111
- var _a;
112
117
  let currentRawResponse = undefined;
113
- const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse;
118
+ const providedCallback = args.options?.onResponse;
114
119
  const callback = (rawResponse, flatResponse) => {
115
120
  currentRawResponse = rawResponse;
116
- providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse);
121
+ providedCallback?.(rawResponse, flatResponse);
122
+ };
123
+ const updatedArgs = {
124
+ ...args,
125
+ options: {
126
+ ...args.options,
127
+ onResponse: callback
128
+ }
117
129
  };
118
- const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) });
119
130
  const flatResponse = await directSendOperation(updatedArgs, spec);
120
131
  return {
121
132
  flatResponse,
@@ -128,8 +139,8 @@ class ConversationAnalysisClient extends coreClient.ServiceClient {
128
139
  };
129
140
  const lro = new lroImpl_js_1.LroImpl(sendOperation, { task, options }, conversationAnalysisOperationSpec);
130
141
  const poller = new core_lro_1.LroEngine(lro, {
131
- resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom,
132
- intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs
142
+ resumeFrom: options?.resumeFrom,
143
+ intervalInMs: options?.updateIntervalInMs
133
144
  });
134
145
  await poller.poll();
135
146
  return poller;
@@ -1 +1 @@
1
- {"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../../src/generated/conversationAnalysisClient.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAEH,uEAAiD;AACjD,oFAA8D;AAM9D,8CAA4E;AAC5E,6CAAuC;AACvC,2EAAqD;AACrD,qEAA+C;AAW/C,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,UAAU,CAAC,aAAa;IAItE;;;;;OAKG;IACH,YACE,QAAgB,EAChB,OAAkD;;QAElD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;QACD,MAAM,QAAQ,GAA6C;YACzD,kBAAkB,EAAE,iCAAiC;SACt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;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"]}
1
+ {"version":3,"file":"conversationAnalysisClient.js","sourceRoot":"","sources":["../../../src/generated/conversationAnalysisClient.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAEH,uEAAiD;AACjD,oFAA8D;AAM9D,8CAA4E;AAC5E,6CAAuC;AACvC,2EAAqD;AACrD,qEAA+C;AAW/C,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,UAAU,CAAC,aAAa;IACtE,QAAQ,CAAS;IACjB,UAAU,CAAS;IAEnB;;;;;OAKG;IACH,YACE,QAAgB,EAChB,OAAkD;QAElD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;QACD,MAAM,QAAQ,GAA6C;YACzD,kBAAkB,EAAE,iCAAiC;SACtD,CAAC;QAEF,MAAM,cAAc,GAAG,iDAAiD,CAAC;QACzE,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,GAAG;YAC1B,GAAG,QAAQ;YACX,GAAG,OAAO;YACV,gBAAgB,EAAE;gBAChB,eAAe;aAChB;YACD,OAAO,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,qBAAqB;SACtE,CAAC;QACF,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAE3B,IAAI,OAAO,EAAE,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1E,MAAM,gBAAgB,GAAsC,OA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CAAC,6BAA6B;SAClD;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;YACjC,aAAa,EACX,OAAO,CAAC,6DAA6D;SACxE;KACF;IACD,WAAW,EAAE,UAAU,CAAC,IAAI;IAC5B,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,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"]}
@@ -8,8 +8,12 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.LroImpl = void 0;
11
- const tslib_1 = require("tslib");
12
11
  class LroImpl {
12
+ sendOperationFn;
13
+ args;
14
+ spec;
15
+ requestPath;
16
+ requestMethod;
13
17
  constructor(sendOperationFn, args, spec, requestPath = spec.path, requestMethod = spec.httpMethod) {
14
18
  this.sendOperationFn = sendOperationFn;
15
19
  this.args = args;
@@ -21,8 +25,12 @@ class LroImpl {
21
25
  return this.sendOperationFn(this.args, this.spec);
22
26
  }
23
27
  async sendPollRequest(path) {
24
- const _a = this.spec, { requestBody } = _a, restSpec = tslib_1.__rest(_a, ["requestBody"]);
25
- return this.sendOperationFn(this.args, Object.assign(Object.assign({}, restSpec), { path, httpMethod: "GET" }));
28
+ const { requestBody, ...restSpec } = this.spec;
29
+ return this.sendOperationFn(this.args, {
30
+ ...restSpec,
31
+ path,
32
+ httpMethod: "GET"
33
+ });
26
34
  }
27
35
  }
28
36
  exports.LroImpl = LroImpl;
@@ -1 +1 @@
1
- {"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../../src/generated/lroImpl.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAIH,MAAa,OAAO;IAClB,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,KAA+B,IAAI,CAAC,IAAI,EAAxC,EAAE,WAAW,OAA2B,EAAtB,QAAQ,sBAA1B,eAA4B,CAAY,CAAC;QAC/C,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,kCAChC,QAAQ,KACX,IAAI,EACJ,UAAU,EAAE,KAAK,IACjB,CAAC;IACL,CAAC;CACF;AAvBD,0BAuBC","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"]}
1
+ {"version":3,"file":"lroImpl.js","sourceRoot":"","sources":["../../../src/generated/lroImpl.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,MAAa,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;AAvBD,0BAuBC","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"]}