@azure/ai-language-text 1.0.0-alpha.20220808.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +780 -0
  3. package/dist/index.js +4771 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist-esm/src/azureKeyCredentialPolicy.js +22 -0
  6. package/dist-esm/src/azureKeyCredentialPolicy.js.map +1 -0
  7. package/dist-esm/src/constants.js +16 -0
  8. package/dist-esm/src/constants.js.map +1 -0
  9. package/dist-esm/src/generated/generatedClient.js +119 -0
  10. package/dist-esm/src/generated/generatedClient.js.map +1 -0
  11. package/dist-esm/src/generated/index.js +11 -0
  12. package/dist-esm/src/generated/index.js.map +1 -0
  13. package/dist-esm/src/generated/models/index.js +644 -0
  14. package/dist-esm/src/generated/models/index.js.map +1 -0
  15. package/dist-esm/src/generated/models/mappers.js +2810 -0
  16. package/dist-esm/src/generated/models/mappers.js.map +1 -0
  17. package/dist-esm/src/generated/models/parameters.js +98 -0
  18. package/dist-esm/src/generated/models/parameters.js.map +1 -0
  19. package/dist-esm/src/generated/operations/analyzeText.js +105 -0
  20. package/dist-esm/src/generated/operations/analyzeText.js.map +1 -0
  21. package/dist-esm/src/generated/operations/index.js +9 -0
  22. package/dist-esm/src/generated/operations/index.js.map +1 -0
  23. package/dist-esm/src/generated/operationsInterfaces/analyzeText.js +9 -0
  24. package/dist-esm/src/generated/operationsInterfaces/analyzeText.js.map +1 -0
  25. package/dist-esm/src/generated/operationsInterfaces/index.js +9 -0
  26. package/dist-esm/src/generated/operationsInterfaces/index.js.map +1 -0
  27. package/dist-esm/src/index.js +18 -0
  28. package/dist-esm/src/index.js.map +1 -0
  29. package/dist-esm/src/logger.js +9 -0
  30. package/dist-esm/src/logger.js.map +1 -0
  31. package/dist-esm/src/lro.js +179 -0
  32. package/dist-esm/src/lro.js.map +1 -0
  33. package/dist-esm/src/models.js +42 -0
  34. package/dist-esm/src/models.js.map +1 -0
  35. package/dist-esm/src/textAnalysisClient.js +191 -0
  36. package/dist-esm/src/textAnalysisClient.js.map +1 -0
  37. package/dist-esm/src/transforms.js +287 -0
  38. package/dist-esm/src/transforms.js.map +1 -0
  39. package/dist-esm/src/util.js +117 -0
  40. package/dist-esm/src/util.js.map +1 -0
  41. package/package.json +135 -0
  42. package/types/ai-language-text.d.ts +2477 -0
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ const API_KEY_HEADER_NAME = "Ocp-Apim-Subscription-Key";
4
+ /**
5
+ * The programmatic identifier of the textAnalyticsAzureKeyCredentialPolicy.
6
+ */
7
+ const textAnalyticsAzureKeyCredentialPolicyName = "textAnalyticsAzureKeyCredentialPolicy";
8
+ /**
9
+ * Create an HTTP pipeline policy to authenticate a request
10
+ * using an `AzureKeyCredential` for Text Analytics
11
+ * @internal
12
+ */
13
+ export function textAnalyticsAzureKeyCredentialPolicy(credential) {
14
+ return {
15
+ name: textAnalyticsAzureKeyCredentialPolicyName,
16
+ sendRequest(request, next) {
17
+ request.headers.set(API_KEY_HEADER_NAME, credential.key);
18
+ return next(request);
19
+ },
20
+ };
21
+ }
22
+ //# sourceMappingURL=azureKeyCredentialPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azureKeyCredentialPolicy.js","sourceRoot":"","sources":["../../src/azureKeyCredentialPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,MAAM,mBAAmB,GAAG,2BAA2B,CAAC;AAExD;;GAEG;AACH,MAAM,yCAAyC,GAAG,uCAAuC,CAAC;AAE1F;;;;GAIG;AACH,MAAM,UAAU,qCAAqC,CAAC,UAAyB;IAC7E,OAAO;QACL,IAAI,EAAE,yCAAyC;QAC/C,WAAW,CAAC,OAAwB,EAAE,IAAiB;YACrD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { KeyCredential } from \"@azure/core-auth\";\n\nconst API_KEY_HEADER_NAME = \"Ocp-Apim-Subscription-Key\";\n\n/**\n * The programmatic identifier of the textAnalyticsAzureKeyCredentialPolicy.\n */\nconst textAnalyticsAzureKeyCredentialPolicyName = \"textAnalyticsAzureKeyCredentialPolicy\";\n\n/**\n * Create an HTTP pipeline policy to authenticate a request\n * using an `AzureKeyCredential` for Text Analytics\n * @internal\n */\nexport function textAnalyticsAzureKeyCredentialPolicy(credential: KeyCredential): PipelinePolicy {\n return {\n name: textAnalyticsAzureKeyCredentialPolicyName,\n sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n request.headers.set(API_KEY_HEADER_NAME, credential.key);\n return next(request);\n },\n };\n}\n"]}
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /**
4
+ * The default AAD permissions scope for Cognitive Services.
5
+ * @internal
6
+ */
7
+ export const DEFAULT_COGNITIVE_SCOPE = "https://cognitiveservices.azure.com/.default";
8
+ /**
9
+ * @internal
10
+ */
11
+ export const SDK_VERSION = "1.0.0-beta.1";
12
+ /**
13
+ * @internal
14
+ */
15
+ export const clientName = "TextAnalysisClient";
16
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,8CAA8C,CAAC;AAEtF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * The default AAD permissions scope for Cognitive Services.\n * @internal\n */\nexport const DEFAULT_COGNITIVE_SCOPE = \"https://cognitiveservices.azure.com/.default\";\n\n/**\n * @internal\n */\nexport const SDK_VERSION = \"1.0.0-beta.1\";\n\n/**\n * @internal\n */\nexport const clientName = \"TextAnalysisClient\";\n"]}
@@ -0,0 +1,119 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+ import * as coreClient from "@azure/core-client";
9
+ import * as coreRestPipeline from "@azure/core-rest-pipeline";
10
+ import { AnalyzeTextImpl } from "./operations";
11
+ import * as Parameters from "./models/parameters";
12
+ import * as Mappers from "./models/mappers";
13
+ /** @internal */
14
+ export class GeneratedClient extends coreClient.ServiceClient {
15
+ /**
16
+ * Initializes a new instance of the GeneratedClient class.
17
+ * @param endpoint Supported Cognitive Services endpoint (e.g.,
18
+ * https://<resource-name>.api.cognitiveservices.azure.com).
19
+ * @param options The parameter options
20
+ */
21
+ constructor(endpoint, options) {
22
+ var _a, _b;
23
+ if (endpoint === undefined) {
24
+ throw new Error("'endpoint' cannot be null");
25
+ }
26
+ // Initializing default values for options
27
+ if (!options) {
28
+ options = {};
29
+ }
30
+ const defaults = {
31
+ requestContentType: "application/json; charset=utf-8"
32
+ };
33
+ const packageDetails = `azsdk-js-ai-language-text/1.0.0-beta.1`;
34
+ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
35
+ ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
36
+ : `${packageDetails}`;
37
+ const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
38
+ userAgentPrefix
39
+ }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{Endpoint}/language" });
40
+ super(optionsWithDefaults);
41
+ if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
42
+ const pipelinePolicies = options.pipeline.getOrderedPolicies();
43
+ const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
44
+ coreRestPipeline.bearerTokenAuthenticationPolicyName);
45
+ if (!bearerTokenAuthenticationPolicyFound) {
46
+ this.pipeline.removePolicy({
47
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
48
+ });
49
+ this.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
50
+ scopes: `${optionsWithDefaults.baseUri}/.default`,
51
+ challengeCallbacks: {
52
+ authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge
53
+ }
54
+ }));
55
+ }
56
+ }
57
+ // Parameter assignments
58
+ this.endpoint = endpoint;
59
+ // Assigning values to Constant parameters
60
+ this.apiVersion = options.apiVersion || "2022-04-01-preview";
61
+ this.analyzeText = new AnalyzeTextImpl(this);
62
+ this.addCustomApiVersionPolicy(options.apiVersion);
63
+ }
64
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
65
+ addCustomApiVersionPolicy(apiVersion) {
66
+ if (!apiVersion) {
67
+ return;
68
+ }
69
+ const apiVersionPolicy = {
70
+ name: "CustomApiVersionPolicy",
71
+ async sendRequest(request, next) {
72
+ const param = request.url.split("?");
73
+ if (param.length > 1) {
74
+ const newParams = param[1].split("&").map((item) => {
75
+ if (item.indexOf("api-version") > -1) {
76
+ return "api-version=" + apiVersion;
77
+ }
78
+ else {
79
+ return item;
80
+ }
81
+ });
82
+ request.url = param[0] + "?" + newParams.join("&");
83
+ }
84
+ return next(request);
85
+ }
86
+ };
87
+ this.pipeline.addPolicy(apiVersionPolicy);
88
+ }
89
+ /**
90
+ * Submit a collection of text documents for analysis. Specify a single unique task to be executed
91
+ * immediately.
92
+ * @param body Collection of documents to analyze and a single task to execute.
93
+ * @param options The options parameters.
94
+ */
95
+ analyze(body, options) {
96
+ return this.sendOperationRequest({ body, options }, analyzeOperationSpec);
97
+ }
98
+ }
99
+ // Operation Specifications
100
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
101
+ const analyzeOperationSpec = {
102
+ path: "/:analyze-text",
103
+ httpMethod: "POST",
104
+ responses: {
105
+ 200: {
106
+ bodyMapper: Mappers.AnalyzeTextTaskResult
107
+ },
108
+ default: {
109
+ bodyMapper: Mappers.ErrorResponse
110
+ }
111
+ },
112
+ requestBody: Parameters.body,
113
+ queryParameters: [Parameters.apiVersion, Parameters.includeStatistics],
114
+ urlParameters: [Parameters.endpoint],
115
+ headerParameters: [Parameters.contentType, Parameters.accept],
116
+ mediaType: "json",
117
+ serializer
118
+ };
119
+ //# sourceMappingURL=generatedClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generatedClient.js","sourceRoot":"","sources":["../../../src/generated/generatedClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAC;AAM9D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAQ5C,gBAAgB;AAChB,MAAM,OAAO,eAAgB,SAAQ,UAAU,CAAC,aAAa;IAI3D;;;;;OAKG;IACH,YAAY,QAAgB,EAAE,OAAuC;;QACnE,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO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IAED;;;;;OAKG;IACH,OAAO,CACL,IAAwB,EACxB,OAA+B;QAE/B,OAAO,IAAI,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,oBAAoB,CAAC,CAAC;IAC5E,CAAC;CAGF;AACD,2BAA2B;AAC3B,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AAE3E,MAAM,oBAAoB,GAA6B;IACrD,IAAI,EAAE,gBAAgB;IACtB,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,qBAAqB;SAC1C;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,WAAW,EAAE,UAAU,CAAC,IAAI;IAC5B,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,iBAAiB,CAAC;IACtE,aAAa,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;IACpC,gBAAgB,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport {\n PipelineRequest,\n PipelineResponse,\n SendRequest\n} from \"@azure/core-rest-pipeline\";\nimport { AnalyzeTextImpl } from \"./operations\";\nimport { AnalyzeText } from \"./operationsInterfaces\";\nimport * as Parameters from \"./models/parameters\";\nimport * as Mappers from \"./models/mappers\";\nimport {\n GeneratedClientOptionalParams,\n AnalyzeActionUnion,\n AnalyzeOptionalParams,\n AnalyzeResponse\n} from \"./models\";\n\n/** @internal */\nexport class GeneratedClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the GeneratedClient class.\n * @param endpoint Supported Cognitive Services endpoint (e.g.,\n * https://<resource-name>.api.cognitiveservices.azure.com).\n * @param options The parameter options\n */\n constructor(endpoint: string, options?: GeneratedClientOptionalParams) {\n if (endpoint === undefined) {\n throw new Error(\"'endpoint' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: GeneratedClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-ai-language-text/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n baseUri: options.endpoint ?? options.baseUri ?? \"{Endpoint}/language\"\n };\n super(optionsWithDefaults);\n\n if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {\n const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();\n const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(\n (pipelinePolicy) =>\n pipelinePolicy.name ===\n coreRestPipeline.bearerTokenAuthenticationPolicyName\n );\n if (!bearerTokenAuthenticationPolicyFound) {\n this.pipeline.removePolicy({\n name: coreRestPipeline.bearerTokenAuthenticationPolicyName\n });\n this.pipeline.addPolicy(\n coreRestPipeline.bearerTokenAuthenticationPolicy({\n scopes: `${optionsWithDefaults.baseUri}/.default`,\n challengeCallbacks: {\n authorizeRequestOnChallenge:\n coreClient.authorizeRequestOnClaimChallenge\n }\n })\n );\n }\n }\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2022-04-01-preview\";\n this.analyzeText = new AnalyzeTextImpl(this);\n this.addCustomApiVersionPolicy(options.apiVersion);\n }\n\n /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */\n private addCustomApiVersionPolicy(apiVersion?: string) {\n if (!apiVersion) {\n return;\n }\n const apiVersionPolicy = {\n name: \"CustomApiVersionPolicy\",\n async sendRequest(\n request: PipelineRequest,\n next: SendRequest\n ): Promise<PipelineResponse> {\n const param = request.url.split(\"?\");\n if (param.length > 1) {\n const newParams = param[1].split(\"&\").map((item) => {\n if (item.indexOf(\"api-version\") > -1) {\n return \"api-version=\" + apiVersion;\n } else {\n return item;\n }\n });\n request.url = param[0] + \"?\" + newParams.join(\"&\");\n }\n return next(request);\n }\n };\n this.pipeline.addPolicy(apiVersionPolicy);\n }\n\n /**\n * Submit a collection of text documents for analysis. Specify a single unique task to be executed\n * immediately.\n * @param body Collection of documents to analyze and a single task to execute.\n * @param options The options parameters.\n */\n analyze(\n body: AnalyzeActionUnion,\n options?: AnalyzeOptionalParams\n ): Promise<AnalyzeResponse> {\n return this.sendOperationRequest({ body, options }, analyzeOperationSpec);\n }\n\n analyzeText: AnalyzeText;\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst analyzeOperationSpec: coreClient.OperationSpec = {\n path: \"/:analyze-text\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.AnalyzeTextTaskResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n requestBody: Parameters.body,\n queryParameters: [Parameters.apiVersion, Parameters.includeStatistics],\n urlParameters: [Parameters.endpoint],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\n"]}
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+ export * from "./models";
9
+ export { GeneratedClient } from "./generatedClient";
10
+ export * from "./operationsInterfaces";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/generated/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,wBAAwB,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nexport * from \"./models\";\nexport { GeneratedClient } from \"./generatedClient\";\nexport * from \"./operationsInterfaces\";\n"]}