UNPKG

@azure/search-documents

Version:
48 lines (47 loc) 2.23 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 searchIndexerContext_exports = {}; __export(searchIndexerContext_exports, { createSearchIndexer: () => createSearchIndexer }); module.exports = __toCommonJS(searchIndexerContext_exports); var import_logger = require("../../logger.js"); var import_core_client = require("@azure-rest/core-client"); function createSearchIndexer(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 ?? 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 }; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { createSearchIndexer }); //# sourceMappingURL=searchIndexerContext.js.map