@azure/ai-text-analytics 5.1.1-alpha.20250619.1 → 5.1.1-alpha.20250721.1

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 (122) hide show
  1. package/dist/browser/analyzeActionsResult.js +6 -7
  2. package/dist/browser/analyzeActionsResult.js.map +1 -1
  3. package/dist/browser/analyzeHealthcareEntitiesResult.js +7 -3
  4. package/dist/browser/analyzeHealthcareEntitiesResult.js.map +1 -1
  5. package/dist/browser/analyzeSentimentResult.js +7 -4
  6. package/dist/browser/analyzeSentimentResult.js.map +1 -1
  7. package/dist/browser/detectLanguageResult.js +4 -1
  8. package/dist/browser/detectLanguageResult.js.map +1 -1
  9. package/dist/browser/extractKeyPhrasesResult.js +4 -1
  10. package/dist/browser/extractKeyPhrasesResult.js.map +1 -1
  11. package/dist/browser/generated/generatedClient.js +12 -4
  12. package/dist/browser/generated/generatedClient.js.map +1 -1
  13. package/dist/browser/generated/models/mappers.js +44 -10
  14. package/dist/browser/generated/models/mappers.js.map +1 -1
  15. package/dist/browser/lro/analyze/operation.js +27 -18
  16. package/dist/browser/lro/analyze/operation.js.map +1 -1
  17. package/dist/browser/lro/health/operation.js +27 -34
  18. package/dist/browser/lro/health/operation.js.map +1 -1
  19. package/dist/browser/lro/poller.js +5 -7
  20. package/dist/browser/lro/poller.js.map +1 -1
  21. package/dist/browser/recognizeCategorizedEntitiesResult.js +4 -1
  22. package/dist/browser/recognizeCategorizedEntitiesResult.js.map +1 -1
  23. package/dist/browser/recognizeLinkedEntitiesResult.js +4 -1
  24. package/dist/browser/recognizeLinkedEntitiesResult.js.map +1 -1
  25. package/dist/browser/recognizePiiEntitiesResult.js +5 -2
  26. package/dist/browser/recognizePiiEntitiesResult.js.map +1 -1
  27. package/dist/browser/textAnalyticsClient.js +38 -16
  28. package/dist/browser/textAnalyticsClient.js.map +1 -1
  29. package/dist/browser/util.js +6 -8
  30. package/dist/browser/util.js.map +1 -1
  31. package/dist/commonjs/analyzeActionsResult.js +6 -7
  32. package/dist/commonjs/analyzeActionsResult.js.map +1 -1
  33. package/dist/commonjs/analyzeHealthcareEntitiesResult.js +7 -3
  34. package/dist/commonjs/analyzeHealthcareEntitiesResult.js.map +1 -1
  35. package/dist/commonjs/analyzeSentimentResult.js +7 -4
  36. package/dist/commonjs/analyzeSentimentResult.js.map +1 -1
  37. package/dist/commonjs/detectLanguageResult.js +4 -1
  38. package/dist/commonjs/detectLanguageResult.js.map +1 -1
  39. package/dist/commonjs/extractKeyPhrasesResult.js +4 -1
  40. package/dist/commonjs/extractKeyPhrasesResult.js.map +1 -1
  41. package/dist/commonjs/generated/generatedClient.js +12 -4
  42. package/dist/commonjs/generated/generatedClient.js.map +1 -1
  43. package/dist/commonjs/generated/models/mappers.js +44 -10
  44. package/dist/commonjs/generated/models/mappers.js.map +1 -1
  45. package/dist/commonjs/lro/analyze/operation.js +27 -18
  46. package/dist/commonjs/lro/analyze/operation.js.map +1 -1
  47. package/dist/commonjs/lro/health/operation.js +27 -34
  48. package/dist/commonjs/lro/health/operation.js.map +1 -1
  49. package/dist/commonjs/lro/poller.js +5 -7
  50. package/dist/commonjs/lro/poller.js.map +1 -1
  51. package/dist/commonjs/recognizeCategorizedEntitiesResult.js +4 -1
  52. package/dist/commonjs/recognizeCategorizedEntitiesResult.js.map +1 -1
  53. package/dist/commonjs/recognizeLinkedEntitiesResult.js +4 -1
  54. package/dist/commonjs/recognizeLinkedEntitiesResult.js.map +1 -1
  55. package/dist/commonjs/recognizePiiEntitiesResult.js +5 -2
  56. package/dist/commonjs/recognizePiiEntitiesResult.js.map +1 -1
  57. package/dist/commonjs/textAnalyticsClient.js +38 -16
  58. package/dist/commonjs/textAnalyticsClient.js.map +1 -1
  59. package/dist/commonjs/tsdoc-metadata.json +11 -11
  60. package/dist/commonjs/util.js +6 -8
  61. package/dist/commonjs/util.js.map +1 -1
  62. package/dist/esm/analyzeActionsResult.js +6 -7
  63. package/dist/esm/analyzeActionsResult.js.map +1 -1
  64. package/dist/esm/analyzeHealthcareEntitiesResult.js +7 -3
  65. package/dist/esm/analyzeHealthcareEntitiesResult.js.map +1 -1
  66. package/dist/esm/analyzeSentimentResult.js +7 -4
  67. package/dist/esm/analyzeSentimentResult.js.map +1 -1
  68. package/dist/esm/detectLanguageResult.js +4 -1
  69. package/dist/esm/detectLanguageResult.js.map +1 -1
  70. package/dist/esm/extractKeyPhrasesResult.js +4 -1
  71. package/dist/esm/extractKeyPhrasesResult.js.map +1 -1
  72. package/dist/esm/generated/generatedClient.js +12 -4
  73. package/dist/esm/generated/generatedClient.js.map +1 -1
  74. package/dist/esm/generated/models/mappers.js +44 -10
  75. package/dist/esm/generated/models/mappers.js.map +1 -1
  76. package/dist/esm/lro/analyze/operation.js +27 -18
  77. package/dist/esm/lro/analyze/operation.js.map +1 -1
  78. package/dist/esm/lro/health/operation.js +27 -34
  79. package/dist/esm/lro/health/operation.js.map +1 -1
  80. package/dist/esm/lro/poller.js +5 -7
  81. package/dist/esm/lro/poller.js.map +1 -1
  82. package/dist/esm/recognizeCategorizedEntitiesResult.js +4 -1
  83. package/dist/esm/recognizeCategorizedEntitiesResult.js.map +1 -1
  84. package/dist/esm/recognizeLinkedEntitiesResult.js +4 -1
  85. package/dist/esm/recognizeLinkedEntitiesResult.js.map +1 -1
  86. package/dist/esm/recognizePiiEntitiesResult.js +5 -2
  87. package/dist/esm/recognizePiiEntitiesResult.js.map +1 -1
  88. package/dist/esm/textAnalyticsClient.js +38 -16
  89. package/dist/esm/textAnalyticsClient.js.map +1 -1
  90. package/dist/esm/util.js +6 -8
  91. package/dist/esm/util.js.map +1 -1
  92. package/dist/react-native/analyzeActionsResult.js +6 -7
  93. package/dist/react-native/analyzeActionsResult.js.map +1 -1
  94. package/dist/react-native/analyzeHealthcareEntitiesResult.js +7 -3
  95. package/dist/react-native/analyzeHealthcareEntitiesResult.js.map +1 -1
  96. package/dist/react-native/analyzeSentimentResult.js +7 -4
  97. package/dist/react-native/analyzeSentimentResult.js.map +1 -1
  98. package/dist/react-native/detectLanguageResult.js +4 -1
  99. package/dist/react-native/detectLanguageResult.js.map +1 -1
  100. package/dist/react-native/extractKeyPhrasesResult.js +4 -1
  101. package/dist/react-native/extractKeyPhrasesResult.js.map +1 -1
  102. package/dist/react-native/generated/generatedClient.js +12 -4
  103. package/dist/react-native/generated/generatedClient.js.map +1 -1
  104. package/dist/react-native/generated/models/mappers.js +44 -10
  105. package/dist/react-native/generated/models/mappers.js.map +1 -1
  106. package/dist/react-native/lro/analyze/operation.js +27 -18
  107. package/dist/react-native/lro/analyze/operation.js.map +1 -1
  108. package/dist/react-native/lro/health/operation.js +27 -34
  109. package/dist/react-native/lro/health/operation.js.map +1 -1
  110. package/dist/react-native/lro/poller.js +5 -7
  111. package/dist/react-native/lro/poller.js.map +1 -1
  112. package/dist/react-native/recognizeCategorizedEntitiesResult.js +4 -1
  113. package/dist/react-native/recognizeCategorizedEntitiesResult.js.map +1 -1
  114. package/dist/react-native/recognizeLinkedEntitiesResult.js +4 -1
  115. package/dist/react-native/recognizeLinkedEntitiesResult.js.map +1 -1
  116. package/dist/react-native/recognizePiiEntitiesResult.js +5 -2
  117. package/dist/react-native/recognizePiiEntitiesResult.js.map +1 -1
  118. package/dist/react-native/textAnalyticsClient.js +38 -16
  119. package/dist/react-native/textAnalyticsClient.js.map +1 -1
  120. package/dist/react-native/util.js +6 -8
  121. package/dist/react-native/util.js.map +1 -1
  122. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/analyze/operation.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAmBlC,2EAA2E;AAE3E,2CAAiF;AAEjF,4CAAqD;AAErD,+CAAyC;AAoFzC;;GAEG;AACH,SAAS,uBAAuB,CAC9B,QAAyB;IAEzB,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,eAAe;QACnC,cAAc,EAAE,QAAQ,CAAC,kBAAkB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/E,KAAK,CAAC,sBAAsB,GAAG,eAAe,CAAC,gBAAgB,CAAC,sBAAsB,CAAC;QACvF,KAAK,CAAC,WAAW,GAAG,MAAA,eAAe,CAAC,gBAAgB,0CAAE,WAAW,CAAC;QAElE,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC;YAC/C,MAAM,aAAa,GAAG,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,WAAY,EAAE;gBACvE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;gBACrC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;gBAC3C,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB;gBACjD,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;gBACnC,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB;aAClD,CAAC,CAAC;YACH,oDAAoD;YACpD,yDAAyD;YACzD,gDAAgD;YAChD,2CAA2C;YAC3C,MAAM;YACN,KAAK,CAAC,MAAM,GAAG,aAAa,CAAC;YAC7B,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QAC3B,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;YAC/C,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,kBAAM,CAAC,OAAO,CAAC,iEAAiE,CAAC,CAAC;QAClF,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArMD,gFAqMC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\n\nimport type {\n AnalyzeStatusOptionalParams as AnalyzeActionsOperationStatusOptions,\n AnalyzeJobState,\n AnalyzeResponse as BeginAnalyzeResponse,\n JobManifestTasks as GeneratedActions,\n TextDocumentBatchStatistics,\n TextDocumentInput,\n} from \"../../generated/models/index.js\";\nimport type {\n AnalyzeActionsResult,\n PagedAnalyzeActionsResult,\n PagedAsyncIterableAnalyzeActionsResult,\n} from \"../../analyzeActionsResult.js\";\nimport { createAnalyzeActionsResult } from \"../../analyzeActionsResult.js\";\nimport type { PageSettings } from \"@azure/core-paging\";\nimport { getOperationId, nextLinkToTopAndSkip, throwError } from \"../../util.js\";\nimport type { AnalysisPollOperationState, OperationMetadata } from \"../poller.js\";\nimport { AnalysisPollOperation } from \"../poller.js\";\nimport type { GeneratedClient as Client } from \"../../generated/index.js\";\nimport { logger } from \"../../logger.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\n\n/**\n * @internal\n */\ninterface AnalyzeResultsWithPagination {\n result: AnalyzeActionsResult;\n top?: number;\n skip?: number;\n}\n\n/**\n * The metadata for beginAnalyzeActions operations.\n */\nexport interface AnalyzeActionsOperationMetadata extends OperationMetadata {\n /**\n * Number of successfully completed actions.\n */\n actionsSucceededCount: number;\n /**\n * Number of failed actions.\n */\n actionsFailedCount: number;\n /**\n * Number of actions still in progress.\n */\n actionsInProgressCount: number;\n /**\n * The operation's display name.\n */\n displayName?: string;\n}\n\n/**\n * @internal\n */\ninterface AnalyzeActionsOperationStatus {\n done: boolean;\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n operationMetdata: Omit<AnalyzeActionsOperationMetadata, \"operationId\">;\n}\n\n/**\n * @internal\n */\ninterface BeginAnalyzeInternalOptions extends OperationOptions {\n displayName?: string;\n}\n\n/**\n * Options for the begin analyze actions operation.\n */\nexport interface BeginAnalyzeActionsOptions extends OperationOptions {\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n updateIntervalInMs?: number;\n /**\n * A serialized poller which can be used to resume an existing paused Long-Running-Operation.\n */\n resumeFrom?: string;\n /**\n * If set to true, response will contain input and document level statistics.\n */\n includeStatistics?: boolean;\n /**\n * The operation's display name.\n */\n displayName?: string;\n}\n\n/**\n * The state of the begin analyze polling operation.\n */\nexport interface AnalyzeActionsOperationState\n extends AnalysisPollOperationState<PagedAnalyzeActionsResult>,\n AnalyzeActionsOperationMetadata {}\n\n/**\n * @internal\n */\nfunction getMetaInfoFromResponse(\n response: AnalyzeJobState,\n): Omit<AnalyzeActionsOperationMetadata, \"operationId\"> {\n return {\n createdOn: response.createdDateTime,\n lastModifiedOn: response.lastUpdateDateTime,\n expiresOn: response.expirationDateTime,\n status: response.status,\n actionsSucceededCount: response.tasks.completed,\n actionsFailedCount: response.tasks.failed,\n actionsInProgressCount: response.tasks.inProgress,\n displayName: response.displayName,\n };\n}\n\n/**\n * Class that represents a poller that waits for results of the analyze\n * operation.\n * @internal\n */\nexport class BeginAnalyzeActionsPollerOperation extends AnalysisPollOperation<\n AnalyzeActionsOperationState,\n PagedAnalyzeActionsResult\n> {\n constructor(\n public state: AnalyzeActionsOperationState,\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n private client: Client,\n private tracing: TracingClient,\n private documents: TextDocumentInput[],\n private actions: GeneratedActions,\n private options: BeginAnalyzeActionsOptions = {},\n ) {\n super(state);\n }\n\n /**\n * should be called only after all the status of the analyze actions operations became\n * \"succeeded\" and it returns an iterator for the results and provides a\n * byPage method to return the results paged.\n */\n private listAnalyzeActionsResults(\n operationId: string,\n options: AnalyzeActionsOperationStatusOptions = {},\n ): PagedAsyncIterableAnalyzeActionsResult {\n const iter = this._listAnalyzeActionsResultsPaged(operationId, options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings?: PageSettings) => {\n const pageOptions = { ...options, top: settings?.maxPageSize };\n return this._listAnalyzeActionsResultsPaged(operationId, pageOptions);\n },\n };\n }\n\n /**\n * returns an iterator to arrays of the results of an analyze actions operation.\n */\n private async *_listAnalyzeActionsResultsPaged(\n operationId: string,\n options?: AnalyzeActionsOperationStatusOptions,\n ): AsyncIterableIterator<AnalyzeActionsResult> {\n let response = await this._listAnalyzeActionsResultsSinglePage(operationId, options);\n yield response.result;\n while (response.skip) {\n const optionsWithContinuation: AnalyzeActionsOperationStatusOptions = {\n ...options,\n top: response.top,\n skip: response.skip,\n };\n response = await this._listAnalyzeActionsResultsSinglePage(\n operationId,\n optionsWithContinuation,\n );\n yield response.result;\n }\n }\n\n /**\n * returns an iterator to arrays of the sorted results of an analyze actions operation.\n */\n private async _listAnalyzeActionsResultsSinglePage(\n operationId: string,\n options?: AnalyzeActionsOperationStatusOptions,\n ): Promise<AnalyzeResultsWithPagination> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-_listAnalyzeActionsResultsSinglePage\",\n options || {},\n (finalOptions) => this.client.analyzeStatus(operationId, finalOptions),\n );\n const result = createAnalyzeActionsResult(response, this.documents);\n return response.nextLink ? { result, ...nextLinkToTopAndSkip(response.nextLink) } : { result };\n }\n\n /**\n * returns whether the analyze actions operation is done and if so returns also\n * statistics.\n */\n private async getAnalyzeActionsOperationStatus(\n operationId: string,\n options?: AnalyzeActionsOperationStatusOptions,\n ): Promise<AnalyzeActionsOperationStatus> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-getAnalyzeActionsOperationStatus\",\n options || {},\n (finalOptions) => this.client.analyzeStatus(operationId, finalOptions),\n );\n switch (response.status) {\n case \"notStarted\":\n case \"running\":\n break;\n default: {\n return {\n done: true,\n statistics: response.statistics,\n operationMetdata: getMetaInfoFromResponse(response),\n };\n }\n }\n return { done: false, operationMetdata: getMetaInfoFromResponse(response) };\n }\n\n private async beginAnalyzeActions(\n documents: TextDocumentInput[],\n actions: GeneratedActions,\n options?: BeginAnalyzeInternalOptions,\n ): Promise<BeginAnalyzeResponse> {\n return this.tracing.withSpan(\n \"TextAnalyticsClient-beginAnalyze\",\n options || {},\n (finalOptions) =>\n throwError(\n this.client.analyze({\n body: {\n analysisInput: { documents: documents },\n tasks: actions,\n displayName: options?.displayName,\n },\n ...finalOptions,\n }),\n ),\n );\n }\n\n async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: AnalyzeActionsOperationState) => void;\n } = {},\n ): Promise<BeginAnalyzeActionsPollerOperation> {\n const state = this.state;\n const updatedAbortSignal = options.abortSignal;\n if (!state.isStarted) {\n state.isStarted = true;\n const response = await this.beginAnalyzeActions(this.documents, this.actions, {\n displayName: this.options.displayName,\n tracingOptions: this.options.tracingOptions,\n requestOptions: this.options.requestOptions,\n abortSignal: updatedAbortSignal ? updatedAbortSignal : this.options.abortSignal,\n });\n if (!response.operationLocation) {\n throw new Error(\n \"Expects a valid 'operationLocation' to retrieve analyze results but did not find any\",\n );\n }\n state.operationId = getOperationId(response.operationLocation);\n }\n\n const operationStatus = await this.getAnalyzeActionsOperationStatus(state.operationId!, {\n abortSignal: updatedAbortSignal ? updatedAbortSignal : options.abortSignal,\n includeStatistics: this.options.includeStatistics,\n tracingOptions: this.options.tracingOptions,\n });\n\n state.createdOn = operationStatus.operationMetdata.createdOn;\n state.expiresOn = operationStatus.operationMetdata.expiresOn;\n state.lastModifiedOn = operationStatus.operationMetdata.lastModifiedOn;\n state.status = operationStatus.operationMetdata.status;\n state.actionsSucceededCount = operationStatus.operationMetdata.actionsSucceededCount;\n state.actionsFailedCount = operationStatus.operationMetdata.actionsFailedCount;\n state.actionsInProgressCount = operationStatus.operationMetdata.actionsInProgressCount;\n state.displayName = operationStatus.operationMetdata?.displayName;\n\n if (!state.isCompleted && operationStatus.done) {\n const pagedIterator = this.listAnalyzeActionsResults(state.operationId!, {\n abortSignal: this.options.abortSignal,\n tracingOptions: this.options.tracingOptions,\n includeStatistics: this.options.includeStatistics,\n onResponse: this.options.onResponse,\n serializerOptions: this.options.serializerOptions,\n });\n // Attach stats if the service starts to return them\n // https://github.com/Azure/azure-sdk-for-js/issues/14139\n // state.result = Object.assign(pagedIterator, {\n // statistics: operationStatus.statistics\n // });\n state.result = pagedIterator;\n state.isCompleted = true;\n }\n\n if (typeof options.fireProgress === \"function\") {\n options.fireProgress(state);\n }\n return this;\n }\n\n async cancel(): Promise<BeginAnalyzeActionsPollerOperation> {\n const state = this.state;\n logger.warning(`The service does not yet support cancellation for beginAnalyze.`);\n state.isCancelled = true;\n return this;\n }\n}\n"]}
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/analyze/operation.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAmBlC,2EAA2E;AAE3E,2CAAiF;AAEjF,4CAAqD;AAErD,+CAAyC;AAoFzC;;GAEG;AACH,SAAS,uBAAuB,CAC9B,QAAyB;IAEzB,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,eAAe;QACnC,cAAc,EAAE,QAAQ,CAAC,kBAAkB;QAC3C,SAAS,EAAE,QAAQ,CAAC,kBAAkB;QACtC,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,qBAAqB,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS;QAC/C,kBAAkB,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM;QACzC,sBAAsB,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;QACjD,WAAW,EAAE,QAAQ,CAAC,WAAW;KAClC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAa,kCAAmC,SAAQ,iCAGvD;IAEU;IAEC;IACA;IACA;IACA;IACA;IAPV,YACS,KAAmC;IAC1C,wEAAwE;IAChE,MAAc,EACd,OAAsB,EACtB,SAA8B,EAC9B,OAAyB,EACzB,UAAsC,EAAE;QAEhD,KAAK,CAAC,KAAK,CAAC,CAAC;QARN,UAAK,GAAL,KAAK,CAA8B;QAElC,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAAe;QACtB,cAAS,GAAT,SAAS,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C;YAC3C,MAAM;YACN,KAAK,CAAC,MAAM,GAAG,aAAa,CAAC;YAC7B,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QAC3B,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;YAC/C,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,kBAAM,CAAC,OAAO,CAAC,iEAAiE,CAAC,CAAC;QAClF,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArMD,gFAqMC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\n\nimport type {\n AnalyzeStatusOptionalParams as AnalyzeActionsOperationStatusOptions,\n AnalyzeJobState,\n AnalyzeResponse as BeginAnalyzeResponse,\n JobManifestTasks as GeneratedActions,\n TextDocumentBatchStatistics,\n TextDocumentInput,\n} from \"../../generated/models/index.js\";\nimport type {\n AnalyzeActionsResult,\n PagedAnalyzeActionsResult,\n PagedAsyncIterableAnalyzeActionsResult,\n} from \"../../analyzeActionsResult.js\";\nimport { createAnalyzeActionsResult } from \"../../analyzeActionsResult.js\";\nimport type { PageSettings } from \"@azure/core-paging\";\nimport { getOperationId, nextLinkToTopAndSkip, throwError } from \"../../util.js\";\nimport type { AnalysisPollOperationState, OperationMetadata } from \"../poller.js\";\nimport { AnalysisPollOperation } from \"../poller.js\";\nimport type { GeneratedClient as Client } from \"../../generated/index.js\";\nimport { logger } from \"../../logger.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\n\n/**\n * @internal\n */\ninterface AnalyzeResultsWithPagination {\n result: AnalyzeActionsResult;\n top?: number;\n skip?: number;\n}\n\n/**\n * The metadata for beginAnalyzeActions operations.\n */\nexport interface AnalyzeActionsOperationMetadata extends OperationMetadata {\n /**\n * Number of successfully completed actions.\n */\n actionsSucceededCount: number;\n /**\n * Number of failed actions.\n */\n actionsFailedCount: number;\n /**\n * Number of actions still in progress.\n */\n actionsInProgressCount: number;\n /**\n * The operation's display name.\n */\n displayName?: string;\n}\n\n/**\n * @internal\n */\ninterface AnalyzeActionsOperationStatus {\n done: boolean;\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n operationMetdata: Omit<AnalyzeActionsOperationMetadata, \"operationId\">;\n}\n\n/**\n * @internal\n */\ninterface BeginAnalyzeInternalOptions extends OperationOptions {\n displayName?: string;\n}\n\n/**\n * Options for the begin analyze actions operation.\n */\nexport interface BeginAnalyzeActionsOptions extends OperationOptions {\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n updateIntervalInMs?: number;\n /**\n * A serialized poller which can be used to resume an existing paused Long-Running-Operation.\n */\n resumeFrom?: string;\n /**\n * If set to true, response will contain input and document level statistics.\n */\n includeStatistics?: boolean;\n /**\n * The operation's display name.\n */\n displayName?: string;\n}\n\n/**\n * The state of the begin analyze polling operation.\n */\nexport interface AnalyzeActionsOperationState\n extends AnalysisPollOperationState<PagedAnalyzeActionsResult>,\n AnalyzeActionsOperationMetadata {}\n\n/**\n * @internal\n */\nfunction getMetaInfoFromResponse(\n response: AnalyzeJobState,\n): Omit<AnalyzeActionsOperationMetadata, \"operationId\"> {\n return {\n createdOn: response.createdDateTime,\n lastModifiedOn: response.lastUpdateDateTime,\n expiresOn: response.expirationDateTime,\n status: response.status,\n actionsSucceededCount: response.tasks.completed,\n actionsFailedCount: response.tasks.failed,\n actionsInProgressCount: response.tasks.inProgress,\n displayName: response.displayName,\n };\n}\n\n/**\n * Class that represents a poller that waits for results of the analyze\n * operation.\n * @internal\n */\nexport class BeginAnalyzeActionsPollerOperation extends AnalysisPollOperation<\n AnalyzeActionsOperationState,\n PagedAnalyzeActionsResult\n> {\n constructor(\n public state: AnalyzeActionsOperationState,\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n private client: Client,\n private tracing: TracingClient,\n private documents: TextDocumentInput[],\n private actions: GeneratedActions,\n private options: BeginAnalyzeActionsOptions = {},\n ) {\n super(state);\n }\n\n /**\n * should be called only after all the status of the analyze actions operations became\n * \"succeeded\" and it returns an iterator for the results and provides a\n * byPage method to return the results paged.\n */\n private listAnalyzeActionsResults(\n operationId: string,\n options: AnalyzeActionsOperationStatusOptions = {},\n ): PagedAsyncIterableAnalyzeActionsResult {\n const iter = this._listAnalyzeActionsResultsPaged(operationId, options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings?: PageSettings) => {\n const pageOptions = { ...options, top: settings?.maxPageSize };\n return this._listAnalyzeActionsResultsPaged(operationId, pageOptions);\n },\n };\n }\n\n /**\n * returns an iterator to arrays of the results of an analyze actions operation.\n */\n private async *_listAnalyzeActionsResultsPaged(\n operationId: string,\n options?: AnalyzeActionsOperationStatusOptions,\n ): AsyncIterableIterator<AnalyzeActionsResult> {\n let response = await this._listAnalyzeActionsResultsSinglePage(operationId, options);\n yield response.result;\n while (response.skip) {\n const optionsWithContinuation: AnalyzeActionsOperationStatusOptions = {\n ...options,\n top: response.top,\n skip: response.skip,\n };\n response = await this._listAnalyzeActionsResultsSinglePage(\n operationId,\n optionsWithContinuation,\n );\n yield response.result;\n }\n }\n\n /**\n * returns an iterator to arrays of the sorted results of an analyze actions operation.\n */\n private async _listAnalyzeActionsResultsSinglePage(\n operationId: string,\n options?: AnalyzeActionsOperationStatusOptions,\n ): Promise<AnalyzeResultsWithPagination> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-_listAnalyzeActionsResultsSinglePage\",\n options || {},\n (finalOptions) => this.client.analyzeStatus(operationId, finalOptions),\n );\n const result = createAnalyzeActionsResult(response, this.documents);\n return response.nextLink ? { result, ...nextLinkToTopAndSkip(response.nextLink) } : { result };\n }\n\n /**\n * returns whether the analyze actions operation is done and if so returns also\n * statistics.\n */\n private async getAnalyzeActionsOperationStatus(\n operationId: string,\n options?: AnalyzeActionsOperationStatusOptions,\n ): Promise<AnalyzeActionsOperationStatus> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-getAnalyzeActionsOperationStatus\",\n options || {},\n (finalOptions) => this.client.analyzeStatus(operationId, finalOptions),\n );\n switch (response.status) {\n case \"notStarted\":\n case \"running\":\n break;\n default: {\n return {\n done: true,\n statistics: response.statistics,\n operationMetdata: getMetaInfoFromResponse(response),\n };\n }\n }\n return { done: false, operationMetdata: getMetaInfoFromResponse(response) };\n }\n\n private async beginAnalyzeActions(\n documents: TextDocumentInput[],\n actions: GeneratedActions,\n options?: BeginAnalyzeInternalOptions,\n ): Promise<BeginAnalyzeResponse> {\n return this.tracing.withSpan(\n \"TextAnalyticsClient-beginAnalyze\",\n options || {},\n (finalOptions) =>\n throwError(\n this.client.analyze({\n body: {\n analysisInput: { documents: documents },\n tasks: actions,\n displayName: options?.displayName,\n },\n ...finalOptions,\n }),\n ),\n );\n }\n\n async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: AnalyzeActionsOperationState) => void;\n } = {},\n ): Promise<BeginAnalyzeActionsPollerOperation> {\n const state = this.state;\n const updatedAbortSignal = options.abortSignal;\n if (!state.isStarted) {\n state.isStarted = true;\n const response = await this.beginAnalyzeActions(this.documents, this.actions, {\n displayName: this.options.displayName,\n tracingOptions: this.options.tracingOptions,\n requestOptions: this.options.requestOptions,\n abortSignal: updatedAbortSignal ? updatedAbortSignal : this.options.abortSignal,\n });\n if (!response.operationLocation) {\n throw new Error(\n \"Expects a valid 'operationLocation' to retrieve analyze results but did not find any\",\n );\n }\n state.operationId = getOperationId(response.operationLocation);\n }\n\n const operationStatus = await this.getAnalyzeActionsOperationStatus(state.operationId!, {\n abortSignal: updatedAbortSignal ? updatedAbortSignal : options.abortSignal,\n includeStatistics: this.options.includeStatistics,\n tracingOptions: this.options.tracingOptions,\n });\n\n state.createdOn = operationStatus.operationMetdata.createdOn;\n state.expiresOn = operationStatus.operationMetdata.expiresOn;\n state.lastModifiedOn = operationStatus.operationMetdata.lastModifiedOn;\n state.status = operationStatus.operationMetdata.status;\n state.actionsSucceededCount = operationStatus.operationMetdata.actionsSucceededCount;\n state.actionsFailedCount = operationStatus.operationMetdata.actionsFailedCount;\n state.actionsInProgressCount = operationStatus.operationMetdata.actionsInProgressCount;\n state.displayName = operationStatus.operationMetdata?.displayName;\n\n if (!state.isCompleted && operationStatus.done) {\n const pagedIterator = this.listAnalyzeActionsResults(state.operationId!, {\n abortSignal: this.options.abortSignal,\n tracingOptions: this.options.tracingOptions,\n includeStatistics: this.options.includeStatistics,\n onResponse: this.options.onResponse,\n serializerOptions: this.options.serializerOptions,\n });\n // Attach stats if the service starts to return them\n // https://github.com/Azure/azure-sdk-for-js/issues/14139\n // state.result = Object.assign(pagedIterator, {\n // statistics: operationStatus.statistics\n // });\n state.result = pagedIterator;\n state.isCompleted = true;\n }\n\n if (typeof options.fireProgress === \"function\") {\n options.fireProgress(state);\n }\n return this;\n }\n\n async cancel(): Promise<BeginAnalyzeActionsPollerOperation> {\n const state = this.state;\n logger.warning(`The service does not yet support cancellation for beginAnalyze.`);\n state.isCancelled = true;\n return this;\n }\n}\n"]}
@@ -3,7 +3,6 @@
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.BeginAnalyzeHealthcarePollerOperation = void 0;
6
- const tslib_1 = require("tslib");
7
6
  const analyzeHealthcareEntitiesResult_js_1 = require("../../analyzeHealthcareEntitiesResult.js");
8
7
  const util_js_1 = require("../../util.js");
9
8
  const poller_js_1 = require("../poller.js");
@@ -24,6 +23,11 @@ function getMetaInfoFromResponse(response) {
24
23
  * @internal
25
24
  */
26
25
  class BeginAnalyzeHealthcarePollerOperation extends poller_js_1.AnalysisPollOperation {
26
+ state;
27
+ client;
28
+ tracing;
29
+ documents;
30
+ options;
27
31
  constructor(state,
28
32
  // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters
29
33
  client, tracing, documents, options = {}) {
@@ -49,7 +53,7 @@ class BeginAnalyzeHealthcarePollerOperation extends poller_js_1.AnalysisPollOper
49
53
  return this;
50
54
  },
51
55
  byPage: (settings) => {
52
- const pageOptions = Object.assign(Object.assign({}, options), { top: settings === null || settings === void 0 ? void 0 : settings.maxPageSize });
56
+ const pageOptions = { ...options, top: settings?.maxPageSize };
53
57
  return this._listHealthcareEntitiesPaged(operationId, pageOptions);
54
58
  },
55
59
  };
@@ -57,39 +61,26 @@ class BeginAnalyzeHealthcarePollerOperation extends poller_js_1.AnalysisPollOper
57
61
  /**
58
62
  * returns an iterator to the results of a healthcare operation.
59
63
  */
60
- _listHealthcareEntities(operationId, options) {
61
- return tslib_1.__asyncGenerator(this, arguments, function* _listHealthcareEntities_1() {
62
- var _a, e_1, _b, _c;
63
- try {
64
- for (var _d = true, _e = tslib_1.__asyncValues(this._listHealthcareEntitiesPaged(operationId, options)), _f; _f = yield tslib_1.__await(_e.next()), _a = _f.done, !_a; _d = true) {
65
- _c = _f.value;
66
- _d = false;
67
- const page = _c;
68
- yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(page)));
69
- }
70
- }
71
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
72
- finally {
73
- try {
74
- if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
75
- }
76
- finally { if (e_1) throw e_1.error; }
77
- }
78
- });
64
+ async *_listHealthcareEntities(operationId, options) {
65
+ for await (const page of this._listHealthcareEntitiesPaged(operationId, options)) {
66
+ yield* page;
67
+ }
79
68
  }
80
69
  /**
81
70
  * returns an iterator to arrays of the results of a healthcare operation.
82
71
  */
83
- _listHealthcareEntitiesPaged(operationId, options) {
84
- return tslib_1.__asyncGenerator(this, arguments, function* _listHealthcareEntitiesPaged_1() {
85
- let response = yield tslib_1.__await(this._listHealthcareEntitiesSinglePage(operationId, options));
86
- yield yield tslib_1.__await(response.result);
87
- while (response.skip) {
88
- const optionsWithContinuation = Object.assign(Object.assign({}, options), { top: response.top, skip: response.skip });
89
- response = yield tslib_1.__await(this._listHealthcareEntitiesSinglePage(operationId, optionsWithContinuation));
90
- yield yield tslib_1.__await(response.result);
91
- }
92
- });
72
+ async *_listHealthcareEntitiesPaged(operationId, options) {
73
+ let response = await this._listHealthcareEntitiesSinglePage(operationId, options);
74
+ yield response.result;
75
+ while (response.skip) {
76
+ const optionsWithContinuation = {
77
+ ...options,
78
+ top: response.top,
79
+ skip: response.skip,
80
+ };
81
+ response = await this._listHealthcareEntitiesSinglePage(operationId, optionsWithContinuation);
82
+ yield response.result;
83
+ }
93
84
  }
94
85
  /**
95
86
  * returns an iterator to arrays of the sorted results of a healthcare operation.
@@ -99,7 +90,8 @@ class BeginAnalyzeHealthcarePollerOperation extends poller_js_1.AnalysisPollOper
99
90
  if (response.results) {
100
91
  const result = (0, textAnalyticsResult_js_1.processAndCombineSuccessfulAndErroneousDocuments)(this.documents, response.results, analyzeHealthcareEntitiesResult_js_1.makeHealthcareEntitiesResult, analyzeHealthcareEntitiesResult_js_1.makeHealthcareEntitiesErrorResult);
101
92
  return response.nextLink
102
- ? Object.assign({ result }, (0, util_js_1.nextLinkToTopAndSkip)(response.nextLink)) : { result };
93
+ ? { result, ...(0, util_js_1.nextLinkToTopAndSkip)(response.nextLink) }
94
+ : { result };
103
95
  }
104
96
  else {
105
97
  throw new Error("Healthcare action has succeeded but the there are no results!");
@@ -110,14 +102,15 @@ class BeginAnalyzeHealthcarePollerOperation extends poller_js_1.AnalysisPollOper
110
102
  * statistics and the model version used.
111
103
  */
112
104
  async getHealthStatus(operationId, options) {
113
- var _a;
114
105
  const response = await this.tracing.withSpan("TextAnalyticsClient-getHealthStatus", options || {}, (finalOptions) => this.client.healthStatus(operationId, finalOptions));
115
106
  switch (response.status) {
116
107
  case "notStarted":
117
108
  case "running":
118
109
  break;
119
110
  case "failed": {
120
- const errors = (_a = response.errors) === null || _a === void 0 ? void 0 : _a.map((e) => ` code ${e.code}, message: '${e.message}'`).join("\n");
111
+ const errors = response.errors
112
+ ?.map((e) => ` code ${e.code}, message: '${e.message}'`)
113
+ .join("\n");
121
114
  const message = `Healthcare analysis failed. Error(s): ${errors || ""}`;
122
115
  throw new Error(message);
123
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/health/operation.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAkBlC,iGAGkD;AAGlD,2CAKuB;AAKvB,4CAAqD;AAErD,yEAAgG;AAiFhG;;GAEG;AACH,SAAS,uBAAuB,CAC9B,QAA4B;IAE5B,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,eAAe;QACnC,cAAc,EAAE,QAAQ,CAAC,kBAAkB;QAC3C,SAAS,EAAE,QAAQ,CAAC,kBAAkB;QACtC,MAAM,EAAE,QAAQ,CAAC,MAAM;KACxB,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAa,qCAAsC,SAAQ,iCAG1D;IACC,YACS,KAAsC;IAC7C,wEAAwE;IAChE,MAAc,EACd,OAAsB,EACtB,SAA8B,EAC9B,UAAiD,EAAE;QAE3D,KAAK,CAAC,KAAK,CAAC,CAAC;QAPN,UAAK,GAAL,KAAK,CAAiC;QAErC,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAAe;QACtB,cAAS,GAAT,SAAS,CAAqB;QAC9B,YAAO,GAAP,OAAO,CAA4C;IAG7D,CAAC;IAED;;;;OAIG;IACK,4BAA4B,CAClC,WAAmB,EACnB,UAAsC,EAAE;QAExC,MAAM,IAAI,GAAG,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAChE,OAAO;YACL,IA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ortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure/core-client\";\n\nimport type {\n HealthResponse as BeginAnalyzeHealthcareResponse,\n HealthcareJobState,\n HealthStatusOptionalParams as HealthcareJobStatusOptions,\n TextDocumentBatchStatistics,\n TextDocumentInput,\n} from \"../../generated/models/index.js\";\nimport type {\n AnalyzeHealthcareEntitiesResult,\n AnalyzeHealthcareEntitiesResultArray,\n PagedAnalyzeHealthcareEntitiesResult,\n PagedAsyncIterableAnalyzeHealthcareEntitiesResult,\n} from \"../../analyzeHealthcareEntitiesResult.js\";\nimport {\n makeHealthcareEntitiesErrorResult,\n makeHealthcareEntitiesResult,\n} from \"../../analyzeHealthcareEntitiesResult.js\";\nimport type { PageSettings } from \"@azure/core-paging\";\nimport type { StringIndexType } from \"../../util.js\";\nimport {\n addStrEncodingParam,\n getOperationId,\n nextLinkToTopAndSkip,\n throwError,\n} from \"../../util.js\";\nimport type {\n AnalysisPollOperationState,\n OperationMetadata as AnalyzeHealthcareEntitiesOperationMetadata,\n} from \"../poller.js\";\nimport { AnalysisPollOperation } from \"../poller.js\";\nimport type { GeneratedClient as Client } from \"../../generated/index.js\";\nimport { processAndCombineSuccessfulAndErroneousDocuments } from \"../../textAnalyticsResult.js\";\nimport type { TextAnalyticsOperationOptions } from \"../../textAnalyticsOperationOptions.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\n\n/**\n * @internal\n */\ninterface AnalyzeHealthcareEntitiesResultWithPagination {\n result: AnalyzeHealthcareEntitiesResultArray;\n top?: number;\n skip?: number;\n}\n\n/**\n * @internal\n */\ninterface HealthcareJobStatus {\n done: boolean;\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion?: string;\n operationMetdata: Omit<AnalyzeHealthcareEntitiesOperationMetadata, \"operationId\">;\n}\n\n/**\n * @internal\n */\ninterface BeginAnalyzeHealthcareInternalOptions extends OperationOptions {\n /**\n * This value indicates which model will be used for scoring. If a model-version is\n * not specified, the API should default to the latest, non-preview version.\n * For supported model versions, see operation-specific documentation, for example:\n * https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis#model-versioning\n */\n modelVersion?: string;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for healthcare entities analysis. Setting this parameter to false,\n * enables input logging.\n */\n loggingOptOut?: boolean;\n}\n\n/**\n * Options for the begin analyze healthcare entities operation.\n */\nexport interface BeginAnalyzeHealthcareEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n stringIndexType?: StringIndexType;\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n updateIntervalInMs?: number;\n /**\n * A serialized poller which can be used to resume an existing paused Long-Running-Operation.\n */\n resumeFrom?: string;\n}\n\n/**\n * The state of the begin analyze healthcare polling operation.\n */\nexport interface AnalyzeHealthcareOperationState\n extends AnalysisPollOperationState<PagedAnalyzeHealthcareEntitiesResult> {}\n\n/**\n * @internal\n */\nfunction getMetaInfoFromResponse(\n response: HealthcareJobState,\n): Omit<AnalyzeHealthcareEntitiesOperationMetadata, \"operationId\"> {\n return {\n createdOn: response.createdDateTime,\n lastModifiedOn: response.lastUpdateDateTime,\n expiresOn: response.expirationDateTime,\n status: response.status,\n };\n}\n\n/**\n * Class that represents a poller that waits for the healthcare results.\n * @internal\n */\nexport class BeginAnalyzeHealthcarePollerOperation extends AnalysisPollOperation<\n AnalyzeHealthcareOperationState,\n PagedAnalyzeHealthcareEntitiesResult\n> {\n constructor(\n public state: AnalyzeHealthcareOperationState,\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n private client: Client,\n private tracing: TracingClient,\n private documents: TextDocumentInput[],\n private options: BeginAnalyzeHealthcareEntitiesOptions = {},\n ) {\n super(state);\n }\n\n /**\n * should be called only after all the status of the healthcare operations became\n * \"succeeded\" and it returns an iterator for the results and provides a\n * byPage method to return the results paged.\n */\n private listHealthcareEntitiesByPage(\n operationId: string,\n options: HealthcareJobStatusOptions = {},\n ): PagedAsyncIterableAnalyzeHealthcareEntitiesResult {\n const iter = this._listHealthcareEntities(operationId, options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings?: PageSettings) => {\n const pageOptions = { ...options, top: settings?.maxPageSize };\n return this._listHealthcareEntitiesPaged(operationId, pageOptions);\n },\n };\n }\n\n /**\n * returns an iterator to the results of a healthcare operation.\n */\n private async *_listHealthcareEntities(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): AsyncIterableIterator<AnalyzeHealthcareEntitiesResult> {\n for await (const page of this._listHealthcareEntitiesPaged(operationId, options)) {\n yield* page;\n }\n }\n\n /**\n * returns an iterator to arrays of the results of a healthcare operation.\n */\n private async *_listHealthcareEntitiesPaged(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): AsyncIterableIterator<AnalyzeHealthcareEntitiesResultArray> {\n let response = await this._listHealthcareEntitiesSinglePage(operationId, options);\n yield response.result;\n while (response.skip) {\n const optionsWithContinuation: HealthcareJobStatusOptions = {\n ...options,\n top: response.top,\n skip: response.skip,\n };\n response = await this._listHealthcareEntitiesSinglePage(operationId, optionsWithContinuation);\n yield response.result;\n }\n }\n\n /**\n * returns an iterator to arrays of the sorted results of a healthcare operation.\n */\n private async _listHealthcareEntitiesSinglePage(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): Promise<AnalyzeHealthcareEntitiesResultWithPagination> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-_listHealthcareEntitiesSinglePage\",\n options || {},\n (finalOptions) => this.client.healthStatus(operationId, finalOptions),\n );\n if (response.results) {\n const result = processAndCombineSuccessfulAndErroneousDocuments(\n this.documents,\n response.results,\n makeHealthcareEntitiesResult,\n makeHealthcareEntitiesErrorResult,\n );\n return response.nextLink\n ? { result, ...nextLinkToTopAndSkip(response.nextLink) }\n : { result };\n } else {\n throw new Error(\"Healthcare action has succeeded but the there are no results!\");\n }\n }\n\n /**\n * returns whether the healthcare operation is done and if so returns also\n * statistics and the model version used.\n */\n private async getHealthStatus(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): Promise<HealthcareJobStatus> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-getHealthStatus\",\n options || {},\n (finalOptions) => this.client.healthStatus(operationId, finalOptions),\n );\n switch (response.status) {\n case \"notStarted\":\n case \"running\":\n break;\n case \"failed\": {\n const errors = response.errors\n ?.map((e) => ` code ${e.code}, message: '${e.message}'`)\n .join(\"\\n\");\n const message = `Healthcare analysis failed. Error(s): ${errors || \"\"}`;\n throw new Error(message);\n }\n default: {\n if (response.results) {\n return {\n done: true,\n statistics: response.results.statistics,\n modelVersion: response.results.modelVersion,\n operationMetdata: getMetaInfoFromResponse(response),\n };\n } else {\n throw new Error(\"Healthcare action has finished but the there are no results!\");\n }\n }\n }\n return { done: false, operationMetdata: getMetaInfoFromResponse(response) };\n }\n\n private async beginAnalyzeHealthcare(\n documents: TextDocumentInput[],\n options?: BeginAnalyzeHealthcareInternalOptions,\n ): Promise<BeginAnalyzeHealthcareResponse> {\n return this.tracing.withSpan(\n \"TextAnalyticsClient-beginAnalyzeHealthcare\",\n addStrEncodingParam(options || {}),\n (finalOptions) => throwError(this.client.health({ documents: documents }, finalOptions)),\n );\n }\n\n async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: AnalyzeHealthcareOperationState) => void;\n } = {},\n ): Promise<BeginAnalyzeHealthcarePollerOperation> {\n const state = this.state;\n const updatedAbortSignal = options.abortSignal;\n if (!state.isStarted) {\n state.isStarted = true;\n const response = await this.beginAnalyzeHealthcare(this.documents, {\n requestOptions: this.options.requestOptions,\n tracingOptions: this.options.tracingOptions,\n abortSignal: updatedAbortSignal ? updatedAbortSignal : options.abortSignal,\n modelVersion: this.options.modelVersion,\n stringIndexType: this.options.stringIndexType,\n loggingOptOut: this.options.disableServiceLogs,\n });\n if (!response.operationLocation) {\n throw new Error(\n \"Expects a valid 'operationLocation' to retrieve health results but did not find any\",\n );\n }\n state.operationId = getOperationId(response.operationLocation);\n }\n const operationStatus = await this.getHealthStatus(state.operationId!, {\n abortSignal: updatedAbortSignal ? updatedAbortSignal : options.abortSignal,\n includeStatistics: this.options.includeStatistics,\n tracingOptions: this.options.tracingOptions,\n onResponse: this.options.onResponse,\n serializerOptions: this.options.serializerOptions,\n });\n\n state.createdOn = operationStatus.operationMetdata.createdOn;\n state.expiresOn = operationStatus.operationMetdata.expiresOn;\n state.lastModifiedOn = operationStatus.operationMetdata.lastModifiedOn;\n state.status = operationStatus.operationMetdata.status;\n\n if (!state.isCompleted && operationStatus.done) {\n const pagedIterator = this.listHealthcareEntitiesByPage(state.operationId!, {\n abortSignal: this.options.abortSignal,\n tracingOptions: this.options.tracingOptions,\n });\n state.result = Object.assign(pagedIterator, {\n statistics: operationStatus.statistics,\n modelVersion: operationStatus.modelVersion!,\n });\n state.isCompleted = true;\n }\n if (typeof options.fireProgress === \"function\") {\n options.fireProgress(state);\n }\n return this;\n }\n\n async cancel(): Promise<BeginAnalyzeHealthcarePollerOperation> {\n const state = this.state;\n if (state.operationId) {\n await this.client.cancelHealthJob(state.operationId, {\n abortSignal: this.options.abortSignal,\n tracingOptions: this.options.tracingOptions,\n });\n }\n state.isCancelled = true;\n return this;\n }\n}\n"]}
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/health/operation.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAkBlC,iGAGkD;AAGlD,2CAKuB;AAKvB,4CAAq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;YACH,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QAC3B,CAAC;QACD,IAAI,OAAO,OAAO,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;YAC/C,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,EAAE;gBACnD,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;gBACrC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;aAC5C,CAAC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAvND,sFAuNC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure/core-client\";\n\nimport type {\n HealthResponse as BeginAnalyzeHealthcareResponse,\n HealthcareJobState,\n HealthStatusOptionalParams as HealthcareJobStatusOptions,\n TextDocumentBatchStatistics,\n TextDocumentInput,\n} from \"../../generated/models/index.js\";\nimport type {\n AnalyzeHealthcareEntitiesResult,\n AnalyzeHealthcareEntitiesResultArray,\n PagedAnalyzeHealthcareEntitiesResult,\n PagedAsyncIterableAnalyzeHealthcareEntitiesResult,\n} from \"../../analyzeHealthcareEntitiesResult.js\";\nimport {\n makeHealthcareEntitiesErrorResult,\n makeHealthcareEntitiesResult,\n} from \"../../analyzeHealthcareEntitiesResult.js\";\nimport type { PageSettings } from \"@azure/core-paging\";\nimport type { StringIndexType } from \"../../util.js\";\nimport {\n addStrEncodingParam,\n getOperationId,\n nextLinkToTopAndSkip,\n throwError,\n} from \"../../util.js\";\nimport type {\n AnalysisPollOperationState,\n OperationMetadata as AnalyzeHealthcareEntitiesOperationMetadata,\n} from \"../poller.js\";\nimport { AnalysisPollOperation } from \"../poller.js\";\nimport type { GeneratedClient as Client } from \"../../generated/index.js\";\nimport { processAndCombineSuccessfulAndErroneousDocuments } from \"../../textAnalyticsResult.js\";\nimport type { TextAnalyticsOperationOptions } from \"../../textAnalyticsOperationOptions.js\";\nimport type { TracingClient } from \"@azure/core-tracing\";\n\n/**\n * @internal\n */\ninterface AnalyzeHealthcareEntitiesResultWithPagination {\n result: AnalyzeHealthcareEntitiesResultArray;\n top?: number;\n skip?: number;\n}\n\n/**\n * @internal\n */\ninterface HealthcareJobStatus {\n done: boolean;\n /**\n * Statistics about the input document batch and how it was processed\n * by the service. This property will have a value when includeStatistics is set to true\n * in the client call.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * The version of the text analytics model used by this operation on this\n * batch of input documents.\n */\n modelVersion?: string;\n operationMetdata: Omit<AnalyzeHealthcareEntitiesOperationMetadata, \"operationId\">;\n}\n\n/**\n * @internal\n */\ninterface BeginAnalyzeHealthcareInternalOptions extends OperationOptions {\n /**\n * This value indicates which model will be used for scoring. If a model-version is\n * not specified, the API should default to the latest, non-preview version.\n * For supported model versions, see operation-specific documentation, for example:\n * https://learn.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-sentiment-analysis#model-versioning\n */\n modelVersion?: string;\n /**\n * Specifies the measurement unit used to calculate the offset and length properties.\n * Possible units are \"TextElements_v8\", \"UnicodeCodePoint\", and \"Utf16CodeUnit\".\n * The default is the JavaScript's default which is \"Utf16CodeUnit\".\n */\n stringIndexType?: StringIndexType;\n /**\n * If set to false, you opt-in to have your text input logged for troubleshooting. By default, Text Analytics\n * will not log your input text for healthcare entities analysis. Setting this parameter to false,\n * enables input logging.\n */\n loggingOptOut?: boolean;\n}\n\n/**\n * Options for the begin analyze healthcare entities operation.\n */\nexport interface BeginAnalyzeHealthcareEntitiesOptions extends TextAnalyticsOperationOptions {\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n stringIndexType?: StringIndexType;\n /**\n * Delay to wait until next poll, in milliseconds.\n */\n updateIntervalInMs?: number;\n /**\n * A serialized poller which can be used to resume an existing paused Long-Running-Operation.\n */\n resumeFrom?: string;\n}\n\n/**\n * The state of the begin analyze healthcare polling operation.\n */\nexport interface AnalyzeHealthcareOperationState\n extends AnalysisPollOperationState<PagedAnalyzeHealthcareEntitiesResult> {}\n\n/**\n * @internal\n */\nfunction getMetaInfoFromResponse(\n response: HealthcareJobState,\n): Omit<AnalyzeHealthcareEntitiesOperationMetadata, \"operationId\"> {\n return {\n createdOn: response.createdDateTime,\n lastModifiedOn: response.lastUpdateDateTime,\n expiresOn: response.expirationDateTime,\n status: response.status,\n };\n}\n\n/**\n * Class that represents a poller that waits for the healthcare results.\n * @internal\n */\nexport class BeginAnalyzeHealthcarePollerOperation extends AnalysisPollOperation<\n AnalyzeHealthcareOperationState,\n PagedAnalyzeHealthcareEntitiesResult\n> {\n constructor(\n public state: AnalyzeHealthcareOperationState,\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n private client: Client,\n private tracing: TracingClient,\n private documents: TextDocumentInput[],\n private options: BeginAnalyzeHealthcareEntitiesOptions = {},\n ) {\n super(state);\n }\n\n /**\n * should be called only after all the status of the healthcare operations became\n * \"succeeded\" and it returns an iterator for the results and provides a\n * byPage method to return the results paged.\n */\n private listHealthcareEntitiesByPage(\n operationId: string,\n options: HealthcareJobStatusOptions = {},\n ): PagedAsyncIterableAnalyzeHealthcareEntitiesResult {\n const iter = this._listHealthcareEntities(operationId, options);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings?: PageSettings) => {\n const pageOptions = { ...options, top: settings?.maxPageSize };\n return this._listHealthcareEntitiesPaged(operationId, pageOptions);\n },\n };\n }\n\n /**\n * returns an iterator to the results of a healthcare operation.\n */\n private async *_listHealthcareEntities(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): AsyncIterableIterator<AnalyzeHealthcareEntitiesResult> {\n for await (const page of this._listHealthcareEntitiesPaged(operationId, options)) {\n yield* page;\n }\n }\n\n /**\n * returns an iterator to arrays of the results of a healthcare operation.\n */\n private async *_listHealthcareEntitiesPaged(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): AsyncIterableIterator<AnalyzeHealthcareEntitiesResultArray> {\n let response = await this._listHealthcareEntitiesSinglePage(operationId, options);\n yield response.result;\n while (response.skip) {\n const optionsWithContinuation: HealthcareJobStatusOptions = {\n ...options,\n top: response.top,\n skip: response.skip,\n };\n response = await this._listHealthcareEntitiesSinglePage(operationId, optionsWithContinuation);\n yield response.result;\n }\n }\n\n /**\n * returns an iterator to arrays of the sorted results of a healthcare operation.\n */\n private async _listHealthcareEntitiesSinglePage(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): Promise<AnalyzeHealthcareEntitiesResultWithPagination> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-_listHealthcareEntitiesSinglePage\",\n options || {},\n (finalOptions) => this.client.healthStatus(operationId, finalOptions),\n );\n if (response.results) {\n const result = processAndCombineSuccessfulAndErroneousDocuments(\n this.documents,\n response.results,\n makeHealthcareEntitiesResult,\n makeHealthcareEntitiesErrorResult,\n );\n return response.nextLink\n ? { result, ...nextLinkToTopAndSkip(response.nextLink) }\n : { result };\n } else {\n throw new Error(\"Healthcare action has succeeded but the there are no results!\");\n }\n }\n\n /**\n * returns whether the healthcare operation is done and if so returns also\n * statistics and the model version used.\n */\n private async getHealthStatus(\n operationId: string,\n options?: HealthcareJobStatusOptions,\n ): Promise<HealthcareJobStatus> {\n const response = await this.tracing.withSpan(\n \"TextAnalyticsClient-getHealthStatus\",\n options || {},\n (finalOptions) => this.client.healthStatus(operationId, finalOptions),\n );\n switch (response.status) {\n case \"notStarted\":\n case \"running\":\n break;\n case \"failed\": {\n const errors = response.errors\n ?.map((e) => ` code ${e.code}, message: '${e.message}'`)\n .join(\"\\n\");\n const message = `Healthcare analysis failed. Error(s): ${errors || \"\"}`;\n throw new Error(message);\n }\n default: {\n if (response.results) {\n return {\n done: true,\n statistics: response.results.statistics,\n modelVersion: response.results.modelVersion,\n operationMetdata: getMetaInfoFromResponse(response),\n };\n } else {\n throw new Error(\"Healthcare action has finished but the there are no results!\");\n }\n }\n }\n return { done: false, operationMetdata: getMetaInfoFromResponse(response) };\n }\n\n private async beginAnalyzeHealthcare(\n documents: TextDocumentInput[],\n options?: BeginAnalyzeHealthcareInternalOptions,\n ): Promise<BeginAnalyzeHealthcareResponse> {\n return this.tracing.withSpan(\n \"TextAnalyticsClient-beginAnalyzeHealthcare\",\n addStrEncodingParam(options || {}),\n (finalOptions) => throwError(this.client.health({ documents: documents }, finalOptions)),\n );\n }\n\n async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: AnalyzeHealthcareOperationState) => void;\n } = {},\n ): Promise<BeginAnalyzeHealthcarePollerOperation> {\n const state = this.state;\n const updatedAbortSignal = options.abortSignal;\n if (!state.isStarted) {\n state.isStarted = true;\n const response = await this.beginAnalyzeHealthcare(this.documents, {\n requestOptions: this.options.requestOptions,\n tracingOptions: this.options.tracingOptions,\n abortSignal: updatedAbortSignal ? updatedAbortSignal : options.abortSignal,\n modelVersion: this.options.modelVersion,\n stringIndexType: this.options.stringIndexType,\n loggingOptOut: this.options.disableServiceLogs,\n });\n if (!response.operationLocation) {\n throw new Error(\n \"Expects a valid 'operationLocation' to retrieve health results but did not find any\",\n );\n }\n state.operationId = getOperationId(response.operationLocation);\n }\n const operationStatus = await this.getHealthStatus(state.operationId!, {\n abortSignal: updatedAbortSignal ? updatedAbortSignal : options.abortSignal,\n includeStatistics: this.options.includeStatistics,\n tracingOptions: this.options.tracingOptions,\n onResponse: this.options.onResponse,\n serializerOptions: this.options.serializerOptions,\n });\n\n state.createdOn = operationStatus.operationMetdata.createdOn;\n state.expiresOn = operationStatus.operationMetdata.expiresOn;\n state.lastModifiedOn = operationStatus.operationMetdata.lastModifiedOn;\n state.status = operationStatus.operationMetdata.status;\n\n if (!state.isCompleted && operationStatus.done) {\n const pagedIterator = this.listHealthcareEntitiesByPage(state.operationId!, {\n abortSignal: this.options.abortSignal,\n tracingOptions: this.options.tracingOptions,\n });\n state.result = Object.assign(pagedIterator, {\n statistics: operationStatus.statistics,\n modelVersion: operationStatus.modelVersion!,\n });\n state.isCompleted = true;\n }\n if (typeof options.fireProgress === \"function\") {\n options.fireProgress(state);\n }\n return this;\n }\n\n async cancel(): Promise<BeginAnalyzeHealthcarePollerOperation> {\n const state = this.state;\n if (state.operationId) {\n await this.client.cancelHealthJob(state.operationId, {\n abortSignal: this.options.abortSignal,\n tracingOptions: this.options.tracingOptions,\n });\n }\n state.isCancelled = true;\n return this;\n }\n}\n"]}
@@ -10,13 +10,10 @@ const util_js_1 = require("../util.js");
10
10
  * @internal
11
11
  */
12
12
  class AnalysisPoller extends core_lro_1.Poller {
13
- constructor() {
14
- super(...arguments);
15
- /**
16
- * Defines how much time the poller is going to wait before making a new request to the service.
17
- */
18
- this.updateIntervalInMs = 2000;
19
- }
13
+ /**
14
+ * Defines how much time the poller is going to wait before making a new request to the service.
15
+ */
16
+ updateIntervalInMs = 2000;
20
17
  /**
21
18
  * The method used by the poller to wait before attempting to update its operation.
22
19
  */
@@ -30,6 +27,7 @@ exports.AnalysisPoller = AnalysisPoller;
30
27
  * @internal
31
28
  */
32
29
  class AnalysisPollOperation {
30
+ state;
33
31
  constructor(state) {
34
32
  this.state = state;
35
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../src/lro/poller.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,8CAAyC;AAIzC,wCAAmC;AA+CnC;;;GAGG;AACH,MAAsB,cAGpB,SAAQ,iBAAuB;IAHjC;;QAIE;;WAEG;QACI,uBAAkB,GAAW,IAAI,CAAC;IAQ3C,CAAC;IANC;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;CACF;AAfD,wCAeC;AAED;;;GAGG;AACH,MAAsB,qBAAqB;IAGzC,YAAmB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAcpC;;OAEG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;CACF;AAzBD,sDAyBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PollOperation, PollOperationState } from \"@azure/core-lro\";\nimport { Poller } from \"@azure/core-lro\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport type { GeneratedClient } from \"../generated/generatedClient.js\";\nimport type { State, TextDocumentInput } from \"../generated/models/index.js\";\nimport { delay } from \"../util.js\";\n\n/**\n * Common parameters to a Poller.\n * @internal\n */\nexport interface AnalysisPollerOptions {\n readonly client: GeneratedClient;\n readonly tracing: TracingClient;\n readonly documents: TextDocumentInput[];\n updateIntervalInMs?: number;\n resumeFrom?: string;\n}\n\n/**\n * Metadata information for an analysis poller operation.\n */\nexport interface OperationMetadata {\n /**\n * The date and time the operation was created.\n */\n createdOn: Date;\n /**\n * The date and time when the operation results will expire on the server.\n */\n expiresOn?: Date;\n /**\n * The operation id.\n */\n operationId: string;\n /**\n * The time the operation status was last updated.\n */\n lastModifiedOn: Date;\n /**\n * The current status of the operation.\n */\n status: State;\n}\n\n/**\n * An interface representing the state of an analysis poller operation.\n */\nexport interface AnalysisPollOperationState<TResult>\n extends PollOperationState<TResult>,\n OperationMetadata {}\n\n/**\n * Common properties and methods of analysis Pollers.\n * @internal\n */\nexport abstract class AnalysisPoller<\n TState extends PollOperationState<TResult>,\n TResult,\n> extends Poller<TState, TResult> {\n /**\n * Defines how much time the poller is going to wait before making a new request to the service.\n */\n public updateIntervalInMs: number = 2000;\n\n /**\n * The method used by the poller to wait before attempting to update its operation.\n */\n async delay(): Promise<void> {\n return delay(this.updateIntervalInMs);\n }\n}\n\n/**\n * Common properties and methods of polling operations.\n * @internal\n */\nexport abstract class AnalysisPollOperation<TState, TResult>\n implements PollOperation<TState, TResult>\n{\n constructor(public state: TState) {}\n\n /**\n * Meant to reach to the service and update the Poller operation.\n * @param options - The optional parameters, which is only an abortSignal from \\@azure/abort-controller\n */\n public abstract update(): Promise<PollOperation<TState, TResult>>;\n\n /**\n * Meant to reach to the service and cancel the Poller operation.\n * @param options - The optional parameters, which is only an abortSignal from \\@azure/abort-controller\n */\n public abstract cancel(): Promise<PollOperation<TState, TResult>>;\n\n /**\n * Serializes the Poller operation.\n */\n public toString(): string {\n return JSON.stringify({\n state: this.state,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../src/lro/poller.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,8CAAyC;AAIzC,wCAAmC;AA+CnC;;;GAGG;AACH,MAAsB,cAGpB,SAAQ,iBAAuB;IAC/B;;OAEG;IACI,kBAAkB,GAAW,IAAI,CAAC;IAEzC;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;CACF;AAfD,wCAeC;AAED;;;GAGG;AACH,MAAsB,qBAAqB;IAGtB;IAAnB,YAAmB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAcpC;;OAEG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;CACF;AAzBD,sDAyBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PollOperation, PollOperationState } from \"@azure/core-lro\";\nimport { Poller } from \"@azure/core-lro\";\nimport type { TracingClient } from \"@azure/core-tracing\";\nimport type { GeneratedClient } from \"../generated/generatedClient.js\";\nimport type { State, TextDocumentInput } from \"../generated/models/index.js\";\nimport { delay } from \"../util.js\";\n\n/**\n * Common parameters to a Poller.\n * @internal\n */\nexport interface AnalysisPollerOptions {\n readonly client: GeneratedClient;\n readonly tracing: TracingClient;\n readonly documents: TextDocumentInput[];\n updateIntervalInMs?: number;\n resumeFrom?: string;\n}\n\n/**\n * Metadata information for an analysis poller operation.\n */\nexport interface OperationMetadata {\n /**\n * The date and time the operation was created.\n */\n createdOn: Date;\n /**\n * The date and time when the operation results will expire on the server.\n */\n expiresOn?: Date;\n /**\n * The operation id.\n */\n operationId: string;\n /**\n * The time the operation status was last updated.\n */\n lastModifiedOn: Date;\n /**\n * The current status of the operation.\n */\n status: State;\n}\n\n/**\n * An interface representing the state of an analysis poller operation.\n */\nexport interface AnalysisPollOperationState<TResult>\n extends PollOperationState<TResult>,\n OperationMetadata {}\n\n/**\n * Common properties and methods of analysis Pollers.\n * @internal\n */\nexport abstract class AnalysisPoller<\n TState extends PollOperationState<TResult>,\n TResult,\n> extends Poller<TState, TResult> {\n /**\n * Defines how much time the poller is going to wait before making a new request to the service.\n */\n public updateIntervalInMs: number = 2000;\n\n /**\n * The method used by the poller to wait before attempting to update its operation.\n */\n async delay(): Promise<void> {\n return delay(this.updateIntervalInMs);\n }\n}\n\n/**\n * Common properties and methods of polling operations.\n * @internal\n */\nexport abstract class AnalysisPollOperation<TState, TResult>\n implements PollOperation<TState, TResult>\n{\n constructor(public state: TState) {}\n\n /**\n * Meant to reach to the service and update the Poller operation.\n * @param options - The optional parameters, which is only an abortSignal from \\@azure/abort-controller\n */\n public abstract update(): Promise<PollOperation<TState, TResult>>;\n\n /**\n * Meant to reach to the service and cancel the Poller operation.\n * @param options - The optional parameters, which is only an abortSignal from \\@azure/abort-controller\n */\n public abstract cancel(): Promise<PollOperation<TState, TResult>>;\n\n /**\n * Serializes the Poller operation.\n */\n public toString(): string {\n return JSON.stringify({\n state: this.state,\n });\n }\n}\n"]}
@@ -10,7 +10,10 @@ const textAnalyticsResult_js_1 = require("./textAnalyticsResult.js");
10
10
  */
11
11
  function makeRecognizeCategorizedEntitiesResult(result) {
12
12
  const { entities, statistics, warnings, id } = result;
13
- return Object.assign(Object.assign({}, (0, textAnalyticsResult_js_1.makeTextAnalyticsSuccessResult)(id, warnings, statistics)), { entities });
13
+ return {
14
+ ...(0, textAnalyticsResult_js_1.makeTextAnalyticsSuccessResult)(id, warnings, statistics),
15
+ entities,
16
+ };
14
17
  }
15
18
  /**
16
19
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"recognizeCategorizedEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizeCategorizedEntitiesResult.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA4ClC,wFAQC;AAKD,kGAKC;AAxDD,qEAGkC;AAgClC;;GAEG;AACH,SAAgB,sCAAsC,CACpD,MAAwB;IAExB,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;IACtD,uCACK,IAAA,uDAA8B,EAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,QAAQ,IACR;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,2CAA2C,CACzD,EAAU,EACV,KAAyB;IAEzB,OAAO,IAAA,qDAA4B,EAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type { DocumentEntities, Entity, TextAnalyticsError } from \"./generated/models/index.js\";\n\n/**\n * An entity from text analysis with information about its categorical\n * classification.\n */\nexport interface CategorizedEntity extends Entity {}\n\n/**\n * The result of the recognize entities operation on a single document.\n */\nexport type RecognizeCategorizedEntitiesResult =\n | RecognizeCategorizedEntitiesSuccessResult\n | RecognizeCategorizedEntitiesErrorResult;\n\n/**\n * The result of the recognize entities operation on a single document, containing the collection of\n * `Entity` objects identified in that document.\n */\nexport interface RecognizeCategorizedEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: CategorizedEntity[];\n}\n\n/**\n * An error result from the recognize entities operation on a single document.\n */\nexport type RecognizeCategorizedEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesResult(\n result: DocumentEntities,\n): RecognizeCategorizedEntitiesSuccessResult {\n const { entities, statistics, warnings, id } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities,\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError,\n): RecognizeCategorizedEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
1
+ {"version":3,"file":"recognizeCategorizedEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizeCategorizedEntitiesResult.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA4ClC,wFAQC;AAKD,kGAKC;AAxDD,qEAGkC;AAgClC;;GAEG;AACH,SAAgB,sCAAsC,CACpD,MAAwB;IAExB,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;IACtD,OAAO;QACL,GAAG,IAAA,uDAA8B,EAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC;QAC3D,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,2CAA2C,CACzD,EAAU,EACV,KAAyB;IAEzB,OAAO,IAAA,qDAA4B,EAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type { DocumentEntities, Entity, TextAnalyticsError } from \"./generated/models/index.js\";\n\n/**\n * An entity from text analysis with information about its categorical\n * classification.\n */\nexport interface CategorizedEntity extends Entity {}\n\n/**\n * The result of the recognize entities operation on a single document.\n */\nexport type RecognizeCategorizedEntitiesResult =\n | RecognizeCategorizedEntitiesSuccessResult\n | RecognizeCategorizedEntitiesErrorResult;\n\n/**\n * The result of the recognize entities operation on a single document, containing the collection of\n * `Entity` objects identified in that document.\n */\nexport interface RecognizeCategorizedEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: CategorizedEntity[];\n}\n\n/**\n * An error result from the recognize entities operation on a single document.\n */\nexport type RecognizeCategorizedEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesResult(\n result: DocumentEntities,\n): RecognizeCategorizedEntitiesSuccessResult {\n const { entities, statistics, warnings, id } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities,\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeCategorizedEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError,\n): RecognizeCategorizedEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -10,7 +10,10 @@ const textAnalyticsResult_js_1 = require("./textAnalyticsResult.js");
10
10
  */
11
11
  function makeRecognizeLinkedEntitiesResult(result) {
12
12
  const { statistics, id, warnings, entities } = result;
13
- return Object.assign(Object.assign({}, (0, textAnalyticsResult_js_1.makeTextAnalyticsSuccessResult)(id, warnings, statistics)), { entities });
13
+ return {
14
+ ...(0, textAnalyticsResult_js_1.makeTextAnalyticsSuccessResult)(id, warnings, statistics),
15
+ entities,
16
+ };
14
17
  }
15
18
  /**
16
19
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"recognizeLinkedEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizeLinkedEntitiesResult.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA0ClC,8EAQC;AAKD,wFAKC;AAtDD,qEAGkC;AA8BlC;;GAEG;AACH,SAAgB,iCAAiC,CAC/C,MAA8B;IAE9B,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IACtD,uCACK,IAAA,uDAA8B,EAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,QAAQ,IACR;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,sCAAsC,CACpD,EAAU,EACV,KAAyB;IAEzB,OAAO,IAAA,qDAA4B,EAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type {\n DocumentLinkedEntities,\n LinkedEntity,\n TextAnalyticsError,\n} from \"./generated/models/index.js\";\n\n/**\n * The result of the recognize linked entities operation on a single document.\n */\nexport type RecognizeLinkedEntitiesResult =\n | RecognizeLinkedEntitiesSuccessResult\n | RecognizeLinkedEntitiesErrorResult;\n\n/**\n * The result of the recognize linked entities operation on a single document,\n * containing a collection of the `LinkedEntity` objects identified in that document.\n */\nexport interface RecognizeLinkedEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: LinkedEntity[];\n}\n\n/**\n * An error result from the recognize linked entities operation on a single document.\n */\nexport type RecognizeLinkedEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizeLinkedEntitiesResult(\n result: DocumentLinkedEntities,\n): RecognizeLinkedEntitiesSuccessResult {\n const { statistics, id, warnings, entities } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities,\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeLinkedEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError,\n): RecognizeLinkedEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
1
+ {"version":3,"file":"recognizeLinkedEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizeLinkedEntitiesResult.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA0ClC,8EAQC;AAKD,wFAKC;AAtDD,qEAGkC;AA8BlC;;GAEG;AACH,SAAgB,iCAAiC,CAC/C,MAA8B;IAE9B,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IACtD,OAAO;QACL,GAAG,IAAA,uDAA8B,EAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC;QAC3D,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,sCAAsC,CACpD,EAAU,EACV,KAAyB;IAEzB,OAAO,IAAA,qDAA4B,EAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type {\n DocumentLinkedEntities,\n LinkedEntity,\n TextAnalyticsError,\n} from \"./generated/models/index.js\";\n\n/**\n * The result of the recognize linked entities operation on a single document.\n */\nexport type RecognizeLinkedEntitiesResult =\n | RecognizeLinkedEntitiesSuccessResult\n | RecognizeLinkedEntitiesErrorResult;\n\n/**\n * The result of the recognize linked entities operation on a single document,\n * containing a collection of the `LinkedEntity` objects identified in that document.\n */\nexport interface RecognizeLinkedEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: LinkedEntity[];\n}\n\n/**\n * An error result from the recognize linked entities operation on a single document.\n */\nexport type RecognizeLinkedEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizeLinkedEntitiesResult(\n result: DocumentLinkedEntities,\n): RecognizeLinkedEntitiesSuccessResult {\n const { statistics, id, warnings, entities } = result;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities,\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizeLinkedEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError,\n): RecognizeLinkedEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -10,8 +10,11 @@ const textAnalyticsResult_js_1 = require("./textAnalyticsResult.js");
10
10
  */
11
11
  function makeRecognizePiiEntitiesResult(document) {
12
12
  const { id, entities, warnings, statistics, redactedText } = document;
13
- return Object.assign(Object.assign({}, (0, textAnalyticsResult_js_1.makeTextAnalyticsSuccessResult)(id, warnings, statistics)), { entities,
14
- redactedText });
13
+ return {
14
+ ...(0, textAnalyticsResult_js_1.makeTextAnalyticsSuccessResult)(id, warnings, statistics),
15
+ entities,
16
+ redactedText,
17
+ };
15
18
  }
16
19
  /**
17
20
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"recognizePiiEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizePiiEntitiesResult.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAgDlC,wEASC;AAKD,kFAKC;AA7DD,qEAGkC;AAoClC;;GAEG;AACH,SAAgB,8BAA8B,CAC5C,QAA6B;IAE7B,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;IACtE,uCACK,IAAA,uDAA8B,EAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,KAC3D,QAAQ;QACR,YAAY,IACZ;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,mCAAmC,CACjD,EAAU,EACV,KAAyB;IAEzB,OAAO,IAAA,qDAA4B,EAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type { Entity, PiiDocumentEntities, TextAnalyticsError } from \"./generated/models/index.js\";\n\n/**\n * An entity from PII recognition with information about the kind of PII\n * encountered.\n */\nexport interface PiiEntity extends Entity {}\n\n/**\n * The result of the recognize entities operation on a single document.\n */\nexport type RecognizePiiEntitiesResult =\n | RecognizePiiEntitiesSuccessResult\n | RecognizePiiEntitiesErrorResult;\n\n/**\n * The result of the recognize entities operation on a single document, containing the collection of\n * `Entity` objects identified in that document.\n */\nexport interface RecognizePiiEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: PiiEntity[];\n /**\n * The text redacted.\n */\n redactedText: string;\n}\n\n/**\n * An error result from the recognize entities operation on a single document.\n */\nexport type RecognizePiiEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizePiiEntitiesResult(\n document: PiiDocumentEntities,\n): RecognizePiiEntitiesSuccessResult {\n const { id, entities, warnings, statistics, redactedText } = document;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities,\n redactedText,\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizePiiEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError,\n): RecognizePiiEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
1
+ {"version":3,"file":"recognizePiiEntitiesResult.js","sourceRoot":"","sources":["../../src/recognizePiiEntitiesResult.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAgDlC,wEASC;AAKD,kFAKC;AA7DD,qEAGkC;AAoClC;;GAEG;AACH,SAAgB,8BAA8B,CAC5C,QAA6B;IAE7B,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;IACtE,OAAO;QACL,GAAG,IAAA,uDAA8B,EAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC;QAC3D,QAAQ;QACR,YAAY;KACb,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,mCAAmC,CACjD,EAAU,EACV,KAAyB;IAEzB,OAAO,IAAA,qDAA4B,EAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n TextAnalyticsErrorResult,\n TextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport {\n makeTextAnalyticsErrorResult,\n makeTextAnalyticsSuccessResult,\n} from \"./textAnalyticsResult.js\";\nimport type { Entity, PiiDocumentEntities, TextAnalyticsError } from \"./generated/models/index.js\";\n\n/**\n * An entity from PII recognition with information about the kind of PII\n * encountered.\n */\nexport interface PiiEntity extends Entity {}\n\n/**\n * The result of the recognize entities operation on a single document.\n */\nexport type RecognizePiiEntitiesResult =\n | RecognizePiiEntitiesSuccessResult\n | RecognizePiiEntitiesErrorResult;\n\n/**\n * The result of the recognize entities operation on a single document, containing the collection of\n * `Entity` objects identified in that document.\n */\nexport interface RecognizePiiEntitiesSuccessResult extends TextAnalyticsSuccessResult {\n /**\n * The collection of entities identified in the input document.\n */\n readonly entities: PiiEntity[];\n /**\n * The text redacted.\n */\n redactedText: string;\n}\n\n/**\n * An error result from the recognize entities operation on a single document.\n */\nexport type RecognizePiiEntitiesErrorResult = TextAnalyticsErrorResult;\n\n/**\n * @internal\n */\nexport function makeRecognizePiiEntitiesResult(\n document: PiiDocumentEntities,\n): RecognizePiiEntitiesSuccessResult {\n const { id, entities, warnings, statistics, redactedText } = document;\n return {\n ...makeTextAnalyticsSuccessResult(id, warnings, statistics),\n entities,\n redactedText,\n };\n}\n\n/**\n * @internal\n */\nexport function makeRecognizePiiEntitiesErrorResult(\n id: string,\n error: TextAnalyticsError,\n): RecognizePiiEntitiesErrorResult {\n return makeTextAnalyticsErrorResult(id, error);\n}\n"]}
@@ -3,7 +3,6 @@
3
3
  // Licensed under the MIT License.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.TextAnalyticsClient = exports.PiiEntityDomain = void 0;
6
- const tslib_1 = require("tslib");
7
6
  const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
8
7
  const core_auth_1 = require("@azure/core-auth");
9
8
  const constants_js_1 = require("./constants.js");
@@ -35,6 +34,24 @@ var PiiEntityDomain;
35
34
  * Client class for interacting with Azure Text Analytics.
36
35
  */
37
36
  class TextAnalyticsClient {
37
+ /**
38
+ * The URL to the TextAnalytics endpoint
39
+ */
40
+ endpointUrl;
41
+ /**
42
+ * The default country hint to use. Defaults to "us".
43
+ */
44
+ defaultCountryHint;
45
+ /**
46
+ * The default language to use. Defaults to "en".
47
+ */
48
+ defaultLanguage;
49
+ /**
50
+ * @internal
51
+ * A reference to the auto-generated TextAnalytics HTTP client.
52
+ */
53
+ client;
54
+ _tracing;
38
55
  /**
39
56
  * Creates an instance of TextAnalyticsClient.
40
57
  *
@@ -50,7 +67,7 @@ class TextAnalyticsClient {
50
67
  */
51
68
  constructor(endpointUrl, credential, options = {}) {
52
69
  this.endpointUrl = endpointUrl;
53
- const { defaultCountryHint = "us", defaultLanguage = "en" } = options, pipelineOptions = tslib_1.__rest(options, ["defaultCountryHint", "defaultLanguage"]);
70
+ const { defaultCountryHint = "us", defaultLanguage = "en", ...pipelineOptions } = options;
54
71
  this.defaultCountryHint = defaultCountryHint;
55
72
  this.defaultLanguage = defaultLanguage;
56
73
  const libInfo = `azsdk-js-ai-textanalytics/${constants_js_1.SDK_VERSION}`;
@@ -63,12 +80,15 @@ class TextAnalyticsClient {
63
80
  else {
64
81
  pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;
65
82
  }
66
- const internalPipelineOptions = Object.assign(Object.assign({}, pipelineOptions), {
67
- loggingOptions: {
68
- logger: logger_js_1.logger.info,
69
- additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"],
83
+ const internalPipelineOptions = {
84
+ ...pipelineOptions,
85
+ ...{
86
+ loggingOptions: {
87
+ logger: logger_js_1.logger.info,
88
+ additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"],
89
+ },
70
90
  },
71
- });
91
+ };
72
92
  this.client = new generatedClient_js_1.GeneratedClient(this.endpointUrl, internalPipelineOptions);
73
93
  const authPolicy = (0, core_auth_1.isTokenCredential)(credential)
74
94
  ? (0, core_rest_pipeline_1.bearerTokenAuthenticationPolicy)({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })
@@ -93,7 +113,10 @@ class TextAnalyticsClient {
93
113
  }
94
114
  else {
95
115
  // Replace "none" hints with ""
96
- realInputs = documents.map((input) => (Object.assign(Object.assign({}, input), { countryHint: input.countryHint === "none" ? "" : input.countryHint })));
116
+ realInputs = documents.map((input) => ({
117
+ ...input,
118
+ countryHint: input.countryHint === "none" ? "" : input.countryHint,
119
+ }));
97
120
  realOptions = countryHintOrOptions || {};
98
121
  }
99
122
  return this._tracing.withSpan("TextAnalyticsClient-detectLanguages", makeGeneratedDetectLanguageOptions(realOptions), (finalOptions) => this.client
@@ -216,7 +239,7 @@ class TextAnalyticsClient {
216
239
  realInputs = documents;
217
240
  realOptions = languageOrOptions || {};
218
241
  }
219
- const { updateIntervalInMs, resumeFrom } = realOptions, restOptions = tslib_1.__rest(realOptions, ["updateIntervalInMs", "resumeFrom"]);
242
+ const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;
220
243
  const poller = new poller_js_1.BeginAnalyzeHealthcarePoller({
221
244
  client: this.client,
222
245
  tracing: this._tracing,
@@ -244,7 +267,7 @@ class TextAnalyticsClient {
244
267
  realOptions = languageOrOptions || {};
245
268
  }
246
269
  const compiledActions = compileAnalyzeInput(actions);
247
- const { updateIntervalInMs, resumeFrom } = realOptions, restOptions = tslib_1.__rest(realOptions, ["updateIntervalInMs", "resumeFrom"]);
270
+ const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;
248
271
  const poller = new poller_js_2.BeginAnalyzeActionsPoller({
249
272
  client: this.client,
250
273
  tracing: this._tracing,
@@ -263,13 +286,12 @@ exports.TextAnalyticsClient = TextAnalyticsClient;
263
286
  * @internal
264
287
  */
265
288
  function compileAnalyzeInput(actions) {
266
- var _a, _b, _c, _d, _e;
267
289
  return {
268
- entityRecognitionPiiTasks: (_a = actions.recognizePiiEntitiesActions) === null || _a === void 0 ? void 0 : _a.map((0, util_js_1.compose)(util_js_1.setStrEncodingParam, (0, util_js_1.compose)(util_js_1.setCategoriesFilter, util_js_1.addParamsToTask))),
269
- entityRecognitionTasks: (_b = actions.recognizeEntitiesActions) === null || _b === void 0 ? void 0 : _b.map((0, util_js_1.compose)(util_js_1.setStrEncodingParam, util_js_1.addParamsToTask)),
270
- keyPhraseExtractionTasks: (_c = actions.extractKeyPhrasesActions) === null || _c === void 0 ? void 0 : _c.map(util_js_1.addParamsToTask),
271
- entityLinkingTasks: (_d = actions.recognizeLinkedEntitiesActions) === null || _d === void 0 ? void 0 : _d.map((0, util_js_1.compose)(util_js_1.setStrEncodingParam, util_js_1.addParamsToTask)),
272
- sentimentAnalysisTasks: (_e = actions.analyzeSentimentActions) === null || _e === void 0 ? void 0 : _e.map((0, util_js_1.compose)(util_js_1.setStrEncodingParam, (0, util_js_1.compose)(util_js_1.setOpinionMining, util_js_1.addParamsToTask))),
290
+ entityRecognitionPiiTasks: actions.recognizePiiEntitiesActions?.map((0, util_js_1.compose)(util_js_1.setStrEncodingParam, (0, util_js_1.compose)(util_js_1.setCategoriesFilter, util_js_1.addParamsToTask))),
291
+ entityRecognitionTasks: actions.recognizeEntitiesActions?.map((0, util_js_1.compose)(util_js_1.setStrEncodingParam, util_js_1.addParamsToTask)),
292
+ keyPhraseExtractionTasks: actions.extractKeyPhrasesActions?.map(util_js_1.addParamsToTask),
293
+ entityLinkingTasks: actions.recognizeLinkedEntitiesActions?.map((0, util_js_1.compose)(util_js_1.setStrEncodingParam, util_js_1.addParamsToTask)),
294
+ sentimentAnalysisTasks: actions.analyzeSentimentActions?.map((0, util_js_1.compose)(util_js_1.setStrEncodingParam, (0, util_js_1.compose)(util_js_1.setOpinionMining, util_js_1.addParamsToTask))),
273
295
  };
274
296
  }
275
297
  function isStringArray(documents) {