UNPKG

@azure/search-documents

Version:
48 lines (47 loc) 2.19 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var searchContext_exports = {}; __export(searchContext_exports, { createSearch: () => createSearch }); module.exports = __toCommonJS(searchContext_exports); var import_logger = require("../../logger.js"); var import_core_client = require("@azure-rest/core-client"); function createSearch(endpointParam, credential, indexName, 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 ?? import_logger.logger.info }, credentials: { scopes: options.credentials?.scopes ?? ["https://search.azure.com/.default"], apiKeyHeaderName: options.credentials?.apiKeyHeaderName ?? "api-key" } }; const clientContext = (0, import_core_client.getClient)(endpointUrl, credential, updatedOptions); const apiVersion = options.apiVersion; return { ...clientContext, apiVersion, indexName }; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { createSearch }); //# sourceMappingURL=searchContext.js.map