private validateConfig()

in packages/search-ui-elasticsearch-connector/src/transporter/ApiClientTransporter.ts [26:52]


  private validateConfig(): void {
    if (!this.config.index) {
      throw new Error("Index name is required");
    }

    if (!this.config.host && !this.config.cloud) {
      throw new Error("Either host or cloud configuration must be provided");
    }

    if (this.config.host) {
      try {
        new URL(this.config.host);
      } catch (e) {
        throw new Error("Invalid host URL format");
      }
    }

    if (this.config.cloud) {
      if (!this.config.cloud.id) {
        throw new Error("Cloud ID is required");
      }

      if (!this.config.cloud.id.includes(":")) {
        throw new Error("Invalid cloud ID format");
      }
    }
  }