@azure/ai-language-text 1.0.1-alpha.20220908.7 → 1.0.1-alpha.20220919.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.
@@ -17,15 +17,6 @@ export class AnalyzeTextImpl {
17
17
  constructor(client) {
18
18
  this.client = client;
19
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
20
  /**
30
21
  * Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are
31
22
  * succeeded, the job will transition to the succeeded state and results will be available for each
@@ -47,24 +38,6 @@ export class AnalyzeTextImpl {
47
38
  }
48
39
  // Operation Specifications
49
40
  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
41
  const jobStatusOperationSpec = {
69
42
  path: "/analyze-text/jobs/{jobId}",
70
43
  httpMethod: "GET",
@@ -1 +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;AAY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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"]}
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;AASnD,+CAA+C;AAC/C,MAAM,OAAO,eAAe;IAG1B;;;OAGG;IACH,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,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,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 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 * 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 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"]}
@@ -1 +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"]}
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 AnalyzeTextJobStatusOptionalParams,\n AnalyzeTextJobStatusResponse,\n AnalyzeTextCancelJobOptionalParams,\n AnalyzeTextCancelJobResponse\n} from \"../models\";\n\n/** Interface representing a AnalyzeText. */\nexport interface AnalyzeText {\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"]}
@@ -66,7 +66,7 @@ export function createAnalyzeBatchLro(settings) {
66
66
  const { client, commonOptions, documents, initialRequestOptions, pollRequestOptions, tasks, tracing, } = settings;
67
67
  return {
68
68
  async sendInitialRequest() {
69
- return tracing.withSpan(`${clientName}.beginAnalyzeBatch`, Object.assign(Object.assign({}, commonOptions), initialRequestOptions), async (finalOptions) => throwError(getRawResponse((paramOptions) => client.analyzeText.submitJob({
69
+ return tracing.withSpan(`${clientName}.beginAnalyzeBatch`, Object.assign(Object.assign({}, commonOptions), initialRequestOptions), async (finalOptions) => throwError(getRawResponse((paramOptions) => client.analyzeBatch({
70
70
  tasks,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B,CAAC;QACF,YAAY,CAAC,SAAS,GAAG,SAAS,CAAC;QACnC,YAAY,CAAC,UAAU,GAAG,UAAU,CAAC;QACrC,YAAY,CAAC,SAAS,GAAG,SAAS,CAAC;QACnC,YAAY,CAAC,WAAW,GAAG,WAAW,CAAC;QACvC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;QACrB,YAAY,CAAC,oBAAoB,GAAG,KAAK,CAAC,SAAS,CAAC;QACpD,YAAY,CAAC,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC;QAC9C,YAAY,CAAC,qBAAqB,GAAG,KAAK,CAAC,UAAU,CAAC;QACtD,IAAI,YAAY,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE;YAC7D,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC;SAC9B;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAM5C;IACC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IAC1D,uCACK,MAAM,KACT,uBAAuB,EAAE,KAAK,IAAI,EAAE;YAClC,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,UAAU,oBAAoB,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,CACxF,UAAU,CACR,cAAc,CACZ,CAAC,YAAY,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,EAAE,YAAY,CAAC,EAChE,YAAY,CACb,CACF,CACF,CAAC;QACJ,CAAC,IACD;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as Mappers from \"./generated/models/mappers\";\nimport * as Parameters from \"./generated/models/parameters\";\nimport {\n AnalyzeBatchActionUnion,\n AnalyzeTextJobStatusOptionalParams,\n AnalyzeTextJobStatusResponse,\n GeneratedClient,\n TextDocumentInput,\n} from \"./generated\";\nimport {\n AnalyzeBatchOperationState,\n AnalyzeBatchResult,\n PagedAnalyzeBatchResult,\n PollerLike,\n} from \"./models\";\nimport {\n FullOperationResponse,\n OperationOptions,\n OperationSpec,\n createSerializer,\n} from \"@azure/core-client\";\nimport { LongRunningOperation, LroResponse, SimplePollerLike } from \"@azure/core-lro\";\nimport { PagedResult, getPagedAsyncIterator } from \"@azure/core-paging\";\nimport { throwError, transformAnalyzeBatchResults } from \"./transforms\";\nimport { HttpMethods } from \"@azure/core-rest-pipeline\";\nimport { TracingClient } from \"@azure/core-tracing\";\nimport { clientName } from \"./constants\";\nimport { logger } from \"./logger\";\n\nconst serializer = createSerializer(Mappers, /* isXml */ false);\n\nconst jobStatusOperationSpec: OperationSpec = {\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeTextJobState,\n },\n default: {\n bodyMapper: Mappers.ErrorResponse,\n },\n },\n headerParameters: [Parameters.accept],\n queryParameters: [Parameters.top, Parameters.skip, Parameters.includeStatistics],\n serializer,\n};\n\nasync function getRawResponse<TOptions extends OperationOptions, TResponse>(\n getResponse: (options: TOptions) => Promise<TResponse>,\n options: TOptions\n): Promise<LroResponse<TResponse>> {\n const { onResponse } = options || {};\n let rawResponse: FullOperationResponse;\n const flatResponse = await getResponse({\n ...options,\n onResponse: (response, flatResponseParam) => {\n rawResponse = response;\n onResponse?.(response, flatResponseParam);\n },\n });\n return {\n flatResponse,\n rawResponse: {\n statusCode: rawResponse!.status,\n headers: rawResponse!.headers.toJSON(),\n body: rawResponse!.parsedBody,\n },\n };\n}\n\nasync function sendRequest<TOptions extends OperationOptions>(settings: {\n client: GeneratedClient;\n tracing: TracingClient;\n spec: OperationSpec;\n spanStr: string;\n opOptions: TOptions;\n path: string;\n httpMethod?: HttpMethods;\n}): Promise<LroResponse<unknown>> {\n const { client, opOptions, path, spanStr, spec, tracing, httpMethod = \"GET\" } = settings;\n return tracing.withSpan(spanStr, opOptions, async (finalOptions: TOptions) =>\n throwError(\n getRawResponse(\n (options) =>\n client.sendOperationRequest(\n { options },\n {\n ...spec,\n path,\n httpMethod,\n }\n ),\n finalOptions\n )\n )\n );\n}\n\n/**\n * @internal\n */\nfunction createSendPollRequest<TOptions extends OperationOptions>(settings: {\n client: GeneratedClient;\n tracing: TracingClient;\n options: TOptions;\n spanStr: string;\n}): (path: string) => Promise<LroResponse<unknown>> {\n const { client, options, tracing, spanStr } = settings;\n return async (path: string): Promise<LroResponse<unknown>> => {\n return throwError(\n sendRequest({\n client,\n opOptions: options,\n path,\n spanStr,\n spec: jobStatusOperationSpec,\n tracing,\n })\n );\n };\n}\n\n/**\n * @internal\n */\nexport function createAnalyzeBatchLro(settings: {\n client: GeneratedClient;\n tracing: TracingClient;\n commonOptions: OperationOptions;\n initialRequestOptions: {\n displayName?: string;\n };\n pollRequestOptions: {\n includeStatistics?: boolean;\n };\n documents: TextDocumentInput[];\n tasks: AnalyzeBatchActionUnion[];\n}): LongRunningOperation {\n const {\n client,\n commonOptions,\n documents,\n initialRequestOptions,\n pollRequestOptions,\n tasks,\n tracing,\n } = settings;\n return {\n async sendInitialRequest(): Promise<LroResponse<unknown>> {\n return tracing.withSpan(\n `${clientName}.beginAnalyzeBatch`,\n {\n ...commonOptions,\n ...initialRequestOptions,\n },\n async (finalOptions) =>\n throwError(\n getRawResponse(\n (paramOptions) =>\n client.analyzeText.submitJob(\n {\n tasks,\n analysisInput: {\n documents,\n },\n displayName: initialRequestOptions.displayName,\n },\n paramOptions\n ),\n finalOptions\n )\n )\n );\n },\n sendPollRequest: createSendPollRequest({\n client,\n options: { ...commonOptions, ...pollRequestOptions },\n spanStr: `${clientName}.beginAnalyzeBatch`,\n tracing,\n }),\n };\n}\n\n/**\n * @internal\n */\nexport function getDocIDsFromState(serializedState: string): string[] {\n try {\n const { docIds } = JSON.parse(serializedState).state;\n return docIds;\n } catch (e) {\n logger.error(\n `Document IDs are not found in the LRO's state. The results may not be ordered correctly.`\n );\n return [];\n }\n}\n\n/**\n * @internal\n */\nexport function createCreateAnalyzeBatchPollerLro<OptionsT extends OperationOptions>(settings: {\n client: GeneratedClient;\n tracing: TracingClient;\n options: OptionsT;\n}): LongRunningOperation {\n const { client, options, tracing } = settings;\n return {\n async sendInitialRequest(): Promise<LroResponse<unknown>> {\n throw new Error(`The operation has already started`);\n },\n sendPollRequest: createSendPollRequest({\n client,\n options,\n spanStr: `${clientName}.beginAnalyzeBatch`,\n tracing,\n }),\n };\n}\n\n/**\n * @internal\n */\nexport function processAnalyzeResult(options: {\n client: GeneratedClient;\n tracing: TracingClient;\n docIds: string[];\n opOptions: AnalyzeTextJobStatusOptionalParams;\n state: { continuationToken: string };\n}): (result: unknown, state: AnalyzeBatchOperationState) => PagedAnalyzeBatchResult {\n return (): PagedAnalyzeBatchResult => {\n const { client, docIds, opOptions, tracing, state } = options;\n const pageURL = state.continuationToken;\n const pagedResult: PagedResult<AnalyzeBatchResult[]> = {\n firstPageLink: pageURL,\n getPage: async (pageLink: string, maxPageSize?: number) => {\n const response = await sendRequest({\n client,\n spec: jobStatusOperationSpec,\n spanStr: `${clientName}.beginAnalyzeBatch`,\n // if `top` is set to `undefined`, the default value will not be sent\n // as part of the request.\n opOptions: maxPageSize ? { ...opOptions, top: maxPageSize } : opOptions,\n path: pageLink,\n tracing,\n });\n const flatResponse = response.flatResponse as AnalyzeTextJobStatusResponse;\n return {\n page: transformAnalyzeBatchResults(docIds, flatResponse.tasks.items),\n nextPageLink: flatResponse.nextLink,\n };\n },\n };\n return getPagedAsyncIterator(pagedResult);\n };\n}\n\ntype Writable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\n/**\n * @internal\n */\nexport function createUpdateAnalyzeState(docIds?: string[]) {\n return (state: AnalyzeBatchOperationState, lastResponse: LroResponse): void => {\n const { createdOn, modifiedOn, id, displayName, expiresOn, tasks } =\n lastResponse.flatResponse as AnalyzeTextJobStatusResponse;\n const mutableState = state as Writable<AnalyzeBatchOperationState> & {\n docIds?: string[];\n };\n mutableState.createdOn = createdOn;\n mutableState.modifiedOn = modifiedOn;\n mutableState.expiresOn = expiresOn;\n mutableState.displayName = displayName;\n mutableState.id = id;\n mutableState.actionSucceededCount = tasks.completed;\n mutableState.actionFailedCount = tasks.failed;\n mutableState.actionInProgressCount = tasks.inProgress;\n if (mutableState.docIds === undefined && docIds !== undefined) {\n mutableState.docIds = docIds;\n }\n };\n}\n\n/**\n * @internal\n */\nexport function createPollerWithCancellation(settings: {\n poller: SimplePollerLike<AnalyzeBatchOperationState, PagedAnalyzeBatchResult>;\n client: GeneratedClient;\n tracing: TracingClient;\n options: AnalyzeTextJobStatusOptionalParams;\n id: string;\n}): PollerLike<AnalyzeBatchOperationState, PagedAnalyzeBatchResult> {\n const { client, options, poller, id, tracing } = settings;\n return {\n ...poller,\n sendCancellationRequest: async () => {\n await tracing.withSpan(`${clientName}.beginAnalyzeBatch`, options, async (finalOptions) =>\n throwError(\n getRawResponse(\n (paramOptions) => client.analyzeText.cancelJob(id, paramOptions),\n finalOptions\n )\n )\n );\n },\n };\n}\n"]}
1
+ {"version":3,"file":"lro.js","sourceRoot":"","sources":["../../src/lro.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAc5D,OAAO,EAIL,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAe,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AAEhE,MAAM,sBAAsB,GAAkB;IAC5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OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IAC1D,uCACK,MAAM,KACT,uBAAuB,EAAE,KAAK,IAAI,EAAE;YAClC,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,UAAU,oBAAoB,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,CACxF,UAAU,CACR,cAAc,CACZ,CAAC,YAAY,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,EAAE,YAAY,CAAC,EAChE,YAAY,CACb,CACF,CACF,CAAC;QACJ,CAAC,IACD;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport * as Mappers from \"./generated/models/mappers\";\nimport * as Parameters from \"./generated/models/parameters\";\nimport {\n AnalyzeBatchActionUnion,\n AnalyzeTextJobStatusOptionalParams,\n AnalyzeTextJobStatusResponse,\n GeneratedClient,\n TextDocumentInput,\n} from \"./generated\";\nimport {\n AnalyzeBatchOperationState,\n AnalyzeBatchResult,\n PagedAnalyzeBatchResult,\n PollerLike,\n} from \"./models\";\nimport {\n FullOperationResponse,\n OperationOptions,\n OperationSpec,\n createSerializer,\n} from \"@azure/core-client\";\nimport { LongRunningOperation, LroResponse, SimplePollerLike } from \"@azure/core-lro\";\nimport { PagedResult, getPagedAsyncIterator } from \"@azure/core-paging\";\nimport { throwError, transformAnalyzeBatchResults } from \"./transforms\";\nimport { HttpMethods } from \"@azure/core-rest-pipeline\";\nimport { TracingClient } from \"@azure/core-tracing\";\nimport { clientName } from \"./constants\";\nimport { logger } from \"./logger\";\n\nconst serializer = createSerializer(Mappers, /* isXml */ false);\n\nconst jobStatusOperationSpec: OperationSpec = {\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeTextJobState,\n },\n default: {\n bodyMapper: Mappers.ErrorResponse,\n },\n },\n headerParameters: [Parameters.accept],\n queryParameters: [Parameters.top, Parameters.skip, Parameters.includeStatistics],\n serializer,\n};\n\nasync function getRawResponse<TOptions extends OperationOptions, TResponse>(\n getResponse: (options: TOptions) => Promise<TResponse>,\n options: TOptions\n): Promise<LroResponse<TResponse>> {\n const { onResponse } = options || {};\n let rawResponse: FullOperationResponse;\n const flatResponse = await getResponse({\n ...options,\n onResponse: (response, flatResponseParam) => {\n rawResponse = response;\n onResponse?.(response, flatResponseParam);\n },\n });\n return {\n flatResponse,\n rawResponse: {\n statusCode: rawResponse!.status,\n headers: rawResponse!.headers.toJSON(),\n body: rawResponse!.parsedBody,\n },\n };\n}\n\nasync function sendRequest<TOptions extends OperationOptions>(settings: {\n client: GeneratedClient;\n tracing: TracingClient;\n spec: OperationSpec;\n spanStr: string;\n opOptions: TOptions;\n path: string;\n httpMethod?: HttpMethods;\n}): Promise<LroResponse<unknown>> {\n const { client, opOptions, path, spanStr, spec, tracing, httpMethod = \"GET\" } = settings;\n return tracing.withSpan(spanStr, opOptions, async (finalOptions: TOptions) =>\n throwError(\n getRawResponse(\n (options) =>\n client.sendOperationRequest(\n { options },\n {\n ...spec,\n path,\n httpMethod,\n }\n ),\n finalOptions\n )\n )\n );\n}\n\n/**\n * @internal\n */\nfunction createSendPollRequest<TOptions extends OperationOptions>(settings: {\n client: GeneratedClient;\n tracing: TracingClient;\n options: TOptions;\n spanStr: string;\n}): (path: string) => Promise<LroResponse<unknown>> {\n const { client, options, tracing, spanStr } = settings;\n return async (path: string): Promise<LroResponse<unknown>> => {\n return throwError(\n sendRequest({\n client,\n opOptions: options,\n path,\n spanStr,\n spec: jobStatusOperationSpec,\n tracing,\n })\n );\n };\n}\n\n/**\n * @internal\n */\nexport function createAnalyzeBatchLro(settings: {\n client: GeneratedClient;\n tracing: TracingClient;\n commonOptions: OperationOptions;\n initialRequestOptions: {\n displayName?: string;\n };\n pollRequestOptions: {\n includeStatistics?: boolean;\n };\n documents: TextDocumentInput[];\n tasks: AnalyzeBatchActionUnion[];\n}): LongRunningOperation {\n const {\n client,\n commonOptions,\n documents,\n initialRequestOptions,\n pollRequestOptions,\n tasks,\n tracing,\n } = settings;\n return {\n async sendInitialRequest(): Promise<LroResponse<unknown>> {\n return tracing.withSpan(\n `${clientName}.beginAnalyzeBatch`,\n {\n ...commonOptions,\n ...initialRequestOptions,\n },\n async (finalOptions) =>\n throwError(\n getRawResponse(\n (paramOptions) =>\n client.analyzeBatch(\n {\n tasks,\n analysisInput: {\n documents,\n },\n displayName: initialRequestOptions.displayName,\n },\n paramOptions\n ),\n finalOptions\n )\n )\n );\n },\n sendPollRequest: createSendPollRequest({\n client,\n options: { ...commonOptions, ...pollRequestOptions },\n spanStr: `${clientName}.beginAnalyzeBatch`,\n tracing,\n }),\n };\n}\n\n/**\n * @internal\n */\nexport function getDocIDsFromState(serializedState: string): string[] {\n try {\n const { docIds } = JSON.parse(serializedState).state;\n return docIds;\n } catch (e) {\n logger.error(\n `Document IDs are not found in the LRO's state. The results may not be ordered correctly.`\n );\n return [];\n }\n}\n\n/**\n * @internal\n */\nexport function createCreateAnalyzeBatchPollerLro<OptionsT extends OperationOptions>(settings: {\n client: GeneratedClient;\n tracing: TracingClient;\n options: OptionsT;\n}): LongRunningOperation {\n const { client, options, tracing } = settings;\n return {\n async sendInitialRequest(): Promise<LroResponse<unknown>> {\n throw new Error(`The operation has already started`);\n },\n sendPollRequest: createSendPollRequest({\n client,\n options,\n spanStr: `${clientName}.beginAnalyzeBatch`,\n tracing,\n }),\n };\n}\n\n/**\n * @internal\n */\nexport function processAnalyzeResult(options: {\n client: GeneratedClient;\n tracing: TracingClient;\n docIds: string[];\n opOptions: AnalyzeTextJobStatusOptionalParams;\n state: { continuationToken: string };\n}): (result: unknown, state: AnalyzeBatchOperationState) => PagedAnalyzeBatchResult {\n return (): PagedAnalyzeBatchResult => {\n const { client, docIds, opOptions, tracing, state } = options;\n const pageURL = state.continuationToken;\n const pagedResult: PagedResult<AnalyzeBatchResult[]> = {\n firstPageLink: pageURL,\n getPage: async (pageLink: string, maxPageSize?: number) => {\n const response = await sendRequest({\n client,\n spec: jobStatusOperationSpec,\n spanStr: `${clientName}.beginAnalyzeBatch`,\n // if `top` is set to `undefined`, the default value will not be sent\n // as part of the request.\n opOptions: maxPageSize ? { ...opOptions, top: maxPageSize } : opOptions,\n path: pageLink,\n tracing,\n });\n const flatResponse = response.flatResponse as AnalyzeTextJobStatusResponse;\n return {\n page: transformAnalyzeBatchResults(docIds, flatResponse.tasks.items),\n nextPageLink: flatResponse.nextLink,\n };\n },\n };\n return getPagedAsyncIterator(pagedResult);\n };\n}\n\ntype Writable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\n/**\n * @internal\n */\nexport function createUpdateAnalyzeState(docIds?: string[]) {\n return (state: AnalyzeBatchOperationState, lastResponse: LroResponse): void => {\n const { createdOn, modifiedOn, id, displayName, expiresOn, tasks } =\n lastResponse.flatResponse as AnalyzeTextJobStatusResponse;\n const mutableState = state as Writable<AnalyzeBatchOperationState> & {\n docIds?: string[];\n };\n mutableState.createdOn = createdOn;\n mutableState.modifiedOn = modifiedOn;\n mutableState.expiresOn = expiresOn;\n mutableState.displayName = displayName;\n mutableState.id = id;\n mutableState.actionSucceededCount = tasks.completed;\n mutableState.actionFailedCount = tasks.failed;\n mutableState.actionInProgressCount = tasks.inProgress;\n if (mutableState.docIds === undefined && docIds !== undefined) {\n mutableState.docIds = docIds;\n }\n };\n}\n\n/**\n * @internal\n */\nexport function createPollerWithCancellation(settings: {\n poller: SimplePollerLike<AnalyzeBatchOperationState, PagedAnalyzeBatchResult>;\n client: GeneratedClient;\n tracing: TracingClient;\n options: AnalyzeTextJobStatusOptionalParams;\n id: string;\n}): PollerLike<AnalyzeBatchOperationState, PagedAnalyzeBatchResult> {\n const { client, options, poller, id, tracing } = settings;\n return {\n ...poller,\n sendCancellationRequest: async () => {\n await tracing.withSpan(`${clientName}.beginAnalyzeBatch`, options, async (finalOptions) =>\n throwError(\n getRawResponse(\n (paramOptions) => client.analyzeText.cancelJob(id, paramOptions),\n finalOptions\n )\n )\n );\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "An isomorphic client library for the text analysis features in the Azure Cognitive Language Service.",
6
- "version": "1.0.1-alpha.20220908.7",
6
+ "version": "1.0.1-alpha.20220919.2",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",
@@ -27,11 +27,11 @@ export declare interface ActionCommon {
27
27
  disableServiceLogs?: boolean;
28
28
  }
29
29
 
30
- /** Parameters object for a text analysis task using custom models. */
30
+ /** Configuration common to all actions that use custom models. */
31
31
  export declare interface ActionCustom extends ActionCommon {
32
- /** This field indicates the project name for the model. */
32
+ /** The project name for the model to be used by the action. */
33
33
  projectName: string;
34
- /** This field indicates the deployment name for the model. */
34
+ /** The deployment name for the model to be used by the action. */
35
35
  deploymentName: string;
36
36
  }
37
37
 
@@ -1520,7 +1520,7 @@ export declare type PiiEntityDomain = string;
1520
1520
  /** Options for a Pii entity recognition action. */
1521
1521
  export declare interface PiiEntityRecognitionAction extends ActionPrebuilt {
1522
1522
  /**
1523
- * Filters entities to ones only included in the specified domain (e.g., if set to `Phi`, only entities in the Protected Healthcare Information domain will be returned). For a list of possible domains, see {@link PiiDomain}.
1523
+ * Filters entities to ones only included in the specified domain (e.g., if set to `Phi`, only entities in the Protected Healthcare Information domain will be returned). For a list of possible domains, see {@link KnownPiiEntityDomain}.
1524
1524
  *
1525
1525
  * See {@link https://aka.ms/tanerpii the service documentation} for more information.
1526
1526
  */