@azure/ai-text-analytics 5.2.0-beta.1 → 5.2.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +3 -1
- package/dist/index.js +919 -234
- package/dist/index.js.map +1 -1
- package/dist-esm/src/analyzeActionsResult.js +48 -10
- package/dist-esm/src/analyzeActionsResult.js.map +1 -1
- package/dist-esm/src/analyzeLro.js +18 -16
- package/dist-esm/src/analyzeLro.js.map +1 -1
- package/dist-esm/src/generated/generatedClientContext.js +2 -2
- 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 +620 -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/healthLro.js +23 -15
- package/dist-esm/src/healthLro.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 +7 -19
- 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 +28 -44
- package/dist-esm/src/util.js.map +1 -1
- package/package.json +7 -9
- package/types/ai-text-analytics.d.ts +348 -40
- package/dist-esm/src/paging.js +0 -83
- package/dist-esm/src/paging.js.map +0 -1
- 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
package/dist-esm/src/paging.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*
|
|
7
|
-
* returns an async iterator that will retrieve items from the server. It also has a `byPage`
|
|
8
|
-
* method that can return pages of items at once.
|
|
9
|
-
*
|
|
10
|
-
* @param pagedResult - an object that describes how to communicate with the service and how to build a page of items.
|
|
11
|
-
* @param path - the path to the resource to retrieve
|
|
12
|
-
* @param options - the options to pass to the service
|
|
13
|
-
* @returns a paged async iterator that will retrieve items from the server.
|
|
14
|
-
*/
|
|
15
|
-
export function getPagedAsyncIterator(pagedResult, path, options) {
|
|
16
|
-
const iter = getItemAsyncIterator(pagedResult, path, options);
|
|
17
|
-
return {
|
|
18
|
-
next() {
|
|
19
|
-
return iter.next();
|
|
20
|
-
},
|
|
21
|
-
[Symbol.asyncIterator]() {
|
|
22
|
-
return this;
|
|
23
|
-
},
|
|
24
|
-
byPage: (settings) => {
|
|
25
|
-
const pageOptions = Object.assign(Object.assign({}, options), { top: settings === null || settings === void 0 ? void 0 : settings.maxPageSize });
|
|
26
|
-
return getPageAsyncIterator(pagedResult, path, pageOptions);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function getItemAsyncIterator(pagedResult, path, options) {
|
|
31
|
-
return __asyncGenerator(this, arguments, function* getItemAsyncIterator_1() {
|
|
32
|
-
var e_1, _a;
|
|
33
|
-
const metaInfo = { isArray: false };
|
|
34
|
-
const pages = getPageAsyncIterator(pagedResult, path, options, metaInfo);
|
|
35
|
-
const firstVal = yield __await(pages.next());
|
|
36
|
-
// if the result does not have an array shape, i.e. TPage = TElement, then we return it as is
|
|
37
|
-
if (!metaInfo.isArray) {
|
|
38
|
-
yield yield __await(firstVal.value);
|
|
39
|
-
yield __await(yield* __asyncDelegator(__asyncValues(pages)));
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
yield __await(yield* __asyncDelegator(__asyncValues(firstVal.value)));
|
|
43
|
-
try {
|
|
44
|
-
for (var pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), !pages_1_1.done;) {
|
|
45
|
-
const page = pages_1_1.value;
|
|
46
|
-
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
50
|
-
finally {
|
|
51
|
-
try {
|
|
52
|
-
if (pages_1_1 && !pages_1_1.done && (_a = pages_1.return)) yield __await(_a.call(pages_1));
|
|
53
|
-
}
|
|
54
|
-
finally { if (e_1) throw e_1.error; }
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function getPageAsyncIterator(pagedResult, path, options, metaInfo = { isArray: true }) {
|
|
60
|
-
return __asyncGenerator(this, arguments, function* getPageAsyncIterator_1() {
|
|
61
|
-
let response = yield __await(retrievePage(pagedResult, path, options));
|
|
62
|
-
metaInfo.isArray = Array.isArray(response.result);
|
|
63
|
-
yield yield __await(response.result);
|
|
64
|
-
while (response.nextLink) {
|
|
65
|
-
response = yield __await(retrievePage(pagedResult, response.nextLink, options));
|
|
66
|
-
yield yield __await(response.result);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function getDefaultNextLink(response) {
|
|
71
|
-
return response.nextLink;
|
|
72
|
-
}
|
|
73
|
-
async function retrievePage(pagedResult, path, options) {
|
|
74
|
-
var _a, _b, _c;
|
|
75
|
-
const response = await pagedResult.sendGetRequest(path, options);
|
|
76
|
-
const result = (_b = (_a = pagedResult.buildPage) === null || _a === void 0 ? void 0 : _a.call(pagedResult, response)) !== null && _b !== void 0 ? _b : response.results;
|
|
77
|
-
const getNextLink = (_c = pagedResult.getNextLink) !== null && _c !== void 0 ? _c : getDefaultNextLink;
|
|
78
|
-
return {
|
|
79
|
-
result,
|
|
80
|
-
nextLink: getNextLink(response)
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=paging.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paging.js","sourceRoot":"","sources":["../../src/paging.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAsBlC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CAMnC,WAAoD,EACpD,IAAY,EACZ,OAAiB;IAEjB,MAAM,IAAI,GAAG,oBAAoB,CAC/B,WAAW,EACX,IAAI,EACJ,OAAO,CACR,CAAC;IACF,OAAO;QACL,IAAI;YACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,EAAE,CAAC,QAAuB,EAAE,EAAE;YAClC,MAAM,WAAW,mCAAQ,OAAO,KAAE,GAAG,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,GAAE,CAAC;YAC/D,OAAO,oBAAoB,CAAC,WAAW,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QAC9D,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAg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QAAQ,CAAC,MAAM,CAAA,CAAC;SACvB;IACH,CAAC;CAAA;AAED,SAAS,kBAAkB,CAAY,QAAmB;IACxD,OAAQ,QAAgB,CAAC,QAAQ,CAAC;AACpC,CAAC;AAOD,KAAK,UAAU,YAAY,CACzB,WAAoD,EACpD,IAAY,EACZ,OAAiB;;IAEjB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,MAAM,GAAU,MAAA,MAAA,WAAW,CAAC,SAAS,+CAArB,WAAW,EAAa,QAAQ,CAAC,mCAAK,QAAgB,CAAC,OAAO,CAAC;IACrF,MAAM,WAAW,GAAG,MAAA,WAAW,CAAC,WAAW,mCAAI,kBAAkB,CAAC;IAClE,OAAO;QACL,MAAM;QACN,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC;KAChC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PagedAsyncIterableIterator, PageSettings } from \"@azure/core-paging\";\n\n/**\n * an interface that describes how to communicate with the service and how to build a page of items.\n */\nexport interface PagedResult<TOptions extends Record<string, any>, TResponse, TPage> {\n /**\n * A method that send a GET request to the service and returns a response.\n */\n sendGetRequest: (path: string, options: TOptions) => Promise<TResponse>;\n /**\n * A method that extracts the link to the next page of results from the response.\n */\n getNextLink?: (response: TResponse) => string | undefined;\n /**\n * A method to build a page of items from the response.\n */\n buildPage?: (response: TResponse) => TPage;\n}\n\n/**\n * @internal\n *\n * returns an async iterator that will retrieve items from the server. It also has a `byPage`\n * method that can return pages of items at once.\n *\n * @param pagedResult - an object that describes how to communicate with the service and how to build a page of items.\n * @param path - the path to the resource to retrieve\n * @param options - the options to pass to the service\n * @returns a paged async iterator that will retrieve items from the server.\n */\nexport function getPagedAsyncIterator<\n TOptions extends Record<string, any>,\n TResponse,\n TElement,\n TPage = TElement[]\n>(\n pagedResult: PagedResult<TOptions, TResponse, TPage>,\n path: string,\n options: TOptions\n): PagedAsyncIterableIterator<TElement, TPage> {\n const iter = getItemAsyncIterator<TOptions, TResponse, TElement, TPage>(\n pagedResult,\n path,\n options\n );\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 getPageAsyncIterator(pagedResult, path, pageOptions);\n }\n };\n}\n\nasync function* getItemAsyncIterator<\n TOptions extends Record<string, unknown>,\n TResponse,\n TElement,\n TPage\n>(\n pagedResult: PagedResult<TOptions, TResponse, TPage>,\n path: string,\n options: TOptions\n): AsyncIterableIterator<TElement> {\n const metaInfo = { isArray: false };\n const pages = getPageAsyncIterator(pagedResult, path, options, metaInfo);\n const firstVal = await pages.next();\n // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is\n if (!metaInfo.isArray) {\n yield firstVal.value;\n yield* (pages as unknown) as AsyncIterableIterator<TElement>;\n } else {\n yield* firstVal.value;\n for await (const page of pages) {\n yield* page as any;\n }\n }\n}\n\nasync function* getPageAsyncIterator<TOptions extends Record<string, unknown>, TResponse, TPage>(\n pagedResult: PagedResult<TOptions, TResponse, TPage>,\n path: string,\n options: TOptions,\n metaInfo: { isArray: boolean } = { isArray: true }\n): AsyncIterableIterator<TPage> {\n let response = await retrievePage<TOptions, TResponse, TPage>(pagedResult, path, options);\n metaInfo.isArray = Array.isArray(response.result);\n yield response.result;\n while (response.nextLink) {\n response = await retrievePage(pagedResult, response.nextLink, options);\n yield response.result;\n }\n}\n\nfunction getDefaultNextLink<TResponse>(response: TResponse): string | undefined {\n return (response as any).nextLink;\n}\n\ninterface ResultWithPaging<TPage> {\n result: TPage;\n nextLink?: string;\n}\n\nasync function retrievePage<TOptions extends Record<string, unknown>, TResponse, TPage>(\n pagedResult: PagedResult<TOptions, TResponse, TPage>,\n path: string,\n options: TOptions\n): Promise<ResultWithPaging<TPage>> {\n const response = await pagedResult.sendGetRequest(path, options);\n const result: TPage = pagedResult.buildPage?.(response) ?? (response as any).results;\n const getNextLink = pagedResult.getNextLink ?? getDefaultNextLink;\n return {\n result,\n nextLink: getNextLink(response)\n };\n}\n"]}
|
|
@@ -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"]}
|