@azure-rest/ai-document-translator 1.0.0-alpha.20250131.1 → 1.0.0-alpha.20250203.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ Copyright (c) Microsoft Corporation.
2
2
 
3
- Copyright (c) 2020 Microsoft
3
+ MIT License
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -12,7 +12,7 @@ furnished to do so, subject to the following conditions:
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
14
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
package/README.md CHANGED
@@ -89,32 +89,12 @@ az cognitiveservices account keys list --name "resource-name" --resource-group "
89
89
 
90
90
  Once you have an API key and endpoint, you can use the `AzureKeyCredential` class to authenticate the client as follows:
91
91
 
92
- ```javascript
93
- const DocumentTranslator = require("@azure-rest/ai-document-translator");
92
+ ```ts snippet:ReadmeSampleCreateClient_APIKey
93
+ import DocumentTranslator from "@azure-rest/ai-document-translator";
94
94
 
95
95
  const client = DocumentTranslator("<endpoint>", { key: "<API key>" });
96
96
  ```
97
97
 
98
- #### Using an Azure Active Directory Credential
99
-
100
- Client API key authentication is used in most of the examples, but you can also authenticate with Azure Active Directory using the [Azure Identity library][azure_identity]. To use the [DefaultAzureCredential][defaultazurecredential] provider shown below,
101
- or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
102
-
103
- ```bash
104
- npm install @azure/identity
105
- ```
106
-
107
- You will also need to [register a new AAD application][register_aad_app] and grant access to Document Translator by assigning the `"Managed Application Contributor Role"` role to your service principal (note: other roles such as `"Owner"` will not grant the necessary permissions, only `"Managed Application Contributor Role"` will suffice to run the examples and the sample code).
108
-
109
- Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
110
-
111
- ```javascript
112
- const DocumentTranslator = require("@azure-rest/ai-document-translator");
113
- const { DefaultAzureCredential } = require("@azure/identity");
114
-
115
- const client = DocumentTranslator("<endpoint>", new DefaultAzureCredential());
116
- ```
117
-
118
98
  ## Key concepts
119
99
 
120
100
  The Document Translation service requires that you upload your files to an Azure Blob Storage source container and provide
@@ -144,9 +124,10 @@ and the target language(s) for translation.
144
124
 
145
125
  A single source container with documents can be translated to many different languages:
146
126
 
147
- ```typescript
148
- import { BatchSubmissionRequest } from "@azure-rest/ai-document-translator";
149
- const batchSubmissionRequest: BatchSubmissionRequest = {
127
+ ```ts snippet:ReadmeSampleBatchSubmissionRequest
128
+ import { StartTranslationDetails } from "@azure-rest/ai-document-translator";
129
+
130
+ const batchSubmissionRequest: StartTranslationDetails = {
150
131
  inputs: [
151
132
  {
152
133
  source: { sourceUrl: "<sas_url_to_source>" },
@@ -158,9 +139,10 @@ const batchSubmissionRequest: BatchSubmissionRequest = {
158
139
 
159
140
  Or multiple different sources can be provided each with their own targets.
160
141
 
161
- ```typescript
162
- import { BatchSubmissionRequest } from "@azure-rest/ai-document-translator";
163
- const batchSubmissionRequest: BatchSubmissionRequest = {
142
+ ```ts snippet:ReadmeSampleBatchSubmissionRequestMultiple
143
+ import { StartTranslationDetails } from "@azure-rest/ai-document-translator";
144
+
145
+ const batchSubmissionRequest: StartTranslationDetails = {
164
146
  inputs: [
165
147
  {
166
148
  source: { sourceUrl: "<sas_url_to_source_A>" },
@@ -197,7 +179,7 @@ Please refer to the samples folder to see code samples, including:
197
179
 
198
180
  Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
199
181
 
200
- ```ts
182
+ ```ts snippet:SetLogLevel
201
183
  import { setLogLevel } from "@azure/logger";
202
184
 
203
185
  setLogLevel("info");
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.49.1"
8
+ "packageVersion": "7.49.2"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "An isomorphic rest level client library for the Azure Document Translator service.",
6
- "version": "1.0.0-alpha.20250131.1",
6
+ "version": "1.0.0-alpha.20250203.2",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",
@@ -77,17 +77,17 @@
77
77
  "unit-test": "npm run unit-test:node && npm run unit-test:browser",
78
78
  "unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
79
79
  "unit-test:node": "dev-tool run test:vitest",
80
- "update-snippets": "echo skipped"
80
+ "update-snippets": "dev-tool run update-snippets"
81
81
  },
82
82
  "sideEffects": false,
83
83
  "autoPublish": false,
84
84
  "dependencies": {
85
+ "@azure-rest/core-client": "^2.3.1",
85
86
  "@azure-tools/test-recorder": "^3.0.0",
86
- "@azure/core-lro": "^3.0.0",
87
87
  "@azure/abort-controller": "^2.1.2",
88
- "@azure-rest/core-client": "^2.3.1",
89
88
  "@azure/core-auth": "^1.9.0",
90
- "@azure/core-rest-pipeline": "^1.18.0",
89
+ "@azure/core-lro": "^3.0.0",
90
+ "@azure/core-rest-pipeline": "^1.18.2",
91
91
  "@azure/logger": "^1.1.4",
92
92
  "tslib": "^2.8.1"
93
93
  },
@@ -97,18 +97,19 @@
97
97
  "@azure-tools/test-utils-vitest": ">=1.0.0-alpha <1.0.0-alphb",
98
98
  "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
99
99
  "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
100
- "@azure/identity": "^4.5.0",
100
+ "@azure/identity": "^4.6.0",
101
101
  "@types/node": "^18.0.0",
102
102
  "@vitest/browser": "^3.0.3",
103
103
  "@vitest/coverage-istanbul": "^3.0.3",
104
104
  "dotenv": "^16.0.0",
105
105
  "eslint": "^9.9.0",
106
- "playwright": "^1.49.0",
106
+ "playwright": "^1.50.1",
107
107
  "typescript": "~5.7.2",
108
108
  "vitest": "^3.0.3"
109
109
  },
110
110
  "type": "module",
111
111
  "tshy": {
112
+ "project": "./tsconfig.src.json",
112
113
  "exports": {
113
114
  "./package.json": "./package.json",
114
115
  ".": "./src/index.ts"
@@ -121,8 +122,7 @@
121
122
  "browser",
122
123
  "react-native"
123
124
  ],
124
- "selfLink": false,
125
- "project": "./tsconfig.src.json"
125
+ "selfLink": false
126
126
  },
127
127
  "browser": "./dist/browser/index.js",
128
128
  "exports": {
@@ -145,5 +145,6 @@
145
145
  "default": "./dist/commonjs/index.js"
146
146
  }
147
147
  }
148
- }
148
+ },
149
+ "react-native": "./dist/react-native/index.js"
149
150
  }