<commit_before>import { BaseClient } from './base-client';
import { HOST_BASE } from './host_base';
import { ConsoleLogger, Logger } from './logger';
import { ElementsHeaders } from './network';
import { RequestOptions } from './request';
import { RetryStrategyOptions } from './retry-strategy';
import { Subscription, SubscriptionListeners } from './subscription';
import { TokenProvider } from './token-provider';

export interface InstanceOptions {
  locator: string;
  serviceName: string;
  serviceVersion: string;
  host?: string; // Allows injection of the hostname explicitly
  logger?: Logger;
  client?: BaseClient;
  encrypted?: boolean;
  tokenProvider?: TokenProvider;
}

export interface SubscribeOptions {
  path: string;
  headers?: ElementsHeaders;
  listeners: SubscriptionListeners;
  retryStrategyOptions?: RetryStrategyOptions;
  tokenProvider?: TokenProvider;
}

export interface ResumableSubscribeOptions extends SubscribeOptions {
  initialEventId?: string;
}

export default class Instance {
  logger: Logger;
  private client: BaseClient;
  private host: string;
  private id: string;
  private cluster: string;
  private platformVersion: string;
  private serviceVersion: string;
  private serviceName: string;
  private tokenProvider?: TokenProvider;

  constructor(options: InstanceOptions) {
    if (!options.locator) {
      throw new Error('Expected `locator` property in Instance options!');
    }

    const splitInstanceLocator = options.locator.split(':');
    if (splitInstanceLocator.length !== 3) {
      throw new Error('The instance locator property is in the wrong format!');
    }

    if (!options.serviceName) {
      throw new Error('Expected `serviceName` property in Instance options!');
    }

    if (!options.serviceVersion) {
      throw new Error(
        'Expected `serviceVersion` property in Instance otpions!',
      );
    }

    this.platformVersion = splitInstanceLocator[0];
    this.cluster = splitInstanceLocator[1];<commit_msg>Make tokenProvider on Instance public<commit_after>import { BaseClient } from './base-client';
import { HOST_BASE } from './host_base';
import { ConsoleLogger, Logger } from './logger';
import { ElementsHeaders } from './network';
import { RequestOptions } from './request';
import { RetryStrategyOptions } from './retry-strategy';
import { Subscription, SubscriptionListeners } from './subscription';
import { TokenProvider } from './token-provider';

export interface InstanceOptions {
  locator: string;
  serviceName: string;
  serviceVersion: string;
  host?: string; // Allows injection of the hostname explicitly
  logger?: Logger;
  client?: BaseClient;
  encrypted?: boolean;
  tokenProvider?: TokenProvider;
}

export interface SubscribeOptions {
  path: string;
  headers?: ElementsHeaders;
  listeners: SubscriptionListeners;
  retryStrategyOptions?: RetryStrategyOptions;
  tokenProvider?: TokenProvider;
}

export interface ResumableSubscribeOptions extends SubscribeOptions {
  initialEventId?: string;
}

export default class Instance {
  logger: Logger;
  tokenProvider?: TokenProvider;
  private client: BaseClient;
  private host: string;
  private id: string;
  private cluster: string;
  private platformVersion: string;
  private serviceVersion: string;
  private serviceName: string;

  constructor(options: InstanceOptions) {
    if (!options.locator) {
      throw new Error('Expected `locator` property in Instance options!');
    }

    const splitInstanceLocator = options.locator.split(':');
    if (splitInstanceLocator.length !== 3) {
      throw new Error('The instance locator property is in the wrong format!');
    }

    if (!options.serviceName) {
      throw new Error('Expected `serviceName` property in Instance options!');
    }

    if (!options.serviceVersion) {
      throw new Error(
        'Expected `serviceVersion` property in Instance otpions!',
      );
    }

    this.platformVersion = splitInstanceLocator[0];
    this.cluster = splitInstanceLocator[1];
{'fraction_non_alphanumeric': 0.10455227613806903, 'fraction_numerical': 0.0015007503751875938, 'mean_word_length': 4.404054054054054, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5347082', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1059, 'n_words': 328}