UNPKG

@azure/search-documents

Version:
25 lines 1.23 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { logger } from "../../logger.js"; import { getClient } from "@azure-rest/core-client"; export function createSearchIndex(endpointParam, credential, options = {}) { const endpointUrl = options.endpoint ?? String(endpointParam); const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; const userAgentInfo = `azsdk-js-search-documents/13.0.0`; const userAgentPrefix = prefixFromOptions ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` : `azsdk-js-api ${userAgentInfo}`; const { apiVersion: _, ...updatedOptions } = { ...options, userAgentOptions: { userAgentPrefix }, loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, credentials: { scopes: options.credentials?.scopes ?? ["https://search.azure.com/.default"], apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key", }, }; const clientContext = getClient(endpointUrl, credential, updatedOptions); const apiVersion = options.apiVersion; return { ...clientContext, apiVersion }; } //# sourceMappingURL=searchIndexContext.js.map