From f83a3fc767d4ce0100c03d194be432b8877ce846 Mon Sep 17 00:00:00 2001 From: Sarangan Rajamanickam Date: Tue, 5 Jan 2021 19:21:17 -0800 Subject: [PATCH] Response to PR Comments --- .../review/search-documents.api.md | 4 ++-- sdk/search/search-documents/src/logger.ts | 2 +- .../src/searchIndexingBufferedSenderImpl.ts | 21 ++++++++++++------- .../search-documents/src/serialization.ts | 3 ++- .../search-documents/src/serviceModels.ts | 18 ++++++---------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/sdk/search/search-documents/review/search-documents.api.md b/sdk/search/search-documents/review/search-documents.api.md index a3414050e8a9..9f1ba16e7e9c 100644 --- a/sdk/search/search-documents/review/search-documents.api.md +++ b/sdk/search/search-documents/review/search-documents.api.md @@ -541,10 +541,10 @@ export interface IndexingSchedule { } // @public -export type IndexIterator = PagedAsyncIterableIterator>; +export type IndexIterator = PagedAsyncIterableIterator; // @public -export type IndexNameIterator = PagedAsyncIterableIterator>; +export type IndexNameIterator = PagedAsyncIterableIterator; // @public export interface InputFieldMappingEntry { diff --git a/sdk/search/search-documents/src/logger.ts b/sdk/search/search-documents/src/logger.ts index d13a3c0a476f..75335573005d 100644 --- a/sdk/search/search-documents/src/logger.ts +++ b/sdk/search/search-documents/src/logger.ts @@ -4,6 +4,6 @@ import { createClientLogger } from "@azure/logger"; /** - * The \@azure/logger configuration for this package. + * The `@azure/logger` configuration for this package. */ export const logger = createClientLogger("search"); diff --git a/sdk/search/search-documents/src/searchIndexingBufferedSenderImpl.ts b/sdk/search/search-documents/src/searchIndexingBufferedSenderImpl.ts index 549cc4c80b03..71c695de342d 100644 --- a/sdk/search/search-documents/src/searchIndexingBufferedSenderImpl.ts +++ b/sdk/search/search-documents/src/searchIndexingBufferedSenderImpl.ts @@ -9,7 +9,8 @@ import { SearchIndexingBufferedSenderMergeDocumentsOptions, SearchIndexingBufferedSenderMergeOrUploadDocumentsOptions, SearchIndexingBufferedSenderDeleteDocumentsOptions, - SearchIndexingBufferedSenderFlushDocumentsOptions + SearchIndexingBufferedSenderFlushDocumentsOptions, + IndexDocumentsOptions } from "./indexModels"; import { IndexDocumentsResult } from "./generated/data/models"; import { RestError, OperationOptions } from "@azure/core-http"; @@ -19,7 +20,13 @@ import { CanonicalCode } from "@opentelemetry/api"; import { SearchIndexingBufferedSender } from "./searchIndexingBufferedSender"; import { delay } from "@azure/core-http"; import { getRandomIntegerInclusive } from "./serviceUtils"; -import { SearchClient } from "./searchClient"; + +interface IndexDocumentsClient { + indexDocuments( + batch: IndexDocumentsBatch, + options: IndexDocumentsOptions + ): Promise; +} /** * Default Batch Size @@ -50,7 +57,7 @@ class SearchIndexingBufferedSenderImpl implements SearchIndexingBufferedSende /** * Search Client used to call the underlying IndexBatch operations. */ - private client: SearchClient; + private client: IndexDocumentsClient; /** * Indicates if autoFlush is enabled. */ @@ -95,8 +102,7 @@ class SearchIndexingBufferedSenderImpl implements SearchIndexingBufferedSende * @param options - Options to modify auto flush. * */ - // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters - constructor(client: SearchClient, options: SearchIndexingBufferedSenderOptions = {}) { + constructor(client: IndexDocumentsClient, options: SearchIndexingBufferedSenderOptions = {}) { this.client = client; // General Configuration properties this.autoFlush = options.autoFlush ?? false; @@ -411,9 +417,8 @@ class SearchIndexingBufferedSenderImpl implements SearchIndexingBufferedSende * @param options - Options to modify auto flush. */ export function createSearchIndexingBufferedSender( - // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters - searchClient: SearchClient, + indexDocumentsClient: IndexDocumentsClient, options: SearchIndexingBufferedSenderOptions = {} ): SearchIndexingBufferedSender { - return new SearchIndexingBufferedSenderImpl(searchClient, options); + return new SearchIndexingBufferedSenderImpl(indexDocumentsClient, options); } diff --git a/sdk/search/search-documents/src/serialization.ts b/sdk/search/search-documents/src/serialization.ts index e3d77dd8a49f..d621b7703eef 100644 --- a/sdk/search/search-documents/src/serialization.ts +++ b/sdk/search/search-documents/src/serialization.ts @@ -24,7 +24,8 @@ export function deserialize(obj: unknown): OutputT { } function walk(start: unknown, mapper: (val: any) => any): any { - const seenMarker = new WeakMap, boolean>(); + // eslint-disable-next-line @typescript-eslint/ban-types + const seenMarker = new WeakMap(); const result = { value: undefined }; const queue: { value: any; parent: any; key: string }[] = [ { value: start, parent: result, key: "value" } diff --git a/sdk/search/search-documents/src/serviceModels.ts b/sdk/search/search-documents/src/serviceModels.ts index da52fb4c255c..0fce983cb574 100644 --- a/sdk/search/search-documents/src/serviceModels.ts +++ b/sdk/search/search-documents/src/serviceModels.ts @@ -381,7 +381,7 @@ export interface PatternAnalyzer { lowerCaseTerms?: boolean; /** * A regular expression pattern to match token separators. Default is an expression that matches - * one or more whitespace characters. Default value: '\\W+'. + * one or more whitespace characters. Default value: `\W+`. */ pattern?: string; /** @@ -479,7 +479,7 @@ export interface PatternTokenizer { name: string; /** * A regular expression pattern to match token separators. Default is an expression that matches - * one or more whitespace characters. Default value: '\\W+'. + * one or more whitespace characters. Default value: `\W+`. */ pattern?: string; /** @@ -862,22 +862,16 @@ export interface SynonymMap { * as needed during iteration. Use .byPage() to make one request to the server * per iteration. */ -export type IndexIterator = PagedAsyncIterableIterator< - SearchIndex, - SearchIndex[], - Record ->; +// eslint-disable-next-line @typescript-eslint/ban-types +export type IndexIterator = PagedAsyncIterableIterator; /** * An iterator for listing the indexes that exist in the Search service. Will make requests * as needed during iteration. Use .byPage() to make one request to the server * per iteration. */ -export type IndexNameIterator = PagedAsyncIterableIterator< - string, - string[], - Record ->; +// eslint-disable-next-line @typescript-eslint/ban-types +export type IndexNameIterator = PagedAsyncIterableIterator; /** * Represents a search index definition, which describes the fields and search behavior of an