Skip to content

Commit 4c53b59

Browse files
authored
[Search] Miscellaneous small fixups (Azure#29600)
1 parent 7f1cb9a commit 4c53b59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+249
-371
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 66 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/search/search-documents/api-extractor.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3-
"mainEntryPointFilePath": "types/src/index.d.ts",
4-
"docModel": {
5-
"enabled": true
6-
},
73
"apiReport": {
84
"enabled": true,
95
"reportFolder": "./review"
106
},
7+
"docModel": {
8+
"enabled": true
9+
},
1110
"dtsRollup": {
1211
"enabled": true,
1312
"publicTrimmedFilePath": "./types/search-documents.d.ts",
1413
"untrimmedFilePath": ""
1514
},
15+
"mainEntryPointFilePath": "types/src/index.d.ts",
1616
"messages": {
1717
"extractorMessageReporting": {
1818
"ae-missing-release-tag": {
@@ -27,5 +27,6 @@
2727
"logLevel": "none"
2828
}
2929
}
30-
}
30+
},
31+
"newlineKind": "lf"
3132
}

sdk/search/search-documents/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "js",
44
"TagPrefix": "js/search/search-documents",
5-
"Tag": "js/search/search-documents_13f2a06b1c"
5+
"Tag": "js/search/search-documents_e4f423ced3"
66
}

sdk/search/search-documents/karma.conf.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ module.exports = function (config) {
4646
// inject following environment values into browser testing with window.__env__
4747
// environment values MUST be exported or set with same console running "karma start"
4848
// https://www.npmjs.com/package/karma-env-preprocessor
49-
envPreprocessor: [
50-
"TEST_MODE",
51-
"ENDPOINT",
52-
"SEARCH_API_ADMIN_KEY",
53-
"SEARCH_API_ADMIN_KEY_ALT",
54-
"RECORDINGS_RELATIVE_PATH",
55-
],
49+
envPreprocessor: ["TEST_MODE", "ENDPOINT", "RECORDINGS_RELATIVE_PATH"],
5650

5751
// test results reporter to use
5852
// possible values: 'dots', 'progress'

sdk/search/search-documents/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,14 @@
9595
"tslib": "^2.2.0"
9696
},
9797
"devDependencies": {
98+
"@azure-tools/test-credential": "^2.0.0",
9899
"@azure-tools/test-recorder": "^3.0.0",
100+
"@azure-tools/test-utils": "^1.0.1",
99101
"@azure/core-util": "^1.6.1",
100102
"@azure/dev-tool": "^1.0.0",
101103
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
104+
"@azure/identity": "^4.0.1",
102105
"@azure/openai": "1.0.0-beta.13",
103-
"@azure-tools/test-utils": "^1.0.1",
104106
"@microsoft/api-extractor": "^7.31.1",
105107
"@types/chai": "^4.1.6",
106108
"@types/mocha": "^10.0.0",

sdk/search/search-documents/sample.env

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
# The primary key of your Azure Search account.
2-
SEARCH_API_ADMIN_KEY=<search-api-admin-key>
3-
4-
# (optional) The secondary key of your Azure Search account.
5-
SEARCH_API_ADMIN_KEY_ALT=<search-api-admin-key-alt>
6-
71
# The endpoint of your Azure Search account.
82
ENDPOINT=<endpoint>
93

104
# The endpoint for the OpenAI service.
115
AZURE_OPENAI_ENDPOINT=<openai-endpoint>
126

13-
# The key for the OpenAI service.
14-
AZURE_OPENAI_KEY=<openai-key>
15-
167
# The name of the OpenAI deployment you'd like your tests to use.
178
AZURE_OPENAI_DEPLOYMENT_NAME=<deployment-name>
189

sdk/search/search-documents/samples-dev/bufferedSenderAutoFlushSize.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* @summary Demonstrates the SearchIndexingBufferedSender with Autoflush based on size.
66
*/
77

8+
import { DefaultAzureCredential } from "@azure/identity";
89
import {
9-
AzureKeyCredential,
1010
GeographyPoint,
1111
SearchClient,
1212
SearchIndexClient,
@@ -26,7 +26,6 @@ dotenv.config();
2626
* by default.
2727
*/
2828
const endpoint = process.env.ENDPOINT || "";
29-
const apiKey = process.env.SEARCH_API_ADMIN_KEY || "";
3029
const TEST_INDEX_NAME = "example-index-sample-4";
3130

3231
function getDocumentsArray(size: number): Hotel[] {
@@ -59,14 +58,14 @@ function getDocumentsArray(size: number): Hotel[] {
5958
}
6059

6160
async function main(): Promise<void> {
62-
if (!endpoint || !apiKey) {
63-
console.log("Make sure to set valid values for endpoint and apiKey with proper authorization.");
61+
if (!endpoint) {
62+
console.log("Be sure to set a valid endpoint with proper authorization.");
6463
return;
6564
}
6665

6766
console.log(`Running SearchIndexingBufferedSender-uploadDocuments-With Auto Flush Sizes Sample`);
6867

69-
const credential = new AzureKeyCredential(apiKey);
68+
const credential = new DefaultAzureCredential();
7069
const searchClient: SearchClient<Hotel> = new SearchClient<Hotel>(
7170
endpoint,
7271
TEST_INDEX_NAME,

sdk/search/search-documents/samples-dev/bufferedSenderAutoFlushTimer.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* @summary Demonstrates the SearchIndexingBufferedSender with Autoflush based on timer.
66
*/
77

8+
import { DefaultAzureCredential } from "@azure/identity";
89
import {
9-
AzureKeyCredential,
1010
DEFAULT_FLUSH_WINDOW,
1111
GeographyPoint,
1212
SearchClient,
@@ -27,18 +27,17 @@ dotenv.config();
2727
* by default.
2828
*/
2929
const endpoint = process.env.ENDPOINT || "";
30-
const apiKey = process.env.SEARCH_API_ADMIN_KEY || "";
3130
const TEST_INDEX_NAME = "example-index-sample-5";
3231

3332
export async function main(): Promise<void> {
34-
if (!endpoint || !apiKey) {
35-
console.log("Make sure to set valid values for endpoint and apiKey with proper authorization.");
33+
if (!endpoint) {
34+
console.log("Be sure to set a valid endpoint with proper authorization.");
3635
return;
3736
}
3837

3938
console.log(`Running SearchIndexingBufferedSender-uploadDocuments-With Auto Flush Timer Sample`);
4039

41-
const credential = new AzureKeyCredential(apiKey);
40+
const credential = new DefaultAzureCredential();
4241
const searchClient: SearchClient<Hotel> = new SearchClient<Hotel>(
4342
endpoint,
4443
TEST_INDEX_NAME,

sdk/search/search-documents/samples-dev/bufferedSenderManualFlush.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* @summary Demonstrates the SearchIndexingBufferedSender with Manual Flush.
66
*/
77

8+
import { DefaultAzureCredential } from "@azure/identity";
89
import {
9-
AzureKeyCredential,
1010
GeographyPoint,
1111
SearchClient,
1212
SearchIndexClient,
@@ -24,18 +24,17 @@ dotenv.config();
2424
* wants to call the flush manually.
2525
*/
2626
const endpoint = process.env.ENDPOINT || "";
27-
const apiKey = process.env.SEARCH_API_ADMIN_KEY || "";
2827
const TEST_INDEX_NAME = "example-index-sample-6";
2928

3029
export async function main(): Promise<void> {
31-
if (!endpoint || !apiKey) {
32-
console.log("Make sure to set valid values for endpoint and apiKey with proper authorization.");
30+
if (!endpoint) {
31+
console.log("Be sure to set a valid endpoint with proper authorization.");
3332
return;
3433
}
3534

3635
console.log(`Running SearchIndexingBufferedSender-uploadDocuments-Without AutoFlush Sample`);
3736

38-
const credential = new AzureKeyCredential(apiKey);
37+
const credential = new DefaultAzureCredential();
3938
const searchClient: SearchClient<Hotel> = new SearchClient<Hotel>(
4039
endpoint,
4140
TEST_INDEX_NAME,

sdk/search/search-documents/samples-dev/dataSourceConnectionOperations.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
* @summary Demonstrates the DataSource Connection Operations.
66
*/
77

8-
import {
9-
AzureKeyCredential,
10-
SearchIndexerClient,
11-
SearchIndexerDataSourceConnection,
12-
} from "@azure/search-documents";
8+
import { DefaultAzureCredential } from "@azure/identity";
9+
import { SearchIndexerClient, SearchIndexerDataSourceConnection } from "@azure/search-documents";
1310

1411
import * as dotenv from "dotenv";
1512
dotenv.config();
1613

1714
const endpoint = process.env.ENDPOINT || "";
18-
const apiKey = process.env.SEARCH_API_ADMIN_KEY || "";
1915
const connectionString = process.env.CONNECTION_STRING || "";
2016
const TEST_DATA_SOURCE_CONNECTION_NAME = "example-ds-connection-sample-1";
2117

@@ -79,11 +75,11 @@ async function deleteDataSourceConnection(
7975

8076
async function main(): Promise<void> {
8177
console.log(`Running DS Connection Operations Sample....`);
82-
if (!endpoint || !apiKey || !connectionString) {
83-
console.log("Make sure to set valid values for endpoint and apiKey with proper authorization.");
78+
if (!endpoint || !connectionString) {
79+
console.log("Be sure to set a valid endpoint with proper authorization.");
8480
return;
8581
}
86-
const client = new SearchIndexerClient(endpoint, new AzureKeyCredential(apiKey));
82+
const client = new SearchIndexerClient(endpoint, new DefaultAzureCredential());
8783
try {
8884
await createDataSourceConnection(TEST_DATA_SOURCE_CONNECTION_NAME, client);
8985
await getAndUpdateDataSourceConnection(TEST_DATA_SOURCE_CONNECTION_NAME, client);

0 commit comments

Comments
 (0)