@azure/ai-text-analytics 5.2.0-alpha.20210913.4 → 5.2.0-alpha.20211027.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.
- package/CHANGELOG.md +3 -0
- package/README.md +3 -1
- package/dist/index.js +803 -112
- package/dist/index.js.map +1 -1
- package/dist-esm/src/analyzeActionsResult.js +35 -5
- package/dist-esm/src/analyzeActionsResult.js.map +1 -1
- package/dist-esm/src/generated/generatedClientContext.js +1 -1
- package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +559 -1
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/models/parameters.js +2 -1
- package/dist-esm/src/generated/models/parameters.js.map +1 -1
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/multiCategoryClassifyResult.js +17 -0
- package/dist-esm/src/multiCategoryClassifyResult.js.map +1 -0
- package/dist-esm/src/multiCategoryClassifyResultArray.js +11 -0
- package/dist-esm/src/multiCategoryClassifyResultArray.js.map +1 -0
- package/dist-esm/src/recognizeCustomEntitiesResult.js +17 -0
- package/dist-esm/src/recognizeCustomEntitiesResult.js.map +1 -0
- package/dist-esm/src/recognizeCustomEntitiesResultArray.js +11 -0
- package/dist-esm/src/recognizeCustomEntitiesResultArray.js.map +1 -0
- package/dist-esm/src/singleCategoryClassifyResult.js +17 -0
- package/dist-esm/src/singleCategoryClassifyResult.js.map +1 -0
- package/dist-esm/src/singleCategoryClassifyResultArray.js +11 -0
- package/dist-esm/src/singleCategoryClassifyResultArray.js.map +1 -0
- package/dist-esm/src/textAnalyticsAction.js.map +1 -1
- package/dist-esm/src/textAnalyticsClient.js +5 -2
- package/dist-esm/src/textAnalyticsClient.js.map +1 -1
- package/dist-esm/src/textAnalyticsResult.js +16 -0
- package/dist-esm/src/textAnalyticsResult.js.map +1 -1
- package/dist-esm/src/util.js +0 -26
- package/dist-esm/src/util.js.map +1 -1
- package/package.json +3 -4
- package/types/ai-text-analytics.d.ts +293 -2
- package/dist-esm/src/utils/url.browser.js +0 -6
- package/dist-esm/src/utils/url.browser.js.map +0 -1
- package/dist-esm/src/utils/url.js +0 -4
- package/dist-esm/src/utils/url.js.map +0 -1
|
@@ -75,4 +75,20 @@ export function combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVers
|
|
|
75
75
|
modelVersion: response.modelVersion
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* @internal
|
|
80
|
+
* combines successful and erroneous results into a single array of results and
|
|
81
|
+
* sort them so that the IDs order match that of the input documents array. It
|
|
82
|
+
* also attaches statistics, projectName, and deploymentName to the returned array.
|
|
83
|
+
* @param input - the array of documents sent to the service for processing.
|
|
84
|
+
* @param response - the response received from the service.
|
|
85
|
+
*/
|
|
86
|
+
export function combineSuccessfulAndErroneousDocumentsWithStatisticsAndCustomProjectInfo(input, response, processSuccess, processError) {
|
|
87
|
+
const sorted = processAndCombineSuccessfulAndErroneousDocuments(input, response, processSuccess, processError);
|
|
88
|
+
return Object.assign(sorted, {
|
|
89
|
+
statistics: response.statistics,
|
|
90
|
+
projectName: response.projectName,
|
|
91
|
+
deploymentName: response.deploymentName
|
|
92
|
+
});
|
|
93
|
+
}
|
|
78
94
|
//# sourceMappingURL=textAnalyticsResult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textAnalyticsResult.js","sourceRoot":"","sources":["../../src/textAnalyticsResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAalC,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAwH/C;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAyD;IAEzD,wDAAwD;IACxD,8BAA8B;IAC9B,IAAI,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE;QACvC,OAAO,sBAAsB,CAAC,UAAU,CAA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gDAAgD,CAC7D,KAAK,EACL,QAAQ,EACR,cAAc,EACd,YAAY,CACb,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,YAAY,EAAE,QAAQ,CAAC,YAAY;KACpC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextDocumentStatistics,\n TextAnalyticsError as GeneratedTextAnalyticsErrorModel,\n InnerError,\n ErrorCodeValue,\n InnerErrorCodeValue,\n TextAnalyticsWarning,\n DocumentError,\n TextDocumentBatchStatistics,\n TextDocumentInput\n} from \"./generated/models\";\nimport { sortResponseIdObjects } from \"./util\";\n\n/**\n * The result of a text analytics operation on a single input document.\n * @internal\n */\nexport type TextAnalyticsResult = TextAnalyticsSuccessResult | TextAnalyticsErrorResult;\n\n/**\n * An Error Code returned from the Text Analytics service. Possible\n * values include:\n *\n * For more information about the error, see the `message` property of the associated error.\n */\nexport type ErrorCode = ErrorCodeValue | InnerErrorCodeValue;\n\n/**\n * Type describing an error from the Text Analytics service.\n */\nexport interface TextAnalyticsError {\n /**\n * A code describing the kind of error produced\n */\n readonly code: ErrorCode;\n /**\n * A message from the service explaining the error\n */\n readonly message: string;\n /**\n * The target of the particular error (for example, the name of an invalid parameter)\n */\n readonly target?: string;\n}\n\n/**\n * Base type for results of text analytics operations corresponding to a single\n * input document.\n */\nexport interface TextAnalyticsSuccessResult {\n /**\n * Unique, non-empty document identifier.\n */\n readonly id: string;\n\n /**\n * Statistics about the input document 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 readonly statistics?: TextDocumentStatistics;\n\n /**\n * An array of warning data corresponding to this document.\n *\n * If no warnings were returned, this array will be empty.\n */\n readonly warnings: TextAnalyticsWarning[];\n\n /**\n * Discriminant to determine if that this is an error result.\n */\n readonly error?: undefined;\n}\n\n/**\n * Base type for error results of text analytics operations corresponding to a\n * single document.\n */\nexport interface TextAnalyticsErrorResult {\n /**\n * Unique, non-empty document identifier.\n */\n readonly id: string;\n\n /**\n * The Error for this document result.\n */\n readonly error: TextAnalyticsError;\n}\n\n/**\n * @internal\n */\nexport interface TextAnalyticsResultArray<T1 extends TextAnalyticsSuccessResult>\n extends Array<T1 | TextAnalyticsErrorResult> {\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}\n\n/**\n * @internal\n */\nexport interface TextAnalyticsResponse<T1 extends TextAnalyticsSuccessResult> {\n /**\n * Response by document\n */\n documents: T1[];\n /**\n * Errors by document id.\n */\n errors: DocumentError[];\n /**\n * if includeStatistics=true was specified in the request this field will contain information about the request payload.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * This field indicates which model is used for scoring.\n */\n modelVersion: string;\n}\n\n/**\n * Helper function for converting nested service error into\n * the unified TextAnalyticsError\n * @internal\n */\nexport function intoTextAnalyticsError(\n errorModel: GeneratedTextAnalyticsErrorModel | InnerError\n): TextAnalyticsError {\n // Return the deepest error. This will always be at most\n // one level for TextAnalytics\n if (errorModel.innererror !== undefined) {\n return intoTextAnalyticsError(errorModel.innererror);\n }\n\n return {\n code: errorModel.code,\n message: errorModel.message,\n target: errorModel.target\n };\n}\n\n/**\n * @internal\n */\nexport function makeTextAnalyticsSuccessResult(\n id: string,\n warnings: TextAnalyticsWarning[],\n statistics?: TextDocumentStatistics\n): TextAnalyticsSuccessResult {\n return {\n id,\n statistics,\n warnings\n };\n}\n\n/**\n * @internal\n */\nexport function makeTextAnalyticsErrorResult(\n id: string,\n error: GeneratedTextAnalyticsErrorModel\n): TextAnalyticsErrorResult {\n return {\n id,\n error: intoTextAnalyticsError(error)\n };\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n */\nexport function combineSuccessfulAndErroneousDocuments<TSuccess extends TextAnalyticsSuccessResult>(\n input: TextDocumentInput[],\n response: TextAnalyticsResponse<TSuccess>\n): (TSuccess | TextAnalyticsErrorResult)[] {\n return processAndCombineSuccessfulAndErroneousDocuments(\n input,\n response,\n (x) => x,\n makeTextAnalyticsErrorResult\n );\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n * @param process - a function to convert the results from one type to another.\n */\nexport function processAndCombineSuccessfulAndErroneousDocuments<\n TSuccessService extends TextAnalyticsSuccessResult,\n TSuccessSDK extends TextAnalyticsSuccessResult,\n TError extends TextAnalyticsErrorResult\n>(\n input: TextDocumentInput[],\n response: TextAnalyticsResponse<TSuccessService>,\n processSuccess: (successResult: TSuccessService) => TSuccessSDK,\n processError: (id: string, error: GeneratedTextAnalyticsErrorModel) => TError\n): (TSuccessSDK | TextAnalyticsErrorResult)[] {\n const successResults: (TSuccessSDK | TextAnalyticsErrorResult)[] = response.documents.map(\n processSuccess\n );\n const unsortedResults = successResults.concat(\n response.errors.map((error) => processError(error.id, error.error))\n );\n\n return sortResponseIdObjects(input, unsortedResults);\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array. It\n * also attaches statistics and modelVersion to the returned array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n */\nexport function combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion<\n TSuccessService extends TextAnalyticsSuccessResult,\n TSuccessSDK extends TextAnalyticsSuccessResult,\n TError extends TextAnalyticsErrorResult\n>(\n input: TextDocumentInput[],\n response: TextAnalyticsResponse<TSuccessService>,\n processSuccess: (doc: TSuccessService) => TSuccessSDK,\n processError: (id: string, error: GeneratedTextAnalyticsErrorModel) => TError\n): TextAnalyticsResultArray<TSuccessSDK> {\n const sorted = processAndCombineSuccessfulAndErroneousDocuments(\n input,\n response,\n processSuccess,\n processError\n );\n return Object.assign(sorted, {\n statistics: response.statistics,\n modelVersion: response.modelVersion\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"textAnalyticsResult.js","sourceRoot":"","sources":["../../src/textAnalyticsResult.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAalC,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAuK/C;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAyD;IAEzD,wDAAwD;IACxD,8BAA8B;IAC9B,IAAI,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE;QACvC,OAAO,sBAAsB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;KACtD;IAED,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAC5C,EAAU,EACV,QAAgC,EAChC,UAAmC;IAEnC,OAAO;QACL,EAAE;QACF,UAAU;QACV,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC1C,EAAU,EACV,KAAuC;IAEvC,OAAO;QACL,EAAE;QACF,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC;KACrC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sCAAsC,CACpD,KAA0B,EAC1B,QAAiD;IAEjD,OAAO,gDAAgD,CACrD,KAAK,EACL,QAAQ,EACR,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EACR,4BAA4B,CAC7B,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gDAAgD,CAK9D,KAA0B,EAC1B,QAGC,EACD,cAA+D,EAC/D,YAA6E;IAE7E,MAAM,cAAc,GAA+C,QAAQ,CAAC,SAAS,CAAC,GAAG,CACvF,cAAc,CACf,CAAC;IACF,MAAM,eAAe,GAAG,cAAc,CAAC,MAAM,CAC3C,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CACpE,CAAC;IAEF,OAAO,qBAAqB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mEAAmE,CAKjF,KAA0B,EAC1B,QAAwD,EACxD,cAAqD,EACrD,YAA6E;IAE7E,MAAM,MAAM,GAAG,gDAAgD,CAC7D,KAAK,EACL,QAAQ,EACR,cAAc,EACd,YAAY,CACb,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,YAAY,EAAE,QAAQ,CAAC,YAAY;KACpC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wEAAwE,CAKtF,KAA0B,EAC1B,QAAsD,EACtD,cAAqD,EACrD,YAA6E;IAE7E,MAAM,MAAM,GAAG,gDAAgD,CAC7D,KAAK,EACL,QAAQ,EACR,cAAc,EACd,YAAY,CACb,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,cAAc,EAAE,QAAQ,CAAC,cAAc;KACxC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n TextDocumentStatistics,\n TextAnalyticsError as GeneratedTextAnalyticsErrorModel,\n InnerError,\n ErrorCodeValue,\n InnerErrorCodeValue,\n TextAnalyticsWarning,\n DocumentError,\n TextDocumentBatchStatistics,\n TextDocumentInput\n} from \"./generated/models\";\nimport { sortResponseIdObjects } from \"./util\";\n\n/**\n * The result of a text analytics operation on a single input document.\n * @internal\n */\nexport type TextAnalyticsResult = TextAnalyticsSuccessResult | TextAnalyticsErrorResult;\n\n/**\n * An Error Code returned from the Text Analytics service. Possible\n * values include:\n *\n * For more information about the error, see the `message` property of the associated error.\n */\nexport type ErrorCode = ErrorCodeValue | InnerErrorCodeValue;\n\n/**\n * Type describing an error from the Text Analytics service.\n */\nexport interface TextAnalyticsError {\n /**\n * A code describing the kind of error produced\n */\n readonly code: ErrorCode;\n /**\n * A message from the service explaining the error\n */\n readonly message: string;\n /**\n * The target of the particular error (for example, the name of an invalid parameter)\n */\n readonly target?: string;\n}\n\n/**\n * Base type for results of text analytics operations corresponding to a single\n * input document.\n */\nexport interface TextAnalyticsSuccessResult {\n /**\n * Unique, non-empty document identifier.\n */\n readonly id: string;\n\n /**\n * Statistics about the input document 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 readonly statistics?: TextDocumentStatistics;\n\n /**\n * An array of warning data corresponding to this document.\n *\n * If no warnings were returned, this array will be empty.\n */\n readonly warnings: TextAnalyticsWarning[];\n\n /**\n * Discriminant to determine if that this is an error result.\n */\n readonly error?: undefined;\n}\n\n/**\n * Base type for error results of text analytics operations corresponding to a\n * single document.\n */\nexport interface TextAnalyticsErrorResult {\n /**\n * Unique, non-empty document identifier.\n */\n readonly id: string;\n\n /**\n * The Error for this document result.\n */\n readonly error: TextAnalyticsError;\n}\n\n/**\n * @internal\n */\nexport interface StandardTextAnalyticsResultArray<T1 extends TextAnalyticsSuccessResult>\n extends Array<T1 | TextAnalyticsErrorResult> {\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}\n\n/**\n * @internal\n */\nexport interface CustomTextAnalyticsResultArray<T1 extends TextAnalyticsSuccessResult>\n extends Array<T1 | TextAnalyticsErrorResult> {\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 * This field indicates the project name for the model.\n */\n projectName: string;\n /**\n * This field indicates the deployment name for the model.\n */\n deploymentName: string;\n}\n\n/**\n * @internal\n */\nexport interface StandardTextAnalyticsResponse<T1 extends TextAnalyticsSuccessResult> {\n /**\n * Response by document\n */\n documents: T1[];\n /**\n * Errors by document id.\n */\n errors: DocumentError[];\n /**\n * if includeStatistics=true was specified in the request this field will contain information about the request payload.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * This field indicates which model is used for scoring.\n */\n modelVersion: string;\n}\n\n/**\n * @internal\n */\nexport interface CustomTextAnalyticsResponse<T1 extends TextAnalyticsSuccessResult> {\n /**\n * Response by document\n */\n documents: T1[];\n /**\n * Errors by document id.\n */\n errors: DocumentError[];\n /**\n * if includeStatistics=true was specified in the request this field will contain information about the request payload.\n */\n statistics?: TextDocumentBatchStatistics;\n /**\n * This field indicates the project name for the model.\n */\n projectName: string;\n /**\n * This field indicates the deployment name for the model.\n */\n deploymentName: string;\n}\n\n/**\n * Helper function for converting nested service error into\n * the unified TextAnalyticsError\n * @internal\n */\nexport function intoTextAnalyticsError(\n errorModel: GeneratedTextAnalyticsErrorModel | InnerError\n): TextAnalyticsError {\n // Return the deepest error. This will always be at most\n // one level for TextAnalytics\n if (errorModel.innererror !== undefined) {\n return intoTextAnalyticsError(errorModel.innererror);\n }\n\n return {\n code: errorModel.code,\n message: errorModel.message,\n target: errorModel.target\n };\n}\n\n/**\n * @internal\n */\nexport function makeTextAnalyticsSuccessResult(\n id: string,\n warnings: TextAnalyticsWarning[],\n statistics?: TextDocumentStatistics\n): TextAnalyticsSuccessResult {\n return {\n id,\n statistics,\n warnings\n };\n}\n\n/**\n * @internal\n */\nexport function makeTextAnalyticsErrorResult(\n id: string,\n error: GeneratedTextAnalyticsErrorModel\n): TextAnalyticsErrorResult {\n return {\n id,\n error: intoTextAnalyticsError(error)\n };\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n */\nexport function combineSuccessfulAndErroneousDocuments<TSuccess extends TextAnalyticsSuccessResult>(\n input: TextDocumentInput[],\n response: StandardTextAnalyticsResponse<TSuccess>\n): (TSuccess | TextAnalyticsErrorResult)[] {\n return processAndCombineSuccessfulAndErroneousDocuments(\n input,\n response,\n (x) => x,\n makeTextAnalyticsErrorResult\n );\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n * @param process - a function to convert the results from one type to another.\n */\nexport function processAndCombineSuccessfulAndErroneousDocuments<\n TSuccessService extends TextAnalyticsSuccessResult,\n TSuccessSDK extends TextAnalyticsSuccessResult,\n TError extends TextAnalyticsErrorResult\n>(\n input: TextDocumentInput[],\n response: {\n documents: TSuccessService[];\n errors: DocumentError[];\n },\n processSuccess: (successResult: TSuccessService) => TSuccessSDK,\n processError: (id: string, error: GeneratedTextAnalyticsErrorModel) => TError\n): (TSuccessSDK | TextAnalyticsErrorResult)[] {\n const successResults: (TSuccessSDK | TextAnalyticsErrorResult)[] = response.documents.map(\n processSuccess\n );\n const unsortedResults = successResults.concat(\n response.errors.map((error) => processError(error.id, error.error))\n );\n\n return sortResponseIdObjects(input, unsortedResults);\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array. It\n * also attaches statistics and modelVersion to the returned array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n */\nexport function combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion<\n TSuccessService extends TextAnalyticsSuccessResult,\n TSuccessSDK extends TextAnalyticsSuccessResult,\n TError extends TextAnalyticsErrorResult\n>(\n input: TextDocumentInput[],\n response: StandardTextAnalyticsResponse<TSuccessService>,\n processSuccess: (doc: TSuccessService) => TSuccessSDK,\n processError: (id: string, error: GeneratedTextAnalyticsErrorModel) => TError\n): StandardTextAnalyticsResultArray<TSuccessSDK> {\n const sorted = processAndCombineSuccessfulAndErroneousDocuments(\n input,\n response,\n processSuccess,\n processError\n );\n return Object.assign(sorted, {\n statistics: response.statistics,\n modelVersion: response.modelVersion\n });\n}\n\n/**\n * @internal\n * combines successful and erroneous results into a single array of results and\n * sort them so that the IDs order match that of the input documents array. It\n * also attaches statistics, projectName, and deploymentName to the returned array.\n * @param input - the array of documents sent to the service for processing.\n * @param response - the response received from the service.\n */\nexport function combineSuccessfulAndErroneousDocumentsWithStatisticsAndCustomProjectInfo<\n TSuccessService extends TextAnalyticsSuccessResult,\n TSuccessSDK extends TextAnalyticsSuccessResult,\n TError extends TextAnalyticsErrorResult\n>(\n input: TextDocumentInput[],\n response: CustomTextAnalyticsResponse<TSuccessService>,\n processSuccess: (doc: TSuccessService) => TSuccessSDK,\n processError: (id: string, error: GeneratedTextAnalyticsErrorModel) => TError\n): CustomTextAnalyticsResultArray<TSuccessSDK> {\n const sorted = processAndCombineSuccessfulAndErroneousDocuments(\n input,\n response,\n processSuccess,\n processError\n );\n return Object.assign(sorted, {\n statistics: response.statistics,\n projectName: response.projectName,\n deploymentName: response.deploymentName\n });\n}\n"]}
|
package/dist-esm/src/util.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { __rest } from "tslib";
|
|
4
4
|
import { RestError } from "@azure/core-rest-pipeline";
|
|
5
5
|
import { SpanStatusCode } from "@azure/core-tracing";
|
|
6
|
-
import { URL, URLSearchParams } from "./utils/url";
|
|
7
6
|
import { logger } from "./logger";
|
|
8
7
|
import { createSpan } from "./tracing";
|
|
9
8
|
/**
|
|
@@ -118,31 +117,6 @@ export function addParamsToTask(action) {
|
|
|
118
117
|
export function setModelVersionParam(x) {
|
|
119
118
|
return Object.assign(Object.assign({}, x), { modelVersion: x.modelVersion || "latest" });
|
|
120
119
|
}
|
|
121
|
-
/**
|
|
122
|
-
* @internal
|
|
123
|
-
*/
|
|
124
|
-
export function nextLinkToTopAndSkip(nextLink) {
|
|
125
|
-
const url = new URL(nextLink);
|
|
126
|
-
const searchParams = new URLSearchParams(url.searchParams);
|
|
127
|
-
let top;
|
|
128
|
-
if (searchParams.has("$top")) {
|
|
129
|
-
top = parseInt(searchParams.get("$top"));
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
throw new Error(`nextLink URL does not have the $top param: ${nextLink}`);
|
|
133
|
-
}
|
|
134
|
-
let skip;
|
|
135
|
-
if (searchParams.has("$skip")) {
|
|
136
|
-
skip = parseInt(searchParams.get("$skip"));
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
throw new Error(`nextLink URL does not have the $skip param: ${nextLink}`);
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
skip: skip,
|
|
143
|
-
top: top
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
120
|
/**
|
|
147
121
|
* @internal
|
|
148
122
|
*/
|
package/dist-esm/src/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAUvC;;;;;;;GAOG;AACH,MAAM,UAAU,qBA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AC;YACb,IAAI,EAAE,cAAc,CAAC,KAAK;YAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;SACnB,CAAC,CAAC;QACH,MAAM,CAAC,CAAC;KACT;YAAS;QACR,IAAI,CAAC,GAAG,EAAE,CAAC;KACZ;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { FullOperationResponse, OperationOptions, OperationSpec } from \"@azure/core-client\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { URL, URLSearchParams } from \"./utils/url\";\nimport { logger } from \"./logger\";\nimport { GeneratedClient, StringIndexType as GeneratedStringIndexType } from \"./generated\";\nimport { TextAnalyticsAction } from \"./textAnalyticsAction\";\nimport { createSpan } from \"./tracing\";\nimport { LroResponse } from \"@azure/core-lro\";\n\n/**\n * @internal\n */\nexport interface IdObject {\n id: string;\n}\n\n/**\n * Given a sorted array of input objects (with a unique ID) and an unsorted array of results,\n * return a sorted array of results.\n *\n * @internal\n * @param sortedArray - An array of entries sorted by `id`\n * @param unsortedArray - An array of entries that contain `id` but are not sorted\n */\nexport function sortResponseIdObjects<T extends IdObject, U extends IdObject>(\n sortedArray: T[],\n unsortedArray: U[]\n): U[] {\n const unsortedMap = new Map<string, U>();\n for (const item of unsortedArray) {\n unsortedMap.set(item.id, item);\n }\n\n if (unsortedArray.length !== sortedArray.length) {\n const ordinal = unsortedArray.length > sortedArray.length ? \"more\" : \"fewer\";\n logger.warning(\n `The service returned ${ordinal} responses than inputs. Some errors may be treated as fatal.`\n );\n }\n\n const result: U[] = [];\n for (const sortedItem of sortedArray) {\n const item = unsortedMap.get(sortedItem.id);\n if (item) {\n result.push(item);\n }\n }\n return result;\n}\n\n/**\n * @internal\n */\nexport interface AssessmentIndex {\n document: number;\n sentence: number;\n assessment: number;\n}\n\n/**\n * @internal\n */\nexport function parseAssessmentIndex(pointer: string): AssessmentIndex {\n const regex = new RegExp(/#\\/documents\\/(\\d+)\\/sentences\\/(\\d+)\\/assessments\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n const assessmentIndex: AssessmentIndex = {\n document: parseInt(res[1]),\n sentence: parseInt(res[2]),\n assessment: parseInt(res[3])\n };\n return assessmentIndex;\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid Assessment pointer`);\n }\n}\n\n/**\n * Parses the index of the healthcare entity from a JSON pointer.\n * @param pointer - a JSON pointer representing an entity\n * @internal\n */\nexport function parseHealthcareEntityIndex(pointer: string): number {\n const regex = new RegExp(/#\\/results\\/documents\\/(\\d+)\\/entities\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n return parseInt(res[2]);\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid healthcare entity pointer`);\n }\n}\n\nconst jsEncodingUnit = \"Utf16CodeUnit\";\n\n/**\n * Measurement units that can used to calculate the offset and length properties.\n */\nexport type StringIndexType = \"TextElement_v8\" | \"UnicodeCodePoint\" | \"Utf16CodeUnit\";\n\n/**\n * @internal\n */\nexport function addStrEncodingParam<Options extends { stringIndexType?: StringIndexType }>(\n options: Options\n): Options & { stringIndexType: StringIndexType } {\n return { ...options, stringIndexType: options.stringIndexType || jsEncodingUnit };\n}\n\n/**\n * Set the stringIndexType property with default if it does not exist in x.\n * @param options - operation options bag that has a {@link StringIndexType}\n * @internal\n */\nexport function setStrEncodingParam<X extends { stringIndexType?: GeneratedStringIndexType }>(\n x: X\n): X & { stringIndexType: GeneratedStringIndexType } {\n return { ...x, stringIndexType: x.stringIndexType || jsEncodingUnit };\n}\n\nexport function setStrEncodingParamValue(\n stringIndexType?: GeneratedStringIndexType\n): GeneratedStringIndexType {\n return stringIndexType || jsEncodingUnit;\n}\n\n/**\n * Set the opinion mining property\n * @internal\n */\nexport function setOpinionMining<X extends { includeOpinionMining?: boolean }>(\n x: X\n): X & { opinionMining?: boolean } {\n return { ...x, opinionMining: x.includeOpinionMining };\n}\n\n/**\n * Set the pii categories property\n * @internal\n */\nexport function setCategoriesFilter<X extends { categoriesFilter?: string[] }>(\n x: X\n): X & { piiCategories?: string[] } {\n return { ...x, piiCategories: x.categoriesFilter };\n}\n\nexport function setSentenceCount<X extends { maxSentenceCount?: number }>(\n x: X\n): X & { sentenceCount?: number } {\n return { ...x, sentenceCount: x.maxSentenceCount };\n}\n\nexport function setOrderBy<X extends { orderBy?: string }>(x: X): X & { sortBy?: string } {\n return { ...x, sortBy: x.orderBy };\n}\n\n/**\n * @internal\n */\nexport function addParamsToTask<X extends TextAnalyticsAction>(\n action: X\n): { parameters?: Omit<X, \"actionName\">; taskName?: string } {\n const { actionName, ...params } = action;\n return { parameters: params, taskName: actionName };\n}\n\n/**\n * Set the modelVersion property with default if it does not exist in x.\n * @param options - operation options bag that has a {@link StringIndexType}\n * @internal\n */\nexport function setModelVersionParam<X extends { modelVersion?: string }>(\n x: X\n): X & { modelVersion: string } {\n return { ...x, modelVersion: x.modelVersion || \"latest\" };\n}\n\n/**\n * @internal\n */\nexport interface PageParam {\n top: number;\n skip: number;\n}\n\n/**\n * @internal\n */\nexport function nextLinkToTopAndSkip(nextLink: string): PageParam {\n const url = new URL(nextLink);\n const searchParams = new URLSearchParams(url.searchParams);\n let top: number;\n if (searchParams.has(\"$top\")) {\n top = parseInt(searchParams.get(\"$top\")!);\n } else {\n throw new Error(`nextLink URL does not have the $top param: ${nextLink}`);\n }\n let skip: number;\n if (searchParams.has(\"$skip\")) {\n skip = parseInt(searchParams.get(\"$skip\")!);\n } else {\n throw new Error(`nextLink URL does not have the $skip param: ${nextLink}`);\n }\n return {\n skip: skip,\n top: top\n };\n}\n\n/**\n * @internal\n */\nexport function getOperationId(operationLocation: string): string {\n const lastSlashIndex = operationLocation.lastIndexOf(\"/\");\n return operationLocation.substring(lastSlashIndex + 1);\n}\n\n/**\n * @internal\n * parses incoming errors from the service and if the inner error code is\n * InvalidDocumentBatch, it exposes that as the statusCode instead.\n * @param error - the incoming error\n */\nexport function handleInvalidDocumentBatch(error: unknown): any {\n const castError = error as {\n response: {\n parsedBody?: {\n error?: {\n innererror?: {\n code: string;\n message: string;\n };\n };\n };\n };\n statusCode: number;\n };\n const innerCode = castError.response?.parsedBody?.error?.innererror?.code;\n const innerMessage = castError.response?.parsedBody?.error?.innererror?.message;\n if (innerMessage) {\n return innerCode === \"InvalidDocumentBatch\"\n ? new RestError(innerMessage, { code: innerCode, statusCode: castError.statusCode })\n : error;\n } else {\n // unfortunately, the service currently does not follow the swagger definition\n // for errors in some cases.\n // Issue: https://msazure.visualstudio.com/Cognitive%20Services/_workitems/edit/8775003/?workitem=8972164\n // throw new Error(\n // `The error coming from the service does not follow the expected structure: ${error}`\n // );\n logger.warning(\n `The error coming from the service does not follow the expected structure: ${error}`\n );\n return error;\n }\n}\n\n/**\n * A wrapper for setTimeout that resolves a promise after t milliseconds.\n * @internal\n * @param timeInMs - The number of milliseconds to be delayed.\n * @returns Resolved promise\n */\nexport function delay(timeInMs: number): Promise<void> {\n return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));\n}\n\n/**\n * @internal\n */\nexport function compose<T1, T2, T3>(fn1: (x: T1) => T2, fn2: (y: T2) => T3): (x: T1) => T3 {\n return (value: T1) => fn2(fn1(value));\n}\n\n/**\n * @internal\n */\nexport async function getRawResponse<TOptions extends OperationOptions, TResult>(\n f: (options: TOptions) => Promise<TResult>,\n options: TOptions\n): Promise<LroResponse<TResult>> {\n const { onResponse } = options || {};\n let rawResponse: FullOperationResponse | undefined = undefined;\n const flatResponse = await f({\n ...options,\n onResponse: (response: FullOperationResponse, flatResponseParam: unknown) => {\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\n/**\n * @internal\n */\nexport async function sendGetRequest<TOptions extends OperationOptions>(\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n client: GeneratedClient,\n spec: OperationSpec,\n spanStr: string,\n options: TOptions,\n path: string\n): Promise<LroResponse<unknown>> {\n const { span, updatedOptions: finalOptions } = createSpan(\n `TextAnalyticsClient-${spanStr}`,\n options\n );\n try {\n const { flatResponse, rawResponse } = await getRawResponse(\n (paramOptions) =>\n client.sendOperationRequest(\n { options: paramOptions },\n {\n ...spec,\n path,\n httpMethod: \"GET\"\n }\n ),\n finalOptions\n );\n return {\n flatResponse: flatResponse,\n rawResponse\n };\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAUvC;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAgB,EAChB,aAAkB;IAElB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAa,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE;QAChC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;KAChC;IAED,IAAI,aAAa,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,EAAE;QAC/C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QAC7E,MAAM,CAAC,OAAO,CACZ,wBAAwB,OAAO,8DAA8D,CAC9F,CAAC;KACH;IAED,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,KAAK,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AE,cAAc,CAAC,KAAK;YAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;SACnB,CAAC,CAAC;QACH,MAAM,CAAC,CAAC;KACT;YAAS;QACR,IAAI,CAAC,GAAG,EAAE,CAAC;KACZ;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RestError } from \"@azure/core-rest-pipeline\";\nimport { FullOperationResponse, OperationOptions, OperationSpec } from \"@azure/core-client\";\nimport { SpanStatusCode } from \"@azure/core-tracing\";\nimport { logger } from \"./logger\";\nimport { GeneratedClient, StringIndexType as GeneratedStringIndexType } from \"./generated\";\nimport { TextAnalyticsAction } from \"./textAnalyticsAction\";\nimport { createSpan } from \"./tracing\";\nimport { LroResponse } from \"@azure/core-lro\";\n\n/**\n * @internal\n */\nexport interface IdObject {\n id: string;\n}\n\n/**\n * Given a sorted array of input objects (with a unique ID) and an unsorted array of results,\n * return a sorted array of results.\n *\n * @internal\n * @param sortedArray - An array of entries sorted by `id`\n * @param unsortedArray - An array of entries that contain `id` but are not sorted\n */\nexport function sortResponseIdObjects<T extends IdObject, U extends IdObject>(\n sortedArray: T[],\n unsortedArray: U[]\n): U[] {\n const unsortedMap = new Map<string, U>();\n for (const item of unsortedArray) {\n unsortedMap.set(item.id, item);\n }\n\n if (unsortedArray.length !== sortedArray.length) {\n const ordinal = unsortedArray.length > sortedArray.length ? \"more\" : \"fewer\";\n logger.warning(\n `The service returned ${ordinal} responses than inputs. Some errors may be treated as fatal.`\n );\n }\n\n const result: U[] = [];\n for (const sortedItem of sortedArray) {\n const item = unsortedMap.get(sortedItem.id);\n if (item) {\n result.push(item);\n }\n }\n return result;\n}\n\n/**\n * @internal\n */\nexport interface AssessmentIndex {\n document: number;\n sentence: number;\n assessment: number;\n}\n\n/**\n * @internal\n */\nexport function parseAssessmentIndex(pointer: string): AssessmentIndex {\n const regex = new RegExp(/#\\/documents\\/(\\d+)\\/sentences\\/(\\d+)\\/assessments\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n const assessmentIndex: AssessmentIndex = {\n document: parseInt(res[1]),\n sentence: parseInt(res[2]),\n assessment: parseInt(res[3])\n };\n return assessmentIndex;\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid Assessment pointer`);\n }\n}\n\n/**\n * Parses the index of the healthcare entity from a JSON pointer.\n * @param pointer - a JSON pointer representing an entity\n * @internal\n */\nexport function parseHealthcareEntityIndex(pointer: string): number {\n const regex = new RegExp(/#\\/results\\/documents\\/(\\d+)\\/entities\\/(\\d+)/);\n const res = regex.exec(pointer);\n if (res !== null) {\n return parseInt(res[2]);\n } else {\n throw new Error(`Pointer \"${pointer}\" is not a valid healthcare entity pointer`);\n }\n}\n\nconst jsEncodingUnit = \"Utf16CodeUnit\";\n\n/**\n * Measurement units that can used to calculate the offset and length properties.\n */\nexport type StringIndexType = \"TextElement_v8\" | \"UnicodeCodePoint\" | \"Utf16CodeUnit\";\n\n/**\n * @internal\n */\nexport function addStrEncodingParam<Options extends { stringIndexType?: StringIndexType }>(\n options: Options\n): Options & { stringIndexType: StringIndexType } {\n return { ...options, stringIndexType: options.stringIndexType || jsEncodingUnit };\n}\n\n/**\n * Set the stringIndexType property with default if it does not exist in x.\n * @param options - operation options bag that has a {@link StringIndexType}\n * @internal\n */\nexport function setStrEncodingParam<X extends { stringIndexType?: GeneratedStringIndexType }>(\n x: X\n): X & { stringIndexType: GeneratedStringIndexType } {\n return { ...x, stringIndexType: x.stringIndexType || jsEncodingUnit };\n}\n\nexport function setStrEncodingParamValue(\n stringIndexType?: GeneratedStringIndexType\n): GeneratedStringIndexType {\n return stringIndexType || jsEncodingUnit;\n}\n\n/**\n * Set the opinion mining property\n * @internal\n */\nexport function setOpinionMining<X extends { includeOpinionMining?: boolean }>(\n x: X\n): X & { opinionMining?: boolean } {\n return { ...x, opinionMining: x.includeOpinionMining };\n}\n\n/**\n * Set the pii categories property\n * @internal\n */\nexport function setCategoriesFilter<X extends { categoriesFilter?: string[] }>(\n x: X\n): X & { piiCategories?: string[] } {\n return { ...x, piiCategories: x.categoriesFilter };\n}\n\nexport function setSentenceCount<X extends { maxSentenceCount?: number }>(\n x: X\n): X & { sentenceCount?: number } {\n return { ...x, sentenceCount: x.maxSentenceCount };\n}\n\nexport function setOrderBy<X extends { orderBy?: string }>(x: X): X & { sortBy?: string } {\n return { ...x, sortBy: x.orderBy };\n}\n\n/**\n * @internal\n */\nexport function addParamsToTask<X extends TextAnalyticsAction>(\n action: X\n): { parameters?: Omit<X, \"actionName\">; taskName?: string } {\n const { actionName, ...params } = action;\n return { parameters: params, taskName: actionName };\n}\n\n/**\n * Set the modelVersion property with default if it does not exist in x.\n * @param options - operation options bag that has a {@link StringIndexType}\n * @internal\n */\nexport function setModelVersionParam<X extends { modelVersion?: string }>(\n x: X\n): X & { modelVersion: string } {\n return { ...x, modelVersion: x.modelVersion || \"latest\" };\n}\n\n/**\n * @internal\n */\nexport interface PageParam {\n top: number;\n skip: number;\n}\n\n/**\n * @internal\n */\nexport function getOperationId(operationLocation: string): string {\n const lastSlashIndex = operationLocation.lastIndexOf(\"/\");\n return operationLocation.substring(lastSlashIndex + 1);\n}\n\n/**\n * @internal\n * parses incoming errors from the service and if the inner error code is\n * InvalidDocumentBatch, it exposes that as the statusCode instead.\n * @param error - the incoming error\n */\nexport function handleInvalidDocumentBatch(error: unknown): any {\n const castError = error as {\n response: {\n parsedBody?: {\n error?: {\n innererror?: {\n code: string;\n message: string;\n };\n };\n };\n };\n statusCode: number;\n };\n const innerCode = castError.response?.parsedBody?.error?.innererror?.code;\n const innerMessage = castError.response?.parsedBody?.error?.innererror?.message;\n if (innerMessage) {\n return innerCode === \"InvalidDocumentBatch\"\n ? new RestError(innerMessage, { code: innerCode, statusCode: castError.statusCode })\n : error;\n } else {\n // unfortunately, the service currently does not follow the swagger definition\n // for errors in some cases.\n // Issue: https://msazure.visualstudio.com/Cognitive%20Services/_workitems/edit/8775003/?workitem=8972164\n // throw new Error(\n // `The error coming from the service does not follow the expected structure: ${error}`\n // );\n logger.warning(\n `The error coming from the service does not follow the expected structure: ${error}`\n );\n return error;\n }\n}\n\n/**\n * A wrapper for setTimeout that resolves a promise after t milliseconds.\n * @internal\n * @param timeInMs - The number of milliseconds to be delayed.\n * @returns Resolved promise\n */\nexport function delay(timeInMs: number): Promise<void> {\n return new Promise((resolve) => setTimeout(() => resolve(), timeInMs));\n}\n\n/**\n * @internal\n */\nexport function compose<T1, T2, T3>(fn1: (x: T1) => T2, fn2: (y: T2) => T3): (x: T1) => T3 {\n return (value: T1) => fn2(fn1(value));\n}\n\n/**\n * @internal\n */\nexport async function getRawResponse<TOptions extends OperationOptions, TResult>(\n f: (options: TOptions) => Promise<TResult>,\n options: TOptions\n): Promise<LroResponse<TResult>> {\n const { onResponse } = options || {};\n let rawResponse: FullOperationResponse | undefined = undefined;\n const flatResponse = await f({\n ...options,\n onResponse: (response: FullOperationResponse, flatResponseParam: unknown) => {\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\n/**\n * @internal\n */\nexport async function sendGetRequest<TOptions extends OperationOptions>(\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n client: GeneratedClient,\n spec: OperationSpec,\n spanStr: string,\n options: TOptions,\n path: string\n): Promise<LroResponse<unknown>> {\n const { span, updatedOptions: finalOptions } = createSpan(\n `TextAnalyticsClient-${spanStr}`,\n options\n );\n try {\n const { flatResponse, rawResponse } = await getRawResponse(\n (paramOptions) =>\n client.sendOperationRequest(\n { options: paramOptions },\n {\n ...spec,\n path,\n httpMethod: \"GET\"\n }\n ),\n finalOptions\n );\n return {\n flatResponse: flatResponse,\n rawResponse\n };\n } catch (e) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: e.message\n });\n throw e;\n } finally {\n span.end();\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 Azure Text Analytics service.",
|
|
6
|
-
"version": "5.2.0-alpha.
|
|
6
|
+
"version": "5.2.0-alpha.20211027.1",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
9
9
|
"azure",
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"browser": {
|
|
58
|
-
"./dist-esm/src/utils/url.js": "./dist-esm/src/utils/url.browser.js",
|
|
59
58
|
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
|
|
60
59
|
},
|
|
61
60
|
"scripts": {
|
|
@@ -101,10 +100,10 @@
|
|
|
101
100
|
"devDependencies": {
|
|
102
101
|
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
|
103
102
|
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
|
104
|
-
"@azure/identity": "
|
|
103
|
+
"@azure/identity": "2.0.0-beta.6",
|
|
105
104
|
"@azure/test-utils": ">=1.0.0-alpha <1.0.0-alphb",
|
|
106
105
|
"@azure-tools/test-recorder": "^1.0.0",
|
|
107
|
-
"@microsoft/api-extractor": "^7.18.
|
|
106
|
+
"@microsoft/api-extractor": "^7.18.11",
|
|
108
107
|
"@types/chai": "^4.1.6",
|
|
109
108
|
"@types/chai-as-promised": "^7.1.0",
|
|
110
109
|
"@types/mocha": "^7.0.2",
|
|
@@ -74,6 +74,18 @@ export declare interface AnalyzeActionsResult {
|
|
|
74
74
|
* Array of the results for each extract summary action.
|
|
75
75
|
*/
|
|
76
76
|
extractSummaryResults: ExtractSummaryActionResult[];
|
|
77
|
+
/**
|
|
78
|
+
* Array of the results for each recognize custom entities action.
|
|
79
|
+
*/
|
|
80
|
+
recognizeCustomEntitiesResults: RecognizeCustomEntitiesActionResult[];
|
|
81
|
+
/**
|
|
82
|
+
* Array of the results for each custom classify document single category action.
|
|
83
|
+
*/
|
|
84
|
+
singleCategoryClassifyResults: SingleCategoryClassifyActionResult[];
|
|
85
|
+
/**
|
|
86
|
+
* Array of the results for each custom classify document multi category action.
|
|
87
|
+
*/
|
|
88
|
+
multiCategoryClassifyResults: MultiCategoryClassifyActionResult[];
|
|
77
89
|
}
|
|
78
90
|
|
|
79
91
|
/**
|
|
@@ -290,6 +302,39 @@ export declare interface BeginAnalyzeHealthcareEntitiesOptions extends TextAnaly
|
|
|
290
302
|
export declare interface CategorizedEntity extends Entity {
|
|
291
303
|
}
|
|
292
304
|
|
|
305
|
+
/**
|
|
306
|
+
* A classification result from a custom classify document single category action
|
|
307
|
+
*/
|
|
308
|
+
export declare interface ClassificationCategory extends ClassificationResult {
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export declare interface ClassificationResult {
|
|
312
|
+
/** Classification type. */
|
|
313
|
+
category: string;
|
|
314
|
+
/** Confidence score between 0 and 1 of the recognized classification. */
|
|
315
|
+
confidenceScore: number;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* The type of a custom text analytics action.
|
|
320
|
+
*/
|
|
321
|
+
export declare interface CustomTextAnalyticsAction {
|
|
322
|
+
/**
|
|
323
|
+
* The project name for the text analytics model used by this operation on this
|
|
324
|
+
* batch of input documents.
|
|
325
|
+
*/
|
|
326
|
+
projectName: string;
|
|
327
|
+
/**
|
|
328
|
+
* The deployment name for the text analytics model used by this operation on this
|
|
329
|
+
* batch of input documents.
|
|
330
|
+
*/
|
|
331
|
+
deploymentName: string;
|
|
332
|
+
/**
|
|
333
|
+
* The preferred name for this action.
|
|
334
|
+
*/
|
|
335
|
+
actionName?: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
293
338
|
/** Information about the language of a document as identified by the Text Analytics service. */
|
|
294
339
|
export declare interface DetectedLanguage {
|
|
295
340
|
/** Long name of a detected language (e.g. English, French). */
|
|
@@ -525,7 +570,7 @@ export declare interface ExtractSummaryAction extends TextAnalyticsAction {
|
|
|
525
570
|
*/
|
|
526
571
|
maxSentenceCount?: number;
|
|
527
572
|
/**
|
|
528
|
-
* Specifies how to sort the returned sentences. Please refer to {@link
|
|
573
|
+
* Specifies how to sort the returned sentences. Please refer to {@link KnownSummarySentencesOrderBy} for possible values.
|
|
529
574
|
*/
|
|
530
575
|
orderBy?: string;
|
|
531
576
|
}
|
|
@@ -838,6 +883,82 @@ export declare interface Match {
|
|
|
838
883
|
length: number;
|
|
839
884
|
}
|
|
840
885
|
|
|
886
|
+
/**
|
|
887
|
+
* Options for a custom classify document multi categories action.
|
|
888
|
+
*/
|
|
889
|
+
export declare interface MultiCategoryClassifyAction extends CustomTextAnalyticsAction {
|
|
890
|
+
/**
|
|
891
|
+
* If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics
|
|
892
|
+
* logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,
|
|
893
|
+
* disables input logging and may limit our ability to remediate issues that occur.
|
|
894
|
+
*/
|
|
895
|
+
disableServiceLogs?: boolean;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* The error of a custom classify document multi category action.
|
|
900
|
+
*/
|
|
901
|
+
export declare type MultiCategoryClassifyActionErrorResult = TextAnalyticsActionErrorResult;
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* The result of a custom classify document multi category action.
|
|
905
|
+
*/
|
|
906
|
+
export declare type MultiCategoryClassifyActionResult = MultiCategoryClassifyActionSuccessResult | MultiCategoryClassifyActionErrorResult;
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* The results of a succeeded custom classify document multi category action.
|
|
910
|
+
*/
|
|
911
|
+
export declare interface MultiCategoryClassifyActionSuccessResult extends TextAnalyticsActionSuccessState {
|
|
912
|
+
/**
|
|
913
|
+
* Array of the results for each custom classify document multi category action.
|
|
914
|
+
*/
|
|
915
|
+
results: MultiCategoryClassifyResultArray;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* An error result from the custom classify document multi category operation on a multi document.
|
|
920
|
+
*/
|
|
921
|
+
export declare type MultiCategoryClassifyErrorResult = TextAnalyticsErrorResult;
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* The result of the custom classify document multi categories operation on a multi document.
|
|
925
|
+
*/
|
|
926
|
+
export declare type MultiCategoryClassifyResult = MultiCategoryClassifySuccessResult | MultiCategoryClassifyErrorResult;
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* Array of `MultiCategoryClassifyResult` objects corresponding to a batch of input documents, and
|
|
930
|
+
* annotated with information about the batch operation.
|
|
931
|
+
*/
|
|
932
|
+
export declare interface MultiCategoryClassifyResultArray extends Array<MultiCategoryClassifyResult> {
|
|
933
|
+
/**
|
|
934
|
+
* Statistics about the input document batch and how it was processed
|
|
935
|
+
* by the service. This property will have a value when includeStatistics is set to true
|
|
936
|
+
* in the client call.
|
|
937
|
+
*/
|
|
938
|
+
statistics?: TextDocumentBatchStatistics;
|
|
939
|
+
/**
|
|
940
|
+
* The version of the text analytics custom project used by this operation on this
|
|
941
|
+
* batch of input documents.
|
|
942
|
+
*/
|
|
943
|
+
projectName: string;
|
|
944
|
+
/**
|
|
945
|
+
* The version of the text analytics custom deployment used by this operation on this
|
|
946
|
+
* batch of input documents.
|
|
947
|
+
*/
|
|
948
|
+
deploymentName: string;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* The result of the custom classify document multi categories operation on a multi document,
|
|
953
|
+
* containing the result of the classification.
|
|
954
|
+
*/
|
|
955
|
+
export declare interface MultiCategoryClassifySuccessResult extends TextAnalyticsSuccessResult {
|
|
956
|
+
/**
|
|
957
|
+
* The collection of classifications in the input document.
|
|
958
|
+
*/
|
|
959
|
+
classifications: ClassificationCategory[];
|
|
960
|
+
}
|
|
961
|
+
|
|
841
962
|
/**
|
|
842
963
|
* Metadata information for an analysis poller operation.
|
|
843
964
|
*/
|
|
@@ -1206,6 +1327,73 @@ export declare interface RecognizeCategorizedEntitiesSuccessResult extends TextA
|
|
|
1206
1327
|
readonly entities: CategorizedEntity[];
|
|
1207
1328
|
}
|
|
1208
1329
|
|
|
1330
|
+
/**
|
|
1331
|
+
* Options for a custom recognize entities action.
|
|
1332
|
+
*/
|
|
1333
|
+
export declare interface RecognizeCustomEntitiesAction extends CustomTextAnalyticsAction {
|
|
1334
|
+
/**
|
|
1335
|
+
* Specifies the measurement unit used to calculate the offset and length properties.
|
|
1336
|
+
* Possible units are "TextElements_v8", "UnicodeCodePoint", and "Utf16CodeUnit".
|
|
1337
|
+
* The default is the JavaScript's default which is "Utf16CodeUnit".
|
|
1338
|
+
*/
|
|
1339
|
+
stringIndexType?: StringIndexType;
|
|
1340
|
+
/**
|
|
1341
|
+
* If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics
|
|
1342
|
+
* logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,
|
|
1343
|
+
* disables input logging and may limit our ability to remediate issues that occur.
|
|
1344
|
+
*/
|
|
1345
|
+
disableServiceLogs?: boolean;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* The result of a custom recognize entities action.
|
|
1350
|
+
*/
|
|
1351
|
+
export declare type RecognizeCustomEntitiesActionResult = RecongizeCustomEntitiesActionSuccessResult | RecongizeCustomEntitiesActionErrorResult;
|
|
1352
|
+
|
|
1353
|
+
/**
|
|
1354
|
+
* An error result from the recognize custom entities operation on a single document.
|
|
1355
|
+
*/
|
|
1356
|
+
export declare type RecognizeCustomEntitiesErrorResult = TextAnalyticsErrorResult;
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* The result of the custom recognize entities operation on a single document.
|
|
1360
|
+
*/
|
|
1361
|
+
export declare type RecognizeCustomEntitiesResult = RecognizeCustomEntitiesSuccessResult | RecognizeCustomEntitiesErrorResult;
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* Array of `CustomRecognizeEntitiesResult` objects corresponding to a batch of input documents, and
|
|
1365
|
+
* annotated with information about the batch operation.
|
|
1366
|
+
*/
|
|
1367
|
+
export declare interface RecognizeCustomEntitiesResultArray extends Array<RecognizeCustomEntitiesResult> {
|
|
1368
|
+
/**
|
|
1369
|
+
* Statistics about the input document batch and how it was processed
|
|
1370
|
+
* by the service. This property will have a value when includeStatistics is set to true
|
|
1371
|
+
* in the client call.
|
|
1372
|
+
*/
|
|
1373
|
+
statistics?: TextDocumentBatchStatistics;
|
|
1374
|
+
/**
|
|
1375
|
+
* The version of the text analytics custom project used by this operation on this
|
|
1376
|
+
* batch of input documents.
|
|
1377
|
+
*/
|
|
1378
|
+
projectName: string;
|
|
1379
|
+
/**
|
|
1380
|
+
* The version of the text analytics custom deployment used by this operation on this
|
|
1381
|
+
* batch of input documents.
|
|
1382
|
+
*/
|
|
1383
|
+
deploymentName: string;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* The result of the recognize custom entities operation on a single document,
|
|
1388
|
+
* containing a collection of the entities identified in that document.
|
|
1389
|
+
*/
|
|
1390
|
+
export declare interface RecognizeCustomEntitiesSuccessResult extends TextAnalyticsSuccessResult {
|
|
1391
|
+
/**
|
|
1392
|
+
* The collection of entities identified in the input document.
|
|
1393
|
+
*/
|
|
1394
|
+
entities: CategorizedEntity[];
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1209
1397
|
/**
|
|
1210
1398
|
* Options for an entities linking action.
|
|
1211
1399
|
*/
|
|
@@ -1408,6 +1596,21 @@ export declare interface RecognizePiiEntitiesSuccessResult extends TextAnalytics
|
|
|
1408
1596
|
redactedText: string;
|
|
1409
1597
|
}
|
|
1410
1598
|
|
|
1599
|
+
/**
|
|
1600
|
+
* The error of a custom recognize entities action.
|
|
1601
|
+
*/
|
|
1602
|
+
export declare type RecongizeCustomEntitiesActionErrorResult = TextAnalyticsActionErrorResult;
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* The results of a succeeded custom recognize entities action.
|
|
1606
|
+
*/
|
|
1607
|
+
export declare interface RecongizeCustomEntitiesActionSuccessResult extends TextAnalyticsActionSuccessState {
|
|
1608
|
+
/**
|
|
1609
|
+
* Array of the results for each custom recognize entities action.
|
|
1610
|
+
*/
|
|
1611
|
+
results: RecognizeCustomEntitiesResultArray;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1411
1614
|
export declare interface SentenceAssessment {
|
|
1412
1615
|
/** Assessment sentiment in the sentence. */
|
|
1413
1616
|
sentiment: TokenSentimentValue;
|
|
@@ -1466,6 +1669,82 @@ export declare interface SentimentConfidenceScores {
|
|
|
1466
1669
|
negative: number;
|
|
1467
1670
|
}
|
|
1468
1671
|
|
|
1672
|
+
/**
|
|
1673
|
+
* Options for an custom classify document single category action.
|
|
1674
|
+
*/
|
|
1675
|
+
export declare interface SingleCategoryClassifyAction extends CustomTextAnalyticsAction {
|
|
1676
|
+
/**
|
|
1677
|
+
* If set to true, you opt-out of having your text input logged for troubleshooting. By default, Text Analytics
|
|
1678
|
+
* logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting this parameter to true,
|
|
1679
|
+
* disables input logging and may limit our ability to remediate issues that occur.
|
|
1680
|
+
*/
|
|
1681
|
+
disableServiceLogs?: boolean;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* The error of a custom classify document single category action.
|
|
1686
|
+
*/
|
|
1687
|
+
export declare type SingleCategoryClassifyActionErrorResult = TextAnalyticsActionErrorResult;
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* The result of a custom classify document single category action.
|
|
1691
|
+
*/
|
|
1692
|
+
export declare type SingleCategoryClassifyActionResult = SingleCategoryClassifyActionSuccessResult | SingleCategoryClassifyActionErrorResult;
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* The results of a succeeded custom classify document single category action.
|
|
1696
|
+
*/
|
|
1697
|
+
export declare interface SingleCategoryClassifyActionSuccessResult extends TextAnalyticsActionSuccessState {
|
|
1698
|
+
/**
|
|
1699
|
+
* Array of the results for each custom classify document single category action.
|
|
1700
|
+
*/
|
|
1701
|
+
results: SingleCategoryClassifyResultArray;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* An error result from the custom classify document single category operation on a single document.
|
|
1706
|
+
*/
|
|
1707
|
+
export declare type SingleCategoryClassifyErrorResult = TextAnalyticsErrorResult;
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
* The result of the custom classify document single category operation on a single document.
|
|
1711
|
+
*/
|
|
1712
|
+
export declare type SingleCategoryClassifyResult = SingleCategoryClassifySuccessResult | SingleCategoryClassifyErrorResult;
|
|
1713
|
+
|
|
1714
|
+
/**
|
|
1715
|
+
* Array of `SingleCategoryClassifyResult` objects corresponding to a batch of input documents, and
|
|
1716
|
+
* annotated with information about the batch operation.
|
|
1717
|
+
*/
|
|
1718
|
+
export declare interface SingleCategoryClassifyResultArray extends Array<SingleCategoryClassifyResult> {
|
|
1719
|
+
/**
|
|
1720
|
+
* Statistics about the input document batch and how it was processed
|
|
1721
|
+
* by the service. This property will have a value when includeStatistics is set to true
|
|
1722
|
+
* in the client call.
|
|
1723
|
+
*/
|
|
1724
|
+
statistics?: TextDocumentBatchStatistics;
|
|
1725
|
+
/**
|
|
1726
|
+
* The version of the text analytics custom project used by this operation on this
|
|
1727
|
+
* batch of input documents.
|
|
1728
|
+
*/
|
|
1729
|
+
projectName: string;
|
|
1730
|
+
/**
|
|
1731
|
+
* The version of the text analytics custom deployment used by this operation on this
|
|
1732
|
+
* batch of input documents.
|
|
1733
|
+
*/
|
|
1734
|
+
deploymentName: string;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
/**
|
|
1738
|
+
* The result of the custom classify document single category operation on a single document,
|
|
1739
|
+
* containing the result of the classification.
|
|
1740
|
+
*/
|
|
1741
|
+
export declare interface SingleCategoryClassifySuccessResult extends TextAnalyticsSuccessResult {
|
|
1742
|
+
/**
|
|
1743
|
+
* The classification result of the input document.
|
|
1744
|
+
*/
|
|
1745
|
+
classification: ClassificationCategory;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1469
1748
|
/**
|
|
1470
1749
|
* Measurement units that can used to calculate the offset and length properties.
|
|
1471
1750
|
*/
|
|
@@ -1523,7 +1802,7 @@ export declare interface TargetSentiment {
|
|
|
1523
1802
|
}
|
|
1524
1803
|
|
|
1525
1804
|
/**
|
|
1526
|
-
* The type of a text analytics action.
|
|
1805
|
+
* The type of a standard text analytics action.
|
|
1527
1806
|
*/
|
|
1528
1807
|
export declare interface TextAnalyticsAction {
|
|
1529
1808
|
/**
|
|
@@ -1579,6 +1858,18 @@ export declare interface TextAnalyticsActions {
|
|
|
1579
1858
|
* A collection of descriptions of summarization extraction actions. However, currently, the service can accept up to one action only for `extractSummary`.
|
|
1580
1859
|
*/
|
|
1581
1860
|
extractSummaryActions?: ExtractSummaryAction[];
|
|
1861
|
+
/**
|
|
1862
|
+
* A collection of descriptions of custom entity recognition actions. However, currently, the service can accept up to one action only for `customRecognizeEntities`.
|
|
1863
|
+
*/
|
|
1864
|
+
recognizeCustomEntitiesActions?: RecognizeCustomEntitiesAction[];
|
|
1865
|
+
/**
|
|
1866
|
+
* A collection of descriptions of custom single classification actions. However, currently, the service can accept up to one action only for `singleCategoryClassifyActions`.
|
|
1867
|
+
*/
|
|
1868
|
+
singleCategoryClassifyActions?: SingleCategoryClassifyAction[];
|
|
1869
|
+
/**
|
|
1870
|
+
* A collection of descriptions of custom multi classification actions. However, currently, the service can accept up to one action only for `multiCategoryClassifyActions`.
|
|
1871
|
+
*/
|
|
1872
|
+
multiCategoryClassifyActions?: MultiCategoryClassifyAction[];
|
|
1582
1873
|
}
|
|
1583
1874
|
|
|
1584
1875
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"url.browser.js","sourceRoot":"","sources":["../../../src/utils/url.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,GAAG,GAAG,GAAG,CAAC;AAChB,MAAM,eAAe,GAAG,eAAe,CAAC;AAExC,OAAO,EAAE,GAAG,IAAI,GAAG,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nconst url = URL;\nconst urlSearchParams = URLSearchParams;\n\nexport { url as URL, urlSearchParams as URLSearchParams };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/utils/url.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport { URL, URLSearchParams } from \"url\";\n"]}
|