{"version":3,"sources":["../src/errors.ts","../src/results/chunkCombiner.ts","../src/options.ts","../src/util/logger.ts","../src/util/escape.ts","../src/util/time.ts","../src/util/common.ts","../src/util/generics.ts","../src/PointValues.ts","../src/Point.ts","../src/impl/node/NodeHttpTransport.ts","../src/impl/completeCommunicationObserver.ts","../src/impl/version.ts","../src/impl/node/rpc.ts","../src/util/fixUrl.ts","../src/impl/node/index.ts","../src/impl/WriteApiImpl.ts","../src/impl/QueryApiImpl.ts","../src/generated/flight/Flight.ts","../../../node_modules/@protobuf-ts/runtime/build/es2015/json-typings.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/base64.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/binary-format-contract.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/goog-varint.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/pb-long.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/binary-reader.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/assert.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/binary-writer.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/json-format-contract.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/message-type-contract.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/lower-camel-case.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-info.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/oneof.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-type-check.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-long-convert.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-json-reader.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-json-writer.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-scalar-default.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-binary-reader.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-binary-writer.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-create.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-merge-partial.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/reflection-equals.js","../../../node_modules/@protobuf-ts/runtime/build/es2015/message-type.js","../src/generated/flight/google/protobuf/timestamp.ts","../src/generated/flight/Flight.client.ts","../src/util/sql.ts","../src/util/TypeCasting.ts","../src/InfluxDBClient.ts"],"sourcesContent":["import {Headers} from './results'\n\nfunction formatErrorMessage(node: any): string | undefined {\n  if (!node || typeof node !== 'object' || Array.isArray(node)) {\n    return undefined\n  }\n  const message = typeof node.message === 'string' ? node.message : undefined\n  if (message) {\n    return message\n  }\n\n  const errorText = typeof node.error === 'string' ? node.error : undefined\n  const data = node.data\n  if (errorText && Array.isArray(data)) {\n    const details: string[] = []\n    for (const item of data) {\n      if (!item || typeof item !== 'object' || Array.isArray(item)) {\n        continue\n      }\n      const lineNumber = item.line_number\n      const errorMessage = item.error_message\n      const originalLine = item.original_line\n      if (\n        lineNumber !== undefined &&\n        lineNumber !== null &&\n        typeof errorMessage === 'string' &&\n        errorMessage.length > 0 &&\n        typeof originalLine === 'string' &&\n        originalLine.length > 0\n      ) {\n        details.push(`\\tline ${lineNumber}: ${errorMessage} (${originalLine})`)\n      } else if (typeof errorMessage === 'string' && errorMessage.length > 0) {\n        details.push(`\\t${errorMessage}`)\n      }\n    }\n    if (details.length) {\n      return `${errorText}:\\n${details.join('\\n')}`\n    }\n    return errorText\n  }\n  if (data && typeof data === 'object' && !Array.isArray(data)) {\n    const errorMessage = (data as {error_message?: unknown}).error_message\n    if (typeof errorMessage === 'string' && errorMessage.length > 0) {\n      return errorMessage\n    }\n  }\n  if (errorText) {\n    return errorText\n  }\n\n  return undefined\n}\n\n/** IllegalArgumentError is thrown when illegal argument is supplied. */\nexport class IllegalArgumentError extends Error {\n  /* istanbul ignore next */\n  constructor(message: string) {\n    super(message)\n    this.name = 'IllegalArgumentError'\n    Object.setPrototypeOf(this, IllegalArgumentError.prototype)\n  }\n}\n\n/**\n * A general HTTP error.\n */\nexport class HttpError extends Error {\n  /** application error code, when available */\n  public code: string | undefined\n  /** json error response */\n  public json: any\n\n  /* istanbul ignore next because of super() not being covered*/\n  constructor(\n    readonly statusCode: number,\n    readonly statusMessage: string | undefined,\n    readonly body?: string,\n    readonly contentType?: string | undefined | null,\n    readonly headers?: Headers | null,\n    message?: string\n  ) {\n    super()\n    Object.setPrototypeOf(this, HttpError.prototype)\n    if (message) {\n      this.message = message\n    } else if (body) {\n      // Core/Enterprise may not set Content-Type header\n      if (contentType?.startsWith('application/json') || !contentType) {\n        try {\n          this.json = JSON.parse(body)\n          if (typeof this.json?.code === 'string') {\n            this.code = this.json.code\n          }\n          const parsedMessage = formatErrorMessage(this.json)\n          if (parsedMessage) {\n            this.message = parsedMessage\n          }\n        } catch (e) {\n          // silently ignore, body string is still available\n        }\n      }\n    }\n    if (!this.message) {\n      this.message = `${statusCode} ${statusMessage} : ${body}`\n    }\n    this.name = 'HttpError'\n  }\n}\n\n/** RequestTimedOutError indicates request timeout in the communication with the server */\nexport class RequestTimedOutError extends Error {\n  /* istanbul ignore next because of super() not being covered */\n  constructor() {\n    super()\n    Object.setPrototypeOf(this, RequestTimedOutError.prototype)\n    this.name = 'RequestTimedOutError'\n    this.message = 'Request timed out'\n  }\n}\n\n/** AbortError indicates that the communication with the server was aborted */\nexport class AbortError extends Error {\n  /* istanbul ignore next because of super() not being covered */\n  constructor() {\n    super()\n    this.name = 'AbortError'\n    Object.setPrototypeOf(this, AbortError.prototype)\n    this.message = 'Response aborted'\n  }\n}\n","/**\n * ChunkCombiner is a simplified platform-neutral manipulation of Uint8arrays\n * that allows to process text data on the fly. The implementation can be optimized\n * for the target platform (node vs browser).\n */\nexport interface ChunkCombiner {\n  /**\n   * Concatenates first and second chunk.\n   * @param first - first chunk\n   * @param second - second chunk\n   * @returns first + second\n   */\n  concat(first: Uint8Array, second: Uint8Array): Uint8Array\n\n  /**\n   * Converts chunk into a string.\n   * @param chunk - chunk\n   * @param start - start index\n   * @param end - end index\n   * @returns string representation of chunk slice\n   */\n  toUtf8String(chunk: Uint8Array, start: number, end: number): string\n\n  /**\n   * Creates a new chunk from the supplied chunk.\n   * @param chunk - chunk to copy\n   * @param start - start index\n   * @param end - end index\n   * @returns a copy of a chunk slice\n   */\n  copy(chunk: Uint8Array, start: number, end: number): Uint8Array\n}\n\n// TextDecoder is available since node v8.3.0 and in all modern browsers\ndeclare class TextDecoder {\n  constructor(encoding: string)\n  decode(chunk: Uint8Array): string\n}\n\n/**\n * Creates a chunk combiner instance that uses UTF-8\n * TextDecoder to decode Uint8Arrays into strings.\n */\nexport function createTextDecoderCombiner(): ChunkCombiner {\n  const decoder = new TextDecoder('utf-8')\n  return {\n    concat(first: Uint8Array, second: Uint8Array): Uint8Array {\n      const retVal = new Uint8Array(first.length + second.length)\n      retVal.set(first)\n      retVal.set(second, first.length)\n      return retVal\n    },\n    copy(chunk: Uint8Array, start: number, end: number): Uint8Array {\n      const retVal = new Uint8Array(end - start)\n      retVal.set(chunk.subarray(start, end))\n      return retVal\n    },\n    toUtf8String(chunk: Uint8Array, start: number, end: number): string {\n      return decoder.decode(chunk.subarray(start, end))\n    },\n  }\n}\n","import {Transport} from './transport'\nimport {QParamType} from './QueryApi'\n\n/**\n * Option for the communication with InfluxDB server.\n */\nexport interface ConnectionOptions {\n  /** base host URL */\n  host: string\n\n  /** authentication token */\n  token?: string\n\n  /** token authentication scheme. Not set for Cloud access, set to 'Bearer' for Core/Enterprise. */\n  authScheme?: string\n\n  /**\n   * socket timeout. Not applicable in browser (option is ignored).\n   * @Deprecated: Please use more specific properties like writeTimeout or WriteOptions.timeout.\n   */\n  timeout?: number\n\n  /**\n   * socket timeout. 10000 milliseconds by default in node.js. Not applicable in browser (option is ignored).\n   * @defaultValue 10000\n   */\n  writeTimeout?: number\n\n  /**\n   * stream timeout for query (grpc timeout). The gRPC doesn't apply the socket timeout to operations as is defined above. To successfully close a call to the gRPC endpoint, the queryTimeout must be specified. Without this timeout, a gRPC call might end up in an infinite wait state.\n   * @defaultValue 60000\n   */\n  queryTimeout?: number\n\n  /**\n   * default database for write query if not present as argument.\n   */\n  database?: string\n  /**\n   * TransportOptions supply extra options for the transport layer, they differ between node.js and browser/deno.\n   * Node.js transport accepts options specified in {@link https://nodejs.org/api/http.html#http_http_request_options_callback | http.request } or\n   * {@link https://nodejs.org/api/https.html#https_https_request_options_callback | https.request }. For example, an `agent` property can be set to\n   * {@link https://www.npmjs.com/package/proxy-http-agent | setup HTTP/HTTPS proxy }, {@link  https://nodejs.org/api/tls.html#tls_tls_connect_options_callback | rejectUnauthorized }\n   * property can disable TLS server certificate verification. Additionally,\n   * {@link https://github.com/follow-redirects/follow-redirects | follow-redirects } property can be also specified\n   * in order to follow redirects in node.js.\n   * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | fetch } is used under the hood in browser/deno.\n   * For example,\n   * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | redirect } property can be set to 'error' to abort request if a redirect occurs.\n   */\n  transportOptions?: {[key: string]: any}\n  /**\n   * Default HTTP headers to send with every request.\n   */\n  headers?: Record<string, string>\n  /**\n   * Full HTTP web proxy URL including schema, for example http://your-proxy:8080.\n   */\n  proxyUrl?: string\n\n  /**\n   * Grpc options to be passed when instantiating query transport. See supported channel options in @grpc/grpc-js/README.md.\n   */\n  grpcOptions?: Record<string, any>\n}\n\n/** default connection options */\nexport const DEFAULT_ConnectionOptions: Readonly<Partial<ConnectionOptions>> = {\n  // Legacy timeout property. Will be removed in the future. Use writeTimeout or WriteOptions.timeout instead.\n  timeout: undefined,\n  writeTimeout: 10_000,\n  queryTimeout: 60_000,\n}\n\n/**\n * Options used by {@link InfluxDBClient.default.write} .\n *\n * @example WriteOptions in write call\n * ```typescript\n *       client\n *         .write(point, DATABASE, 'cpu', {\n *           headers: {\n *             'channel-lane': 'reserved',\n *             'notify-central': '30m',\n *           },\n *           precision: 'ns',\n *           gzipThreshold: 1000,\n *           noSync: false,\n *         })\n * ```\n */\nexport interface WriteOptions {\n  /** Precision to use in writes for timestamp. default ns */\n  precision?: WritePrecision\n  /** HTTP headers that will be sent with every write request */\n  //headers?: {[key: string]: string}\n  headers?: Record<string, string>\n  /** When specified, write bodies larger than the threshold are gzipped  */\n  gzipThreshold?: number\n  /**\n   * Instructs the server whether to wait with the response until WAL persistence completes.\n   * noSync=true means faster write but without the confirmation that the data was persisted.\n   *\n   * Note: This option is supported by InfluxDB 3 Core and Enterprise servers only.\n   * For other InfluxDB 3 server types (InfluxDB Clustered, InfluxDB Clould Serverless/Dedicated)\n   * the write operation will fail with an error.\n   *\n   * Default value: false.\n   */\n  noSync?: boolean\n  /** default tags\n   *\n   * @example Default tags using client config\n   * ```typescript\n   * const client = new InfluxDBClient({\n   *            host: 'https://eu-west-1-1.aws.cloud2.influxdata.com',\n   *            writeOptions: {\n   *              defaultTags: {\n   *                device: 'nrdc-th-52-fd889e03',\n   *              },\n   *            },\n   * })\n   *\n   * const p = Point.measurement('measurement').setField('num', 3)\n   *\n   * // this will write point with device=device-a tag\n   * await client.write(p, 'my-db')\n   * ```\n   *\n   * @example Default tags using writeOptions argument\n   * ```typescript\n   * const client = new InfluxDBClient({\n   *            host: 'https://eu-west-1-1.aws.cloud2.influxdata.com',\n   * })\n   *\n   * const defaultTags = {\n   *            device: 'rpi5_0_0599e8d7',\n   * }\n   *\n   * const p = Point.measurement('measurement').setField('num', 3)\n   *\n   * // this will write point with device=device-a tag\n   * await client.write(p, 'my-db', undefined, {defaultTags})\n   * ```\n   */\n  defaultTags?: {[key: string]: string}\n  /**\n   * Preferred order of tags in line protocol serialization.\n   * Tags listed here are written first, in the same order.\n   * Remaining tags are appended in lexicographical order.\n   *\n   * This helps control first-write column order in InfluxDB 3.\n   */\n  tagOrder?: string[]\n  /**  Specific timeout for the writing call. If not set, the value from {@link ConnectionOptions.writeTimeout} is used by default.  */\n  timeout?: number\n}\n\n/** default writeOptions */\nexport const DEFAULT_WriteOptions: WriteOptions = {\n  precision: 'ns',\n  gzipThreshold: 1000,\n  noSync: false,\n}\n\nexport type QueryType = 'sql' | 'influxql'\n\n/**\n * Options used by {@link InfluxDBClient.default.query} and by {@link InfluxDBClient.default.queryPoints}.\n *\n * @example QueryOptions in queryCall\n * ```typescript\n * const data = client.query('SELECT * FROM drive', 'ev_onboard_45ae770c', {\n *       type: 'sql',\n *       headers: {\n *         'one-off': 'totl', // one-off query header\n *         'change-on': 'shift1', // over-write universal value\n *       },\n *       params: {\n *         point: 'a7',\n *         action: 'reverse',\n *       },\n *     })\n * ```\n */\nexport interface QueryOptions {\n  /** Type of query being sent, e.g. 'sql' or 'influxql'.*/\n  type: QueryType\n  /** Custom headers to add to the request.*/\n  headers?: Record<string, string>\n  /** Parameters to accompany a query using them.*/\n  params?: Record<string, QParamType>\n  /** GRPC specific Parameters to be set when instantiating a client\n   * See supported channel options in @grpc/grpc-js/README.md. **/\n  grpcOptions?: Record<string, any>\n  /**  Specific timeout for the query. If not set, the value from {@link ConnectionOptions.queryTimeout} is used by default.  */\n  timeout?: number\n}\n\n/** Default QueryOptions */\nexport const DEFAULT_QueryOptions: QueryOptions = {\n  type: 'sql',\n}\n\n/**\n * Options used by {@link InfluxDBClient} .\n */\nexport interface ClientOptions extends ConnectionOptions {\n  /** supplies query options to be use with each and every query.*/\n  queryOptions?: Partial<QueryOptions>\n  /** supplies and overrides default writing options.*/\n  writeOptions?: Partial<WriteOptions>\n  /** specifies custom transport */\n  transport?: Transport\n}\n\n/**\n * Timestamp precision used in write operations.\n * See {@link https://docs.influxdata.com/influxdb/latest/api/#operation/PostWrite }\n */\nexport type WritePrecision = 'ns' | 'us' | 'ms' | 's'\n\n/**\n * Parses connection string into `ClientOptions`.\n * @param connectionString - connection string\n */\nexport function fromConnectionString(connectionString: string): ClientOptions {\n  if (!connectionString) {\n    throw Error('Connection string not set!')\n  }\n  const url = new URL(connectionString.trim(), 'http://localhost') // artificial base is ignored when url is absolute\n  const options: ClientOptions = {\n    host:\n      connectionString.indexOf('://') > 0\n        ? url.origin + url.pathname\n        : url.pathname,\n  }\n  if (url.searchParams.has('token')) {\n    options.token = url.searchParams.get('token') as string\n  }\n  if (url.searchParams.has('authScheme')) {\n    options.authScheme = url.searchParams.get('authScheme') as string\n  }\n  if (url.searchParams.has('database')) {\n    options.database = url.searchParams.get('database') as string\n  }\n  if (url.searchParams.has('timeout')) {\n    options.timeout = parseInt(url.searchParams.get('timeout') as string)\n  }\n  if (url.searchParams.has('precision')) {\n    if (!options.writeOptions) options.writeOptions = {} as WriteOptions\n    options.writeOptions.precision = parsePrecision(\n      url.searchParams.get('precision') as string\n    )\n  }\n  if (url.searchParams.has('gzipThreshold')) {\n    if (!options.writeOptions) options.writeOptions = {} as WriteOptions\n    options.writeOptions.gzipThreshold = parseInt(\n      url.searchParams.get('gzipThreshold') as string\n    )\n  }\n  if (url.searchParams.has('writeNoSync')) {\n    if (!options.writeOptions) options.writeOptions = {} as WriteOptions\n    options.writeOptions.noSync = parseBoolean(\n      url.searchParams.get('writeNoSync') as string\n    )\n  }\n\n  return options\n}\n\n/**\n * Creates `ClientOptions` from environment variables.\n */\nexport function fromEnv(): ClientOptions {\n  if (!process.env.INFLUX_HOST) {\n    throw Error('INFLUX_HOST variable not set!')\n  }\n  if (!process.env.INFLUX_TOKEN) {\n    throw Error('INFLUX_TOKEN variable not set!')\n  }\n  const options: ClientOptions = {\n    host: process.env.INFLUX_HOST.trim(),\n  }\n  if (process.env.INFLUX_TOKEN) {\n    options.token = process.env.INFLUX_TOKEN.trim()\n  }\n  if (process.env.INFLUX_AUTH_SCHEME) {\n    options.authScheme = process.env.INFLUX_AUTH_SCHEME.trim()\n  }\n  if (process.env.INFLUX_DATABASE) {\n    options.database = process.env.INFLUX_DATABASE.trim()\n  }\n  if (process.env.INFLUX_TIMEOUT) {\n    options.timeout = parseInt(process.env.INFLUX_TIMEOUT.trim())\n  }\n  if (process.env.INFLUX_PRECISION) {\n    if (!options.writeOptions) options.writeOptions = {} as WriteOptions\n    options.writeOptions.precision = parsePrecision(\n      process.env.INFLUX_PRECISION as string\n    )\n  }\n  if (process.env.INFLUX_GZIP_THRESHOLD) {\n    if (!options.writeOptions) options.writeOptions = {} as WriteOptions\n    options.writeOptions.gzipThreshold = parseInt(\n      process.env.INFLUX_GZIP_THRESHOLD\n    )\n  }\n  if (process.env.INFLUX_WRITE_NO_SYNC) {\n    if (!options.writeOptions) options.writeOptions = {} as WriteOptions\n    options.writeOptions.noSync = parseBoolean(process.env.INFLUX_WRITE_NO_SYNC)\n  }\n  if (process.env.INFLUX_GRPC_OPTIONS) {\n    const optionSets = process.env.INFLUX_GRPC_OPTIONS.split(',')\n    if (!options.grpcOptions) options.grpcOptions = {} as Record<string, any>\n    for (const optSet of optionSets) {\n      const kvPair = optSet.split('=')\n      // ignore malformed values\n      if (kvPair.length != 2) {\n        continue\n      }\n      let value: any = parseInt(kvPair[1])\n      if (Number.isNaN(value)) {\n        value = parseFloat(kvPair[1])\n        if (Number.isNaN(value)) {\n          value = kvPair[1]\n        }\n      }\n      options.grpcOptions[kvPair[0]] = value\n    }\n  }\n\n  return options\n}\n\nfunction parseBoolean(value: string): boolean {\n  return ['true', '1', 't', 'y', 'yes'].includes(value.trim().toLowerCase())\n}\n\nexport function precisionToV2ApiString(precision: WritePrecision): string {\n  switch (precision) {\n    case 'ns':\n    case 'us':\n    case 'ms':\n    case 's':\n      return precision as string\n    default:\n      throw Error(`Unsupported precision '${precision}'`)\n  }\n}\n\nexport function precisionToV3ApiString(precision: WritePrecision): string {\n  switch (precision) {\n    case 'ns':\n      return 'nanosecond'\n    case 'us':\n      return 'microsecond'\n    case 'ms':\n      return 'millisecond'\n    case 's':\n      return 'second'\n    default:\n      throw Error(`Unsupported precision '${precision}'`)\n  }\n}\n\nexport function parsePrecision(value: string): WritePrecision {\n  switch (value.trim().toLowerCase()) {\n    case 'ns':\n    case 'nanosecond':\n      return 'ns'\n    case 'us':\n    case 'microsecond':\n      return 'us'\n    case 'ms':\n    case 'millisecond':\n      return 'ms'\n    case 's':\n    case 'second':\n      return 's'\n    default:\n      throw Error(`Unsupported precision '${value}'`)\n  }\n}\n","/**\n * Logging interface.\n */\nexport interface Logger {\n  error(message: string, err?: any): void\n  warn(message: string, err?: any): void\n}\n\n/**\n * Logger that logs to console.out\n */\nexport const consoleLogger: Logger = {\n  error(message, error) {\n    // eslint-disable-next-line no-console\n    console.error(`ERROR: ${message}`, error ? error : '')\n  },\n  warn(message, error) {\n    // eslint-disable-next-line no-console\n    console.warn(`WARN: ${message}`, error ? error : '')\n  },\n}\nlet provider: Logger = consoleLogger\n\nexport const Log: Logger = {\n  error(message, error) {\n    provider.error(message, error)\n  },\n  warn(message, error) {\n    provider.warn(message, error)\n  },\n}\n\n/**\n * Sets custom logger.\n * @param logger - logger to use\n * @returns previous logger\n */\nexport function setLogger(logger: Logger): Logger {\n  const previous = provider\n  provider = logger\n  return previous\n}\n","function createEscaper(\n  characters: string,\n  replacements: string[]\n): (value: string) => string {\n  return function (value: string): string {\n    let retVal = ''\n    let from = 0\n    let i = 0\n    while (i < value.length) {\n      const found = characters.indexOf(value[i])\n      if (found >= 0) {\n        retVal += value.substring(from, i)\n        retVal += replacements[found]\n        from = i + 1\n      }\n      i++\n    }\n    if (from == 0) {\n      return value\n    } else if (from < value.length) {\n      retVal += value.substring(from, value.length)\n    }\n    return retVal\n  }\n}\nfunction createQuotedEscaper(\n  characters: string,\n  replacements: string[]\n): (value: string) => string {\n  const escaper = createEscaper(characters, replacements)\n  return (value: string): string => `\"${escaper(value)}\"`\n}\n\n/**\n * Provides functions escape specific parts in InfluxDB line protocol.\n */\nexport const escape = {\n  /**\n   * Measurement escapes measurement names.\n   */\n  measurement: createEscaper(', \\n\\r\\t', ['\\\\,', '\\\\ ', '\\\\n', '\\\\r', '\\\\t']),\n  /**\n   * Quoted escapes quoted values, such as database names.\n   */\n  quoted: createQuotedEscaper('\"\\\\', ['\\\\\"', '\\\\\\\\']),\n\n  /**\n   * TagEscaper escapes tag keys, tag values, and field keys.\n   */\n  tag: createEscaper(', =\\n\\r\\t', ['\\\\,', '\\\\ ', '\\\\=', '\\\\n', '\\\\r', '\\\\t']),\n}\n","import {WritePrecision} from '../options'\n\ndeclare let process: any\nconst zeroPadding = '000000000'\nlet useHrTime = false\n\nexport function useProcessHrtime(use: boolean): boolean {\n  /* istanbul ignore else */\n  if (!process.env.BUILD_BROWSER) {\n    return (useHrTime = use && process && typeof process.hrtime === 'function')\n  } else {\n    return false\n  }\n}\nuseProcessHrtime(true) // preffer node\n\nlet startHrMillis: number | undefined = undefined\nlet startHrTime: [number, number] | undefined = undefined\nlet lastMillis = Date.now()\nlet stepsInMillis = 0\nfunction nanos(): string {\n  if (!process.env.BUILD_BROWSER && useHrTime) {\n    const hrTime = process.hrtime() as [number, number]\n    let millis = Date.now()\n    if (!startHrTime) {\n      startHrTime = hrTime\n      startHrMillis = millis\n    } else {\n      hrTime[0] = hrTime[0] - startHrTime[0]\n      hrTime[1] = hrTime[1] - startHrTime[1]\n      // istanbul ignore next \"cannot mock system clock, manually reviewed\"\n      if (hrTime[1] < 0) {\n        hrTime[0] -= 1\n        hrTime[1] += 1000_000_000\n      }\n      millis =\n        (startHrMillis as number) +\n        hrTime[0] * 1000 +\n        Math.floor(hrTime[1] / 1000_000)\n    }\n    const nanos = String(hrTime[1] % 1000_000)\n    return String(millis) + zeroPadding.substr(0, 6 - nanos.length) + nanos\n  } else {\n    const millis = Date.now()\n    if (millis !== lastMillis) {\n      lastMillis = millis\n      stepsInMillis = 0\n    } else {\n      stepsInMillis++\n    }\n    const nanos = String(stepsInMillis)\n    return String(millis) + zeroPadding.substr(0, 6 - nanos.length) + nanos\n  }\n}\n\nfunction micros(): string {\n  if (!process.env.BUILD_BROWSER && useHrTime) {\n    const hrTime = process.hrtime() as [number, number]\n    const micros = String(Math.trunc(hrTime[1] / 1000) % 1000)\n    return (\n      String(Date.now()) + zeroPadding.substr(0, 3 - micros.length) + micros\n    )\n  } else {\n    return String(Date.now()) + zeroPadding.substr(0, 3)\n  }\n}\nfunction millis(): string {\n  return String(Date.now())\n}\nfunction seconds(): string {\n  return String(Math.floor(Date.now() / 1000))\n}\n\n/**\n * Exposes functions that creates strings that represent a timestamp that\n * can be used in the line protocol. Micro and nano timestamps are emulated\n * depending on the js platform in use.\n */\nexport const currentTime = {\n  s: seconds as () => string,\n  ms: millis as () => string,\n  us: micros as () => string,\n  ns: nanos as () => string,\n  seconds: seconds as () => string,\n  millis: millis as () => string,\n  micros: micros as () => string,\n  nanos: nanos as () => string,\n}\n\n/**\n * dateToProtocolTimestamp provides converters for JavaScript Date to InfluxDB Write Protocol Timestamp. Keys are supported precisions.\n */\nexport const dateToProtocolTimestamp = {\n  s: (d: Date): string => `${Math.floor(d.getTime() / 1000)}`,\n  ms: (d: Date): string => `${d.getTime()}`,\n  us: (d: Date): string => `${d.getTime()}000`,\n  ns: (d: Date): string => `${d.getTime()}000000`,\n}\n\n/**\n * convertTimeToNanos converts Point's timestamp to a string.\n * @param value - supported timestamp value\n * @returns line protocol value\n */\nexport function convertTimeToNanos(\n  value: string | number | Date | undefined\n): string | undefined {\n  if (value === undefined) {\n    return nanos()\n  } else if (typeof value === 'string') {\n    return value.length > 0 ? value : undefined\n  } else if (value instanceof Date) {\n    return `${value.getTime()}000000`\n  } else if (typeof value === 'number') {\n    return String(Math.floor(value))\n  } else {\n    return String(value)\n  }\n}\n\nexport const convertTime = (\n  value: string | number | Date | undefined,\n  precision: WritePrecision = 'ns'\n): string | undefined => {\n  if (value === undefined) {\n    return currentTime[precision]()\n  } else if (typeof value === 'string') {\n    return value.length > 0 ? value : undefined\n  } else if (value instanceof Date) {\n    return dateToProtocolTimestamp[precision](value)\n  } else if (typeof value === 'number') {\n    return String(Math.floor(value))\n  } else {\n    return String(value)\n  }\n}\n","type Defined<T> = Exclude<T, undefined>\n\n/**\n * allows to throw error as expression\n */\nexport const throwReturn = <T>(err: Error): Defined<T> => {\n  throw err\n}\n\nexport const isDefined = <T>(value: T): value is Defined<T> =>\n  value !== undefined\n\nexport const isArrayLike = <T>(value: any): value is ArrayLike<T> =>\n  value instanceof Array ||\n  (value instanceof Object &&\n    typeof value.length === 'number' &&\n    (value.length === 0 ||\n      Object.getOwnPropertyNames(value).some((x) => x === '0')))\n\nexport const createInt32Uint8Array = (value: number): Uint8Array => {\n  const bytes = new Uint8Array(4)\n  bytes[0] = value >> (8 * 0)\n  bytes[1] = value >> (8 * 1)\n  bytes[2] = value >> (8 * 2)\n  bytes[3] = value >> (8 * 3)\n  return bytes\n}\n\nexport const collectAll = async <T>(\n  generator: AsyncGenerator<T, any, any>\n): Promise<T[]> => {\n  const results: T[] = []\n  for await (const value of generator) {\n    results.push(value)\n  }\n  return results\n}\n\n/**\n * Check if an input value is a valid number.\n *\n * @param value - The value to check\n * @returns Returns true if the value is a valid number else false\n */\nexport const isNumber = (value?: number | string | null): boolean => {\n  if (value === null || undefined) {\n    return false\n  }\n\n  if (\n    typeof value === 'string' &&\n    (value === '' || value.indexOf(' ') !== -1)\n  ) {\n    return false\n  }\n\n  return value !== '' && !isNaN(Number(value?.toString()))\n}\n\n/**\n * Check if an input value is a valid unsigned number.\n *\n * @param value - The value to check\n * @returns Returns true if the value is a valid unsigned number else false\n */\nexport const isUnsignedNumber = (value?: number | string | null): boolean => {\n  if (!isNumber(value)) {\n    return false\n  }\n\n  if (typeof value === 'string') {\n    return Number(value) >= 0\n  }\n\n  return typeof value === 'number' && value >= 0\n}\n","import {Point} from '../Point'\nimport {isArrayLike, isDefined} from './common'\n\n/**\n * The `WritableData` type represents different types of data that can be written.\n * The data can either be a uniform ArrayLike collection or a single value of the following types:\n *\n * - `Point`: Represents a {@link Point} object.\n *\n * - `string`: Represents lines of the [Line Protocol](https://bit.ly/2QL99fu).\n */\nexport type WritableData = ArrayLike<string> | ArrayLike<Point> | string | Point\n\nexport const writableDataToLineProtocol = (\n  data: WritableData,\n  defaultTags?: {[key: string]: string},\n  tagOrder?: string[]\n): string[] => {\n  const arrayData = (\n    isArrayLike(data) && typeof data !== 'string'\n      ? Array.from(data as any)\n      : [data]\n  ) as string[] | Point[]\n  if (arrayData.length === 0) return []\n\n  const isLine = typeof arrayData[0] === 'string'\n\n  return isLine\n    ? (arrayData as string[])\n    : (arrayData as Point[])\n        .map((p) => p.toLineProtocol(undefined, defaultTags, tagOrder))\n        .filter(isDefined)\n}\n","import {Point} from './Point'\n\nexport type PointFieldType =\n  | 'float'\n  | 'integer'\n  | 'uinteger'\n  | 'string'\n  | 'boolean'\n\ntype FieldEntryFloat = ['float', number]\ntype FieldEntryInteger = ['integer', number]\ntype FieldEntryUinteger = ['uinteger', number]\ntype FieldEntryString = ['string', string]\ntype FieldEntryBoolean = ['boolean', boolean]\n\ntype FieldEntry =\n  | FieldEntryFloat\n  | FieldEntryInteger\n  | FieldEntryUinteger\n  | FieldEntryString\n  | FieldEntryBoolean\n\nconst inferType = (\n  value: number | string | boolean | undefined\n): PointFieldType | undefined => {\n  if (typeof value === 'number') return 'float'\n  else if (typeof value === 'string') return 'string'\n  else if (typeof value === 'boolean') return 'boolean'\n  else return undefined\n}\n\nexport class GetFieldTypeMissmatchError extends Error {\n  /* istanbul ignore next */\n  constructor(\n    fieldName: string,\n    expectedType: PointFieldType,\n    actualType: PointFieldType\n  ) {\n    super(\n      `field ${fieldName} of type ${actualType} doesn't match expected type ${expectedType}!`\n    )\n    this.name = 'GetFieldTypeMissmatchError'\n    Object.setPrototypeOf(this, GetFieldTypeMissmatchError.prototype)\n  }\n}\n\n/**\n * Point defines values of a single measurement.\n */\nexport class PointValues {\n  private _name: string | undefined\n  private _time: string | number | Date | undefined\n  private _tags: {[key: string]: string} = {}\n  private _fields: {[key: string]: FieldEntry} = {}\n\n  /**\n   * Create an empty PointValues.\n   */\n  constructor() {}\n\n  /**\n   * Get measurement name. Can be undefined if not set.\n   * It will return undefined when querying with SQL Query.\n   *\n   * @returns measurement name or undefined\n   */\n  getMeasurement(): string | undefined {\n    return this._name\n  }\n\n  /**\n   * Sets point's measurement.\n   *\n   * @param name - measurement name\n   * @returns this\n   */\n  public setMeasurement(name: string): PointValues {\n    this._name = name\n    return this\n  }\n\n  /**\n   * Get timestamp. Can be undefined if not set.\n   *\n   * @returns timestamp or undefined\n   */\n  public getTimestamp(): Date | number | string | undefined {\n    return this._time\n  }\n\n  /**\n   * Sets point timestamp. Timestamp can be specified as a Date (preferred), number, string\n   * or an undefined value. An undefined value instructs to assign a local timestamp using\n   * the client's clock. An empty string can be used to let the server assign\n   * the timestamp. A number value represents time as a count of time units since epoch, the\n   * exact time unit then depends on the {@link InfluxDBClient.default.write | precision} of the API\n   * that writes the point.\n   *\n   * Beware that the current time in nanoseconds can't precisely fit into a JS number,\n   * which can hold at most 2^53 integer number. Nanosecond precision numbers are thus supplied as\n   * a (base-10) string. An application can also use ES2020 BigInt to represent nanoseconds,\n   * BigInt's `toString()` returns the required high-precision string.\n   *\n   * Note that InfluxDB requires the timestamp to fit into int64 data type.\n   *\n   * @param value - point time\n   * @returns this\n   */\n  public setTimestamp(value: Date | number | string | undefined): PointValues {\n    this._time = value\n    return this\n  }\n\n  /**\n   * Gets value of tag with given name. Returns undefined if tag not found.\n   *\n   * @param name - tag name\n   * @returns tag value or undefined\n   */\n  public getTag(name: string): string | undefined {\n    return this._tags[name]\n  }\n\n  /**\n   * Sets a tag. The caller has to ensure that both name and value are not empty\n   * and do not end with backslash.\n   *\n   * @param name - tag name\n   * @param value - tag value\n   * @returns this\n   */\n  public setTag(name: string, value: string): PointValues {\n    this._tags[name] = value\n    return this\n  }\n\n  /**\n   * Removes a tag with the specified name if it exists; otherwise, it does nothing.\n   *\n   * @param name - The name of the tag to be removed.\n   * @returns this\n   */\n  public removeTag(name: string): PointValues {\n    delete this._tags[name]\n    return this\n  }\n\n  /**\n   * Gets an array of tag names.\n   *\n   * @returns An array of tag names.\n   */\n  public getTagNames(): string[] {\n    return Object.keys(this._tags)\n  }\n\n  /**\n   * Gets the float field value associated with the specified name.\n   * Throws if actual type of field with given name is not float.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @throws {@link GetFieldTypeMissmatchError} Actual type of field doesn't match float type.\n   * @returns The float field value or undefined.\n   */\n  public getFloatField(name: string): number | undefined {\n    return this.getField(name, 'float')\n  }\n\n  /**\n   * Sets a number field.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @returns this\n   * @throws NaN/Infinity/-Infinity is supplied\n   */\n  public setFloatField(name: string, value: number | any): PointValues {\n    let val: number\n    if (typeof value === 'number') {\n      val = value\n    } else {\n      val = parseFloat(value)\n    }\n    if (!isFinite(val)) {\n      throw new Error(`invalid float value for field '${name}': '${value}'!`)\n    }\n\n    this._fields[name] = ['float', val]\n    return this\n  }\n\n  /**\n   * Gets the integer field value associated with the specified name.\n   * Throws if actual type of field with given name is not integer.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @throws {@link GetFieldTypeMissmatchError} Actual type of field doesn't match integer type.\n   * @returns The integer field value or undefined.\n   */\n  public getIntegerField(name: string): number | undefined {\n    return this.getField(name, 'integer')\n  }\n\n  /**\n   * Sets an integer field.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @returns this\n   * @throws NaN or out of int64 range value is supplied\n   */\n  public setIntegerField(name: string, value: number | any): PointValues {\n    let val: number\n    if (typeof value === 'number') {\n      val = value\n    } else {\n      val = parseInt(String(value))\n    }\n    if (isNaN(val) || val <= -9223372036854776e3 || val >= 9223372036854776e3) {\n      throw new Error(`invalid integer value for field '${name}': '${value}'!`)\n    }\n    this._fields[name] = ['integer', Math.floor(val)]\n    return this\n  }\n\n  /**\n   * Gets the uint field value associated with the specified name.\n   * Throws if actual type of field with given name is not uint.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @throws {@link GetFieldTypeMissmatchError} Actual type of field doesn't match uint type.\n   * @returns The uint field value or undefined.\n   */\n  public getUintegerField(name: string): number | undefined {\n    return this.getField(name, 'uinteger')\n  }\n\n  /**\n   * Sets an unsigned integer field.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @returns this\n   * @throws NaN out of range value is supplied\n   */\n  public setUintegerField(name: string, value: number | any): PointValues {\n    if (typeof value === 'number') {\n      if (isNaN(value) || value < 0 || value > Number.MAX_SAFE_INTEGER) {\n        throw new Error(`uint value for field '${name}' out of range: ${value}`)\n      }\n      this._fields[name] = ['uinteger', Math.floor(value as number)]\n    } else {\n      const strVal = String(value)\n      for (let i = 0; i < strVal.length; i++) {\n        const code = strVal.charCodeAt(i)\n        if (code < 48 || code > 57) {\n          throw new Error(\n            `uint value has an unsupported character at pos ${i}: ${value}`\n          )\n        }\n      }\n      if (\n        strVal.length > 20 ||\n        (strVal.length === 20 &&\n          strVal.localeCompare('18446744073709551615') > 0)\n      ) {\n        throw new Error(\n          `uint value for field '${name}' out of range: ${strVal}`\n        )\n      }\n      this._fields[name] = ['uinteger', +strVal]\n    }\n    return this\n  }\n\n  /**\n   * Gets the string field value associated with the specified name.\n   * Throws if actual type of field with given name is not string.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @throws {@link GetFieldTypeMissmatchError} Actual type of field doesn't match string type.\n   * @returns The string field value or undefined.\n   */\n  public getStringField(name: string): string | undefined {\n    return this.getField(name, 'string')\n  }\n\n  /**\n   * Sets a string field.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @returns this\n   */\n  public setStringField(name: string, value: string | any): PointValues {\n    if (value !== null && value !== undefined) {\n      if (typeof value !== 'string') value = String(value)\n      this._fields[name] = ['string', value]\n    }\n    return this\n  }\n\n  /**\n   * Gets the boolean field value associated with the specified name.\n   * Throws if actual type of field with given name is not boolean.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @throws {@link GetFieldTypeMissmatchError} Actual type of field doesn't match boolean type.\n   * @returns The boolean field value or undefined.\n   */\n  public getBooleanField(name: string): boolean | undefined {\n    return this.getField(name, 'boolean')\n  }\n\n  /**\n   * Sets a boolean field.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @returns this\n   */\n  public setBooleanField(name: string, value: boolean | any): PointValues {\n    this._fields[name] = ['boolean', !!value]\n    return this\n  }\n\n  /**\n   * Get field of numeric type.\n   * Throws if actual type of field with given name is not given numeric type.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @param type - field numeric type\n   * @throws {@link GetFieldTypeMissmatchError} Actual type of field doesn't match provided numeric type.\n   * @returns this\n   */\n  public getField(\n    name: string,\n    type: 'float' | 'integer' | 'uinteger'\n  ): number | undefined\n  /**\n   * Get field of string type.\n   * Throws if actual type of field with given name is not string.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @param type - field string type\n   * @throws {@link GetFieldTypeMissmatchError} Actual type of field doesn't match provided 'string' type.\n   * @returns this\n   */\n  public getField(name: string, type: 'string'): string | undefined\n  /**\n   * Get field of boolean type.\n   * Throws if actual type of field with given name is not boolean.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @param type - field boolean type\n   * @throws {@link GetFieldTypeMissmatchError} Actual type of field doesn't match provided 'boolean' type.\n   * @returns this\n   */\n  public getField(name: string, type: 'boolean'): boolean | undefined\n  /**\n   * Get field without type check.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @returns this\n   */\n  public getField(name: string): number | string | boolean | undefined\n  public getField(\n    name: string,\n    type?: PointFieldType\n  ): number | string | boolean | undefined {\n    const fieldEntry = this._fields[name]\n    if (!fieldEntry) return undefined\n    const [actualType, value] = fieldEntry\n    if (type !== undefined && type !== actualType)\n      throw new GetFieldTypeMissmatchError(name, type, actualType)\n    return value\n  }\n\n  /**\n   * Gets the type of field with given name, if it exists.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @returns The field type or undefined.\n   */\n  public getFieldType(name: string): PointFieldType | undefined {\n    const fieldEntry = this._fields[name]\n    if (!fieldEntry) return undefined\n    return fieldEntry[0]\n  }\n\n  /**\n   * Sets field based on provided type.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @param type - field type\n   * @returns this\n   */\n  public setField(\n    name: string,\n    value: any,\n    type?: PointFieldType\n  ): PointValues {\n    const inferedType = type ?? inferType(value)\n    switch (inferedType) {\n      case 'string':\n        return this.setStringField(name, value)\n      case 'boolean':\n        return this.setBooleanField(name, value)\n      case 'float':\n        return this.setFloatField(name, value)\n      case 'integer':\n        return this.setIntegerField(name, value)\n      case 'uinteger':\n        return this.setUintegerField(name, value)\n      case undefined:\n        return this\n      default:\n        throw new Error(\n          `invalid field type for field '${name}': type -> ${type}, value -> ${value}!`\n        )\n    }\n  }\n\n  /**\n   * Add fields according to their type. All numeric type is considered float\n   *\n   * @param fields - name-value map\n   * @returns this\n   */\n  public setFields(fields: {\n    [key: string]: number | boolean | string\n  }): PointValues {\n    for (const [name, value] of Object.entries(fields)) {\n      this.setField(name, value)\n    }\n    return this\n  }\n\n  /**\n   * Removes a field with the specified name if it exists; otherwise, it does nothing.\n   *\n   * @param name - The name of the field to be removed.\n   * @returns this\n   */\n  public removeField(name: string): PointValues {\n    delete this._fields[name]\n    return this\n  }\n\n  /**\n   * Gets an array of field names associated with this object.\n   *\n   * @returns An array of field names.\n   */\n  public getFieldNames(): string[] {\n    return Object.keys(this._fields)\n  }\n\n  /**\n   * Checks if this object has any fields.\n   *\n   * @returns true if fields are present, false otherwise.\n   */\n  public hasFields(): boolean {\n    return this.getFieldNames().length > 0\n  }\n\n  /**\n   * Creates a copy of this object.\n   *\n   * @returns A new instance with same values.\n   */\n  copy(): PointValues {\n    const copy = new PointValues()\n    copy._name = this._name\n    copy._time = this._time\n    copy._tags = Object.fromEntries(Object.entries(this._tags))\n    copy._fields = Object.fromEntries(\n      Object.entries(this._fields).map((entry) => [...entry])\n    )\n    return copy\n  }\n\n  /**\n   * Creates new Point with this as values.\n   *\n   * @returns Point from this values.\n   */\n  public asPoint(measurement?: string): Point {\n    return Point.fromValues(\n      measurement ? this.setMeasurement(measurement) : this\n    )\n  }\n}\n","import {TimeConverter} from './WriteApi'\nimport {convertTimeToNanos, convertTime} from './util/time'\nimport {escape} from './util/escape'\nimport {WritePrecision} from './options'\nimport {PointFieldType, PointValues} from './PointValues'\n\nconst fieldToLPString: {\n  (type: 'float', value: number): string\n  (type: 'integer', value: number): string\n  (type: 'uinteger', value: number): string\n  (type: 'string', value: string): string\n  (type: 'boolean', value: boolean): string\n  (type: PointFieldType, value: number | string | boolean): string\n} = (type: PointFieldType, value: number | string | boolean): string => {\n  switch (type) {\n    case 'string':\n      return escape.quoted(value as string)\n    case 'boolean':\n      return value ? 'T' : 'F'\n    case 'float':\n      return `${value}`\n    case 'integer':\n      return `${value}i`\n    case 'uinteger':\n      return `${value}u`\n  }\n}\n\nconst collectDefaultTagNames = (\n  pointTagNames: string[],\n  defaultTags?: {[key: string]: string}\n): string[] => {\n  if (!defaultTags) {\n    return []\n  }\n  const pointTagNamesSet = new Set(pointTagNames)\n  return Object.keys(defaultTags)\n    .filter((name) => !pointTagNamesSet.has(name))\n    .sort()\n}\n\nconst applyPreferredTagOrder = (\n  tagNames: string[],\n  tagOrder?: string[]\n): string[] => {\n  if (!tagOrder || tagOrder.length === 0) {\n    return tagNames\n  }\n\n  const remaining = new Set(tagNames)\n  const ordered: string[] = []\n  const seen = new Set<string>()\n\n  for (const tagName of tagOrder) {\n    if (!tagName || seen.has(tagName) || !remaining.has(tagName)) {\n      continue\n    }\n    ordered.push(tagName)\n    seen.add(tagName)\n    remaining.delete(tagName)\n  }\n\n  const sortedRemaining = Array.from(remaining).sort()\n  return ordered.concat(sortedRemaining)\n}\n\n/**\n * Point defines values of a single measurement.\n */\nexport class Point {\n  private readonly _values: PointValues\n\n  /**\n   * Create a new Point with specified a measurement name.\n   *\n   * @param measurementName - the measurement name\n   */\n  private constructor(measurementName: string)\n  /**\n   * Create a new Point with given values.\n   * After creating Point, it's values shouldn't be modified directly by PointValues object.\n   *\n   * @param values - point values\n   */\n  private constructor(values: PointValues)\n  private constructor(arg0?: PointValues | string) {\n    if (arg0 instanceof PointValues) {\n      this._values = arg0\n    } else {\n      this._values = new PointValues()\n    }\n\n    if (typeof arg0 === 'string') this._values.setMeasurement(arg0)\n  }\n\n  /**\n   * Creates new Point with given measurement.\n   *\n   * @param name - measurement name\n   * @returns new Point\n   */\n  public static measurement(name: string): Point {\n    return new Point(name)\n  }\n\n  /**\n   * Creates new point from PointValues object.\n   * Can throw error if measurement missing.\n   *\n   * @param values - point values object with measurement\n   * @throws missing measurement\n   * @returns new point from values\n   */\n  public static fromValues(values: PointValues): Point {\n    if (!values.getMeasurement() || values.getMeasurement() === '') {\n      throw new Error('Cannot convert values to point without measurement set!')\n    }\n    return new Point(values)\n  }\n\n  /**\n   * Get measurement name.\n   * It will return undefined when querying with SQL Query.\n   *\n   * @returns measurement name\n   */\n  public getMeasurement(): string {\n    return this._values.getMeasurement() as string\n  }\n\n  /**\n   * Sets point's measurement.\n   *\n   * @param name - measurement name\n   * @returns this\n   */\n  public setMeasurement(name: string): Point {\n    if (name !== '') {\n      this._values.setMeasurement(name)\n    }\n    return this\n  }\n\n  /**\n   * Get timestamp. Can be undefined if not set.\n   *\n   * @returns timestamp or undefined\n   */\n  public getTimestamp(): Date | number | string | undefined {\n    return this._values.getTimestamp()\n  }\n\n  /**\n   * Sets point timestamp. Timestamp can be specified as a Date (preferred), number, string\n   * or an undefined value. An undefined value instructs to assign a local timestamp using\n   * the client's clock. An empty string can be used to let the server assign\n   * the timestamp. A number value represents time as a count of time units since epoch, the\n   * exact time unit then depends on the {@link InfluxDBClient.default.write | precision} of the API\n   * that writes the point.\n   *\n   * Beware that the current time in nanoseconds can't precisely fit into a JS number,\n   * which can hold at most 2^53 integer number. Nanosecond precision numbers are thus supplied as\n   * a (base-10) string. An application can also use ES2020 BigInt to represent nanoseconds,\n   * BigInt's `toString()` returns the required high-precision string.\n   *\n   * Note that InfluxDB requires the timestamp to fit into int64 data type.\n   *\n   * @param value - point time\n   * @returns this\n   */\n  public setTimestamp(value: Date | number | string | undefined): Point {\n    this._values.setTimestamp(value)\n    return this\n  }\n\n  /**\n   * Gets value of tag with given name. Returns undefined if tag not found.\n   *\n   * @param name - tag name\n   * @returns tag value or undefined\n   */\n  public getTag(name: string): string | undefined {\n    return this._values.getTag(name)\n  }\n\n  /**\n   * Sets a tag. The caller has to ensure that both name and value are not empty\n   * and do not end with backslash.\n   *\n   * @param name - tag name\n   * @param value - tag value\n   * @returns this\n   */\n  public setTag(name: string, value: string): Point {\n    this._values.setTag(name, value)\n    return this\n  }\n\n  /**\n   * Removes a tag with the specified name if it exists; otherwise, it does nothing.\n   *\n   * @param name - The name of the tag to be removed.\n   * @returns this\n   */\n  public removeTag(name: string): Point {\n    this._values.removeTag(name)\n    return this\n  }\n\n  /**\n   * Gets an array of tag names.\n   *\n   * @returns An array of tag names.\n   */\n  public getTagNames(): string[] {\n    return this._values.getTagNames()\n  }\n\n  /**\n   * Gets the float field value associated with the specified name.\n   * Throws if actual type of field with given name is not float.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @throws {@link PointValues.GetFieldTypeMissmatchError} Actual type of field doesn't match float type.\n   * @returns The float field value or undefined.\n   */\n  public getFloatField(name: string): number | undefined {\n    return this._values.getFloatField(name)\n  }\n\n  /**\n   * Sets a number field.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @returns this\n   * @throws NaN/Infinity/-Infinity is supplied\n   */\n  public setFloatField(name: string, value: number | any): Point {\n    this._values.setFloatField(name, value)\n    return this\n  }\n\n  /**\n   * Gets the integer field value associated with the specified name.\n   * Throws if actual type of field with given name is not integer.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @throws {@link PointValues.GetFieldTypeMissmatchError} Actual type of field doesn't match integer type.\n   * @returns The integer field value or undefined.\n   */\n  public getIntegerField(name: string): number | undefined {\n    return this._values.getIntegerField(name)\n  }\n\n  /**\n   * Sets an integer field.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @returns this\n   * @throws NaN or out of int64 range value is supplied\n   */\n  public setIntegerField(name: string, value: number | any): Point {\n    this._values.setIntegerField(name, value)\n    return this\n  }\n\n  /**\n   * Gets the uint field value associated with the specified name.\n   * Throws if actual type of field with given name is not uint.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @throws {@link PointValues.GetFieldTypeMissmatchError} Actual type of field doesn't match uint type.\n   * @returns The uint field value or undefined.\n   */\n  public getUintegerField(name: string): number | undefined {\n    return this._values.getUintegerField(name)\n  }\n\n  /**\n   * Sets an unsigned integer field.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @returns this\n   * @throws NaN out of range value is supplied\n   */\n  public setUintegerField(name: string, value: number | any): Point {\n    this._values.setUintegerField(name, value)\n    return this\n  }\n\n  /**\n   * Gets the string field value associated with the specified name.\n   * Throws if actual type of field with given name is not string.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @throws {@link PointValues.GetFieldTypeMissmatchError} Actual type of field doesn't match string type.\n   * @returns The string field value or undefined.\n   */\n  public getStringField(name: string): string | undefined {\n    return this._values.getStringField(name)\n  }\n\n  /**\n   * Sets a string field.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @returns this\n   */\n  public setStringField(name: string, value: string | any): Point {\n    this._values.setStringField(name, value)\n    return this\n  }\n\n  /**\n   * Gets the boolean field value associated with the specified name.\n   * Throws if actual type of field with given name is not boolean.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @throws {@link PointValues.GetFieldTypeMissmatchError} Actual type of field doesn't match boolean type.\n   * @returns The boolean field value or undefined.\n   */\n  public getBooleanField(name: string): boolean | undefined {\n    return this._values.getBooleanField(name)\n  }\n\n  /**\n   * Sets a boolean field.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @returns this\n   */\n  public setBooleanField(name: string, value: boolean | any): Point {\n    this._values.setBooleanField(name, value)\n    return this\n  }\n\n  /**\n   * Get field of numeric type.\n   *\n   * @param name - field name\n   * @param type - field numeric type\n   * @throws Field type doesn't match actual type\n   * @returns this\n   */\n  public getField(\n    name: string,\n    type: 'float' | 'integer' | 'uinteger'\n  ): number | undefined\n  /**\n   * Get field of string type.\n   *\n   * @param name - field name\n   * @param type - field string type\n   * @throws Field type doesn't match actual type\n   * @returns this\n   */\n  public getField(name: string, type: 'string'): string | undefined\n  /**\n   * Get field of boolean type.\n   *\n   * @param name - field name\n   * @param type - field boolean type\n   * @throws Field type doesn't match actual type\n   * @returns this\n   */\n  public getField(name: string, type: 'boolean'): boolean | undefined\n  /**\n   * Get field without type check.\n   *\n   * @param name - field name\n   * @returns this\n   */\n  public getField(name: string): number | string | boolean | undefined\n  public getField(\n    name: string,\n    type?: PointFieldType\n  ): number | string | boolean | undefined {\n    return this._values.getField(name, type as any)\n  }\n\n  /**\n   * Gets the type of field with given name, if it exists.\n   * If the field is not present, returns undefined.\n   *\n   * @param name - field name\n   * @returns The field type or undefined.\n   */\n  public getFieldType(name: string): PointFieldType | undefined {\n    return this._values.getFieldType(name)\n  }\n\n  /**\n   * Sets field based on provided type.\n   *\n   * @param name - field name\n   * @param value - field value\n   * @param type - field type\n   * @returns this\n   */\n  public setField(name: string, value: any, type?: PointFieldType): Point {\n    this._values.setField(name, value, type)\n    return this\n  }\n\n  /**\n   * Add fields according to their type. All numeric type is considered float\n   *\n   * @param fields - name-value map\n   * @returns this\n   */\n  public setFields(fields: {[key: string]: number | boolean | string}): Point {\n    this._values.setFields(fields)\n    return this\n  }\n\n  /**\n   * Removes a field with the specified name if it exists; otherwise, it does nothing.\n   *\n   * @param name - The name of the field to be removed.\n   * @returns this\n   */\n  public removeField(name: string): Point {\n    this._values.removeField(name)\n    return this\n  }\n\n  /**\n   * Gets an array of field names associated with this object.\n   *\n   * @returns An array of field names.\n   */\n  public getFieldNames(): string[] {\n    return this._values.getFieldNames()\n  }\n\n  /**\n   * Checks if this object has any fields.\n   *\n   * @returns true if fields are present, false otherwise.\n   */\n  public hasFields(): boolean {\n    return this._values.hasFields()\n  }\n\n  /**\n   * Creates a copy of this object.\n   *\n   * @returns A new instance with same values.\n   */\n  copy(): Point {\n    return new Point(this._values.copy())\n  }\n\n  /**\n   * Creates an InfluxDB protocol line out of this instance.\n   * @param convertTimePrecision - settings control serialization of a point timestamp and can also add default tags,\n   * nanosecond timestamp precision is used when no `settings` or no `settings.convertTime` is supplied.\n   * @param tagOrder - optional array of tag names to control their order in the output\n   * @returns an InfluxDB protocol line out of this instance\n   */\n  public toLineProtocol(\n    convertTimePrecision?: TimeConverter | WritePrecision,\n    defaultTags?: {[key: string]: string},\n    tagOrder?: string[]\n  ): string | undefined {\n    if (!this._values.getMeasurement()) return undefined\n    let fieldsLine = ''\n    this._values\n      .getFieldNames()\n      .sort()\n      .forEach((name) => {\n        if (name) {\n          const type = this._values.getFieldType(name)\n          const value = this._values.getField(name)\n          if (type === undefined || value === undefined) return\n          const lpStringValue = fieldToLPString(type, value)\n          if (fieldsLine.length > 0) fieldsLine += ','\n          fieldsLine += `${escape.tag(name)}=${lpStringValue}`\n        }\n      })\n    if (fieldsLine.length === 0) return undefined // no fields present\n    let tagsLine = ''\n    const pointTagNames = this._values.getTagNames().sort()\n    const defaultTagNames = collectDefaultTagNames(pointTagNames, defaultTags)\n    const orderedTagNames = applyPreferredTagOrder(\n      defaultTagNames.concat(pointTagNames),\n      tagOrder\n    )\n\n    orderedTagNames.forEach((name) => {\n      if (name) {\n        const pointTagValue = this._values.getTag(name)\n        const value =\n          pointTagValue !== undefined ? pointTagValue : defaultTags?.[name]\n        if (value) {\n          tagsLine += ','\n          tagsLine += `${escape.tag(name)}=${escape.tag(value)}`\n        }\n      }\n    })\n    let time = this._values.getTimestamp()\n\n    if (!convertTimePrecision) {\n      time = convertTimeToNanos(time)\n    } else if (typeof convertTimePrecision === 'string')\n      time = convertTime(time, convertTimePrecision)\n    else {\n      time = convertTimePrecision(time)\n    }\n\n    return `${escape.measurement(\n      this.getMeasurement()\n    )}${tagsLine} ${fieldsLine}${time !== undefined ? ` ${time}` : ''}`\n  }\n\n  toString(): string {\n    const line = this.toLineProtocol(undefined)\n    return line ? line : `invalid point: ${JSON.stringify(this, undefined)}`\n  }\n}\n","import {parse} from 'url'\nimport * as http from 'http'\nimport * as https from 'https'\nimport {Buffer} from 'buffer'\nimport {RequestTimedOutError, AbortError, HttpError} from '../../errors'\nimport {Transport, SendOptions} from '../../transport'\nimport {\n  Cancellable,\n  CommunicationObserver,\n  Headers,\n  ResponseStartedFn,\n} from '../../results'\nimport zlib from 'zlib'\nimport completeCommunicationObserver from '../completeCommunicationObserver'\nimport {CLIENT_LIB_USER_AGENT} from '../version'\nimport {Log} from '../../util/logger'\nimport {pipeline, Readable} from 'stream'\nimport {ConnectionOptions} from '../../options'\n\nconst zlibOptions = {\n  flush: zlib.constants.Z_SYNC_FLUSH,\n  finishFlush: zlib.constants.Z_SYNC_FLUSH,\n}\nconst emptyBuffer = Buffer.allocUnsafe(0)\n\nclass CancellableImpl implements Cancellable {\n  private _cancelled = false\n  public resume?: () => void\n  cancel(): void {\n    this._cancelled = true\n    if (this.resume) {\n      this.resume()\n      this.resume = undefined\n    }\n  }\n  isCancelled(): boolean {\n    return this._cancelled\n  }\n}\n\n/**\n * Transport layer on top of node http or https library.\n */\nexport class NodeHttpTransport implements Transport {\n  private _defaultOptions: {[key: string]: any}\n  private _requestApi: (\n    options: http.RequestOptions,\n    callback: (res: http.IncomingMessage) => void\n  ) => http.ClientRequest\n  private _contextPath: string\n  private _token?: string\n  private _authScheme?: string\n  private _headers: Record<string, string>\n  /**\n   * Creates a node transport using for the client options supplied.\n   * @param connectionOptions - connection options\n   */\n  constructor(connectionOptions: ConnectionOptions) {\n    const {\n      host: _url,\n      proxyUrl,\n      token,\n      authScheme,\n      transportOptions,\n      ...nodeSupportedOptions\n    } = connectionOptions\n    const url = parse(proxyUrl || _url)\n    this._token = token\n    this._authScheme = authScheme\n    this._defaultOptions = {\n      ...nodeSupportedOptions,\n      ...transportOptions,\n      port: url.port,\n      protocol: url.protocol,\n      hostname: url.hostname,\n      timeout:\n        nodeSupportedOptions.timeout ?? nodeSupportedOptions.writeTimeout,\n    }\n    this._contextPath = proxyUrl ? _url : (url.path ?? '')\n    if (this._contextPath.endsWith('/')) {\n      this._contextPath = this._contextPath.substring(\n        0,\n        this._contextPath.length - 1\n      )\n    }\n    // remove all undefined field to avoid node validation errors\n    // https://github.com/influxdata/influxdb-client-js/issues/380\n    Object.keys(this._defaultOptions).forEach(\n      (key) =>\n        this._defaultOptions[key] === undefined &&\n        delete this._defaultOptions[key]\n    )\n    // https://github.com/influxdata/influxdb-client-js/issues/263\n    // don't allow /api/v2 suffix to avoid future problems\n    if (this._contextPath.endsWith('/api/v2')) {\n      Log.warn(\n        `Please remove '/api/v2' context path from InfluxDB base url, using ${url.protocol}//${url.hostname}:${url.port} !`\n      )\n      this._contextPath = ''\n    }\n\n    if (url.protocol === 'http:') {\n      this._requestApi =\n        this._defaultOptions['follow-redirects']?.http?.request ?? http.request\n    } else if (url.protocol === 'https:') {\n      this._requestApi =\n        this._defaultOptions['follow-redirects']?.https?.request ??\n        https.request\n    } else {\n      throw new Error(\n        `Unsupported protocol \"${url.protocol} in URL: \"${connectionOptions.host}\"`\n      )\n    }\n    this._headers = {\n      'User-Agent': CLIENT_LIB_USER_AGENT,\n      ...connectionOptions.headers,\n    }\n    if (proxyUrl) {\n      this._headers['Host'] = parse(_url).host as string\n    }\n  }\n\n  /**\n   * Sends data to server and receives communication events via communication callbacks.\n   *\n   * @param path - HTTP request  path\n   * @param body - message body\n   * @param options\n   * @param callbacks - communication callbacks\n   */\n  send(\n    path: string,\n    body: string,\n    options: SendOptions,\n    callbacks?: Partial<CommunicationObserver<any>>\n  ): void {\n    const cancellable = new CancellableImpl()\n    if (callbacks && callbacks.useCancellable)\n      callbacks.useCancellable(cancellable)\n    this._createRequestMessage(\n      path,\n      body,\n      options,\n      (message: {[key: string]: any}) => {\n        this._request(message, cancellable, callbacks)\n      },\n      /* istanbul ignore next - hard to simulate failure, manually reviewed */\n      (err: Error) => callbacks?.error && callbacks.error(err)\n    )\n  }\n\n  /**\n   * Sends data to the server and receives decoded result. The type of the result depends on\n   * response's content-type (deserialized json, text).\n\n   * @param path - HTTP path\n   * @param body\n   * @param options - send options\n   * @param responseStarted\n   * @returns Promise of response body\n   */\n  request(\n    path: string,\n    body: any,\n    options: SendOptions,\n    responseStarted?: ResponseStartedFn\n  ): Promise<any> {\n    if (!body) {\n      body = ''\n    } else if (typeof body !== 'string') {\n      body = JSON.stringify(body)\n    }\n    let buffer = emptyBuffer\n    let contentType: string\n    let responseStatusCode: number | undefined\n    return new Promise((resolve, reject) => {\n      this.send(path, body as string, options, {\n        responseStarted(headers: Headers, statusCode?: number) {\n          if (responseStarted) {\n            responseStarted(headers, statusCode)\n          }\n          contentType = String(headers['content-type'])\n          responseStatusCode = statusCode\n        },\n        next: (data: Uint8Array): void => {\n          buffer = Buffer.concat([buffer, data])\n        },\n        complete: (): void => {\n          const responseType = options.headers?.accept ?? contentType\n          try {\n            if (responseStatusCode === 204) {\n              // ignore body of NO_CONTENT response\n              resolve(undefined)\n            }\n            if (responseType.includes('json')) {\n              if (buffer.length) {\n                resolve(JSON.parse(buffer.toString('utf8')))\n              } else {\n                resolve(undefined)\n              }\n            } else if (\n              responseType.includes('text') ||\n              responseType.startsWith('application/csv')\n            ) {\n              resolve(buffer.toString('utf8'))\n            } else {\n              resolve(buffer)\n            }\n          } catch (e) {\n            reject(e)\n          }\n        },\n        error: (e: Error): void => {\n          reject(e)\n        },\n      })\n    })\n  }\n\n  async *iterate(\n    path: string,\n    body: string,\n    options: SendOptions\n  ): AsyncIterableIterator<Uint8Array> {\n    let terminationError: Error | undefined = undefined\n    let nestedReject: (e: Error) => void\n    function wrapReject(error: Error) {\n      terminationError = error\n      nestedReject(error)\n    }\n    const requestMessage = await new Promise<Record<string, any>>(\n      (resolve, reject) => {\n        nestedReject = reject\n        this._createRequestMessage(path, body, options, resolve, wrapReject)\n      }\n    )\n    if (requestMessage.signal?.addEventListener) {\n      ;(requestMessage.signal as AbortSignal).addEventListener('abort', () => {\n        wrapReject(new AbortError())\n      })\n    }\n    const response = await new Promise<http.IncomingMessage>(\n      (resolve, reject) => {\n        nestedReject = reject\n        const req = this._requestApi(requestMessage, resolve)\n        req.on('timeout', () => wrapReject(new RequestTimedOutError()))\n        req.on('error', wrapReject)\n\n        req.write(requestMessage.body)\n        req.end()\n      }\n    )\n    const res = await new Promise<Readable>((resolve, reject) => {\n      nestedReject = reject\n      this._prepareResponse(response, resolve, wrapReject)\n    })\n    for await (const chunk of res) {\n      if (terminationError) {\n        throw terminationError\n      }\n      yield chunk\n    }\n  }\n\n  /**\n   * Creates configuration for a specific request.\n   *\n   * @param path - API path starting with '/' and containing also query parameters\n   * @param body - Request body, will be utf-8 encoded\n   * @param sendOptions - Options for sending a request message\n   * @param resolve - Resolve callback\n   * @param reject - Reject callback\n   * @returns a configuration object that is suitable for making the request\n   */\n  private _createRequestMessage(\n    path: string,\n    body: string,\n    sendOptions: SendOptions,\n    resolve: (req: http.RequestOptions) => void,\n    reject: (err: Error) => void\n  ): void {\n    const bodyBuffer = Buffer.from(body, 'utf-8')\n    const headers: {[key: string]: any} = {\n      'content-type': 'application/json; charset=utf-8',\n      ...this._headers,\n    }\n    if (this._token) {\n      const authScheme = this._authScheme ?? 'Token'\n      headers.authorization = `${authScheme} ${this._token}`\n    }\n\n    const options: {[key: string]: any} = {\n      ...this._defaultOptions,\n      path: this._contextPath + path,\n      method: sendOptions.method,\n      headers: {\n        ...headers,\n        ...sendOptions.headers,\n      },\n      timeout: sendOptions.timeout ?? this._defaultOptions.timeout,\n    }\n    if (sendOptions.signal) {\n      options.signal = sendOptions.signal\n    }\n    if (\n      sendOptions.gzipThreshold !== undefined &&\n      sendOptions.gzipThreshold < bodyBuffer.length\n    ) {\n      zlib.gzip(bodyBuffer, (err, res) => {\n        /* istanbul ignore next - hard to simulate failure, manually reviewed */\n        if (err) {\n          return reject(err)\n        }\n        options.headers['content-encoding'] = 'gzip'\n        options.body = res\n        resolve(options)\n      })\n      return\n    }\n    options.body = bodyBuffer\n    options.headers['content-length'] = options.body.length\n    resolve(options)\n  }\n\n  private _prepareResponse(\n    res: http.IncomingMessage,\n    resolve: (res: Readable) => void,\n    reject: (err: Error) => void\n  ) {\n    res.on('aborted', () => {\n      reject(new AbortError())\n    })\n    res.on('error', reject)\n    /* istanbul ignore next statusCode is optional in http.IncomingMessage */\n    const statusCode = res.statusCode ?? 600\n    const contentEncoding = res.headers['content-encoding']\n    let responseData\n    if (contentEncoding === 'gzip') {\n      responseData = zlib.createGunzip(zlibOptions)\n      responseData = pipeline(res, responseData, (e) => e && reject(e))\n    } else {\n      responseData = res\n    }\n    if (statusCode >= 300) {\n      let body = ''\n      const isJson = String(res.headers['content-type']).startsWith(\n        'application/json'\n      )\n      responseData.on('data', (s) => {\n        body += s.toString()\n        if (!isJson && body.length > 1000) {\n          body = body.slice(0, 1000)\n          res.resume()\n        }\n      })\n      responseData.on('end', () => {\n        if (body === '' && !!res.headers['x-influxdb-error']) {\n          body = res.headers['x-influxdb-error'].toString()\n        }\n        reject(\n          new HttpError(\n            statusCode,\n            res.statusMessage,\n            body,\n            res.headers['content-type'],\n            res.headers\n          )\n        )\n      })\n    } else {\n      resolve(responseData)\n    }\n  }\n\n  private _request(\n    requestMessage: {[key: string]: any},\n    cancellable: CancellableImpl,\n    callbacks?: Partial<CommunicationObserver<any>>\n  ): void {\n    const listeners = completeCommunicationObserver(callbacks)\n    if (cancellable.isCancelled()) {\n      listeners.complete()\n      return\n    }\n    if (requestMessage.signal?.addEventListener) {\n      ;(requestMessage.signal as AbortSignal).addEventListener('abort', () => {\n        listeners.error(new AbortError())\n      })\n    }\n    const req = this._requestApi(\n      requestMessage,\n      (res: http.IncomingMessage) => {\n        /* istanbul ignore next - hard to simulate failure, manually reviewed */\n        if (cancellable.isCancelled()) {\n          res.resume()\n          listeners.complete()\n          return\n        }\n        listeners.responseStarted(res.headers, res.statusCode)\n        this._prepareResponse(\n          res,\n          (responseData) => {\n            responseData.on('data', (data) => {\n              if (cancellable.isCancelled()) {\n                res.resume()\n              } else {\n                if (listeners.next(data) === false) {\n                  // pause processing, the consumer signalizes that\n                  // it is not able to receive more data\n                  if (!listeners.useResume) {\n                    listeners.error(\n                      new Error('Unable to pause, useResume is not configured!')\n                    )\n                    res.resume()\n                    return\n                  }\n                  res.pause()\n                  const resume = () => {\n                    res.resume()\n                  }\n                  cancellable.resume = resume\n                  listeners.useResume(resume)\n                }\n              }\n            })\n            responseData.on('end', listeners.complete)\n          },\n          listeners.error\n        )\n      }\n    )\n    // Support older Nodes which don't allow `timeout` in the\n    // request options\n    /* istanbul ignore else support older node versions */\n    if (typeof req.setTimeout === 'function' && requestMessage.timeout) {\n      req.setTimeout(requestMessage.timeout)\n    }\n\n    req.on('timeout', () => {\n      listeners.error(new RequestTimedOutError())\n    })\n    req.on('error', (error) => {\n      listeners.error(error)\n    })\n\n    /* istanbul ignore else support older node versions */\n    if (requestMessage.body) {\n      req.write(requestMessage.body)\n    }\n    req.end()\n  }\n}\nexport default NodeHttpTransport\n","import {CommunicationObserver, Headers} from '../results'\n\ntype CompleteObserver = Omit<\n  Required<CommunicationObserver<any>>,\n  'useCancellable' | 'useResume'\n> &\n  Pick<CommunicationObserver<any>, 'useResume' | 'useCancellable'>\n\nexport default function completeCommunicationObserver(\n  callbacks: Partial<CommunicationObserver<any>> = {}\n): CompleteObserver {\n  let state = 0\n  const retVal: CompleteObserver = {\n    next: (data: any): void | boolean => {\n      if (\n        state === 0 &&\n        callbacks.next &&\n        data !== null &&\n        data !== undefined\n      ) {\n        return callbacks.next(data)\n      }\n    },\n    error: (error: Error): void => {\n      /* istanbul ignore else propagate error at most once */\n      if (state === 0) {\n        state = 1\n        /* istanbul ignore else safety check */\n        if (callbacks.error) callbacks.error(error)\n      }\n    },\n    complete: (): void => {\n      if (state === 0) {\n        state = 2\n        /* istanbul ignore else safety check */\n        if (callbacks.complete) callbacks.complete()\n      }\n    },\n    responseStarted: (headers: Headers, statusCode?: number): void => {\n      if (callbacks.responseStarted)\n        callbacks.responseStarted(headers, statusCode)\n    },\n  }\n  if (callbacks.useCancellable) {\n    retVal.useCancellable = callbacks.useCancellable.bind(callbacks)\n  }\n  if (callbacks.useResume) {\n    retVal.useResume = callbacks.useResume.bind(callbacks)\n  }\n  return retVal\n}\n","export const CLIENT_LIB_VERSION = '2.2.0'\nexport const CLIENT_LIB_USER_AGENT = `influxdb3-js/${CLIENT_LIB_VERSION}`\n","import {GrpcTransport} from '@protobuf-ts/grpc-transport'\nimport {replaceURLProtocolWithPort} from '../../util/fixUrl'\nimport {CreateQueryTransport} from '../implSelector'\nimport * as grpc from '@grpc/grpc-js'\n\nexport const createTransport: CreateQueryTransport = ({\n  host,\n  timeout,\n  clientOptions,\n}) => {\n  const {url, safe} = replaceURLProtocolWithPort(host)\n  const channelCredentials =\n    grpc.credentials[(safe ?? true) ? 'createSsl' : 'createInsecure']()\n\n  const {interceptors, ...otherClientOptions} = clientOptions ?? {}\n\n  return new GrpcTransport({\n    host: url,\n    channelCredentials: channelCredentials,\n    clientOptions: otherClientOptions,\n    interceptors: interceptors,\n    timeout: timeout,\n  })\n}\n","const HTTP_PREFIX = 'http://'\nconst HTTPS_PREFIX = 'https://'\n\n/**\n * replaceURLProtocolWithPort removes the \"http://\" or \"https://\" protocol from the given URL and replaces it with the port number.\n * Currently, Apache Arrow does not support the \"http://\" or \"https://\" protocol in the URL, so this function is used to remove it.\n * If a port number is already present in the URL, only the protocol is removed.\n * The function also returns a boolean value indicating whether the communication is safe or unsafe.\n * - If the URL starts with \"https://\", the communication is considered safe, and the returned boolean value will be true.\n * - If the URL starts with \"http://\", the communication is considered unsafe, and the returned boolean value will be false.\n * - If the URL does not start with either \"http://\" or \"https://\", the returned boolean value will be undefined.\n *\n * @param url - The URL to process.\n * @returns An object containing the modified URL with the protocol replaced by the port and a boolean value indicating the safety of communication (true for safe, false for unsafe) or undefined if not detected.\n */\nexport const replaceURLProtocolWithPort = (\n  url: string\n): {url: string; safe: boolean | undefined} => {\n  url = url.replace(/\\/$/, '')\n\n  let safe: boolean | undefined\n\n  if (url.startsWith(HTTP_PREFIX)) {\n    url = url.slice(HTTP_PREFIX.length)\n    safe = false\n\n    if (!url.includes(':')) {\n      url = `${url}:80`\n    }\n  } else if (url.startsWith(HTTPS_PREFIX)) {\n    url = url.slice(HTTPS_PREFIX.length)\n    safe = true\n\n    if (!url.includes(':')) {\n      url = `${url}:443`\n    }\n  }\n\n  return {url, safe}\n}\n","import {TargetBasedImplementation} from '../implSelector'\nimport NodeHttpTransport from './NodeHttpTransport'\nimport {createTransport} from './rpc'\n\nconst implementation: TargetBasedImplementation = {\n  writeTransport: (opts) => new NodeHttpTransport(opts),\n  queryTransport: createTransport,\n}\n\nexport default implementation\n","import WriteApi from '../WriteApi'\nimport {\n  ClientOptions,\n  DEFAULT_WriteOptions,\n  precisionToV2ApiString,\n  precisionToV3ApiString,\n  WriteOptions,\n} from '../options'\nimport {Transport} from '../transport'\nimport {Headers} from '../results'\nimport {Log} from '../util/logger'\nimport {HttpError} from '../errors'\nimport {impl} from './implSelector'\n\nexport default class WriteApiImpl implements WriteApi {\n  private _closed = false\n  private _transport: Transport\n\n  constructor(private _options: ClientOptions) {\n    this._transport =\n      this._options.transport ?? impl.writeTransport(this._options)\n    this.doWrite = this.doWrite.bind(this)\n  }\n\n  private _createWritePath(\n    bucket: string,\n    writeOptions: WriteOptions,\n    org?: string\n  ) {\n    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n    const precision = writeOptions.precision!\n\n    let path: string\n    const query: string[] = []\n    if (org) query.push(`org=${encodeURIComponent(org)}`)\n    if (writeOptions.noSync) {\n      // Setting no_sync=true is supported only in the v3 API.\n      path = `/api/v3/write_lp`\n      query.push(`db=${encodeURIComponent(bucket)}`)\n      query.push(`precision=${precisionToV3ApiString(precision)}`)\n      query.push(`no_sync=true`)\n    } else {\n      // By default, use the v2 API.\n      path = `/api/v2/write`\n      query.push(`bucket=${encodeURIComponent(bucket)}`)\n      query.push(`precision=${precisionToV2ApiString(precision)}`)\n    }\n\n    return `${path}?${query.join('&')}`\n  }\n\n  doWrite(\n    lines: string[],\n    bucket: string,\n    org?: string,\n    writeOptions?: Partial<WriteOptions>\n  ): Promise<void> {\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    const self: WriteApiImpl = this\n    if (self._closed) {\n      return Promise.reject(new Error('writeApi: already closed!'))\n    }\n    if (lines.length <= 0 || (lines.length === 1 && lines[0] === ''))\n      return Promise.resolve()\n\n    let resolve: (value: void | PromiseLike<void>) => void\n    let reject: (reason?: any) => void\n    const promise = new Promise<void>((res, rej) => {\n      resolve = res\n      reject = rej\n    })\n\n    const writeOptionsOrDefault: WriteOptions = {\n      ...DEFAULT_WriteOptions,\n      ...writeOptions,\n    }\n\n    let responseStatusCode: number | undefined\n    let headers: Headers\n    const callbacks = {\n      responseStarted(_headers: Headers, statusCode?: number): void {\n        responseStatusCode = statusCode\n        headers = _headers\n      },\n      error(error: Error): void {\n        // ignore informational message about the state of InfluxDB\n        // enterprise cluster, if present\n        if (\n          error instanceof HttpError &&\n          error.json &&\n          typeof error.json.error === 'string' &&\n          error.json.error.includes('hinted handoff queue not empty')\n        ) {\n          Log.warn(`Write to InfluxDB returns: ${error.json.error}`)\n          responseStatusCode = 204\n          callbacks.complete()\n          return\n        }\n        if (\n          error instanceof HttpError &&\n          error.statusCode == 405 &&\n          writeOptionsOrDefault.noSync\n        ) {\n          error = new HttpError(\n            error.statusCode,\n            \"Server doesn't support write with noSync=true \" +\n              '(supported by InfluxDB 3 Core/Enterprise servers only).',\n            error.body,\n            error.contentType,\n            error.headers\n          )\n        }\n        Log.error(`Write to InfluxDB failed.`, error)\n        reject(error)\n      },\n      complete(): void {\n        // older implementations of transport do not report status code\n        if (\n          responseStatusCode == undefined ||\n          (responseStatusCode >= 200 && responseStatusCode < 300)\n        ) {\n          resolve()\n        } else {\n          const message = `2xx HTTP response status code expected, but ${responseStatusCode} returned`\n          const error = new HttpError(\n            responseStatusCode,\n            message,\n            undefined,\n            '0',\n            headers\n          )\n          error.message = message\n          callbacks.error(error)\n        }\n      },\n    }\n\n    const sendOptions = {\n      method: 'POST',\n      headers: {\n        'content-type': 'text/plain; charset=utf-8',\n        ...writeOptions?.headers,\n      },\n      gzipThreshold: writeOptionsOrDefault.gzipThreshold,\n      timeout: writeOptionsOrDefault.timeout,\n    }\n\n    this._transport.send(\n      this._createWritePath(bucket, writeOptionsOrDefault, org),\n      lines.join('\\n'),\n      sendOptions,\n      callbacks\n    )\n\n    return promise\n  }\n\n  async close(): Promise<void> {\n    this._closed = true\n  }\n}\n","import {RecordBatchReader, Type as ArrowType} from 'apache-arrow'\nimport QueryApi, {QParamType} from '../QueryApi'\nimport {Ticket} from '../generated/flight/Flight'\nimport {FlightServiceClient} from '../generated/flight/Flight.client'\nimport {ConnectionOptions, QueryOptions, QueryType} from '../options'\nimport {createInt32Uint8Array} from '../util/common'\nimport {RpcMetadata, RpcOptions} from '@protobuf-ts/runtime-rpc'\nimport {impl} from './implSelector'\nimport {PointFieldType, PointValues} from '../PointValues'\nimport {allParamsMatched, queryHasParams} from '../util/sql'\nimport {CLIENT_LIB_USER_AGENT} from './version'\nimport {getMappedValue} from '../util/TypeCasting'\nimport {ClientOptions} from '@grpc/grpc-js'\n\nexport type TicketDataType = {\n  database: string\n  sql_query: string\n  query_type: QueryType\n  params?: {[name: string]: QParamType | undefined}\n}\n\nexport default class QueryApiImpl implements QueryApi {\n  private _closed = false\n  private _flightClient: FlightServiceClient\n  private _transport: ReturnType<typeof impl.queryTransport>\n\n  private _defaultHeaders: Record<string, string> | undefined\n\n  constructor(private _options: ConnectionOptions) {\n    const {host, queryTimeout, grpcOptions} = this._options\n\n    this._defaultHeaders = this._options.headers\n    let clientOptions: ClientOptions = {}\n    if (grpcOptions !== undefined) {\n      clientOptions = grpcOptions\n    }\n\n    this._transport = impl.queryTransport({\n      host: host,\n      timeout: queryTimeout,\n      clientOptions: {...clientOptions},\n    })\n    this._flightClient = new FlightServiceClient(this._transport)\n  }\n\n  prepareTicket(\n    database: string,\n    query: string,\n    options: QueryOptions\n  ): Ticket {\n    const ticketData: TicketDataType = {\n      database: database,\n      sql_query: query,\n      query_type: options.type,\n    }\n\n    if (options.params) {\n      const param: {[name: string]: QParamType | undefined} = {}\n      for (const key of Object.keys(options.params)) {\n        if (options.params[key]) {\n          param[key] = options.params[key]\n        }\n      }\n      ticketData['params'] = param as {[name: string]: QParamType | undefined}\n    }\n\n    return Ticket.create({\n      ticket: new TextEncoder().encode(JSON.stringify(ticketData)),\n    })\n  }\n\n  prepareMetadata(headers?: Record<string, string>): RpcMetadata {\n    const meta: RpcMetadata = {\n      'User-Agent': CLIENT_LIB_USER_AGENT,\n      ...this._defaultHeaders,\n      ...headers,\n    }\n\n    const token = this._options.token\n    if (token) meta['authorization'] = `Bearer ${token}`\n\n    return meta\n  }\n\n  private async *_queryRawBatches(\n    query: string,\n    database: string,\n    options: QueryOptions\n  ) {\n    if (options.params && queryHasParams(query)) {\n      allParamsMatched(query, options.params)\n    }\n\n    if (this._closed) {\n      throw new Error('queryApi: already closed!')\n    }\n    const client = this._flightClient\n\n    const ticket = this.prepareTicket(database, query, options)\n\n    const meta = this.prepareMetadata(options.headers)\n    const rpcOptions: RpcOptions = {meta}\n    rpcOptions.timeout = options.timeout ?? this._options.queryTimeout\n\n    const flightDataStream = client.doGet(ticket, rpcOptions)\n\n    const binaryStream = (async function* () {\n      for await (const flightData of flightDataStream.responses) {\n        // Include the length of dataHeader for the reader.\n        yield createInt32Uint8Array(flightData.dataHeader.length)\n        yield flightData.dataHeader\n        // Length of dataBody is already included in dataHeader.\n        yield flightData.dataBody\n      }\n    })()\n\n    const reader = await RecordBatchReader.from(binaryStream)\n\n    yield* reader\n  }\n\n  async *query(\n    query: string,\n    database: string,\n    options: QueryOptions\n  ): AsyncGenerator<Record<string, any>, void, void> {\n    const batches = this._queryRawBatches(query, database, options)\n\n    for await (const batch of batches) {\n      for (const batchRow of batch) {\n        const row: Record<string, any> = {}\n        for (const column of batch.schema.fields) {\n          const value = batchRow[column.name]\n          row[column.name] = getMappedValue(column, value)\n        }\n        yield row\n      }\n    }\n  }\n\n  async *queryPoints(\n    query: string,\n    database: string,\n    options: QueryOptions\n  ): AsyncGenerator<PointValues, void, void> {\n    const batches = this._queryRawBatches(query, database, options)\n\n    for await (const batch of batches) {\n      for (let rowIndex = 0; rowIndex < batch.numRows; rowIndex++) {\n        const values = new PointValues()\n        for (let columnIndex = 0; columnIndex < batch.numCols; columnIndex++) {\n          const columnSchema = batch.schema.fields[columnIndex]\n          const name = columnSchema.name\n          const value = batch.getChildAt(columnIndex)?.get(rowIndex)\n          const arrowTypeId = columnSchema.typeId\n          const metaType = columnSchema.metadata.get('iox::column::type')\n\n          if (value === undefined || value === null) continue\n\n          if (\n            (name === 'measurement' || name == 'iox::measurement') &&\n            typeof value === 'string'\n          ) {\n            values.setMeasurement(value)\n            continue\n          }\n\n          if (!metaType) {\n            if (name === 'time' && arrowTypeId === ArrowType.Timestamp) {\n              values.setTimestamp(value)\n            } else {\n              values.setField(name, value)\n            }\n\n            continue\n          }\n\n          const [, , valueType, _fieldType] = metaType.split('::')\n\n          if (valueType === 'field') {\n            if (_fieldType && value !== undefined && value !== null) {\n              const mappedValue = getMappedValue(columnSchema, value)\n              values.setField(name, mappedValue, _fieldType as PointFieldType)\n            }\n          } else if (valueType === 'tag') {\n            values.setTag(name, value)\n          } else if (valueType === 'timestamp') {\n            values.setTimestamp(value)\n          }\n        }\n\n        yield values\n      }\n    }\n  }\n\n  async close(): Promise<void> {\n    this._closed = true\n    this._transport.close?.()\n  }\n}\n","// @generated by protobuf-ts 2.9.1 with parameter optimize_code_size\n// @generated from protobuf file \"Flight.proto\" (package \"arrow.flight.protocol\", syntax proto3)\n// tslint:disable\n//\n//\n// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership.  The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License.  You may obtain a copy of the License at\n// <p>\n// http://www.apache.org/licenses/LICENSE-2.0\n// <p>\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\nimport { ServiceType } from \"@protobuf-ts/runtime-rpc\";\nimport { MessageType } from \"@protobuf-ts/runtime\";\nimport { Timestamp } from \"./google/protobuf/timestamp\";\n/**\n *\n * The request that a client provides to a server on handshake.\n *\n * @generated from protobuf message arrow.flight.protocol.HandshakeRequest\n */\nexport interface HandshakeRequest {\n    /**\n     *\n     * A defined protocol version\n     *\n     * @generated from protobuf field: uint64 protocol_version = 1;\n     */\n    protocolVersion: bigint;\n    /**\n     *\n     * Arbitrary auth/handshake info.\n     *\n     * @generated from protobuf field: bytes payload = 2;\n     */\n    payload: Uint8Array;\n}\n/**\n * @generated from protobuf message arrow.flight.protocol.HandshakeResponse\n */\nexport interface HandshakeResponse {\n    /**\n     *\n     * A defined protocol version\n     *\n     * @generated from protobuf field: uint64 protocol_version = 1;\n     */\n    protocolVersion: bigint;\n    /**\n     *\n     * Arbitrary auth/handshake info.\n     *\n     * @generated from protobuf field: bytes payload = 2;\n     */\n    payload: Uint8Array;\n}\n/**\n *\n * A message for doing simple auth.\n *\n * @generated from protobuf message arrow.flight.protocol.BasicAuth\n */\nexport interface BasicAuth {\n    /**\n     * @generated from protobuf field: string username = 2;\n     */\n    username: string;\n    /**\n     * @generated from protobuf field: string password = 3;\n     */\n    password: string;\n}\n/**\n * @generated from protobuf message arrow.flight.protocol.Empty\n */\nexport interface Empty {\n}\n/**\n *\n * Describes an available action, including both the name used for execution\n * along with a short description of the purpose of the action.\n *\n * @generated from protobuf message arrow.flight.protocol.ActionType\n */\nexport interface ActionType {\n    /**\n     * @generated from protobuf field: string type = 1;\n     */\n    type: string;\n    /**\n     * @generated from protobuf field: string description = 2;\n     */\n    description: string;\n}\n/**\n *\n * A service specific expression that can be used to return a limited set\n * of available Arrow Flight streams.\n *\n * @generated from protobuf message arrow.flight.protocol.Criteria\n */\nexport interface Criteria {\n    /**\n     * @generated from protobuf field: bytes expression = 1;\n     */\n    expression: Uint8Array;\n}\n/**\n *\n * An opaque action specific for the service.\n *\n * @generated from protobuf message arrow.flight.protocol.Action\n */\nexport interface Action {\n    /**\n     * @generated from protobuf field: string type = 1;\n     */\n    type: string;\n    /**\n     * @generated from protobuf field: bytes body = 2;\n     */\n    body: Uint8Array;\n}\n/**\n *\n * The request of the CancelFlightInfo action.\n *\n * The request should be stored in Action.body.\n *\n * @generated from protobuf message arrow.flight.protocol.CancelFlightInfoRequest\n */\nexport interface CancelFlightInfoRequest {\n    /**\n     * @generated from protobuf field: arrow.flight.protocol.FlightInfo info = 1;\n     */\n    info?: FlightInfo;\n}\n/**\n *\n * The request of the RenewFlightEndpoint action.\n *\n * The request should be stored in Action.body.\n *\n * @generated from protobuf message arrow.flight.protocol.RenewFlightEndpointRequest\n */\nexport interface RenewFlightEndpointRequest {\n    /**\n     * @generated from protobuf field: arrow.flight.protocol.FlightEndpoint endpoint = 1;\n     */\n    endpoint?: FlightEndpoint;\n}\n/**\n *\n * An opaque result returned after executing an action.\n *\n * @generated from protobuf message arrow.flight.protocol.Result\n */\nexport interface Result {\n    /**\n     * @generated from protobuf field: bytes body = 1;\n     */\n    body: Uint8Array;\n}\n/**\n *\n * The result of the CancelFlightInfo action.\n *\n * The result should be stored in Result.body.\n *\n * @generated from protobuf message arrow.flight.protocol.CancelFlightInfoResult\n */\nexport interface CancelFlightInfoResult {\n    /**\n     * @generated from protobuf field: arrow.flight.protocol.CancelStatus status = 1;\n     */\n    status: CancelStatus;\n}\n/**\n *\n * Wrap the result of a getSchema call\n *\n * @generated from protobuf message arrow.flight.protocol.SchemaResult\n */\nexport interface SchemaResult {\n    /**\n     * The schema of the dataset in its IPC form:\n     *   4 bytes - an optional IPC_CONTINUATION_TOKEN prefix\n     *   4 bytes - the byte length of the payload\n     *   a flatbuffer Message whose header is the Schema\n     *\n     * @generated from protobuf field: bytes schema = 1;\n     */\n    schema: Uint8Array;\n}\n/**\n *\n * The name or tag for a Flight. May be used as a way to retrieve or generate\n * a flight or be used to expose a set of previously defined flights.\n *\n * @generated from protobuf message arrow.flight.protocol.FlightDescriptor\n */\nexport interface FlightDescriptor {\n    /**\n     * @generated from protobuf field: arrow.flight.protocol.FlightDescriptor.DescriptorType type = 1;\n     */\n    type: FlightDescriptor_DescriptorType;\n    /**\n     *\n     * Opaque value used to express a command. Should only be defined when\n     * type = CMD.\n     *\n     * @generated from protobuf field: bytes cmd = 2;\n     */\n    cmd: Uint8Array;\n    /**\n     *\n     * List of strings identifying a particular dataset. Should only be defined\n     * when type = PATH.\n     *\n     * @generated from protobuf field: repeated string path = 3;\n     */\n    path: string[];\n}\n/**\n *\n * Describes what type of descriptor is defined.\n *\n * @generated from protobuf enum arrow.flight.protocol.FlightDescriptor.DescriptorType\n */\nexport enum FlightDescriptor_DescriptorType {\n    /**\n     * Protobuf pattern, not used.\n     *\n     * @generated from protobuf enum value: UNKNOWN = 0;\n     */\n    UNKNOWN = 0,\n    /**\n     *\n     * A named path that identifies a dataset. A path is composed of a string\n     * or list of strings describing a particular dataset. This is conceptually\n     *  similar to a path inside a filesystem.\n     *\n     * @generated from protobuf enum value: PATH = 1;\n     */\n    PATH = 1,\n    /**\n     *\n     * An opaque command to generate a dataset.\n     *\n     * @generated from protobuf enum value: CMD = 2;\n     */\n    CMD = 2\n}\n/**\n *\n * The access coordinates for retrieval of a dataset. With a FlightInfo, a\n * consumer is able to determine how to retrieve a dataset.\n *\n * @generated from protobuf message arrow.flight.protocol.FlightInfo\n */\nexport interface FlightInfo {\n    /**\n     * The schema of the dataset in its IPC form:\n     *   4 bytes - an optional IPC_CONTINUATION_TOKEN prefix\n     *   4 bytes - the byte length of the payload\n     *   a flatbuffer Message whose header is the Schema\n     *\n     * @generated from protobuf field: bytes schema = 1;\n     */\n    schema: Uint8Array;\n    /**\n     *\n     * The descriptor associated with this info.\n     *\n     * @generated from protobuf field: arrow.flight.protocol.FlightDescriptor flight_descriptor = 2;\n     */\n    flightDescriptor?: FlightDescriptor;\n    /**\n     *\n     * A list of endpoints associated with the flight. To consume the\n     * whole flight, all endpoints (and hence all Tickets) must be\n     * consumed. Endpoints can be consumed in any order.\n     *\n     * In other words, an application can use multiple endpoints to\n     * represent partitioned data.\n     *\n     * If the returned data has an ordering, an application can use\n     * \"FlightInfo.ordered = true\" or should return the all data in a\n     * single endpoint. Otherwise, there is no ordering defined on\n     * endpoints or the data within.\n     *\n     * A client can read ordered data by reading data from returned\n     * endpoints, in order, from front to back.\n     *\n     * Note that a client may ignore \"FlightInfo.ordered = true\". If an\n     * ordering is important for an application, an application must\n     * choose one of them:\n     *\n     * * An application requires that all clients must read data in\n     *   returned endpoints order.\n     * * An application must return the all data in a single endpoint.\n     *\n     * @generated from protobuf field: repeated arrow.flight.protocol.FlightEndpoint endpoint = 3;\n     */\n    endpoint: FlightEndpoint[];\n    /**\n     * Set these to -1 if unknown.\n     *\n     * @generated from protobuf field: int64 total_records = 4;\n     */\n    totalRecords: bigint;\n    /**\n     * @generated from protobuf field: int64 total_bytes = 5;\n     */\n    totalBytes: bigint;\n    /**\n     *\n     * FlightEndpoints are in the same order as the data.\n     *\n     * @generated from protobuf field: bool ordered = 6;\n     */\n    ordered: boolean;\n    /**\n     *\n     * Application-defined metadata.\n     *\n     * There is no inherent or required relationship between this\n     * and the app_metadata fields in the FlightEndpoints or resulting\n     * FlightData messages. Since this metadata is application-defined,\n     * a given application could define there to be a relationship,\n     * but there is none required by the spec.\n     *\n     * @generated from protobuf field: bytes app_metadata = 7;\n     */\n    appMetadata: Uint8Array;\n}\n/**\n *\n * The information to process a long-running query.\n *\n * @generated from protobuf message arrow.flight.protocol.PollInfo\n */\nexport interface PollInfo {\n    /**\n     *\n     * The currently available results.\n     *\n     * If \"flight_descriptor\" is not specified, the query is complete\n     * and \"info\" specifies all results. Otherwise, \"info\" contains\n     * partial query results.\n     *\n     * Note that each PollInfo response contains a complete\n     * FlightInfo (not just the delta between the previous and current\n     * FlightInfo).\n     *\n     * Subsequent PollInfo responses may only append new endpoints to\n     * info.\n     *\n     * Clients can begin fetching results via DoGet(Ticket) with the\n     * ticket in the info before the query is\n     * completed. FlightInfo.ordered is also valid.\n     *\n     * @generated from protobuf field: arrow.flight.protocol.FlightInfo info = 1;\n     */\n    info?: FlightInfo;\n    /**\n     *\n     * The descriptor the client should use on the next try.\n     * If unset, the query is complete.\n     *\n     * @generated from protobuf field: arrow.flight.protocol.FlightDescriptor flight_descriptor = 2;\n     */\n    flightDescriptor?: FlightDescriptor;\n    /**\n     *\n     * Query progress. If known, must be in [0.0, 1.0] but need not be\n     * monotonic or nondecreasing. If unknown, do not set.\n     *\n     * @generated from protobuf field: optional double progress = 3;\n     */\n    progress?: number;\n    /**\n     *\n     * Expiration time for this request. After this passes, the server\n     * might not accept the retry descriptor anymore (and the query may\n     * be cancelled). This may be updated on a call to PollFlightInfo.\n     *\n     * @generated from protobuf field: google.protobuf.Timestamp expiration_time = 4;\n     */\n    expirationTime?: Timestamp;\n}\n/**\n *\n * A particular stream or split associated with a flight.\n *\n * @generated from protobuf message arrow.flight.protocol.FlightEndpoint\n */\nexport interface FlightEndpoint {\n    /**\n     *\n     * Token used to retrieve this stream.\n     *\n     * @generated from protobuf field: arrow.flight.protocol.Ticket ticket = 1;\n     */\n    ticket?: Ticket;\n    /**\n     *\n     * A list of URIs where this ticket can be redeemed via DoGet().\n     *\n     * If the list is empty, the expectation is that the ticket can only\n     * be redeemed on the current service where the ticket was\n     * generated.\n     *\n     * If the list is not empty, the expectation is that the ticket can\n     * be redeemed at any of the locations, and that the data returned\n     * will be equivalent. In this case, the ticket may only be redeemed\n     * at one of the given locations, and not (necessarily) on the\n     * current service.\n     *\n     * In other words, an application can use multiple locations to\n     * represent redundant and/or load balanced services.\n     *\n     * @generated from protobuf field: repeated arrow.flight.protocol.Location location = 2;\n     */\n    location: Location[];\n    /**\n     *\n     * Expiration time of this stream. If present, clients may assume\n     * they can retry DoGet requests. Otherwise, it is\n     * application-defined whether DoGet requests may be retried.\n     *\n     * @generated from protobuf field: google.protobuf.Timestamp expiration_time = 3;\n     */\n    expirationTime?: Timestamp;\n    /**\n     *\n     * Application-defined metadata.\n     *\n     * There is no inherent or required relationship between this\n     * and the app_metadata fields in the FlightInfo or resulting\n     * FlightData messages. Since this metadata is application-defined,\n     * a given application could define there to be a relationship,\n     * but there is none required by the spec.\n     *\n     * @generated from protobuf field: bytes app_metadata = 4;\n     */\n    appMetadata: Uint8Array;\n}\n/**\n *\n * A location where a Flight service will accept retrieval of a particular\n * stream given a ticket.\n *\n * @generated from protobuf message arrow.flight.protocol.Location\n */\nexport interface Location {\n    /**\n     * @generated from protobuf field: string uri = 1;\n     */\n    uri: string;\n}\n/**\n *\n * An opaque identifier that the service can use to retrieve a particular\n * portion of a stream.\n *\n * Tickets are meant to be single use. It is an error/application-defined\n * behavior to reuse a ticket.\n *\n * @generated from protobuf message arrow.flight.protocol.Ticket\n */\nexport interface Ticket {\n    /**\n     * @generated from protobuf field: bytes ticket = 1;\n     */\n    ticket: Uint8Array;\n}\n/**\n *\n * A batch of Arrow data as part of a stream of batches.\n *\n * @generated from protobuf message arrow.flight.protocol.FlightData\n */\nexport interface FlightData {\n    /**\n     *\n     * The descriptor of the data. This is only relevant when a client is\n     * starting a new DoPut stream.\n     *\n     * @generated from protobuf field: arrow.flight.protocol.FlightDescriptor flight_descriptor = 1;\n     */\n    flightDescriptor?: FlightDescriptor;\n    /**\n     *\n     * Header for message data as described in Message.fbs::Message.\n     *\n     * @generated from protobuf field: bytes data_header = 2;\n     */\n    dataHeader: Uint8Array;\n    /**\n     *\n     * Application-defined metadata.\n     *\n     * @generated from protobuf field: bytes app_metadata = 3;\n     */\n    appMetadata: Uint8Array;\n    /**\n     *\n     * The actual batch of Arrow data. Preferably handled with minimal-copies\n     * coming last in the definition to help with sidecar patterns (it is\n     * expected that some implementations will fetch this field off the wire\n     * with specialized code to avoid extra memory copies).\n     *\n     * @generated from protobuf field: bytes data_body = 1000;\n     */\n    dataBody: Uint8Array;\n}\n/**\n * *\n * The response message associated with the submission of a DoPut.\n *\n * @generated from protobuf message arrow.flight.protocol.PutResult\n */\nexport interface PutResult {\n    /**\n     * @generated from protobuf field: bytes app_metadata = 1;\n     */\n    appMetadata: Uint8Array;\n}\n/**\n *\n * The result of a cancel operation.\n *\n * This is used by CancelFlightInfoResult.status.\n *\n * @generated from protobuf enum arrow.flight.protocol.CancelStatus\n */\nexport enum CancelStatus {\n    /**\n     * The cancellation status is unknown. Servers should avoid using\n     * this value (send a NOT_FOUND error if the requested query is\n     * not known). Clients can retry the request.\n     *\n     * @generated from protobuf enum value: CANCEL_STATUS_UNSPECIFIED = 0;\n     */\n    UNSPECIFIED = 0,\n    /**\n     * The cancellation request is complete. Subsequent requests with\n     * the same payload may return CANCELLED or a NOT_FOUND error.\n     *\n     * @generated from protobuf enum value: CANCEL_STATUS_CANCELLED = 1;\n     */\n    CANCELLED = 1,\n    /**\n     * The cancellation request is in progress. The client may retry\n     * the cancellation request.\n     *\n     * @generated from protobuf enum value: CANCEL_STATUS_CANCELLING = 2;\n     */\n    CANCELLING = 2,\n    /**\n     * The query is not cancellable. The client should not retry the\n     * cancellation request.\n     *\n     * @generated from protobuf enum value: CANCEL_STATUS_NOT_CANCELLABLE = 3;\n     */\n    NOT_CANCELLABLE = 3\n}\n// @generated message type with reflection information, may provide speed optimized methods\nclass HandshakeRequest$Type extends MessageType<HandshakeRequest> {\n    constructor() {\n        super(\"arrow.flight.protocol.HandshakeRequest\", [\n            { no: 1, name: \"protocol_version\", kind: \"scalar\", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },\n            { no: 2, name: \"payload\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.HandshakeRequest\n */\nexport const HandshakeRequest = new HandshakeRequest$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass HandshakeResponse$Type extends MessageType<HandshakeResponse> {\n    constructor() {\n        super(\"arrow.flight.protocol.HandshakeResponse\", [\n            { no: 1, name: \"protocol_version\", kind: \"scalar\", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },\n            { no: 2, name: \"payload\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.HandshakeResponse\n */\nexport const HandshakeResponse = new HandshakeResponse$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass BasicAuth$Type extends MessageType<BasicAuth> {\n    constructor() {\n        super(\"arrow.flight.protocol.BasicAuth\", [\n            { no: 2, name: \"username\", kind: \"scalar\", T: 9 /*ScalarType.STRING*/ },\n            { no: 3, name: \"password\", kind: \"scalar\", T: 9 /*ScalarType.STRING*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.BasicAuth\n */\nexport const BasicAuth = new BasicAuth$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass Empty$Type extends MessageType<Empty> {\n    constructor() {\n        super(\"arrow.flight.protocol.Empty\", []);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.Empty\n */\nexport const Empty = new Empty$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass ActionType$Type extends MessageType<ActionType> {\n    constructor() {\n        super(\"arrow.flight.protocol.ActionType\", [\n            { no: 1, name: \"type\", kind: \"scalar\", T: 9 /*ScalarType.STRING*/ },\n            { no: 2, name: \"description\", kind: \"scalar\", T: 9 /*ScalarType.STRING*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.ActionType\n */\nexport const ActionType = new ActionType$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass Criteria$Type extends MessageType<Criteria> {\n    constructor() {\n        super(\"arrow.flight.protocol.Criteria\", [\n            { no: 1, name: \"expression\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.Criteria\n */\nexport const Criteria = new Criteria$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass Action$Type extends MessageType<Action> {\n    constructor() {\n        super(\"arrow.flight.protocol.Action\", [\n            { no: 1, name: \"type\", kind: \"scalar\", T: 9 /*ScalarType.STRING*/ },\n            { no: 2, name: \"body\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.Action\n */\nexport const Action = new Action$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass CancelFlightInfoRequest$Type extends MessageType<CancelFlightInfoRequest> {\n    constructor() {\n        super(\"arrow.flight.protocol.CancelFlightInfoRequest\", [\n            { no: 1, name: \"info\", kind: \"message\", T: () => FlightInfo }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.CancelFlightInfoRequest\n */\nexport const CancelFlightInfoRequest = new CancelFlightInfoRequest$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass RenewFlightEndpointRequest$Type extends MessageType<RenewFlightEndpointRequest> {\n    constructor() {\n        super(\"arrow.flight.protocol.RenewFlightEndpointRequest\", [\n            { no: 1, name: \"endpoint\", kind: \"message\", T: () => FlightEndpoint }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.RenewFlightEndpointRequest\n */\nexport const RenewFlightEndpointRequest = new RenewFlightEndpointRequest$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass Result$Type extends MessageType<Result> {\n    constructor() {\n        super(\"arrow.flight.protocol.Result\", [\n            { no: 1, name: \"body\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.Result\n */\nexport const Result = new Result$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass CancelFlightInfoResult$Type extends MessageType<CancelFlightInfoResult> {\n    constructor() {\n        super(\"arrow.flight.protocol.CancelFlightInfoResult\", [\n            { no: 1, name: \"status\", kind: \"enum\", T: () => [\"arrow.flight.protocol.CancelStatus\", CancelStatus, \"CANCEL_STATUS_\"] }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.CancelFlightInfoResult\n */\nexport const CancelFlightInfoResult = new CancelFlightInfoResult$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass SchemaResult$Type extends MessageType<SchemaResult> {\n    constructor() {\n        super(\"arrow.flight.protocol.SchemaResult\", [\n            { no: 1, name: \"schema\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.SchemaResult\n */\nexport const SchemaResult = new SchemaResult$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass FlightDescriptor$Type extends MessageType<FlightDescriptor> {\n    constructor() {\n        super(\"arrow.flight.protocol.FlightDescriptor\", [\n            { no: 1, name: \"type\", kind: \"enum\", T: () => [\"arrow.flight.protocol.FlightDescriptor.DescriptorType\", FlightDescriptor_DescriptorType] },\n            { no: 2, name: \"cmd\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ },\n            { no: 3, name: \"path\", kind: \"scalar\", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.FlightDescriptor\n */\nexport const FlightDescriptor = new FlightDescriptor$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass FlightInfo$Type extends MessageType<FlightInfo> {\n    constructor() {\n        super(\"arrow.flight.protocol.FlightInfo\", [\n            { no: 1, name: \"schema\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ },\n            { no: 2, name: \"flight_descriptor\", kind: \"message\", T: () => FlightDescriptor },\n            { no: 3, name: \"endpoint\", kind: \"message\", repeat: 1 /*RepeatType.PACKED*/, T: () => FlightEndpoint },\n            { no: 4, name: \"total_records\", kind: \"scalar\", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },\n            { no: 5, name: \"total_bytes\", kind: \"scalar\", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },\n            { no: 6, name: \"ordered\", kind: \"scalar\", T: 8 /*ScalarType.BOOL*/ },\n            { no: 7, name: \"app_metadata\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.FlightInfo\n */\nexport const FlightInfo = new FlightInfo$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass PollInfo$Type extends MessageType<PollInfo> {\n    constructor() {\n        super(\"arrow.flight.protocol.PollInfo\", [\n            { no: 1, name: \"info\", kind: \"message\", T: () => FlightInfo },\n            { no: 2, name: \"flight_descriptor\", kind: \"message\", T: () => FlightDescriptor },\n            { no: 3, name: \"progress\", kind: \"scalar\", opt: true, T: 1 /*ScalarType.DOUBLE*/ },\n            { no: 4, name: \"expiration_time\", kind: \"message\", T: () => Timestamp }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.PollInfo\n */\nexport const PollInfo = new PollInfo$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass FlightEndpoint$Type extends MessageType<FlightEndpoint> {\n    constructor() {\n        super(\"arrow.flight.protocol.FlightEndpoint\", [\n            { no: 1, name: \"ticket\", kind: \"message\", T: () => Ticket },\n            { no: 2, name: \"location\", kind: \"message\", repeat: 1 /*RepeatType.PACKED*/, T: () => Location },\n            { no: 3, name: \"expiration_time\", kind: \"message\", T: () => Timestamp },\n            { no: 4, name: \"app_metadata\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.FlightEndpoint\n */\nexport const FlightEndpoint = new FlightEndpoint$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass Location$Type extends MessageType<Location> {\n    constructor() {\n        super(\"arrow.flight.protocol.Location\", [\n            { no: 1, name: \"uri\", kind: \"scalar\", T: 9 /*ScalarType.STRING*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.Location\n */\nexport const Location = new Location$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass Ticket$Type extends MessageType<Ticket> {\n    constructor() {\n        super(\"arrow.flight.protocol.Ticket\", [\n            { no: 1, name: \"ticket\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.Ticket\n */\nexport const Ticket = new Ticket$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass FlightData$Type extends MessageType<FlightData> {\n    constructor() {\n        super(\"arrow.flight.protocol.FlightData\", [\n            { no: 1, name: \"flight_descriptor\", kind: \"message\", T: () => FlightDescriptor },\n            { no: 2, name: \"data_header\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ },\n            { no: 3, name: \"app_metadata\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ },\n            { no: 1000, name: \"data_body\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.FlightData\n */\nexport const FlightData = new FlightData$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass PutResult$Type extends MessageType<PutResult> {\n    constructor() {\n        super(\"arrow.flight.protocol.PutResult\", [\n            { no: 1, name: \"app_metadata\", kind: \"scalar\", T: 12 /*ScalarType.BYTES*/ }\n        ]);\n    }\n}\n/**\n * @generated MessageType for protobuf message arrow.flight.protocol.PutResult\n */\nexport const PutResult = new PutResult$Type();\n/**\n * @generated ServiceType for protobuf service arrow.flight.protocol.FlightService\n */\nexport const FlightService = new ServiceType(\"arrow.flight.protocol.FlightService\", [\n    { name: \"Handshake\", serverStreaming: true, clientStreaming: true, options: {}, I: HandshakeRequest, O: HandshakeResponse },\n    { name: \"ListFlights\", serverStreaming: true, options: {}, I: Criteria, O: FlightInfo },\n    { name: \"GetFlightInfo\", options: {}, I: FlightDescriptor, O: FlightInfo },\n    { name: \"PollFlightInfo\", options: {}, I: FlightDescriptor, O: PollInfo },\n    { name: \"GetSchema\", options: {}, I: FlightDescriptor, O: SchemaResult },\n    { name: \"DoGet\", serverStreaming: true, options: {}, I: Ticket, O: FlightData },\n    { name: \"DoPut\", serverStreaming: true, clientStreaming: true, options: {}, I: FlightData, O: PutResult },\n    { name: \"DoExchange\", serverStreaming: true, clientStreaming: true, options: {}, I: FlightData, O: FlightData },\n    { name: \"DoAction\", serverStreaming: true, options: {}, I: Action, O: Result },\n    { name: \"ListActions\", serverStreaming: true, options: {}, I: Empty, O: ActionType }\n]);\n","/**\n * Get the type of a JSON value.\n * Distinguishes between array, null and object.\n */\nexport function typeofJsonValue(value) {\n    let t = typeof value;\n    if (t == \"object\") {\n        if (Array.isArray(value))\n            return \"array\";\n        if (value === null)\n            return \"null\";\n    }\n    return t;\n}\n/**\n * Is this a JSON object (instead of an array or null)?\n */\nexport function isJsonObject(value) {\n    return value !== null && typeof value == \"object\" && !Array.isArray(value);\n}\n","// lookup table from base64 character to byte\nlet encTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n// lookup table from base64 character *code* to byte because lookup by number is fast\nlet decTable = [];\nfor (let i = 0; i < encTable.length; i++)\n    decTable[encTable[i].charCodeAt(0)] = i;\n// support base64url variants\ndecTable[\"-\".charCodeAt(0)] = encTable.indexOf(\"+\");\ndecTable[\"_\".charCodeAt(0)] = encTable.indexOf(\"/\");\n/**\n * Decodes a base64 string to a byte array.\n *\n * - ignores white-space, including line breaks and tabs\n * - allows inner padding (can decode concatenated base64 strings)\n * - does not require padding\n * - understands base64url encoding:\n *   \"-\" instead of \"+\",\n *   \"_\" instead of \"/\",\n *   no padding\n */\nexport function base64decode(base64Str) {\n    // estimate byte size, not accounting for inner padding and whitespace\n    let es = base64Str.length * 3 / 4;\n    // if (es % 3 !== 0)\n    // throw new Error('invalid base64 string');\n    if (base64Str[base64Str.length - 2] == '=')\n        es -= 2;\n    else if (base64Str[base64Str.length - 1] == '=')\n        es -= 1;\n    let bytes = new Uint8Array(es), bytePos = 0, // position in byte array\n    groupPos = 0, // position in base64 group\n    b, // current byte\n    p = 0 // previous byte\n    ;\n    for (let i = 0; i < base64Str.length; i++) {\n        b = decTable[base64Str.charCodeAt(i)];\n        if (b === undefined) {\n            // noinspection FallThroughInSwitchStatementJS\n            switch (base64Str[i]) {\n                case '=':\n                    groupPos = 0; // reset state when padding found\n                case '\\n':\n                case '\\r':\n                case '\\t':\n                case ' ':\n                    continue; // skip white-space, and padding\n                default:\n                    throw Error(`invalid base64 string.`);\n            }\n        }\n        switch (groupPos) {\n            case 0:\n                p = b;\n                groupPos = 1;\n                break;\n            case 1:\n                bytes[bytePos++] = p << 2 | (b & 48) >> 4;\n                p = b;\n                groupPos = 2;\n                break;\n            case 2:\n                bytes[bytePos++] = (p & 15) << 4 | (b & 60) >> 2;\n                p = b;\n                groupPos = 3;\n                break;\n            case 3:\n                bytes[bytePos++] = (p & 3) << 6 | b;\n                groupPos = 0;\n                break;\n        }\n    }\n    if (groupPos == 1)\n        throw Error(`invalid base64 string.`);\n    return bytes.subarray(0, bytePos);\n}\n/**\n * Encodes a byte array to a base64 string.\n * Adds padding at the end.\n * Does not insert newlines.\n */\nexport function base64encode(bytes) {\n    let base64 = '', groupPos = 0, // position in base64 group\n    b, // current byte\n    p = 0; // carry over from previous byte\n    for (let i = 0; i < bytes.length; i++) {\n        b = bytes[i];\n        switch (groupPos) {\n            case 0:\n                base64 += encTable[b >> 2];\n                p = (b & 3) << 4;\n                groupPos = 1;\n                break;\n            case 1:\n                base64 += encTable[p | b >> 4];\n                p = (b & 15) << 2;\n                groupPos = 2;\n                break;\n            case 2:\n                base64 += encTable[p | b >> 6];\n                base64 += encTable[b & 63];\n                groupPos = 0;\n                break;\n        }\n    }\n    // padding required?\n    if (groupPos) {\n        base64 += encTable[p];\n        base64 += '=';\n        if (groupPos == 1)\n            base64 += '=';\n    }\n    return base64;\n}\n","/**\n * This handler implements the default behaviour for unknown fields.\n * When reading data, unknown fields are stored on the message, in a\n * symbol property.\n * When writing data, the symbol property is queried and unknown fields\n * are serialized into the output again.\n */\nexport var UnknownFieldHandler;\n(function (UnknownFieldHandler) {\n    /**\n     * The symbol used to store unknown fields for a message.\n     * The property must conform to `UnknownFieldContainer`.\n     */\n    UnknownFieldHandler.symbol = Symbol.for(\"protobuf-ts/unknown\");\n    /**\n     * Store an unknown field during binary read directly on the message.\n     * This method is compatible with `BinaryReadOptions.readUnknownField`.\n     */\n    UnknownFieldHandler.onRead = (typeName, message, fieldNo, wireType, data) => {\n        let container = is(message) ? message[UnknownFieldHandler.symbol] : message[UnknownFieldHandler.symbol] = [];\n        container.push({ no: fieldNo, wireType, data });\n    };\n    /**\n     * Write unknown fields stored for the message to the writer.\n     * This method is compatible with `BinaryWriteOptions.writeUnknownFields`.\n     */\n    UnknownFieldHandler.onWrite = (typeName, message, writer) => {\n        for (let { no, wireType, data } of UnknownFieldHandler.list(message))\n            writer.tag(no, wireType).raw(data);\n    };\n    /**\n     * List unknown fields stored for the message.\n     * Note that there may be multiples fields with the same number.\n     */\n    UnknownFieldHandler.list = (message, fieldNo) => {\n        if (is(message)) {\n            let all = message[UnknownFieldHandler.symbol];\n            return fieldNo ? all.filter(uf => uf.no == fieldNo) : all;\n        }\n        return [];\n    };\n    /**\n     * Returns the last unknown field by field number.\n     */\n    UnknownFieldHandler.last = (message, fieldNo) => UnknownFieldHandler.list(message, fieldNo).slice(-1)[0];\n    const is = (message) => message && Array.isArray(message[UnknownFieldHandler.symbol]);\n})(UnknownFieldHandler || (UnknownFieldHandler = {}));\n/**\n * Merges binary write or read options. Later values override earlier values.\n */\nexport function mergeBinaryOptions(a, b) {\n    return Object.assign(Object.assign({}, a), b);\n}\n/**\n * Protobuf binary format wire types.\n *\n * A wire type provides just enough information to find the length of the\n * following value.\n *\n * See https://developers.google.com/protocol-buffers/docs/encoding#structure\n */\nexport var WireType;\n(function (WireType) {\n    /**\n     * Used for int32, int64, uint32, uint64, sint32, sint64, bool, enum\n     */\n    WireType[WireType[\"Varint\"] = 0] = \"Varint\";\n    /**\n     * Used for fixed64, sfixed64, double.\n     * Always 8 bytes with little-endian byte order.\n     */\n    WireType[WireType[\"Bit64\"] = 1] = \"Bit64\";\n    /**\n     * Used for string, bytes, embedded messages, packed repeated fields\n     *\n     * Only repeated numeric types (types which use the varint, 32-bit,\n     * or 64-bit wire types) can be packed. In proto3, such fields are\n     * packed by default.\n     */\n    WireType[WireType[\"LengthDelimited\"] = 2] = \"LengthDelimited\";\n    /**\n     * Used for groups\n     * @deprecated\n     */\n    WireType[WireType[\"StartGroup\"] = 3] = \"StartGroup\";\n    /**\n     * Used for groups\n     * @deprecated\n     */\n    WireType[WireType[\"EndGroup\"] = 4] = \"EndGroup\";\n    /**\n     * Used for fixed32, sfixed32, float.\n     * Always 4 bytes with little-endian byte order.\n     */\n    WireType[WireType[\"Bit32\"] = 5] = \"Bit32\";\n})(WireType || (WireType = {}));\n","// Copyright 2008 Google Inc.  All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Code generated by the Protocol Buffer compiler is owned by the owner\n// of the input file used when generating it.  This code is not\n// standalone and requires a support library to be linked with it.  This\n// support library is itself covered by the above license.\n/**\n * Read a 64 bit varint as two JS numbers.\n *\n * Returns tuple:\n * [0]: low bits\n * [0]: high bits\n *\n * Copyright 2008 Google Inc.  All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175\n */\nexport function varint64read() {\n    let lowBits = 0;\n    let highBits = 0;\n    for (let shift = 0; shift < 28; shift += 7) {\n        let b = this.buf[this.pos++];\n        lowBits |= (b & 0x7F) << shift;\n        if ((b & 0x80) == 0) {\n            this.assertBounds();\n            return [lowBits, highBits];\n        }\n    }\n    let middleByte = this.buf[this.pos++];\n    // last four bits of the first 32 bit number\n    lowBits |= (middleByte & 0x0F) << 28;\n    // 3 upper bits are part of the next 32 bit number\n    highBits = (middleByte & 0x70) >> 4;\n    if ((middleByte & 0x80) == 0) {\n        this.assertBounds();\n        return [lowBits, highBits];\n    }\n    for (let shift = 3; shift <= 31; shift += 7) {\n        let b = this.buf[this.pos++];\n        highBits |= (b & 0x7F) << shift;\n        if ((b & 0x80) == 0) {\n            this.assertBounds();\n            return [lowBits, highBits];\n        }\n    }\n    throw new Error('invalid varint');\n}\n/**\n * Write a 64 bit varint, given as two JS numbers, to the given bytes array.\n *\n * Copyright 2008 Google Inc.  All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344\n */\nexport function varint64write(lo, hi, bytes) {\n    for (let i = 0; i < 28; i = i + 7) {\n        const shift = lo >>> i;\n        const hasNext = !((shift >>> 7) == 0 && hi == 0);\n        const byte = (hasNext ? shift | 0x80 : shift) & 0xFF;\n        bytes.push(byte);\n        if (!hasNext) {\n            return;\n        }\n    }\n    const splitBits = ((lo >>> 28) & 0x0F) | ((hi & 0x07) << 4);\n    const hasMoreBits = !((hi >> 3) == 0);\n    bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xFF);\n    if (!hasMoreBits) {\n        return;\n    }\n    for (let i = 3; i < 31; i = i + 7) {\n        const shift = hi >>> i;\n        const hasNext = !((shift >>> 7) == 0);\n        const byte = (hasNext ? shift | 0x80 : shift) & 0xFF;\n        bytes.push(byte);\n        if (!hasNext) {\n            return;\n        }\n    }\n    bytes.push((hi >>> 31) & 0x01);\n}\n// constants for binary math\nconst TWO_PWR_32_DBL = (1 << 16) * (1 << 16);\n/**\n * Parse decimal string of 64 bit integer value as two JS numbers.\n *\n * Returns tuple:\n * [0]: minus sign?\n * [1]: low bits\n * [2]: high bits\n *\n * Copyright 2008 Google Inc.\n */\nexport function int64fromString(dec) {\n    // Check for minus sign.\n    let minus = dec[0] == '-';\n    if (minus)\n        dec = dec.slice(1);\n    // Work 6 decimal digits at a time, acting like we're converting base 1e6\n    // digits to binary. This is safe to do with floating point math because\n    // Number.isSafeInteger(ALL_32_BITS * 1e6) == true.\n    const base = 1e6;\n    let lowBits = 0;\n    let highBits = 0;\n    function add1e6digit(begin, end) {\n        // Note: Number('') is 0.\n        const digit1e6 = Number(dec.slice(begin, end));\n        highBits *= base;\n        lowBits = lowBits * base + digit1e6;\n        // Carry bits from lowBits to highBits\n        if (lowBits >= TWO_PWR_32_DBL) {\n            highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0);\n            lowBits = lowBits % TWO_PWR_32_DBL;\n        }\n    }\n    add1e6digit(-24, -18);\n    add1e6digit(-18, -12);\n    add1e6digit(-12, -6);\n    add1e6digit(-6);\n    return [minus, lowBits, highBits];\n}\n/**\n * Format 64 bit integer value (as two JS numbers) to decimal string.\n *\n * Copyright 2008 Google Inc.\n */\nexport function int64toString(bitsLow, bitsHigh) {\n    // Skip the expensive conversion if the number is small enough to use the\n    // built-in conversions.\n    if ((bitsHigh >>> 0) <= 0x1FFFFF) {\n        return '' + (TWO_PWR_32_DBL * bitsHigh + (bitsLow >>> 0));\n    }\n    // What this code is doing is essentially converting the input number from\n    // base-2 to base-1e7, which allows us to represent the 64-bit range with\n    // only 3 (very large) digits. Those digits are then trivial to convert to\n    // a base-10 string.\n    // The magic numbers used here are -\n    // 2^24 = 16777216 = (1,6777216) in base-1e7.\n    // 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7.\n    // Split 32:32 representation into 16:24:24 representation so our\n    // intermediate digits don't overflow.\n    let low = bitsLow & 0xFFFFFF;\n    let mid = (((bitsLow >>> 24) | (bitsHigh << 8)) >>> 0) & 0xFFFFFF;\n    let high = (bitsHigh >> 16) & 0xFFFF;\n    // Assemble our three base-1e7 digits, ignoring carries. The maximum\n    // value in a digit at this step is representable as a 48-bit integer, which\n    // can be stored in a 64-bit floating point number.\n    let digitA = low + (mid * 6777216) + (high * 6710656);\n    let digitB = mid + (high * 8147497);\n    let digitC = (high * 2);\n    // Apply carries from A to B and from B to C.\n    let base = 10000000;\n    if (digitA >= base) {\n        digitB += Math.floor(digitA / base);\n        digitA %= base;\n    }\n    if (digitB >= base) {\n        digitC += Math.floor(digitB / base);\n        digitB %= base;\n    }\n    // Convert base-1e7 digits to base-10, with optional leading zeroes.\n    function decimalFrom1e7(digit1e7, needLeadingZeros) {\n        let partial = digit1e7 ? String(digit1e7) : '';\n        if (needLeadingZeros) {\n            return '0000000'.slice(partial.length) + partial;\n        }\n        return partial;\n    }\n    return decimalFrom1e7(digitC, /*needLeadingZeros=*/ 0) +\n        decimalFrom1e7(digitB, /*needLeadingZeros=*/ digitC) +\n        // If the final 1e7 digit didn't need leading zeros, we would have\n        // returned via the trivial code path at the top.\n        decimalFrom1e7(digitA, /*needLeadingZeros=*/ 1);\n}\n/**\n * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`\n *\n * Copyright 2008 Google Inc.  All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144\n */\nexport function varint32write(value, bytes) {\n    if (value >= 0) {\n        // write value as varint 32\n        while (value > 0x7f) {\n            bytes.push((value & 0x7f) | 0x80);\n            value = value >>> 7;\n        }\n        bytes.push(value);\n    }\n    else {\n        for (let i = 0; i < 9; i++) {\n            bytes.push(value & 127 | 128);\n            value = value >> 7;\n        }\n        bytes.push(1);\n    }\n}\n/**\n * Read an unsigned 32 bit varint.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220\n */\nexport function varint32read() {\n    let b = this.buf[this.pos++];\n    let result = b & 0x7F;\n    if ((b & 0x80) == 0) {\n        this.assertBounds();\n        return result;\n    }\n    b = this.buf[this.pos++];\n    result |= (b & 0x7F) << 7;\n    if ((b & 0x80) == 0) {\n        this.assertBounds();\n        return result;\n    }\n    b = this.buf[this.pos++];\n    result |= (b & 0x7F) << 14;\n    if ((b & 0x80) == 0) {\n        this.assertBounds();\n        return result;\n    }\n    b = this.buf[this.pos++];\n    result |= (b & 0x7F) << 21;\n    if ((b & 0x80) == 0) {\n        this.assertBounds();\n        return result;\n    }\n    // Extract only last 4 bits\n    b = this.buf[this.pos++];\n    result |= (b & 0x0F) << 28;\n    for (let readBytes = 5; ((b & 0x80) !== 0) && readBytes < 10; readBytes++)\n        b = this.buf[this.pos++];\n    if ((b & 0x80) != 0)\n        throw new Error('invalid varint');\n    this.assertBounds();\n    // Result can have 32 bits, convert it to unsigned\n    return result >>> 0;\n}\n","import { int64fromString, int64toString } from \"./goog-varint\";\nlet BI;\nexport function detectBi() {\n    const dv = new DataView(new ArrayBuffer(8));\n    const ok = globalThis.BigInt !== undefined\n        && typeof dv.getBigInt64 === \"function\"\n        && typeof dv.getBigUint64 === \"function\"\n        && typeof dv.setBigInt64 === \"function\"\n        && typeof dv.setBigUint64 === \"function\";\n    BI = ok ? {\n        MIN: BigInt(\"-9223372036854775808\"),\n        MAX: BigInt(\"9223372036854775807\"),\n        UMIN: BigInt(\"0\"),\n        UMAX: BigInt(\"18446744073709551615\"),\n        C: BigInt,\n        V: dv,\n    } : undefined;\n}\ndetectBi();\nfunction assertBi(bi) {\n    if (!bi)\n        throw new Error(\"BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support\");\n}\n// used to validate from(string) input (when bigint is unavailable)\nconst RE_DECIMAL_STR = /^-?[0-9]+$/;\n// constants for binary math\nconst TWO_PWR_32_DBL = 0x100000000;\nconst HALF_2_PWR_32 = 0x080000000;\n// base class for PbLong and PbULong provides shared code\nclass SharedPbLong {\n    /**\n     * Create a new instance with the given bits.\n     */\n    constructor(lo, hi) {\n        this.lo = lo | 0;\n        this.hi = hi | 0;\n    }\n    /**\n     * Is this instance equal to 0?\n     */\n    isZero() {\n        return this.lo == 0 && this.hi == 0;\n    }\n    /**\n     * Convert to a native number.\n     */\n    toNumber() {\n        let result = this.hi * TWO_PWR_32_DBL + (this.lo >>> 0);\n        if (!Number.isSafeInteger(result))\n            throw new Error(\"cannot convert to safe number\");\n        return result;\n    }\n}\n/**\n * 64-bit unsigned integer as two 32-bit values.\n * Converts between `string`, `number` and `bigint` representations.\n */\nexport class PbULong extends SharedPbLong {\n    /**\n     * Create instance from a `string`, `number` or `bigint`.\n     */\n    static from(value) {\n        if (BI)\n            // noinspection FallThroughInSwitchStatementJS\n            switch (typeof value) {\n                case \"string\":\n                    if (value == \"0\")\n                        return this.ZERO;\n                    if (value == \"\")\n                        throw new Error('string is no integer');\n                    value = BI.C(value);\n                case \"number\":\n                    if (value === 0)\n                        return this.ZERO;\n                    value = BI.C(value);\n                case \"bigint\":\n                    if (!value)\n                        return this.ZERO;\n                    if (value < BI.UMIN)\n                        throw new Error('signed value for ulong');\n                    if (value > BI.UMAX)\n                        throw new Error('ulong too large');\n                    BI.V.setBigUint64(0, value, true);\n                    return new PbULong(BI.V.getInt32(0, true), BI.V.getInt32(4, true));\n            }\n        else\n            switch (typeof value) {\n                case \"string\":\n                    if (value == \"0\")\n                        return this.ZERO;\n                    value = value.trim();\n                    if (!RE_DECIMAL_STR.test(value))\n                        throw new Error('string is no integer');\n                    let [minus, lo, hi] = int64fromString(value);\n                    if (minus)\n                        throw new Error('signed value for ulong');\n                    return new PbULong(lo, hi);\n                case \"number\":\n                    if (value == 0)\n                        return this.ZERO;\n                    if (!Number.isSafeInteger(value))\n                        throw new Error('number is no integer');\n                    if (value < 0)\n                        throw new Error('signed value for ulong');\n                    return new PbULong(value, value / TWO_PWR_32_DBL);\n            }\n        throw new Error('unknown value ' + typeof value);\n    }\n    /**\n     * Convert to decimal string.\n     */\n    toString() {\n        return BI ? this.toBigInt().toString() : int64toString(this.lo, this.hi);\n    }\n    /**\n     * Convert to native bigint.\n     */\n    toBigInt() {\n        assertBi(BI);\n        BI.V.setInt32(0, this.lo, true);\n        BI.V.setInt32(4, this.hi, true);\n        return BI.V.getBigUint64(0, true);\n    }\n}\n/**\n * ulong 0 singleton.\n */\nPbULong.ZERO = new PbULong(0, 0);\n/**\n * 64-bit signed integer as two 32-bit values.\n * Converts between `string`, `number` and `bigint` representations.\n */\nexport class PbLong extends SharedPbLong {\n    /**\n     * Create instance from a `string`, `number` or `bigint`.\n     */\n    static from(value) {\n        if (BI)\n            // noinspection FallThroughInSwitchStatementJS\n            switch (typeof value) {\n                case \"string\":\n                    if (value == \"0\")\n                        return this.ZERO;\n                    if (value == \"\")\n                        throw new Error('string is no integer');\n                    value = BI.C(value);\n                case \"number\":\n                    if (value === 0)\n                        return this.ZERO;\n                    value = BI.C(value);\n                case \"bigint\":\n                    if (!value)\n                        return this.ZERO;\n                    if (value < BI.MIN)\n                        throw new Error('signed long too small');\n                    if (value > BI.MAX)\n                        throw new Error('signed long too large');\n                    BI.V.setBigInt64(0, value, true);\n                    return new PbLong(BI.V.getInt32(0, true), BI.V.getInt32(4, true));\n            }\n        else\n            switch (typeof value) {\n                case \"string\":\n                    if (value == \"0\")\n                        return this.ZERO;\n                    value = value.trim();\n                    if (!RE_DECIMAL_STR.test(value))\n                        throw new Error('string is no integer');\n                    let [minus, lo, hi] = int64fromString(value);\n                    if (minus) {\n                        if (hi > HALF_2_PWR_32 || (hi == HALF_2_PWR_32 && lo != 0))\n                            throw new Error('signed long too small');\n                    }\n                    else if (hi >= HALF_2_PWR_32)\n                        throw new Error('signed long too large');\n                    let pbl = new PbLong(lo, hi);\n                    return minus ? pbl.negate() : pbl;\n                case \"number\":\n                    if (value == 0)\n                        return this.ZERO;\n                    if (!Number.isSafeInteger(value))\n                        throw new Error('number is no integer');\n                    return value > 0\n                        ? new PbLong(value, value / TWO_PWR_32_DBL)\n                        : new PbLong(-value, -value / TWO_PWR_32_DBL).negate();\n            }\n        throw new Error('unknown value ' + typeof value);\n    }\n    /**\n     * Do we have a minus sign?\n     */\n    isNegative() {\n        return (this.hi & HALF_2_PWR_32) !== 0;\n    }\n    /**\n     * Negate two's complement.\n     * Invert all the bits and add one to the result.\n     */\n    negate() {\n        let hi = ~this.hi, lo = this.lo;\n        if (lo)\n            lo = ~lo + 1;\n        else\n            hi += 1;\n        return new PbLong(lo, hi);\n    }\n    /**\n     * Convert to decimal string.\n     */\n    toString() {\n        if (BI)\n            return this.toBigInt().toString();\n        if (this.isNegative()) {\n            let n = this.negate();\n            return '-' + int64toString(n.lo, n.hi);\n        }\n        return int64toString(this.lo, this.hi);\n    }\n    /**\n     * Convert to native bigint.\n     */\n    toBigInt() {\n        assertBi(BI);\n        BI.V.setInt32(0, this.lo, true);\n        BI.V.setInt32(4, this.hi, true);\n        return BI.V.getBigInt64(0, true);\n    }\n}\n/**\n * long 0 singleton.\n */\nPbLong.ZERO = new PbLong(0, 0);\n","import { WireType } from \"./binary-format-contract\";\nimport { PbLong, PbULong } from \"./pb-long\";\nimport { varint32read, varint64read } from \"./goog-varint\";\nconst defaultsRead = {\n    readUnknownField: true,\n    readerFactory: bytes => new BinaryReader(bytes),\n};\n/**\n * Make options for reading binary data form partial options.\n */\nexport function binaryReadOptions(options) {\n    return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;\n}\nexport class BinaryReader {\n    constructor(buf, textDecoder) {\n        this.varint64 = varint64read; // dirty cast for `this`\n        /**\n         * Read a `uint32` field, an unsigned 32 bit varint.\n         */\n        this.uint32 = varint32read; // dirty cast for `this` and access to protected `buf`\n        this.buf = buf;\n        this.len = buf.length;\n        this.pos = 0;\n        this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n        this.textDecoder = textDecoder !== null && textDecoder !== void 0 ? textDecoder : new TextDecoder(\"utf-8\", {\n            fatal: true,\n            ignoreBOM: true,\n        });\n    }\n    /**\n     * Reads a tag - field number and wire type.\n     */\n    tag() {\n        let tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7;\n        if (fieldNo <= 0 || wireType < 0 || wireType > 5)\n            throw new Error(\"illegal tag: field no \" + fieldNo + \" wire type \" + wireType);\n        return [fieldNo, wireType];\n    }\n    /**\n     * Skip one element on the wire and return the skipped data.\n     * Supports WireType.StartGroup since v2.0.0-alpha.23.\n     */\n    skip(wireType) {\n        let start = this.pos;\n        // noinspection FallThroughInSwitchStatementJS\n        switch (wireType) {\n            case WireType.Varint:\n                while (this.buf[this.pos++] & 0x80) {\n                    // ignore\n                }\n                break;\n            case WireType.Bit64:\n                this.pos += 4;\n            case WireType.Bit32:\n                this.pos += 4;\n                break;\n            case WireType.LengthDelimited:\n                let len = this.uint32();\n                this.pos += len;\n                break;\n            case WireType.StartGroup:\n                // From descriptor.proto: Group type is deprecated, not supported in proto3.\n                // But we must still be able to parse and treat as unknown.\n                let t;\n                while ((t = this.tag()[1]) !== WireType.EndGroup) {\n                    this.skip(t);\n                }\n                break;\n            default:\n                throw new Error(\"cant skip wire type \" + wireType);\n        }\n        this.assertBounds();\n        return this.buf.subarray(start, this.pos);\n    }\n    /**\n     * Throws error if position in byte array is out of range.\n     */\n    assertBounds() {\n        if (this.pos > this.len)\n            throw new RangeError(\"premature EOF\");\n    }\n    /**\n     * Read a `int32` field, a signed 32 bit varint.\n     */\n    int32() {\n        return this.uint32() | 0;\n    }\n    /**\n     * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.\n     */\n    sint32() {\n        let zze = this.uint32();\n        // decode zigzag\n        return (zze >>> 1) ^ -(zze & 1);\n    }\n    /**\n     * Read a `int64` field, a signed 64-bit varint.\n     */\n    int64() {\n        return new PbLong(...this.varint64());\n    }\n    /**\n     * Read a `uint64` field, an unsigned 64-bit varint.\n     */\n    uint64() {\n        return new PbULong(...this.varint64());\n    }\n    /**\n     * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.\n     */\n    sint64() {\n        let [lo, hi] = this.varint64();\n        // decode zig zag\n        let s = -(lo & 1);\n        lo = ((lo >>> 1 | (hi & 1) << 31) ^ s);\n        hi = (hi >>> 1 ^ s);\n        return new PbLong(lo, hi);\n    }\n    /**\n     * Read a `bool` field, a variant.\n     */\n    bool() {\n        let [lo, hi] = this.varint64();\n        return lo !== 0 || hi !== 0;\n    }\n    /**\n     * Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.\n     */\n    fixed32() {\n        return this.view.getUint32((this.pos += 4) - 4, true);\n    }\n    /**\n     * Read a `sfixed32` field, a signed, fixed-length 32-bit integer.\n     */\n    sfixed32() {\n        return this.view.getInt32((this.pos += 4) - 4, true);\n    }\n    /**\n     * Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.\n     */\n    fixed64() {\n        return new PbULong(this.sfixed32(), this.sfixed32());\n    }\n    /**\n     * Read a `fixed64` field, a signed, fixed-length 64-bit integer.\n     */\n    sfixed64() {\n        return new PbLong(this.sfixed32(), this.sfixed32());\n    }\n    /**\n     * Read a `float` field, 32-bit floating point number.\n     */\n    float() {\n        return this.view.getFloat32((this.pos += 4) - 4, true);\n    }\n    /**\n     * Read a `double` field, a 64-bit floating point number.\n     */\n    double() {\n        return this.view.getFloat64((this.pos += 8) - 8, true);\n    }\n    /**\n     * Read a `bytes` field, length-delimited arbitrary data.\n     */\n    bytes() {\n        let len = this.uint32();\n        let start = this.pos;\n        this.pos += len;\n        this.assertBounds();\n        return this.buf.subarray(start, start + len);\n    }\n    /**\n     * Read a `string` field, length-delimited data converted to UTF-8 text.\n     */\n    string() {\n        return this.textDecoder.decode(this.bytes());\n    }\n}\n","/**\n * assert that condition is true or throw error (with message)\n */\nexport function assert(condition, msg) {\n    if (!condition) {\n        throw new Error(msg);\n    }\n}\n/**\n * assert that value cannot exist = type `never`. throw runtime error if it does.\n */\nexport function assertNever(value, msg) {\n    throw new Error(msg !== null && msg !== void 0 ? msg : 'Unexpected object: ' + value);\n}\nconst FLOAT32_MAX = 3.4028234663852886e+38, FLOAT32_MIN = -3.4028234663852886e+38, UINT32_MAX = 0xFFFFFFFF, INT32_MAX = 0X7FFFFFFF, INT32_MIN = -0X80000000;\nexport function assertInt32(arg) {\n    if (typeof arg !== \"number\")\n        throw new Error('invalid int 32: ' + typeof arg);\n    if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN)\n        throw new Error('invalid int 32: ' + arg);\n}\nexport function assertUInt32(arg) {\n    if (typeof arg !== \"number\")\n        throw new Error('invalid uint 32: ' + typeof arg);\n    if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0)\n        throw new Error('invalid uint 32: ' + arg);\n}\nexport function assertFloat32(arg) {\n    if (typeof arg !== \"number\")\n        throw new Error('invalid float 32: ' + typeof arg);\n    if (!Number.isFinite(arg))\n        return;\n    if (arg > FLOAT32_MAX || arg < FLOAT32_MIN)\n        throw new Error('invalid float 32: ' + arg);\n}\n","import { PbLong, PbULong } from \"./pb-long\";\nimport { varint32write, varint64write } from \"./goog-varint\";\nimport { assertFloat32, assertInt32, assertUInt32 } from \"./assert\";\nconst defaultsWrite = {\n    writeUnknownFields: true,\n    writerFactory: () => new BinaryWriter(),\n};\n/**\n * Make options for writing binary data form partial options.\n */\nexport function binaryWriteOptions(options) {\n    return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;\n}\nexport class BinaryWriter {\n    constructor(textEncoder) {\n        /**\n         * Previous fork states.\n         */\n        this.stack = [];\n        this.textEncoder = textEncoder !== null && textEncoder !== void 0 ? textEncoder : new TextEncoder();\n        this.chunks = [];\n        this.buf = [];\n    }\n    /**\n     * Return all bytes written and reset this writer.\n     */\n    finish() {\n        this.chunks.push(new Uint8Array(this.buf)); // flush the buffer\n        let len = 0;\n        for (let i = 0; i < this.chunks.length; i++)\n            len += this.chunks[i].length;\n        let bytes = new Uint8Array(len);\n        let offset = 0;\n        for (let i = 0; i < this.chunks.length; i++) {\n            bytes.set(this.chunks[i], offset);\n            offset += this.chunks[i].length;\n        }\n        this.chunks = [];\n        return bytes;\n    }\n    /**\n     * Start a new fork for length-delimited data like a message\n     * or a packed repeated field.\n     *\n     * Must be joined later with `join()`.\n     */\n    fork() {\n        this.stack.push({ chunks: this.chunks, buf: this.buf });\n        this.chunks = [];\n        this.buf = [];\n        return this;\n    }\n    /**\n     * Join the last fork. Write its length and bytes, then\n     * return to the previous state.\n     */\n    join() {\n        // get chunk of fork\n        let chunk = this.finish();\n        // restore previous state\n        let prev = this.stack.pop();\n        if (!prev)\n            throw new Error('invalid state, fork stack empty');\n        this.chunks = prev.chunks;\n        this.buf = prev.buf;\n        // write length of chunk as varint\n        this.uint32(chunk.byteLength);\n        return this.raw(chunk);\n    }\n    /**\n     * Writes a tag (field number and wire type).\n     *\n     * Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.\n     *\n     * Generated code should compute the tag ahead of time and call `uint32()`.\n     */\n    tag(fieldNo, type) {\n        return this.uint32((fieldNo << 3 | type) >>> 0);\n    }\n    /**\n     * Write a chunk of raw bytes.\n     */\n    raw(chunk) {\n        if (this.buf.length) {\n            this.chunks.push(new Uint8Array(this.buf));\n            this.buf = [];\n        }\n        this.chunks.push(chunk);\n        return this;\n    }\n    /**\n     * Write a `uint32` value, an unsigned 32 bit varint.\n     */\n    uint32(value) {\n        assertUInt32(value);\n        // write value as varint 32, inlined for speed\n        while (value > 0x7f) {\n            this.buf.push((value & 0x7f) | 0x80);\n            value = value >>> 7;\n        }\n        this.buf.push(value);\n        return this;\n    }\n    /**\n     * Write a `int32` value, a signed 32 bit varint.\n     */\n    int32(value) {\n        assertInt32(value);\n        varint32write(value, this.buf);\n        return this;\n    }\n    /**\n     * Write a `bool` value, a variant.\n     */\n    bool(value) {\n        this.buf.push(value ? 1 : 0);\n        return this;\n    }\n    /**\n     * Write a `bytes` value, length-delimited arbitrary data.\n     */\n    bytes(value) {\n        this.uint32(value.byteLength); // write length of chunk as varint\n        return this.raw(value);\n    }\n    /**\n     * Write a `string` value, length-delimited data converted to UTF-8 text.\n     */\n    string(value) {\n        let chunk = this.textEncoder.encode(value);\n        this.uint32(chunk.byteLength); // write length of chunk as varint\n        return this.raw(chunk);\n    }\n    /**\n     * Write a `float` value, 32-bit floating point number.\n     */\n    float(value) {\n        assertFloat32(value);\n        let chunk = new Uint8Array(4);\n        new DataView(chunk.buffer).setFloat32(0, value, true);\n        return this.raw(chunk);\n    }\n    /**\n     * Write a `double` value, a 64-bit floating point number.\n     */\n    double(value) {\n        let chunk = new Uint8Array(8);\n        new DataView(chunk.buffer).setFloat64(0, value, true);\n        return this.raw(chunk);\n    }\n    /**\n     * Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.\n     */\n    fixed32(value) {\n        assertUInt32(value);\n        let chunk = new Uint8Array(4);\n        new DataView(chunk.buffer).setUint32(0, value, true);\n        return this.raw(chunk);\n    }\n    /**\n     * Write a `sfixed32` value, a signed, fixed-length 32-bit integer.\n     */\n    sfixed32(value) {\n        assertInt32(value);\n        let chunk = new Uint8Array(4);\n        new DataView(chunk.buffer).setInt32(0, value, true);\n        return this.raw(chunk);\n    }\n    /**\n     * Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.\n     */\n    sint32(value) {\n        assertInt32(value);\n        // zigzag encode\n        value = ((value << 1) ^ (value >> 31)) >>> 0;\n        varint32write(value, this.buf);\n        return this;\n    }\n    /**\n     * Write a `fixed64` value, a signed, fixed-length 64-bit integer.\n     */\n    sfixed64(value) {\n        let chunk = new Uint8Array(8);\n        let view = new DataView(chunk.buffer);\n        let long = PbLong.from(value);\n        view.setInt32(0, long.lo, true);\n        view.setInt32(4, long.hi, true);\n        return this.raw(chunk);\n    }\n    /**\n     * Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.\n     */\n    fixed64(value) {\n        let chunk = new Uint8Array(8);\n        let view = new DataView(chunk.buffer);\n        let long = PbULong.from(value);\n        view.setInt32(0, long.lo, true);\n        view.setInt32(4, long.hi, true);\n        return this.raw(chunk);\n    }\n    /**\n     * Write a `int64` value, a signed 64-bit varint.\n     */\n    int64(value) {\n        let long = PbLong.from(value);\n        varint64write(long.lo, long.hi, this.buf);\n        return this;\n    }\n    /**\n     * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.\n     */\n    sint64(value) {\n        let long = PbLong.from(value), \n        // zigzag encode\n        sign = long.hi >> 31, lo = (long.lo << 1) ^ sign, hi = ((long.hi << 1) | (long.lo >>> 31)) ^ sign;\n        varint64write(lo, hi, this.buf);\n        return this;\n    }\n    /**\n     * Write a `uint64` value, an unsigned 64-bit varint.\n     */\n    uint64(value) {\n        let long = PbULong.from(value);\n        varint64write(long.lo, long.hi, this.buf);\n        return this;\n    }\n}\n","const defaultsWrite = {\n    emitDefaultValues: false,\n    enumAsInteger: false,\n    useProtoFieldName: false,\n    prettySpaces: 0,\n}, defaultsRead = {\n    ignoreUnknownFields: false,\n};\n/**\n * Make options for reading JSON data from partial options.\n */\nexport function jsonReadOptions(options) {\n    return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;\n}\n/**\n * Make options for writing JSON data from partial options.\n */\nexport function jsonWriteOptions(options) {\n    return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;\n}\n/**\n * Merges JSON write or read options. Later values override earlier values. Type registries are merged.\n */\nexport function mergeJsonOptions(a, b) {\n    var _a, _b;\n    let c = Object.assign(Object.assign({}, a), b);\n    c.typeRegistry = [...((_a = a === null || a === void 0 ? void 0 : a.typeRegistry) !== null && _a !== void 0 ? _a : []), ...((_b = b === null || b === void 0 ? void 0 : b.typeRegistry) !== null && _b !== void 0 ? _b : [])];\n    return c;\n}\n","/**\n * The symbol used as a key on message objects to store the message type.\n *\n * Note that this is an experimental feature - it is here to stay, but\n * implementation details may change without notice.\n */\nexport const MESSAGE_TYPE = Symbol.for(\"protobuf-ts/message-type\");\n","/**\n * Converts snake_case to lowerCamelCase.\n *\n * Should behave like protoc:\n * https://github.com/protocolbuffers/protobuf/blob/e8ae137c96444ea313485ed1118c5e43b2099cf1/src/google/protobuf/compiler/java/java_helpers.cc#L118\n */\nexport function lowerCamelCase(snakeCase) {\n    let capNext = false;\n    const sb = [];\n    for (let i = 0; i < snakeCase.length; i++) {\n        let next = snakeCase.charAt(i);\n        if (next == '_') {\n            capNext = true;\n        }\n        else if (/\\d/.test(next)) {\n            sb.push(next);\n            capNext = true;\n        }\n        else if (capNext) {\n            sb.push(next.toUpperCase());\n            capNext = false;\n        }\n        else if (i == 0) {\n            sb.push(next.toLowerCase());\n        }\n        else {\n            sb.push(next);\n        }\n    }\n    return sb.join('');\n}\n","import { lowerCamelCase } from \"./lower-camel-case\";\n/**\n * Scalar value types. This is a subset of field types declared by protobuf\n * enum google.protobuf.FieldDescriptorProto.Type The types GROUP and MESSAGE\n * are omitted, but the numerical values are identical.\n */\nexport var ScalarType;\n(function (ScalarType) {\n    // 0 is reserved for errors.\n    // Order is weird for historical reasons.\n    ScalarType[ScalarType[\"DOUBLE\"] = 1] = \"DOUBLE\";\n    ScalarType[ScalarType[\"FLOAT\"] = 2] = \"FLOAT\";\n    // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if\n    // negative values are likely.\n    ScalarType[ScalarType[\"INT64\"] = 3] = \"INT64\";\n    ScalarType[ScalarType[\"UINT64\"] = 4] = \"UINT64\";\n    // Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if\n    // negative values are likely.\n    ScalarType[ScalarType[\"INT32\"] = 5] = \"INT32\";\n    ScalarType[ScalarType[\"FIXED64\"] = 6] = \"FIXED64\";\n    ScalarType[ScalarType[\"FIXED32\"] = 7] = \"FIXED32\";\n    ScalarType[ScalarType[\"BOOL\"] = 8] = \"BOOL\";\n    ScalarType[ScalarType[\"STRING\"] = 9] = \"STRING\";\n    // Tag-delimited aggregate.\n    // Group type is deprecated and not supported in proto3. However, Proto3\n    // implementations should still be able to parse the group wire format and\n    // treat group fields as unknown fields.\n    // TYPE_GROUP = 10,\n    // TYPE_MESSAGE = 11,  // Length-delimited aggregate.\n    // New in version 2.\n    ScalarType[ScalarType[\"BYTES\"] = 12] = \"BYTES\";\n    ScalarType[ScalarType[\"UINT32\"] = 13] = \"UINT32\";\n    // TYPE_ENUM = 14,\n    ScalarType[ScalarType[\"SFIXED32\"] = 15] = \"SFIXED32\";\n    ScalarType[ScalarType[\"SFIXED64\"] = 16] = \"SFIXED64\";\n    ScalarType[ScalarType[\"SINT32\"] = 17] = \"SINT32\";\n    ScalarType[ScalarType[\"SINT64\"] = 18] = \"SINT64\";\n})(ScalarType || (ScalarType = {}));\n/**\n * JavaScript representation of 64 bit integral types. Equivalent to the\n * field option \"jstype\".\n *\n * By default, protobuf-ts represents 64 bit types as `bigint`.\n *\n * You can change the default behaviour by enabling the plugin parameter\n * `long_type_string`, which will represent 64 bit types as `string`.\n *\n * Alternatively, you can change the behaviour for individual fields\n * with the field option \"jstype\":\n *\n * ```protobuf\n * uint64 my_field = 1 [jstype = JS_STRING];\n * uint64 other_field = 2 [jstype = JS_NUMBER];\n * ```\n */\nexport var LongType;\n(function (LongType) {\n    /**\n     * Use JavaScript `bigint`.\n     *\n     * Field option `[jstype = JS_NORMAL]`.\n     */\n    LongType[LongType[\"BIGINT\"] = 0] = \"BIGINT\";\n    /**\n     * Use JavaScript `string`.\n     *\n     * Field option `[jstype = JS_STRING]`.\n     */\n    LongType[LongType[\"STRING\"] = 1] = \"STRING\";\n    /**\n     * Use JavaScript `number`.\n     *\n     * Large values will loose precision.\n     *\n     * Field option `[jstype = JS_NUMBER]`.\n     */\n    LongType[LongType[\"NUMBER\"] = 2] = \"NUMBER\";\n})(LongType || (LongType = {}));\n/**\n * Protobuf 2.1.0 introduced packed repeated fields.\n * Setting the field option `[packed = true]` enables packing.\n *\n * In proto3, all repeated fields are packed by default.\n * Setting the field option `[packed = false]` disables packing.\n *\n * Packed repeated fields are encoded with a single tag,\n * then a length-delimiter, then the element values.\n *\n * Unpacked repeated fields are encoded with a tag and\n * value for each element.\n *\n * `bytes` and `string` cannot be packed.\n */\nexport var RepeatType;\n(function (RepeatType) {\n    /**\n     * The field is not repeated.\n     */\n    RepeatType[RepeatType[\"NO\"] = 0] = \"NO\";\n    /**\n     * The field is repeated and should be packed.\n     * Invalid for `bytes` and `string`, they cannot be packed.\n     */\n    RepeatType[RepeatType[\"PACKED\"] = 1] = \"PACKED\";\n    /**\n     * The field is repeated but should not be packed.\n     * The only valid repeat type for repeated `bytes` and `string`.\n     */\n    RepeatType[RepeatType[\"UNPACKED\"] = 2] = \"UNPACKED\";\n})(RepeatType || (RepeatType = {}));\n/**\n * Turns PartialFieldInfo into FieldInfo.\n */\nexport function normalizeFieldInfo(field) {\n    var _a, _b, _c, _d;\n    field.localName = (_a = field.localName) !== null && _a !== void 0 ? _a : lowerCamelCase(field.name);\n    field.jsonName = (_b = field.jsonName) !== null && _b !== void 0 ? _b : lowerCamelCase(field.name);\n    field.repeat = (_c = field.repeat) !== null && _c !== void 0 ? _c : RepeatType.NO;\n    field.opt = (_d = field.opt) !== null && _d !== void 0 ? _d : (field.repeat ? false : field.oneof ? false : field.kind == \"message\");\n    return field;\n}\n/**\n * Read custom field options from a generated message type.\n *\n * @deprecated use readFieldOption()\n */\nexport function readFieldOptions(messageType, fieldName, extensionName, extensionType) {\n    var _a;\n    const options = (_a = messageType.fields.find((m, i) => m.localName == fieldName || i == fieldName)) === null || _a === void 0 ? void 0 : _a.options;\n    return options && options[extensionName] ? extensionType.fromJson(options[extensionName]) : undefined;\n}\nexport function readFieldOption(messageType, fieldName, extensionName, extensionType) {\n    var _a;\n    const options = (_a = messageType.fields.find((m, i) => m.localName == fieldName || i == fieldName)) === null || _a === void 0 ? void 0 : _a.options;\n    if (!options) {\n        return undefined;\n    }\n    const optionVal = options[extensionName];\n    if (optionVal === undefined) {\n        return optionVal;\n    }\n    return extensionType ? extensionType.fromJson(optionVal) : optionVal;\n}\nexport function readMessageOption(messageType, extensionName, extensionType) {\n    const options = messageType.options;\n    const optionVal = options[extensionName];\n    if (optionVal === undefined) {\n        return optionVal;\n    }\n    return extensionType ? extensionType.fromJson(optionVal) : optionVal;\n}\n","/**\n * Is the given value a valid oneof group?\n *\n * We represent protobuf `oneof` as algebraic data types (ADT) in generated\n * code. But when working with messages of unknown type, the ADT does not\n * help us.\n *\n * This type guard checks if the given object adheres to the ADT rules, which\n * are as follows:\n *\n * 1) Must be an object.\n *\n * 2) Must have a \"oneofKind\" discriminator property.\n *\n * 3) If \"oneofKind\" is `undefined`, no member field is selected. The object\n * must not have any other properties.\n *\n * 4) If \"oneofKind\" is a `string`, the member field with this name is\n * selected.\n *\n * 5) If a member field is selected, the object must have a second property\n * with this name. The property must not be `undefined`.\n *\n * 6) No extra properties are allowed. The object has either one property\n * (no selection) or two properties (selection).\n *\n */\nexport function isOneofGroup(any) {\n    if (typeof any != 'object' || any === null || !any.hasOwnProperty('oneofKind')) {\n        return false;\n    }\n    switch (typeof any.oneofKind) {\n        case \"string\":\n            if (any[any.oneofKind] === undefined)\n                return false;\n            return Object.keys(any).length == 2;\n        case \"undefined\":\n            return Object.keys(any).length == 1;\n        default:\n            return false;\n    }\n}\n/**\n * Returns the value of the given field in a oneof group.\n */\nexport function getOneofValue(oneof, kind) {\n    return oneof[kind];\n}\nexport function setOneofValue(oneof, kind, value) {\n    if (oneof.oneofKind !== undefined) {\n        delete oneof[oneof.oneofKind];\n    }\n    oneof.oneofKind = kind;\n    if (value !== undefined) {\n        oneof[kind] = value;\n    }\n}\nexport function setUnknownOneofValue(oneof, kind, value) {\n    if (oneof.oneofKind !== undefined) {\n        delete oneof[oneof.oneofKind];\n    }\n    oneof.oneofKind = kind;\n    if (value !== undefined && kind !== undefined) {\n        oneof[kind] = value;\n    }\n}\n/**\n * Removes the selected field in a oneof group.\n *\n * Note that the recommended way to modify a oneof group is to set\n * a new object:\n *\n * ```ts\n * message.result = { oneofKind: undefined };\n * ```\n */\nexport function clearOneofValue(oneof) {\n    if (oneof.oneofKind !== undefined) {\n        delete oneof[oneof.oneofKind];\n    }\n    oneof.oneofKind = undefined;\n}\n/**\n * Returns the selected value of the given oneof group.\n *\n * Not that the recommended way to access a oneof group is to check\n * the \"oneofKind\" property and let TypeScript narrow down the union\n * type for you:\n *\n * ```ts\n * if (message.result.oneofKind === \"error\") {\n *   message.result.error; // string\n * }\n * ```\n *\n * In the rare case you just need the value, and do not care about\n * which protobuf field is selected, you can use this function\n * for convenience.\n */\nexport function getSelectedOneofValue(oneof) {\n    if (oneof.oneofKind === undefined) {\n        return undefined;\n    }\n    return oneof[oneof.oneofKind];\n}\n","import { LongType, ScalarType } from \"./reflection-info\";\nimport { isOneofGroup } from \"./oneof\";\n// noinspection JSMethodCanBeStatic\nexport class ReflectionTypeCheck {\n    constructor(info) {\n        var _a;\n        this.fields = (_a = info.fields) !== null && _a !== void 0 ? _a : [];\n    }\n    prepare() {\n        if (this.data)\n            return;\n        const req = [], known = [], oneofs = [];\n        for (let field of this.fields) {\n            if (field.oneof) {\n                if (!oneofs.includes(field.oneof)) {\n                    oneofs.push(field.oneof);\n                    req.push(field.oneof);\n                    known.push(field.oneof);\n                }\n            }\n            else {\n                known.push(field.localName);\n                switch (field.kind) {\n                    case \"scalar\":\n                    case \"enum\":\n                        if (!field.opt || field.repeat)\n                            req.push(field.localName);\n                        break;\n                    case \"message\":\n                        if (field.repeat)\n                            req.push(field.localName);\n                        break;\n                    case \"map\":\n                        req.push(field.localName);\n                        break;\n                }\n            }\n        }\n        this.data = { req, known, oneofs: Object.values(oneofs) };\n    }\n    /**\n     * Is the argument a valid message as specified by the\n     * reflection information?\n     *\n     * Checks all field types recursively. The `depth`\n     * specifies how deep into the structure the check will be.\n     *\n     * With a depth of 0, only the presence of fields\n     * is checked.\n     *\n     * With a depth of 1 or more, the field types are checked.\n     *\n     * With a depth of 2 or more, the members of map, repeated\n     * and message fields are checked.\n     *\n     * Message fields will be checked recursively with depth - 1.\n     *\n     * The number of map entries / repeated values being checked\n     * is < depth.\n     */\n    is(message, depth, allowExcessProperties = false) {\n        if (depth < 0)\n            return true;\n        if (message === null || message === undefined || typeof message != 'object')\n            return false;\n        this.prepare();\n        let keys = Object.keys(message), data = this.data;\n        // if a required field is missing in arg, this cannot be a T\n        if (keys.length < data.req.length || data.req.some(n => !keys.includes(n)))\n            return false;\n        if (!allowExcessProperties) {\n            // if the arg contains a key we dont know, this is not a literal T\n            if (keys.some(k => !data.known.includes(k)))\n                return false;\n        }\n        // \"With a depth of 0, only the presence and absence of fields is checked.\"\n        // \"With a depth of 1 or more, the field types are checked.\"\n        if (depth < 1) {\n            return true;\n        }\n        // check oneof group\n        for (const name of data.oneofs) {\n            const group = message[name];\n            if (!isOneofGroup(group))\n                return false;\n            if (group.oneofKind === undefined)\n                continue;\n            const field = this.fields.find(f => f.localName === group.oneofKind);\n            if (!field)\n                return false; // we found no field, but have a kind, something is wrong\n            if (!this.field(group[group.oneofKind], field, allowExcessProperties, depth))\n                return false;\n        }\n        // check types\n        for (const field of this.fields) {\n            if (field.oneof !== undefined)\n                continue;\n            if (!this.field(message[field.localName], field, allowExcessProperties, depth))\n                return false;\n        }\n        return true;\n    }\n    field(arg, field, allowExcessProperties, depth) {\n        let repeated = field.repeat;\n        switch (field.kind) {\n            case \"scalar\":\n                if (arg === undefined)\n                    return field.opt;\n                if (repeated)\n                    return this.scalars(arg, field.T, depth, field.L);\n                return this.scalar(arg, field.T, field.L);\n            case \"enum\":\n                if (arg === undefined)\n                    return field.opt;\n                if (repeated)\n                    return this.scalars(arg, ScalarType.INT32, depth);\n                return this.scalar(arg, ScalarType.INT32);\n            case \"message\":\n                if (arg === undefined)\n                    return true;\n                if (repeated)\n                    return this.messages(arg, field.T(), allowExcessProperties, depth);\n                return this.message(arg, field.T(), allowExcessProperties, depth);\n            case \"map\":\n                if (typeof arg != 'object' || arg === null)\n                    return false;\n                if (depth < 2)\n                    return true;\n                if (!this.mapKeys(arg, field.K, depth))\n                    return false;\n                switch (field.V.kind) {\n                    case \"scalar\":\n                        return this.scalars(Object.values(arg), field.V.T, depth, field.V.L);\n                    case \"enum\":\n                        return this.scalars(Object.values(arg), ScalarType.INT32, depth);\n                    case \"message\":\n                        return this.messages(Object.values(arg), field.V.T(), allowExcessProperties, depth);\n                }\n                break;\n        }\n        return true;\n    }\n    message(arg, type, allowExcessProperties, depth) {\n        if (allowExcessProperties) {\n            return type.isAssignable(arg, depth);\n        }\n        return type.is(arg, depth);\n    }\n    messages(arg, type, allowExcessProperties, depth) {\n        if (!Array.isArray(arg))\n            return false;\n        if (depth < 2)\n            return true;\n        if (allowExcessProperties) {\n            for (let i = 0; i < arg.length && i < depth; i++)\n                if (!type.isAssignable(arg[i], depth - 1))\n                    return false;\n        }\n        else {\n            for (let i = 0; i < arg.length && i < depth; i++)\n                if (!type.is(arg[i], depth - 1))\n                    return false;\n        }\n        return true;\n    }\n    scalar(arg, type, longType) {\n        let argType = typeof arg;\n        switch (type) {\n            case ScalarType.UINT64:\n            case ScalarType.FIXED64:\n            case ScalarType.INT64:\n            case ScalarType.SFIXED64:\n            case ScalarType.SINT64:\n                switch (longType) {\n                    case LongType.BIGINT:\n                        return argType == \"bigint\";\n                    case LongType.NUMBER:\n                        return argType == \"number\" && !isNaN(arg);\n                    default:\n                        return argType == \"string\";\n                }\n            case ScalarType.BOOL:\n                return argType == 'boolean';\n            case ScalarType.STRING:\n                return argType == 'string';\n            case ScalarType.BYTES:\n                return arg instanceof Uint8Array;\n            case ScalarType.DOUBLE:\n            case ScalarType.FLOAT:\n                return argType == 'number' && !isNaN(arg);\n            default:\n                // case ScalarType.UINT32:\n                // case ScalarType.FIXED32:\n                // case ScalarType.INT32:\n                // case ScalarType.SINT32:\n                // case ScalarType.SFIXED32:\n                return argType == 'number' && Number.isInteger(arg);\n        }\n    }\n    scalars(arg, type, depth, longType) {\n        if (!Array.isArray(arg))\n            return false;\n        if (depth < 2)\n            return true;\n        if (Array.isArray(arg))\n            for (let i = 0; i < arg.length && i < depth; i++)\n                if (!this.scalar(arg[i], type, longType))\n                    return false;\n        return true;\n    }\n    mapKeys(map, type, depth) {\n        let keys = Object.keys(map);\n        switch (type) {\n            case ScalarType.INT32:\n            case ScalarType.FIXED32:\n            case ScalarType.SFIXED32:\n            case ScalarType.SINT32:\n            case ScalarType.UINT32:\n                return this.scalars(keys.slice(0, depth).map(k => parseInt(k)), type, depth);\n            case ScalarType.BOOL:\n                return this.scalars(keys.slice(0, depth).map(k => k == 'true' ? true : k == 'false' ? false : k), type, depth);\n            default:\n                return this.scalars(keys, type, depth, LongType.STRING);\n        }\n    }\n}\n","import { LongType } from \"./reflection-info\";\n/**\n * Utility method to convert a PbLong or PbUlong to a JavaScript\n * representation during runtime.\n *\n * Works with generated field information, `undefined` is equivalent\n * to `STRING`.\n */\nexport function reflectionLongConvert(long, type) {\n    switch (type) {\n        case LongType.BIGINT:\n            return long.toBigInt();\n        case LongType.NUMBER:\n            return long.toNumber();\n        default:\n            // case undefined:\n            // case LongType.STRING:\n            return long.toString();\n    }\n}\n","import { isJsonObject, typeofJsonValue } from \"./json-typings\";\nimport { base64decode } from \"./base64\";\nimport { LongType, ScalarType } from \"./reflection-info\";\nimport { PbLong, PbULong } from \"./pb-long\";\nimport { assert, assertFloat32, assertInt32, assertUInt32 } from \"./assert\";\nimport { reflectionLongConvert } from \"./reflection-long-convert\";\n/**\n * Reads proto3 messages in canonical JSON format using reflection information.\n *\n * https://developers.google.com/protocol-buffers/docs/proto3#json\n */\nexport class ReflectionJsonReader {\n    constructor(info) {\n        this.info = info;\n    }\n    prepare() {\n        var _a;\n        if (this.fMap === undefined) {\n            this.fMap = {};\n            const fieldsInput = (_a = this.info.fields) !== null && _a !== void 0 ? _a : [];\n            for (const field of fieldsInput) {\n                this.fMap[field.name] = field;\n                this.fMap[field.jsonName] = field;\n                this.fMap[field.localName] = field;\n            }\n        }\n    }\n    // Cannot parse JSON <type of jsonValue> for <type name>#<fieldName>.\n    assert(condition, fieldName, jsonValue) {\n        if (!condition) {\n            let what = typeofJsonValue(jsonValue);\n            if (what == \"number\" || what == \"boolean\")\n                what = jsonValue.toString();\n            throw new Error(`Cannot parse JSON ${what} for ${this.info.typeName}#${fieldName}`);\n        }\n    }\n    /**\n     * Reads a message from canonical JSON format into the target message.\n     *\n     * Repeated fields are appended. Map entries are added, overwriting\n     * existing keys.\n     *\n     * If a message field is already present, it will be merged with the\n     * new data.\n     */\n    read(input, message, options) {\n        this.prepare();\n        const oneofsHandled = [];\n        for (const [jsonKey, jsonValue] of Object.entries(input)) {\n            const field = this.fMap[jsonKey];\n            if (!field) {\n                if (!options.ignoreUnknownFields)\n                    throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${jsonKey}`);\n                continue;\n            }\n            const localName = field.localName;\n            // handle oneof ADT\n            let target; // this will be the target for the field value, whether it is member of a oneof or not\n            if (field.oneof) {\n                if (jsonValue === null && (field.kind !== 'enum' || field.T()[0] !== 'google.protobuf.NullValue')) {\n                    continue;\n                }\n                // since json objects are unordered by specification, it is not possible to take the last of multiple oneofs\n                if (oneofsHandled.includes(field.oneof))\n                    throw new Error(`Multiple members of the oneof group \"${field.oneof}\" of ${this.info.typeName} are present in JSON.`);\n                oneofsHandled.push(field.oneof);\n                target = message[field.oneof] = {\n                    oneofKind: localName\n                };\n            }\n            else {\n                target = message;\n            }\n            // we have handled oneof above. we just have read the value into `target`.\n            if (field.kind == 'map') {\n                if (jsonValue === null) {\n                    continue;\n                }\n                // check input\n                this.assert(isJsonObject(jsonValue), field.name, jsonValue);\n                // our target to put map entries into\n                const fieldObj = target[localName];\n                // read entries\n                for (const [jsonObjKey, jsonObjValue] of Object.entries(jsonValue)) {\n                    this.assert(jsonObjValue !== null, field.name + \" map value\", null);\n                    // read value\n                    let val;\n                    switch (field.V.kind) {\n                        case \"message\":\n                            val = field.V.T().internalJsonRead(jsonObjValue, options);\n                            break;\n                        case \"enum\":\n                            val = this.enum(field.V.T(), jsonObjValue, field.name, options.ignoreUnknownFields);\n                            if (val === false)\n                                continue;\n                            break;\n                        case \"scalar\":\n                            val = this.scalar(jsonObjValue, field.V.T, field.V.L, field.name);\n                            break;\n                    }\n                    this.assert(val !== undefined, field.name + \" map value\", jsonObjValue);\n                    // read key\n                    let key = jsonObjKey;\n                    if (field.K == ScalarType.BOOL)\n                        key = key == \"true\" ? true : key == \"false\" ? false : key;\n                    key = this.scalar(key, field.K, LongType.STRING, field.name).toString();\n                    fieldObj[key] = val;\n                }\n            }\n            else if (field.repeat) {\n                if (jsonValue === null)\n                    continue;\n                // check input\n                this.assert(Array.isArray(jsonValue), field.name, jsonValue);\n                // our target to put array entries into\n                const fieldArr = target[localName];\n                // read array entries\n                for (const jsonItem of jsonValue) {\n                    this.assert(jsonItem !== null, field.name, null);\n                    let val;\n                    switch (field.kind) {\n                        case \"message\":\n                            val = field.T().internalJsonRead(jsonItem, options);\n                            break;\n                        case \"enum\":\n                            val = this.enum(field.T(), jsonItem, field.name, options.ignoreUnknownFields);\n                            if (val === false)\n                                continue;\n                            break;\n                        case \"scalar\":\n                            val = this.scalar(jsonItem, field.T, field.L, field.name);\n                            break;\n                    }\n                    this.assert(val !== undefined, field.name, jsonValue);\n                    fieldArr.push(val);\n                }\n            }\n            else {\n                switch (field.kind) {\n                    case \"message\":\n                        if (jsonValue === null && field.T().typeName != 'google.protobuf.Value') {\n                            this.assert(field.oneof === undefined, field.name + \" (oneof member)\", null);\n                            continue;\n                        }\n                        target[localName] = field.T().internalJsonRead(jsonValue, options, target[localName]);\n                        break;\n                    case \"enum\":\n                        if (jsonValue === null)\n                            continue;\n                        let val = this.enum(field.T(), jsonValue, field.name, options.ignoreUnknownFields);\n                        if (val === false)\n                            continue;\n                        target[localName] = val;\n                        break;\n                    case \"scalar\":\n                        if (jsonValue === null)\n                            continue;\n                        target[localName] = this.scalar(jsonValue, field.T, field.L, field.name);\n                        break;\n                }\n            }\n        }\n    }\n    /**\n     * Returns `false` for unrecognized string representations.\n     *\n     * google.protobuf.NullValue accepts only JSON `null` (or the old `\"NULL_VALUE\"`).\n     */\n    enum(type, json, fieldName, ignoreUnknownFields) {\n        if (type[0] == 'google.protobuf.NullValue')\n            assert(json === null || json === \"NULL_VALUE\", `Unable to parse field ${this.info.typeName}#${fieldName}, enum ${type[0]} only accepts null.`);\n        if (json === null)\n            // we require 0 to be default value for all enums\n            return 0;\n        switch (typeof json) {\n            case \"number\":\n                assert(Number.isInteger(json), `Unable to parse field ${this.info.typeName}#${fieldName}, enum can only be integral number, got ${json}.`);\n                return json;\n            case \"string\":\n                let localEnumName = json;\n                if (type[2] && json.substring(0, type[2].length) === type[2])\n                    // lookup without the shared prefix\n                    localEnumName = json.substring(type[2].length);\n                let enumNumber = type[1][localEnumName];\n                if (typeof enumNumber === 'undefined' && ignoreUnknownFields) {\n                    return false;\n                }\n                assert(typeof enumNumber == \"number\", `Unable to parse field ${this.info.typeName}#${fieldName}, enum ${type[0]} has no value for \"${json}\".`);\n                return enumNumber;\n        }\n        assert(false, `Unable to parse field ${this.info.typeName}#${fieldName}, cannot parse enum value from ${typeof json}\".`);\n    }\n    scalar(json, type, longType, fieldName) {\n        let e;\n        try {\n            switch (type) {\n                // float, double: JSON value will be a number or one of the special string values \"NaN\", \"Infinity\", and \"-Infinity\".\n                // Either numbers or strings are accepted. Exponent notation is also accepted.\n                case ScalarType.DOUBLE:\n                case ScalarType.FLOAT:\n                    if (json === null)\n                        return .0;\n                    if (json === \"NaN\")\n                        return Number.NaN;\n                    if (json === \"Infinity\")\n                        return Number.POSITIVE_INFINITY;\n                    if (json === \"-Infinity\")\n                        return Number.NEGATIVE_INFINITY;\n                    if (json === \"\") {\n                        e = \"empty string\";\n                        break;\n                    }\n                    if (typeof json == \"string\" && json.trim().length !== json.length) {\n                        e = \"extra whitespace\";\n                        break;\n                    }\n                    if (typeof json != \"string\" && typeof json != \"number\") {\n                        break;\n                    }\n                    let float = Number(json);\n                    if (Number.isNaN(float)) {\n                        e = \"not a number\";\n                        break;\n                    }\n                    if (!Number.isFinite(float)) {\n                        // infinity and -infinity are handled by string representation above, so this is an error\n                        e = \"too large or small\";\n                        break;\n                    }\n                    if (type == ScalarType.FLOAT)\n                        assertFloat32(float);\n                    return float;\n                // int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.\n                case ScalarType.INT32:\n                case ScalarType.FIXED32:\n                case ScalarType.SFIXED32:\n                case ScalarType.SINT32:\n                case ScalarType.UINT32:\n                    if (json === null)\n                        return 0;\n                    let int32;\n                    if (typeof json == \"number\")\n                        int32 = json;\n                    else if (json === \"\")\n                        e = \"empty string\";\n                    else if (typeof json == \"string\") {\n                        if (json.trim().length !== json.length)\n                            e = \"extra whitespace\";\n                        else\n                            int32 = Number(json);\n                    }\n                    if (int32 === undefined)\n                        break;\n                    if (type == ScalarType.UINT32)\n                        assertUInt32(int32);\n                    else\n                        assertInt32(int32);\n                    return int32;\n                // int64, fixed64, uint64: JSON value will be a decimal string. Either numbers or strings are accepted.\n                case ScalarType.INT64:\n                case ScalarType.SFIXED64:\n                case ScalarType.SINT64:\n                    if (json === null)\n                        return reflectionLongConvert(PbLong.ZERO, longType);\n                    if (typeof json != \"number\" && typeof json != \"string\")\n                        break;\n                    return reflectionLongConvert(PbLong.from(json), longType);\n                case ScalarType.FIXED64:\n                case ScalarType.UINT64:\n                    if (json === null)\n                        return reflectionLongConvert(PbULong.ZERO, longType);\n                    if (typeof json != \"number\" && typeof json != \"string\")\n                        break;\n                    return reflectionLongConvert(PbULong.from(json), longType);\n                // bool:\n                case ScalarType.BOOL:\n                    if (json === null)\n                        return false;\n                    if (typeof json !== \"boolean\")\n                        break;\n                    return json;\n                // string:\n                case ScalarType.STRING:\n                    if (json === null)\n                        return \"\";\n                    if (typeof json !== \"string\") {\n                        e = \"extra whitespace\";\n                        break;\n                    }\n                    try {\n                        encodeURIComponent(json);\n                    }\n                    catch (e) {\n                        e = \"invalid UTF8\";\n                        break;\n                    }\n                    return json;\n                // bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.\n                // Either standard or URL-safe base64 encoding with/without paddings are accepted.\n                case ScalarType.BYTES:\n                    if (json === null || json === \"\")\n                        return new Uint8Array(0);\n                    if (typeof json !== 'string')\n                        break;\n                    return base64decode(json);\n            }\n        }\n        catch (error) {\n            e = error.message;\n        }\n        this.assert(false, fieldName + (e ? \" - \" + e : \"\"), json);\n    }\n}\n","import { base64encode } from \"./base64\";\nimport { PbLong, PbULong } from \"./pb-long\";\nimport { ScalarType } from \"./reflection-info\";\nimport { assert, assertFloat32, assertInt32, assertUInt32 } from \"./assert\";\n/**\n * Writes proto3 messages in canonical JSON format using reflection\n * information.\n *\n * https://developers.google.com/protocol-buffers/docs/proto3#json\n */\nexport class ReflectionJsonWriter {\n    constructor(info) {\n        var _a;\n        this.fields = (_a = info.fields) !== null && _a !== void 0 ? _a : [];\n    }\n    /**\n     * Converts the message to a JSON object, based on the field descriptors.\n     */\n    write(message, options) {\n        const json = {}, source = message;\n        for (const field of this.fields) {\n            // field is not part of a oneof, simply write as is\n            if (!field.oneof) {\n                let jsonValue = this.field(field, source[field.localName], options);\n                if (jsonValue !== undefined)\n                    json[options.useProtoFieldName ? field.name : field.jsonName] = jsonValue;\n                continue;\n            }\n            // field is part of a oneof\n            const group = source[field.oneof];\n            if (group.oneofKind !== field.localName)\n                continue; // not selected, skip\n            const opt = field.kind == 'scalar' || field.kind == 'enum'\n                ? Object.assign(Object.assign({}, options), { emitDefaultValues: true }) : options;\n            let jsonValue = this.field(field, group[field.localName], opt);\n            assert(jsonValue !== undefined);\n            json[options.useProtoFieldName ? field.name : field.jsonName] = jsonValue;\n        }\n        return json;\n    }\n    field(field, value, options) {\n        let jsonValue = undefined;\n        if (field.kind == 'map') {\n            assert(typeof value == \"object\" && value !== null);\n            const jsonObj = {};\n            switch (field.V.kind) {\n                case \"scalar\":\n                    for (const [entryKey, entryValue] of Object.entries(value)) {\n                        const val = this.scalar(field.V.T, entryValue, field.name, false, true);\n                        assert(val !== undefined);\n                        jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key\n                    }\n                    break;\n                case \"message\":\n                    const messageType = field.V.T();\n                    for (const [entryKey, entryValue] of Object.entries(value)) {\n                        const val = this.message(messageType, entryValue, field.name, options);\n                        assert(val !== undefined);\n                        jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key\n                    }\n                    break;\n                case \"enum\":\n                    const enumInfo = field.V.T();\n                    for (const [entryKey, entryValue] of Object.entries(value)) {\n                        assert(entryValue === undefined || typeof entryValue == 'number');\n                        const val = this.enum(enumInfo, entryValue, field.name, false, true, options.enumAsInteger);\n                        assert(val !== undefined);\n                        jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key\n                    }\n                    break;\n            }\n            if (options.emitDefaultValues || Object.keys(jsonObj).length > 0)\n                jsonValue = jsonObj;\n        }\n        else if (field.repeat) {\n            assert(Array.isArray(value));\n            const jsonArr = [];\n            switch (field.kind) {\n                case \"scalar\":\n                    for (let i = 0; i < value.length; i++) {\n                        const val = this.scalar(field.T, value[i], field.name, field.opt, true);\n                        assert(val !== undefined);\n                        jsonArr.push(val);\n                    }\n                    break;\n                case \"enum\":\n                    const enumInfo = field.T();\n                    for (let i = 0; i < value.length; i++) {\n                        assert(value[i] === undefined || typeof value[i] == 'number');\n                        const val = this.enum(enumInfo, value[i], field.name, field.opt, true, options.enumAsInteger);\n                        assert(val !== undefined);\n                        jsonArr.push(val);\n                    }\n                    break;\n                case \"message\":\n                    const messageType = field.T();\n                    for (let i = 0; i < value.length; i++) {\n                        const val = this.message(messageType, value[i], field.name, options);\n                        assert(val !== undefined);\n                        jsonArr.push(val);\n                    }\n                    break;\n            }\n            // add converted array to json output\n            if (options.emitDefaultValues || jsonArr.length > 0 || options.emitDefaultValues)\n                jsonValue = jsonArr;\n        }\n        else {\n            switch (field.kind) {\n                case \"scalar\":\n                    jsonValue = this.scalar(field.T, value, field.name, field.opt, options.emitDefaultValues);\n                    break;\n                case \"enum\":\n                    jsonValue = this.enum(field.T(), value, field.name, field.opt, options.emitDefaultValues, options.enumAsInteger);\n                    break;\n                case \"message\":\n                    jsonValue = this.message(field.T(), value, field.name, options);\n                    break;\n            }\n        }\n        return jsonValue;\n    }\n    /**\n     * Returns `null` as the default for google.protobuf.NullValue.\n     */\n    enum(type, value, fieldName, optional, emitDefaultValues, enumAsInteger) {\n        if (type[0] == 'google.protobuf.NullValue')\n            return !emitDefaultValues && !optional ? undefined : null;\n        if (value === undefined) {\n            assert(optional);\n            return undefined;\n        }\n        if (value === 0 && !emitDefaultValues && !optional)\n            // we require 0 to be default value for all enums\n            return undefined;\n        assert(typeof value == 'number');\n        assert(Number.isInteger(value));\n        if (enumAsInteger || !type[1].hasOwnProperty(value))\n            // if we don't now the enum value, just return the number\n            return value;\n        if (type[2])\n            // restore the dropped prefix\n            return type[2] + type[1][value];\n        return type[1][value];\n    }\n    message(type, value, fieldName, options) {\n        if (value === undefined)\n            return options.emitDefaultValues ? null : undefined;\n        return type.internalJsonWrite(value, options);\n    }\n    scalar(type, value, fieldName, optional, emitDefaultValues) {\n        if (value === undefined) {\n            assert(optional);\n            return undefined;\n        }\n        const ed = emitDefaultValues || optional;\n        // noinspection FallThroughInSwitchStatementJS\n        switch (type) {\n            // int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.\n            case ScalarType.INT32:\n            case ScalarType.SFIXED32:\n            case ScalarType.SINT32:\n                if (value === 0)\n                    return ed ? 0 : undefined;\n                assertInt32(value);\n                return value;\n            case ScalarType.FIXED32:\n            case ScalarType.UINT32:\n                if (value === 0)\n                    return ed ? 0 : undefined;\n                assertUInt32(value);\n                return value;\n            // float, double: JSON value will be a number or one of the special string values \"NaN\", \"Infinity\", and \"-Infinity\".\n            // Either numbers or strings are accepted. Exponent notation is also accepted.\n            case ScalarType.FLOAT:\n                assertFloat32(value);\n            case ScalarType.DOUBLE:\n                if (value === 0)\n                    return ed ? 0 : undefined;\n                assert(typeof value == 'number');\n                if (Number.isNaN(value))\n                    return 'NaN';\n                if (value === Number.POSITIVE_INFINITY)\n                    return 'Infinity';\n                if (value === Number.NEGATIVE_INFINITY)\n                    return '-Infinity';\n                return value;\n            // string:\n            case ScalarType.STRING:\n                if (value === \"\")\n                    return ed ? '' : undefined;\n                assert(typeof value == 'string');\n                return value;\n            // bool:\n            case ScalarType.BOOL:\n                if (value === false)\n                    return ed ? false : undefined;\n                assert(typeof value == 'boolean');\n                return value;\n            // JSON value will be a decimal string. Either numbers or strings are accepted.\n            case ScalarType.UINT64:\n            case ScalarType.FIXED64:\n                assert(typeof value == 'number' || typeof value == 'string' || typeof value == 'bigint');\n                let ulong = PbULong.from(value);\n                if (ulong.isZero() && !ed)\n                    return undefined;\n                return ulong.toString();\n            // JSON value will be a decimal string. Either numbers or strings are accepted.\n            case ScalarType.INT64:\n            case ScalarType.SFIXED64:\n            case ScalarType.SINT64:\n                assert(typeof value == 'number' || typeof value == 'string' || typeof value == 'bigint');\n                let long = PbLong.from(value);\n                if (long.isZero() && !ed)\n                    return undefined;\n                return long.toString();\n            // bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.\n            // Either standard or URL-safe base64 encoding with/without paddings are accepted.\n            case ScalarType.BYTES:\n                assert(value instanceof Uint8Array);\n                if (!value.byteLength)\n                    return ed ? \"\" : undefined;\n                return base64encode(value);\n        }\n    }\n}\n","import { LongType, ScalarType } from \"./reflection-info\";\nimport { reflectionLongConvert } from \"./reflection-long-convert\";\nimport { PbLong, PbULong } from \"./pb-long\";\n/**\n * Creates the default value for a scalar type.\n */\nexport function reflectionScalarDefault(type, longType = LongType.STRING) {\n    switch (type) {\n        case ScalarType.BOOL:\n            return false;\n        case ScalarType.UINT64:\n        case ScalarType.FIXED64:\n            return reflectionLongConvert(PbULong.ZERO, longType);\n        case ScalarType.INT64:\n        case ScalarType.SFIXED64:\n        case ScalarType.SINT64:\n            return reflectionLongConvert(PbLong.ZERO, longType);\n        case ScalarType.DOUBLE:\n        case ScalarType.FLOAT:\n            return 0.0;\n        case ScalarType.BYTES:\n            return new Uint8Array(0);\n        case ScalarType.STRING:\n            return \"\";\n        default:\n            // case ScalarType.INT32:\n            // case ScalarType.UINT32:\n            // case ScalarType.SINT32:\n            // case ScalarType.FIXED32:\n            // case ScalarType.SFIXED32:\n            return 0;\n    }\n}\n","import { UnknownFieldHandler, WireType } from \"./binary-format-contract\";\nimport { LongType, ScalarType } from \"./reflection-info\";\nimport { reflectionLongConvert } from \"./reflection-long-convert\";\nimport { reflectionScalarDefault } from \"./reflection-scalar-default\";\n/**\n * Reads proto3 messages in binary format using reflection information.\n *\n * https://developers.google.com/protocol-buffers/docs/encoding\n */\nexport class ReflectionBinaryReader {\n    constructor(info) {\n        this.info = info;\n    }\n    prepare() {\n        var _a;\n        if (!this.fieldNoToField) {\n            const fieldsInput = (_a = this.info.fields) !== null && _a !== void 0 ? _a : [];\n            this.fieldNoToField = new Map(fieldsInput.map(field => [field.no, field]));\n        }\n    }\n    /**\n     * Reads a message from binary format into the target message.\n     *\n     * Repeated fields are appended. Map entries are added, overwriting\n     * existing keys.\n     *\n     * If a message field is already present, it will be merged with the\n     * new data.\n     */\n    read(reader, message, options, length) {\n        this.prepare();\n        const end = length === undefined ? reader.len : reader.pos + length;\n        while (reader.pos < end) {\n            // read the tag and find the field\n            const [fieldNo, wireType] = reader.tag(), field = this.fieldNoToField.get(fieldNo);\n            if (!field) {\n                let u = options.readUnknownField;\n                if (u == \"throw\")\n                    throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.info.typeName}`);\n                let d = reader.skip(wireType);\n                if (u !== false)\n                    (u === true ? UnknownFieldHandler.onRead : u)(this.info.typeName, message, fieldNo, wireType, d);\n                continue;\n            }\n            // target object for the field we are reading\n            let target = message, repeated = field.repeat, localName = field.localName;\n            // if field is member of oneof ADT, use ADT as target\n            if (field.oneof) {\n                target = target[field.oneof];\n                // if other oneof member selected, set new ADT\n                if (target.oneofKind !== localName)\n                    target = message[field.oneof] = {\n                        oneofKind: localName\n                    };\n            }\n            // we have handled oneof above, we just have read the value into `target[localName]`\n            switch (field.kind) {\n                case \"scalar\":\n                case \"enum\":\n                    let T = field.kind == \"enum\" ? ScalarType.INT32 : field.T;\n                    let L = field.kind == \"scalar\" ? field.L : undefined;\n                    if (repeated) {\n                        let arr = target[localName]; // safe to assume presence of array, oneof cannot contain repeated values\n                        if (wireType == WireType.LengthDelimited && T != ScalarType.STRING && T != ScalarType.BYTES) {\n                            let e = reader.uint32() + reader.pos;\n                            while (reader.pos < e)\n                                arr.push(this.scalar(reader, T, L));\n                        }\n                        else\n                            arr.push(this.scalar(reader, T, L));\n                    }\n                    else\n                        target[localName] = this.scalar(reader, T, L);\n                    break;\n                case \"message\":\n                    if (repeated) {\n                        let arr = target[localName]; // safe to assume presence of array, oneof cannot contain repeated values\n                        let msg = field.T().internalBinaryRead(reader, reader.uint32(), options);\n                        arr.push(msg);\n                    }\n                    else\n                        target[localName] = field.T().internalBinaryRead(reader, reader.uint32(), options, target[localName]);\n                    break;\n                case \"map\":\n                    let [mapKey, mapVal] = this.mapEntry(field, reader, options);\n                    // safe to assume presence of map object, oneof cannot contain repeated values\n                    target[localName][mapKey] = mapVal;\n                    break;\n            }\n        }\n    }\n    /**\n     * Read a map field, expecting key field = 1, value field = 2\n     */\n    mapEntry(field, reader, options) {\n        let length = reader.uint32();\n        let end = reader.pos + length;\n        let key = undefined; // javascript only allows number or string for object properties\n        let val = undefined;\n        while (reader.pos < end) {\n            let [fieldNo, wireType] = reader.tag();\n            switch (fieldNo) {\n                case 1:\n                    if (field.K == ScalarType.BOOL)\n                        key = reader.bool().toString();\n                    else\n                        // long types are read as string, number types are okay as number\n                        key = this.scalar(reader, field.K, LongType.STRING);\n                    break;\n                case 2:\n                    switch (field.V.kind) {\n                        case \"scalar\":\n                            val = this.scalar(reader, field.V.T, field.V.L);\n                            break;\n                        case \"enum\":\n                            val = reader.int32();\n                            break;\n                        case \"message\":\n                            val = field.V.T().internalBinaryRead(reader, reader.uint32(), options);\n                            break;\n                    }\n                    break;\n                default:\n                    throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) in map entry for ${this.info.typeName}#${field.name}`);\n            }\n        }\n        if (key === undefined) {\n            let keyRaw = reflectionScalarDefault(field.K);\n            key = field.K == ScalarType.BOOL ? keyRaw.toString() : keyRaw;\n        }\n        if (val === undefined)\n            switch (field.V.kind) {\n                case \"scalar\":\n                    val = reflectionScalarDefault(field.V.T, field.V.L);\n                    break;\n                case \"enum\":\n                    val = 0;\n                    break;\n                case \"message\":\n                    val = field.V.T().create();\n                    break;\n            }\n        return [key, val];\n    }\n    scalar(reader, type, longType) {\n        switch (type) {\n            case ScalarType.INT32:\n                return reader.int32();\n            case ScalarType.STRING:\n                return reader.string();\n            case ScalarType.BOOL:\n                return reader.bool();\n            case ScalarType.DOUBLE:\n                return reader.double();\n            case ScalarType.FLOAT:\n                return reader.float();\n            case ScalarType.INT64:\n                return reflectionLongConvert(reader.int64(), longType);\n            case ScalarType.UINT64:\n                return reflectionLongConvert(reader.uint64(), longType);\n            case ScalarType.FIXED64:\n                return reflectionLongConvert(reader.fixed64(), longType);\n            case ScalarType.FIXED32:\n                return reader.fixed32();\n            case ScalarType.BYTES:\n                return reader.bytes();\n            case ScalarType.UINT32:\n                return reader.uint32();\n            case ScalarType.SFIXED32:\n                return reader.sfixed32();\n            case ScalarType.SFIXED64:\n                return reflectionLongConvert(reader.sfixed64(), longType);\n            case ScalarType.SINT32:\n                return reader.sint32();\n            case ScalarType.SINT64:\n                return reflectionLongConvert(reader.sint64(), longType);\n        }\n    }\n}\n","import { UnknownFieldHandler, WireType } from \"./binary-format-contract\";\nimport { RepeatType, ScalarType } from \"./reflection-info\";\nimport { assert } from \"./assert\";\nimport { PbLong, PbULong } from \"./pb-long\";\n/**\n * Writes proto3 messages in binary format using reflection information.\n *\n * https://developers.google.com/protocol-buffers/docs/encoding\n */\nexport class ReflectionBinaryWriter {\n    constructor(info) {\n        this.info = info;\n    }\n    prepare() {\n        if (!this.fields) {\n            const fieldsInput = this.info.fields ? this.info.fields.concat() : [];\n            this.fields = fieldsInput.sort((a, b) => a.no - b.no);\n        }\n    }\n    /**\n     * Writes the message to binary format.\n     */\n    write(message, writer, options) {\n        this.prepare();\n        for (const field of this.fields) {\n            let value, // this will be our field value, whether it is member of a oneof or not\n            emitDefault, // whether we emit the default value (only true for oneof members)\n            repeated = field.repeat, localName = field.localName;\n            // handle oneof ADT\n            if (field.oneof) {\n                const group = message[field.oneof];\n                if (group.oneofKind !== localName)\n                    continue; // if field is not selected, skip\n                value = group[localName];\n                emitDefault = true;\n            }\n            else {\n                value = message[localName];\n                emitDefault = false;\n            }\n            // we have handled oneof above. we just have to honor `emitDefault`.\n            switch (field.kind) {\n                case \"scalar\":\n                case \"enum\":\n                    let T = field.kind == \"enum\" ? ScalarType.INT32 : field.T;\n                    if (repeated) {\n                        assert(Array.isArray(value));\n                        if (repeated == RepeatType.PACKED)\n                            this.packed(writer, T, field.no, value);\n                        else\n                            for (const item of value)\n                                this.scalar(writer, T, field.no, item, true);\n                    }\n                    else if (value === undefined)\n                        assert(field.opt);\n                    else\n                        this.scalar(writer, T, field.no, value, emitDefault || field.opt);\n                    break;\n                case \"message\":\n                    if (repeated) {\n                        assert(Array.isArray(value));\n                        for (const item of value)\n                            this.message(writer, options, field.T(), field.no, item);\n                    }\n                    else {\n                        this.message(writer, options, field.T(), field.no, value);\n                    }\n                    break;\n                case \"map\":\n                    assert(typeof value == 'object' && value !== null);\n                    for (const [key, val] of Object.entries(value))\n                        this.mapEntry(writer, options, field, key, val);\n                    break;\n            }\n        }\n        let u = options.writeUnknownFields;\n        if (u !== false)\n            (u === true ? UnknownFieldHandler.onWrite : u)(this.info.typeName, message, writer);\n    }\n    mapEntry(writer, options, field, key, value) {\n        writer.tag(field.no, WireType.LengthDelimited);\n        writer.fork();\n        // javascript only allows number or string for object properties\n        // we convert from our representation to the protobuf type\n        let keyValue = key;\n        switch (field.K) {\n            case ScalarType.INT32:\n            case ScalarType.FIXED32:\n            case ScalarType.UINT32:\n            case ScalarType.SFIXED32:\n            case ScalarType.SINT32:\n                keyValue = Number.parseInt(key);\n                break;\n            case ScalarType.BOOL:\n                assert(key == 'true' || key == 'false');\n                keyValue = key == 'true';\n                break;\n        }\n        // write key, expecting key field number = 1\n        this.scalar(writer, field.K, 1, keyValue, true);\n        // write value, expecting value field number = 2\n        switch (field.V.kind) {\n            case 'scalar':\n                this.scalar(writer, field.V.T, 2, value, true);\n                break;\n            case 'enum':\n                this.scalar(writer, ScalarType.INT32, 2, value, true);\n                break;\n            case 'message':\n                this.message(writer, options, field.V.T(), 2, value);\n                break;\n        }\n        writer.join();\n    }\n    message(writer, options, handler, fieldNo, value) {\n        if (value === undefined)\n            return;\n        handler.internalBinaryWrite(value, writer.tag(fieldNo, WireType.LengthDelimited).fork(), options);\n        writer.join();\n    }\n    /**\n     * Write a single scalar value.\n     */\n    scalar(writer, type, fieldNo, value, emitDefault) {\n        let [wireType, method, isDefault] = this.scalarInfo(type, value);\n        if (!isDefault || emitDefault) {\n            writer.tag(fieldNo, wireType);\n            writer[method](value);\n        }\n    }\n    /**\n     * Write an array of scalar values in packed format.\n     */\n    packed(writer, type, fieldNo, value) {\n        if (!value.length)\n            return;\n        assert(type !== ScalarType.BYTES && type !== ScalarType.STRING);\n        // write tag\n        writer.tag(fieldNo, WireType.LengthDelimited);\n        // begin length-delimited\n        writer.fork();\n        // write values without tags\n        let [, method,] = this.scalarInfo(type);\n        for (let i = 0; i < value.length; i++)\n            writer[method](value[i]);\n        // end length delimited\n        writer.join();\n    }\n    /**\n     * Get information for writing a scalar value.\n     *\n     * Returns tuple:\n     * [0]: appropriate WireType\n     * [1]: name of the appropriate method of IBinaryWriter\n     * [2]: whether the given value is a default value\n     *\n     * If argument `value` is omitted, [2] is always false.\n     */\n    scalarInfo(type, value) {\n        let t = WireType.Varint;\n        let m;\n        let i = value === undefined;\n        let d = value === 0;\n        switch (type) {\n            case ScalarType.INT32:\n                m = \"int32\";\n                break;\n            case ScalarType.STRING:\n                d = i || !value.length;\n                t = WireType.LengthDelimited;\n                m = \"string\";\n                break;\n            case ScalarType.BOOL:\n                d = value === false;\n                m = \"bool\";\n                break;\n            case ScalarType.UINT32:\n                m = \"uint32\";\n                break;\n            case ScalarType.DOUBLE:\n                t = WireType.Bit64;\n                m = \"double\";\n                break;\n            case ScalarType.FLOAT:\n                t = WireType.Bit32;\n                m = \"float\";\n                break;\n            case ScalarType.INT64:\n                d = i || PbLong.from(value).isZero();\n                m = \"int64\";\n                break;\n            case ScalarType.UINT64:\n                d = i || PbULong.from(value).isZero();\n                m = \"uint64\";\n                break;\n            case ScalarType.FIXED64:\n                d = i || PbULong.from(value).isZero();\n                t = WireType.Bit64;\n                m = \"fixed64\";\n                break;\n            case ScalarType.BYTES:\n                d = i || !value.byteLength;\n                t = WireType.LengthDelimited;\n                m = \"bytes\";\n                break;\n            case ScalarType.FIXED32:\n                t = WireType.Bit32;\n                m = \"fixed32\";\n                break;\n            case ScalarType.SFIXED32:\n                t = WireType.Bit32;\n                m = \"sfixed32\";\n                break;\n            case ScalarType.SFIXED64:\n                d = i || PbLong.from(value).isZero();\n                t = WireType.Bit64;\n                m = \"sfixed64\";\n                break;\n            case ScalarType.SINT32:\n                m = \"sint32\";\n                break;\n            case ScalarType.SINT64:\n                d = i || PbLong.from(value).isZero();\n                m = \"sint64\";\n                break;\n        }\n        return [t, m, i || d];\n    }\n}\n","import { reflectionScalarDefault } from \"./reflection-scalar-default\";\nimport { MESSAGE_TYPE } from './message-type-contract';\n/**\n * Creates an instance of the generic message, using the field\n * information.\n */\nexport function reflectionCreate(type) {\n    /**\n     * This ternary can be removed in the next major version.\n     * The `Object.create()` code path utilizes a new `messagePrototype`\n     * property on the `IMessageType` which has this same `MESSAGE_TYPE`\n     * non-enumerable property on it. Doing it this way means that we only\n     * pay the cost of `Object.defineProperty()` once per `IMessageType`\n     * class of once per \"instance\". The falsy code path is only provided\n     * for backwards compatibility in cases where the runtime library is\n     * updated without also updating the generated code.\n     */\n    const msg = type.messagePrototype\n        ? Object.create(type.messagePrototype)\n        : Object.defineProperty({}, MESSAGE_TYPE, { value: type });\n    for (let field of type.fields) {\n        let name = field.localName;\n        if (field.opt)\n            continue;\n        if (field.oneof)\n            msg[field.oneof] = { oneofKind: undefined };\n        else if (field.repeat)\n            msg[name] = [];\n        else\n            switch (field.kind) {\n                case \"scalar\":\n                    msg[name] = reflectionScalarDefault(field.T, field.L);\n                    break;\n                case \"enum\":\n                    // we require 0 to be default value for all enums\n                    msg[name] = 0;\n                    break;\n                case \"map\":\n                    msg[name] = {};\n                    break;\n            }\n    }\n    return msg;\n}\n","/**\n * Copy partial data into the target message.\n *\n * If a singular scalar or enum field is present in the source, it\n * replaces the field in the target.\n *\n * If a singular message field is present in the source, it is merged\n * with the target field by calling mergePartial() of the responsible\n * message type.\n *\n * If a repeated field is present in the source, its values replace\n * all values in the target array, removing extraneous values.\n * Repeated message fields are copied, not merged.\n *\n * If a map field is present in the source, entries are added to the\n * target map, replacing entries with the same key. Entries that only\n * exist in the target remain. Entries with message values are copied,\n * not merged.\n *\n * Note that this function differs from protobuf merge semantics,\n * which appends repeated fields.\n */\nexport function reflectionMergePartial(info, target, source) {\n    let fieldValue, // the field value we are working with\n    input = source, output; // where we want our field value to go\n    for (let field of info.fields) {\n        let name = field.localName;\n        if (field.oneof) {\n            const group = input[field.oneof]; // this is the oneof`s group in the source\n            if ((group === null || group === void 0 ? void 0 : group.oneofKind) == undefined) { // the user is free to omit\n                continue; // we skip this field, and all other members too\n            }\n            fieldValue = group[name]; // our value comes from the the oneof group of the source\n            output = target[field.oneof]; // and our output is the oneof group of the target\n            output.oneofKind = group.oneofKind; // always update discriminator\n            if (fieldValue == undefined) {\n                delete output[name]; // remove any existing value\n                continue; // skip further work on field\n            }\n        }\n        else {\n            fieldValue = input[name]; // we are using the source directly\n            output = target; // we want our field value to go directly into the target\n            if (fieldValue == undefined) {\n                continue; // skip further work on field, existing value is used as is\n            }\n        }\n        if (field.repeat)\n            output[name].length = fieldValue.length; // resize target array to match source array\n        // now we just work with `fieldValue` and `output` to merge the value\n        switch (field.kind) {\n            case \"scalar\":\n            case \"enum\":\n                if (field.repeat)\n                    for (let i = 0; i < fieldValue.length; i++)\n                        output[name][i] = fieldValue[i]; // not a reference type\n                else\n                    output[name] = fieldValue; // not a reference type\n                break;\n            case \"message\":\n                let T = field.T();\n                if (field.repeat)\n                    for (let i = 0; i < fieldValue.length; i++)\n                        output[name][i] = T.create(fieldValue[i]);\n                else if (output[name] === undefined)\n                    output[name] = T.create(fieldValue); // nothing to merge with\n                else\n                    T.mergePartial(output[name], fieldValue);\n                break;\n            case \"map\":\n                // Map and repeated fields are simply overwritten, not appended or merged\n                switch (field.V.kind) {\n                    case \"scalar\":\n                    case \"enum\":\n                        Object.assign(output[name], fieldValue); // elements are not reference types\n                        break;\n                    case \"message\":\n                        let T = field.V.T();\n                        for (let k of Object.keys(fieldValue))\n                            output[name][k] = T.create(fieldValue[k]);\n                        break;\n                }\n                break;\n        }\n    }\n}\n","import { ScalarType } from \"./reflection-info\";\n/**\n * Determines whether two message of the same type have the same field values.\n * Checks for deep equality, traversing repeated fields, oneof groups, maps\n * and messages recursively.\n * Will also return true if both messages are `undefined`.\n */\nexport function reflectionEquals(info, a, b) {\n    if (a === b)\n        return true;\n    if (!a || !b)\n        return false;\n    for (let field of info.fields) {\n        let localName = field.localName;\n        let val_a = field.oneof ? a[field.oneof][localName] : a[localName];\n        let val_b = field.oneof ? b[field.oneof][localName] : b[localName];\n        switch (field.kind) {\n            case \"enum\":\n            case \"scalar\":\n                let t = field.kind == \"enum\" ? ScalarType.INT32 : field.T;\n                if (!(field.repeat\n                    ? repeatedPrimitiveEq(t, val_a, val_b)\n                    : primitiveEq(t, val_a, val_b)))\n                    return false;\n                break;\n            case \"map\":\n                if (!(field.V.kind == \"message\"\n                    ? repeatedMsgEq(field.V.T(), objectValues(val_a), objectValues(val_b))\n                    : repeatedPrimitiveEq(field.V.kind == \"enum\" ? ScalarType.INT32 : field.V.T, objectValues(val_a), objectValues(val_b))))\n                    return false;\n                break;\n            case \"message\":\n                let T = field.T();\n                if (!(field.repeat\n                    ? repeatedMsgEq(T, val_a, val_b)\n                    : T.equals(val_a, val_b)))\n                    return false;\n                break;\n        }\n    }\n    return true;\n}\nconst objectValues = Object.values;\nfunction primitiveEq(type, a, b) {\n    if (a === b)\n        return true;\n    if (type !== ScalarType.BYTES)\n        return false;\n    let ba = a;\n    let bb = b;\n    if (ba.length !== bb.length)\n        return false;\n    for (let i = 0; i < ba.length; i++)\n        if (ba[i] != bb[i])\n            return false;\n    return true;\n}\nfunction repeatedPrimitiveEq(type, a, b) {\n    if (a.length !== b.length)\n        return false;\n    for (let i = 0; i < a.length; i++)\n        if (!primitiveEq(type, a[i], b[i]))\n            return false;\n    return true;\n}\nfunction repeatedMsgEq(type, a, b) {\n    if (a.length !== b.length)\n        return false;\n    for (let i = 0; i < a.length; i++)\n        if (!type.equals(a[i], b[i]))\n            return false;\n    return true;\n}\n","import { MESSAGE_TYPE } from \"./message-type-contract\";\nimport { normalizeFieldInfo } from \"./reflection-info\";\nimport { ReflectionTypeCheck } from \"./reflection-type-check\";\nimport { ReflectionJsonReader } from \"./reflection-json-reader\";\nimport { ReflectionJsonWriter } from \"./reflection-json-writer\";\nimport { ReflectionBinaryReader } from \"./reflection-binary-reader\";\nimport { ReflectionBinaryWriter } from \"./reflection-binary-writer\";\nimport { reflectionCreate } from \"./reflection-create\";\nimport { reflectionMergePartial } from \"./reflection-merge-partial\";\nimport { typeofJsonValue } from \"./json-typings\";\nimport { jsonReadOptions, jsonWriteOptions, } from \"./json-format-contract\";\nimport { reflectionEquals } from \"./reflection-equals\";\nimport { binaryWriteOptions } from \"./binary-writer\";\nimport { binaryReadOptions } from \"./binary-reader\";\nconst baseDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));\nconst messageTypeDescriptor = baseDescriptors[MESSAGE_TYPE] = {};\n/**\n * This standard message type provides reflection-based\n * operations to work with a message.\n */\nexport class MessageType {\n    constructor(name, fields, options) {\n        this.defaultCheckDepth = 16;\n        this.typeName = name;\n        this.fields = fields.map(normalizeFieldInfo);\n        this.options = options !== null && options !== void 0 ? options : {};\n        messageTypeDescriptor.value = this;\n        this.messagePrototype = Object.create(null, baseDescriptors);\n        this.refTypeCheck = new ReflectionTypeCheck(this);\n        this.refJsonReader = new ReflectionJsonReader(this);\n        this.refJsonWriter = new ReflectionJsonWriter(this);\n        this.refBinReader = new ReflectionBinaryReader(this);\n        this.refBinWriter = new ReflectionBinaryWriter(this);\n    }\n    create(value) {\n        let message = reflectionCreate(this);\n        if (value !== undefined) {\n            reflectionMergePartial(this, message, value);\n        }\n        return message;\n    }\n    /**\n     * Clone the message.\n     *\n     * Unknown fields are discarded.\n     */\n    clone(message) {\n        let copy = this.create();\n        reflectionMergePartial(this, copy, message);\n        return copy;\n    }\n    /**\n     * Determines whether two message of the same type have the same field values.\n     * Checks for deep equality, traversing repeated fields, oneof groups, maps\n     * and messages recursively.\n     * Will also return true if both messages are `undefined`.\n     */\n    equals(a, b) {\n        return reflectionEquals(this, a, b);\n    }\n    /**\n     * Is the given value assignable to our message type\n     * and contains no [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?\n     */\n    is(arg, depth = this.defaultCheckDepth) {\n        return this.refTypeCheck.is(arg, depth, false);\n    }\n    /**\n     * Is the given value assignable to our message type,\n     * regardless of [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?\n     */\n    isAssignable(arg, depth = this.defaultCheckDepth) {\n        return this.refTypeCheck.is(arg, depth, true);\n    }\n    /**\n     * Copy partial data into the target message.\n     */\n    mergePartial(target, source) {\n        reflectionMergePartial(this, target, source);\n    }\n    /**\n     * Create a new message from binary format.\n     */\n    fromBinary(data, options) {\n        let opt = binaryReadOptions(options);\n        return this.internalBinaryRead(opt.readerFactory(data), data.byteLength, opt);\n    }\n    /**\n     * Read a new message from a JSON value.\n     */\n    fromJson(json, options) {\n        return this.internalJsonRead(json, jsonReadOptions(options));\n    }\n    /**\n     * Read a new message from a JSON string.\n     * This is equivalent to `T.fromJson(JSON.parse(json))`.\n     */\n    fromJsonString(json, options) {\n        let value = JSON.parse(json);\n        return this.fromJson(value, options);\n    }\n    /**\n     * Write the message to canonical JSON value.\n     */\n    toJson(message, options) {\n        return this.internalJsonWrite(message, jsonWriteOptions(options));\n    }\n    /**\n     * Convert the message to canonical JSON string.\n     * This is equivalent to `JSON.stringify(T.toJson(t))`\n     */\n    toJsonString(message, options) {\n        var _a;\n        let value = this.toJson(message, options);\n        return JSON.stringify(value, null, (_a = options === null || options === void 0 ? void 0 : options.prettySpaces) !== null && _a !== void 0 ? _a : 0);\n    }\n    /**\n     * Write the message to binary format.\n     */\n    toBinary(message, options) {\n        let opt = binaryWriteOptions(options);\n        return this.internalBinaryWrite(message, opt.writerFactory(), opt).finish();\n    }\n    /**\n     * This is an internal method. If you just want to read a message from\n     * JSON, use `fromJson()` or `fromJsonString()`.\n     *\n     * Reads JSON value and merges the fields into the target\n     * according to protobuf rules. If the target is omitted,\n     * a new instance is created first.\n     */\n    internalJsonRead(json, options, target) {\n        if (json !== null && typeof json == \"object\" && !Array.isArray(json)) {\n            let message = target !== null && target !== void 0 ? target : this.create();\n            this.refJsonReader.read(json, message, options);\n            return message;\n        }\n        throw new Error(`Unable to parse message ${this.typeName} from JSON ${typeofJsonValue(json)}.`);\n    }\n    /**\n     * This is an internal method. If you just want to write a message\n     * to JSON, use `toJson()` or `toJsonString().\n     *\n     * Writes JSON value and returns it.\n     */\n    internalJsonWrite(message, options) {\n        return this.refJsonWriter.write(message, options);\n    }\n    /**\n     * This is an internal method. If you just want to write a message\n     * in binary format, use `toBinary()`.\n     *\n     * Serializes the message in binary format and appends it to the given\n     * writer. Returns passed writer.\n     */\n    internalBinaryWrite(message, writer, options) {\n        this.refBinWriter.write(message, writer, options);\n        return writer;\n    }\n    /**\n     * This is an internal method. If you just want to read a message from\n     * binary data, use `fromBinary()`.\n     *\n     * Reads data from binary format and merges the fields into\n     * the target according to protobuf rules. If the target is\n     * omitted, a new instance is created first.\n     */\n    internalBinaryRead(reader, length, options, target) {\n        let message = target !== null && target !== void 0 ? target : this.create();\n        this.refBinReader.read(reader, message, options, length);\n        return message;\n    }\n}\n","// @generated by protobuf-ts 2.9.1 with parameter optimize_code_size\n// @generated from protobuf file \"google/protobuf/timestamp.proto\" (package \"google.protobuf\", syntax proto3)\n// tslint:disable\n//\n// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\nimport { typeofJsonValue } from \"@protobuf-ts/runtime\";\nimport type { JsonValue } from \"@protobuf-ts/runtime\";\nimport type { JsonReadOptions } from \"@protobuf-ts/runtime\";\nimport type { JsonWriteOptions } from \"@protobuf-ts/runtime\";\nimport { PbLong } from \"@protobuf-ts/runtime\";\nimport { MessageType } from \"@protobuf-ts/runtime\";\n/**\n * A Timestamp represents a point in time independent of any time zone or local\n * calendar, encoded as a count of seconds and fractions of seconds at\n * nanosecond resolution. The count is relative to an epoch at UTC midnight on\n * January 1, 1970, in the proleptic Gregorian calendar which extends the\n * Gregorian calendar backwards to year one.\n *\n * All minutes are 60 seconds long. Leap seconds are \"smeared\" so that no leap\n * second table is needed for interpretation, using a [24-hour linear\n * smear](https://developers.google.com/time/smear).\n *\n * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By\n * restricting to that range, we ensure that we can convert to and from [RFC\n * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.\n *\n * # Examples\n *\n * Example 1: Compute Timestamp from POSIX `time()`.\n *\n *     Timestamp timestamp;\n *     timestamp.set_seconds(time(NULL));\n *     timestamp.set_nanos(0);\n *\n * Example 2: Compute Timestamp from POSIX `gettimeofday()`.\n *\n *     struct timeval tv;\n *     gettimeofday(&tv, NULL);\n *\n *     Timestamp timestamp;\n *     timestamp.set_seconds(tv.tv_sec);\n *     timestamp.set_nanos(tv.tv_usec * 1000);\n *\n * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.\n *\n *     FILETIME ft;\n *     GetSystemTimeAsFileTime(&ft);\n *     UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;\n *\n *     // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z\n *     // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.\n *     Timestamp timestamp;\n *     timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));\n *     timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));\n *\n * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.\n *\n *     long millis = System.currentTimeMillis();\n *\n *     Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)\n *         .setNanos((int) ((millis % 1000) * 1000000)).build();\n *\n * Example 5: Compute Timestamp from Java `Instant.now()`.\n *\n *     Instant now = Instant.now();\n *\n *     Timestamp timestamp =\n *         Timestamp.newBuilder().setSeconds(now.getEpochSecond())\n *             .setNanos(now.getNano()).build();\n *\n * Example 6: Compute Timestamp from current time in Python.\n *\n *     timestamp = Timestamp()\n *     timestamp.GetCurrentTime()\n *\n * # JSON Mapping\n *\n * In JSON format, the Timestamp type is encoded as a string in the\n * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the\n * format is \"{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z\"\n * where {year} is always expressed using four digits while {month}, {day},\n * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional\n * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),\n * are optional. The \"Z\" suffix indicates the timezone (\"UTC\"); the timezone\n * is required. A proto3 JSON serializer should always use UTC (as indicated by\n * \"Z\") when printing the Timestamp type and a proto3 JSON parser should be\n * able to accept both UTC and other timezones (as indicated by an offset).\n *\n * For example, \"2017-01-15T01:30:15.01Z\" encodes 15.01 seconds past\n * 01:30 UTC on January 15, 2017.\n *\n * In JavaScript, one can convert a Date object to this format using the\n * standard\n * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)\n * method. In Python, a standard `datetime.datetime` object can be converted\n * to this format using\n * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with\n * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use\n * the Joda Time's [`ISODateTimeFormat.dateTime()`](\n * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()\n * ) to obtain a formatter capable of generating timestamps in this format.\n *\n *\n * @generated from protobuf message google.protobuf.Timestamp\n */\nexport interface Timestamp {\n    /**\n     * Represents seconds of UTC time since Unix epoch\n     * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n     * 9999-12-31T23:59:59Z inclusive.\n     *\n     * @generated from protobuf field: int64 seconds = 1;\n     */\n    seconds: bigint;\n    /**\n     * Non-negative fractions of a second at nanosecond resolution. Negative\n     * second values with fractions must still have non-negative nanos values\n     * that count forward in time. Must be from 0 to 999,999,999\n     * inclusive.\n     *\n     * @generated from protobuf field: int32 nanos = 2;\n     */\n    nanos: number;\n}\n// @generated message type with reflection information, may provide speed optimized methods\nclass Timestamp$Type extends MessageType<Timestamp> {\n    constructor() {\n        super(\"google.protobuf.Timestamp\", [\n            { no: 1, name: \"seconds\", kind: \"scalar\", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },\n            { no: 2, name: \"nanos\", kind: \"scalar\", T: 5 /*ScalarType.INT32*/ }\n        ]);\n    }\n    /**\n     * Creates a new `Timestamp` for the current time.\n     */\n    now(): Timestamp {\n        const msg = this.create();\n        const ms = Date.now();\n        msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();\n        msg.nanos = (ms % 1000) * 1000000;\n        return msg;\n    }\n    /**\n     * Converts a `Timestamp` to a JavaScript Date.\n     */\n    toDate(message: Timestamp): Date {\n        return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));\n    }\n    /**\n     * Converts a JavaScript Date to a `Timestamp`.\n     */\n    fromDate(date: Date): Timestamp {\n        const msg = this.create();\n        const ms = date.getTime();\n        msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();\n        msg.nanos = (ms % 1000) * 1000000;\n        return msg;\n    }\n    /**\n     * In JSON format, the `Timestamp` type is encoded as a string\n     * in the RFC 3339 format.\n     */\n    internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue {\n        let ms = PbLong.from(message.seconds).toNumber() * 1000;\n        if (ms < Date.parse(\"0001-01-01T00:00:00Z\") || ms > Date.parse(\"9999-12-31T23:59:59Z\"))\n            throw new Error(\"Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.\");\n        if (message.nanos < 0)\n            throw new Error(\"Unable to encode invalid Timestamp to JSON. Nanos must not be negative.\");\n        let z = \"Z\";\n        if (message.nanos > 0) {\n            let nanosStr = (message.nanos + 1000000000).toString().substring(1);\n            if (nanosStr.substring(3) === \"000000\")\n                z = \".\" + nanosStr.substring(0, 3) + \"Z\";\n            else if (nanosStr.substring(6) === \"000\")\n                z = \".\" + nanosStr.substring(0, 6) + \"Z\";\n            else\n                z = \".\" + nanosStr + \"Z\";\n        }\n        return new Date(ms).toISOString().replace(\".000Z\", z);\n    }\n    /**\n     * In JSON format, the `Timestamp` type is encoded as a string\n     * in the RFC 3339 format.\n     */\n    internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp {\n        if (typeof json !== \"string\")\n            throw new Error(\"Unable to parse Timestamp from JSON \" + typeofJsonValue(json) + \".\");\n        let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);\n        if (!matches)\n            throw new Error(\"Unable to parse Timestamp from JSON. Invalid format.\");\n        let ms = Date.parse(matches[1] + \"-\" + matches[2] + \"-\" + matches[3] + \"T\" + matches[4] + \":\" + matches[5] + \":\" + matches[6] + (matches[8] ? matches[8] : \"Z\"));\n        if (Number.isNaN(ms))\n            throw new Error(\"Unable to parse Timestamp from JSON. Invalid value.\");\n        if (ms < Date.parse(\"0001-01-01T00:00:00Z\") || ms > Date.parse(\"9999-12-31T23:59:59Z\"))\n            throw new globalThis.Error(\"Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.\");\n        if (!target)\n            target = this.create();\n        target.seconds = PbLong.from(ms / 1000).toBigInt();\n        target.nanos = 0;\n        if (matches[7])\n            target.nanos = (parseInt(\"1\" + matches[7] + \"0\".repeat(9 - matches[7].length)) - 1000000000);\n        return target;\n    }\n}\n/**\n * @generated MessageType for protobuf message google.protobuf.Timestamp\n */\nexport const Timestamp = new Timestamp$Type();\n","// @generated by protobuf-ts 2.9.1 with parameter optimize_code_size\n// @generated from protobuf file \"Flight.proto\" (package \"arrow.flight.protocol\", syntax proto3)\n// tslint:disable\n//\n//\n// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements.  See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership.  The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License.  You may obtain a copy of the License at\n// <p>\n// http://www.apache.org/licenses/LICENSE-2.0\n// <p>\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\nimport type { RpcTransport } from \"@protobuf-ts/runtime-rpc\";\nimport type { ServiceInfo } from \"@protobuf-ts/runtime-rpc\";\nimport { FlightService } from \"./Flight\";\nimport type { ActionType } from \"./Flight\";\nimport type { Empty } from \"./Flight\";\nimport type { Result } from \"./Flight\";\nimport type { Action } from \"./Flight\";\nimport type { PutResult } from \"./Flight\";\nimport type { FlightData } from \"./Flight\";\nimport type { Ticket } from \"./Flight\";\nimport type { SchemaResult } from \"./Flight\";\nimport type { PollInfo } from \"./Flight\";\nimport type { FlightDescriptor } from \"./Flight\";\nimport type { UnaryCall } from \"@protobuf-ts/runtime-rpc\";\nimport type { FlightInfo } from \"./Flight\";\nimport type { Criteria } from \"./Flight\";\nimport type { ServerStreamingCall } from \"@protobuf-ts/runtime-rpc\";\nimport { stackIntercept } from \"@protobuf-ts/runtime-rpc\";\nimport type { HandshakeResponse } from \"./Flight\";\nimport type { HandshakeRequest } from \"./Flight\";\nimport type { DuplexStreamingCall } from \"@protobuf-ts/runtime-rpc\";\nimport type { RpcOptions } from \"@protobuf-ts/runtime-rpc\";\n/**\n *\n * A flight service is an endpoint for retrieving or storing Arrow data. A\n * flight service can expose one or more predefined endpoints that can be\n * accessed using the Arrow Flight Protocol. Additionally, a flight service\n * can expose a set of actions that are available.\n *\n * @generated from protobuf service arrow.flight.protocol.FlightService\n */\nexport interface IFlightServiceClient {\n    /**\n     *\n     * Handshake between client and server. Depending on the server, the\n     * handshake may be required to determine the token that should be used for\n     * future operations. Both request and response are streams to allow multiple\n     * round-trips depending on auth mechanism.\n     *\n     * @generated from protobuf rpc: Handshake(stream arrow.flight.protocol.HandshakeRequest) returns (stream arrow.flight.protocol.HandshakeResponse);\n     */\n    handshake(options?: RpcOptions): DuplexStreamingCall<HandshakeRequest, HandshakeResponse>;\n    /**\n     *\n     * Get a list of available streams given a particular criteria. Most flight\n     * services will expose one or more streams that are readily available for\n     * retrieval. This api allows listing the streams available for\n     * consumption. A user can also provide a criteria. The criteria can limit\n     * the subset of streams that can be listed via this interface. Each flight\n     * service allows its own definition of how to consume criteria.\n     *\n     * @generated from protobuf rpc: ListFlights(arrow.flight.protocol.Criteria) returns (stream arrow.flight.protocol.FlightInfo);\n     */\n    listFlights(input: Criteria, options?: RpcOptions): ServerStreamingCall<Criteria, FlightInfo>;\n    /**\n     *\n     * For a given FlightDescriptor, get information about how the flight can be\n     * consumed. This is a useful interface if the consumer of the interface\n     * already can identify the specific flight to consume. This interface can\n     * also allow a consumer to generate a flight stream through a specified\n     * descriptor. For example, a flight descriptor might be something that\n     * includes a SQL statement or a Pickled Python operation that will be\n     * executed. In those cases, the descriptor will not be previously available\n     * within the list of available streams provided by ListFlights but will be\n     * available for consumption for the duration defined by the specific flight\n     * service.\n     *\n     * @generated from protobuf rpc: GetFlightInfo(arrow.flight.protocol.FlightDescriptor) returns (arrow.flight.protocol.FlightInfo);\n     */\n    getFlightInfo(input: FlightDescriptor, options?: RpcOptions): UnaryCall<FlightDescriptor, FlightInfo>;\n    /**\n     *\n     * For a given FlightDescriptor, start a query and get information\n     * to poll its execution status. This is a useful interface if the\n     * query may be a long-running query. The first PollFlightInfo call\n     * should return as quickly as possible. (GetFlightInfo doesn't\n     * return until the query is complete.)\n     *\n     * A client can consume any available results before\n     * the query is completed. See PollInfo.info for details.\n     *\n     * A client can poll the updated query status by calling\n     * PollFlightInfo() with PollInfo.flight_descriptor. A server\n     * should not respond until the result would be different from last\n     * time. That way, the client can \"long poll\" for updates\n     * without constantly making requests. Clients can set a short timeout\n     * to avoid blocking calls if desired.\n     *\n     * A client can't use PollInfo.flight_descriptor after\n     * PollInfo.expiration_time passes. A server might not accept the\n     * retry descriptor anymore and the query may be cancelled.\n     *\n     * A client may use the CancelFlightInfo action with\n     * PollInfo.info to cancel the running query.\n     *\n     * @generated from protobuf rpc: PollFlightInfo(arrow.flight.protocol.FlightDescriptor) returns (arrow.flight.protocol.PollInfo);\n     */\n    pollFlightInfo(input: FlightDescriptor, options?: RpcOptions): UnaryCall<FlightDescriptor, PollInfo>;\n    /**\n     *\n     * For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema\n     * This is used when a consumer needs the Schema of flight stream. Similar to\n     * GetFlightInfo this interface may generate a new flight that was not previously\n     * available in ListFlights.\n     *\n     * @generated from protobuf rpc: GetSchema(arrow.flight.protocol.FlightDescriptor) returns (arrow.flight.protocol.SchemaResult);\n     */\n    getSchema(input: FlightDescriptor, options?: RpcOptions): UnaryCall<FlightDescriptor, SchemaResult>;\n    /**\n     *\n     * Retrieve a single stream associated with a particular descriptor\n     * associated with the referenced ticket. A Flight can be composed of one or\n     * more streams where each stream can be retrieved using a separate opaque\n     * ticket that the flight service uses for managing a collection of streams.\n     *\n     * @generated from protobuf rpc: DoGet(arrow.flight.protocol.Ticket) returns (stream arrow.flight.protocol.FlightData);\n     */\n    doGet(input: Ticket, options?: RpcOptions): ServerStreamingCall<Ticket, FlightData>;\n    /**\n     *\n     * Push a stream to the flight service associated with a particular\n     * flight stream. This allows a client of a flight service to upload a stream\n     * of data. Depending on the particular flight service, a client consumer\n     * could be allowed to upload a single stream per descriptor or an unlimited\n     * number. In the latter, the service might implement a 'seal' action that\n     * can be applied to a descriptor once all streams are uploaded.\n     *\n     * @generated from protobuf rpc: DoPut(stream arrow.flight.protocol.FlightData) returns (stream arrow.flight.protocol.PutResult);\n     */\n    doPut(options?: RpcOptions): DuplexStreamingCall<FlightData, PutResult>;\n    /**\n     *\n     * Open a bidirectional data channel for a given descriptor. This\n     * allows clients to send and receive arbitrary Arrow data and\n     * application-specific metadata in a single logical stream. In\n     * contrast to DoGet/DoPut, this is more suited for clients\n     * offloading computation (rather than storage) to a Flight service.\n     *\n     * @generated from protobuf rpc: DoExchange(stream arrow.flight.protocol.FlightData) returns (stream arrow.flight.protocol.FlightData);\n     */\n    doExchange(options?: RpcOptions): DuplexStreamingCall<FlightData, FlightData>;\n    /**\n     *\n     * Flight services can support an arbitrary number of simple actions in\n     * addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut\n     * operations that are potentially available. DoAction allows a flight client\n     * to do a specific action against a flight service. An action includes\n     * opaque request and response objects that are specific to the type action\n     * being undertaken.\n     *\n     * @generated from protobuf rpc: DoAction(arrow.flight.protocol.Action) returns (stream arrow.flight.protocol.Result);\n     */\n    doAction(input: Action, options?: RpcOptions): ServerStreamingCall<Action, Result>;\n    /**\n     *\n     * A flight service exposes all of the available action types that it has\n     * along with descriptions. This allows different flight consumers to\n     * understand the capabilities of the flight service.\n     *\n     * @generated from protobuf rpc: ListActions(arrow.flight.protocol.Empty) returns (stream arrow.flight.protocol.ActionType);\n     */\n    listActions(input: Empty, options?: RpcOptions): ServerStreamingCall<Empty, ActionType>;\n}\n/**\n *\n * A flight service is an endpoint for retrieving or storing Arrow data. A\n * flight service can expose one or more predefined endpoints that can be\n * accessed using the Arrow Flight Protocol. Additionally, a flight service\n * can expose a set of actions that are available.\n *\n * @generated from protobuf service arrow.flight.protocol.FlightService\n */\nexport class FlightServiceClient implements IFlightServiceClient, ServiceInfo {\n    typeName = FlightService.typeName;\n    methods = FlightService.methods;\n    options = FlightService.options;\n    constructor(private readonly _transport: RpcTransport) {\n    }\n    /**\n     *\n     * Handshake between client and server. Depending on the server, the\n     * handshake may be required to determine the token that should be used for\n     * future operations. Both request and response are streams to allow multiple\n     * round-trips depending on auth mechanism.\n     *\n     * @generated from protobuf rpc: Handshake(stream arrow.flight.protocol.HandshakeRequest) returns (stream arrow.flight.protocol.HandshakeResponse);\n     */\n    handshake(options?: RpcOptions): DuplexStreamingCall<HandshakeRequest, HandshakeResponse> {\n        const method = this.methods[0], opt = this._transport.mergeOptions(options);\n        return stackIntercept<HandshakeRequest, HandshakeResponse>(\"duplex\", this._transport, method, opt);\n    }\n    /**\n     *\n     * Get a list of available streams given a particular criteria. Most flight\n     * services will expose one or more streams that are readily available for\n     * retrieval. This api allows listing the streams available for\n     * consumption. A user can also provide a criteria. The criteria can limit\n     * the subset of streams that can be listed via this interface. Each flight\n     * service allows its own definition of how to consume criteria.\n     *\n     * @generated from protobuf rpc: ListFlights(arrow.flight.protocol.Criteria) returns (stream arrow.flight.protocol.FlightInfo);\n     */\n    listFlights(input: Criteria, options?: RpcOptions): ServerStreamingCall<Criteria, FlightInfo> {\n        const method = this.methods[1], opt = this._transport.mergeOptions(options);\n        return stackIntercept<Criteria, FlightInfo>(\"serverStreaming\", this._transport, method, opt, input);\n    }\n    /**\n     *\n     * For a given FlightDescriptor, get information about how the flight can be\n     * consumed. This is a useful interface if the consumer of the interface\n     * already can identify the specific flight to consume. This interface can\n     * also allow a consumer to generate a flight stream through a specified\n     * descriptor. For example, a flight descriptor might be something that\n     * includes a SQL statement or a Pickled Python operation that will be\n     * executed. In those cases, the descriptor will not be previously available\n     * within the list of available streams provided by ListFlights but will be\n     * available for consumption for the duration defined by the specific flight\n     * service.\n     *\n     * @generated from protobuf rpc: GetFlightInfo(arrow.flight.protocol.FlightDescriptor) returns (arrow.flight.protocol.FlightInfo);\n     */\n    getFlightInfo(input: FlightDescriptor, options?: RpcOptions): UnaryCall<FlightDescriptor, FlightInfo> {\n        const method = this.methods[2], opt = this._transport.mergeOptions(options);\n        return stackIntercept<FlightDescriptor, FlightInfo>(\"unary\", this._transport, method, opt, input);\n    }\n    /**\n     *\n     * For a given FlightDescriptor, start a query and get information\n     * to poll its execution status. This is a useful interface if the\n     * query may be a long-running query. The first PollFlightInfo call\n     * should return as quickly as possible. (GetFlightInfo doesn't\n     * return until the query is complete.)\n     *\n     * A client can consume any available results before\n     * the query is completed. See PollInfo.info for details.\n     *\n     * A client can poll the updated query status by calling\n     * PollFlightInfo() with PollInfo.flight_descriptor. A server\n     * should not respond until the result would be different from last\n     * time. That way, the client can \"long poll\" for updates\n     * without constantly making requests. Clients can set a short timeout\n     * to avoid blocking calls if desired.\n     *\n     * A client can't use PollInfo.flight_descriptor after\n     * PollInfo.expiration_time passes. A server might not accept the\n     * retry descriptor anymore and the query may be cancelled.\n     *\n     * A client may use the CancelFlightInfo action with\n     * PollInfo.info to cancel the running query.\n     *\n     * @generated from protobuf rpc: PollFlightInfo(arrow.flight.protocol.FlightDescriptor) returns (arrow.flight.protocol.PollInfo);\n     */\n    pollFlightInfo(input: FlightDescriptor, options?: RpcOptions): UnaryCall<FlightDescriptor, PollInfo> {\n        const method = this.methods[3], opt = this._transport.mergeOptions(options);\n        return stackIntercept<FlightDescriptor, PollInfo>(\"unary\", this._transport, method, opt, input);\n    }\n    /**\n     *\n     * For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema\n     * This is used when a consumer needs the Schema of flight stream. Similar to\n     * GetFlightInfo this interface may generate a new flight that was not previously\n     * available in ListFlights.\n     *\n     * @generated from protobuf rpc: GetSchema(arrow.flight.protocol.FlightDescriptor) returns (arrow.flight.protocol.SchemaResult);\n     */\n    getSchema(input: FlightDescriptor, options?: RpcOptions): UnaryCall<FlightDescriptor, SchemaResult> {\n        const method = this.methods[4], opt = this._transport.mergeOptions(options);\n        return stackIntercept<FlightDescriptor, SchemaResult>(\"unary\", this._transport, method, opt, input);\n    }\n    /**\n     *\n     * Retrieve a single stream associated with a particular descriptor\n     * associated with the referenced ticket. A Flight can be composed of one or\n     * more streams where each stream can be retrieved using a separate opaque\n     * ticket that the flight service uses for managing a collection of streams.\n     *\n     * @generated from protobuf rpc: DoGet(arrow.flight.protocol.Ticket) returns (stream arrow.flight.protocol.FlightData);\n     */\n    doGet(input: Ticket, options?: RpcOptions): ServerStreamingCall<Ticket, FlightData> {\n        const method = this.methods[5], opt = this._transport.mergeOptions(options);\n        return stackIntercept<Ticket, FlightData>(\"serverStreaming\", this._transport, method, opt, input);\n    }\n    /**\n     *\n     * Push a stream to the flight service associated with a particular\n     * flight stream. This allows a client of a flight service to upload a stream\n     * of data. Depending on the particular flight service, a client consumer\n     * could be allowed to upload a single stream per descriptor or an unlimited\n     * number. In the latter, the service might implement a 'seal' action that\n     * can be applied to a descriptor once all streams are uploaded.\n     *\n     * @generated from protobuf rpc: DoPut(stream arrow.flight.protocol.FlightData) returns (stream arrow.flight.protocol.PutResult);\n     */\n    doPut(options?: RpcOptions): DuplexStreamingCall<FlightData, PutResult> {\n        const method = this.methods[6], opt = this._transport.mergeOptions(options);\n        return stackIntercept<FlightData, PutResult>(\"duplex\", this._transport, method, opt);\n    }\n    /**\n     *\n     * Open a bidirectional data channel for a given descriptor. This\n     * allows clients to send and receive arbitrary Arrow data and\n     * application-specific metadata in a single logical stream. In\n     * contrast to DoGet/DoPut, this is more suited for clients\n     * offloading computation (rather than storage) to a Flight service.\n     *\n     * @generated from protobuf rpc: DoExchange(stream arrow.flight.protocol.FlightData) returns (stream arrow.flight.protocol.FlightData);\n     */\n    doExchange(options?: RpcOptions): DuplexStreamingCall<FlightData, FlightData> {\n        const method = this.methods[7], opt = this._transport.mergeOptions(options);\n        return stackIntercept<FlightData, FlightData>(\"duplex\", this._transport, method, opt);\n    }\n    /**\n     *\n     * Flight services can support an arbitrary number of simple actions in\n     * addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut\n     * operations that are potentially available. DoAction allows a flight client\n     * to do a specific action against a flight service. An action includes\n     * opaque request and response objects that are specific to the type action\n     * being undertaken.\n     *\n     * @generated from protobuf rpc: DoAction(arrow.flight.protocol.Action) returns (stream arrow.flight.protocol.Result);\n     */\n    doAction(input: Action, options?: RpcOptions): ServerStreamingCall<Action, Result> {\n        const method = this.methods[8], opt = this._transport.mergeOptions(options);\n        return stackIntercept<Action, Result>(\"serverStreaming\", this._transport, method, opt, input);\n    }\n    /**\n     *\n     * A flight service exposes all of the available action types that it has\n     * along with descriptions. This allows different flight consumers to\n     * understand the capabilities of the flight service.\n     *\n     * @generated from protobuf rpc: ListActions(arrow.flight.protocol.Empty) returns (stream arrow.flight.protocol.ActionType);\n     */\n    listActions(input: Empty, options?: RpcOptions): ServerStreamingCall<Empty, ActionType> {\n        const method = this.methods[9], opt = this._transport.mergeOptions(options);\n        return stackIntercept<Empty, ActionType>(\"serverStreaming\", this._transport, method, opt, input);\n    }\n}\n","import {QParamType} from '../QueryApi'\nimport {throwReturn} from './common'\n\nconst rgxParam = /\\$(\\w+)/g\nexport function queryHasParams(query: string): boolean {\n  return !!query.match(rgxParam)\n}\n\nexport function allParamsMatched(\n  query: string,\n  qParams: Record<string, QParamType>\n): boolean {\n  const matches = query.match(rgxParam)\n\n  if (matches) {\n    for (const match of matches) {\n      if (!qParams[match.trim().replace('$', '')]) {\n        throwReturn(\n          new Error(\n            `No parameter matching ${match} provided in the query params map`\n          )\n        )\n      }\n    }\n  }\n  return true\n}\n","import {Field} from 'apache-arrow'\nimport {isNumber, isUnsignedNumber} from './common'\nimport {Type as ArrowType} from 'apache-arrow/enum'\n\n/**\n * Function to cast value return base on metadata from InfluxDB.\n *\n * @param field the Field object from Arrow\n * @param value the value to cast\n * @return the value with the correct type\n */\nexport function getMappedValue(field: Field, value: any): any {\n  if (value === null || value === undefined) {\n    return null\n  }\n\n  const metaType = field.metadata.get('iox::column::type')\n\n  if (!metaType || field.typeId === ArrowType.Timestamp) {\n    return value\n  }\n\n  const [, , valueType, _fieldType] = metaType.split('::')\n\n  if (valueType === 'field') {\n    switch (_fieldType) {\n      case 'integer':\n        if (isNumber(value)) {\n          return parseInt(value)\n        }\n        console.warn(`Value ${value} is not an integer`)\n        return value\n      case 'uinteger':\n        if (isUnsignedNumber(value)) {\n          return parseInt(value)\n        }\n        console.warn(`Value ${value} is not an unsigned integer`)\n        return value\n      case 'float':\n        if (isNumber(value)) {\n          return parseFloat(value)\n        }\n        console.warn(`Value ${value} is not a float`)\n        return value\n      case 'boolean':\n        if (typeof value === 'boolean') {\n          return value\n        }\n        console.warn(`Value ${value} is not a boolean`)\n        return value\n      case 'string':\n        if (typeof value === 'string') {\n          return String(value)\n        }\n        console.warn(`Value ${value} is not a string`)\n        return value\n      default:\n        return value\n    }\n  }\n\n  return value\n}\n","import WriteApi from './WriteApi'\nimport WriteApiImpl from './impl/WriteApiImpl'\nimport QueryApi, {QParamType} from './QueryApi'\nimport QueryApiImpl from './impl/QueryApiImpl'\nimport {\n  ClientOptions,\n  DEFAULT_ConnectionOptions,\n  DEFAULT_QueryOptions,\n  QueryOptions,\n  // QueryType,\n  WriteOptions,\n  fromConnectionString,\n  fromEnv,\n} from './options'\nimport {IllegalArgumentError} from './errors'\nimport {WritableData, writableDataToLineProtocol} from './util/generics'\nimport {throwReturn} from './util/common'\nimport {PointValues} from './PointValues'\nimport {Transport} from './transport'\nimport {impl} from './impl/implSelector'\n\nconst argumentErrorMessage = `\\\nPlease specify the 'database' as a method parameter or use default configuration \\\nat 'ClientOptions.database'\n`\n\n/**\n * `InfluxDBClient` for interacting with an InfluxDB server, simplifying common operations such as writing, querying.\n */\nexport default class InfluxDBClient {\n  private readonly _options: ClientOptions\n  private readonly _writeApi: WriteApi\n  private readonly _queryApi: QueryApi\n  private readonly _transport: Transport\n\n  /**\n   * Creates a new instance of the `InfluxDBClient` from `ClientOptions`.\n   * @param options - client options\n   */\n  constructor(options: ClientOptions)\n\n  /**\n   * Creates a new instance of the `InfluxDBClient` from connection string.\n   * @example https://us-east-1-1.aws.cloud2.influxdata.com/?token=my-token&database=my-database\n   *\n   * Supported query parameters:\n   *   - token - authentication token (required)\n   *   - authScheme - token authentication scheme. Not set for Cloud access, set to 'Bearer' for Core/Enterprise.\n   *   - database - database (bucket) name\n   *   - timeout - I/O timeout\n   *   - precision - timestamp precision when writing data\n   *   - gzipThreshold - payload size threshold for gzipping data\n   *   - writeNoSync - skip waiting for WAL persistence on write\n   *\n   * @param connectionString - connection string\n   */\n  constructor(connectionString: string)\n\n  /**\n   * Creates a new instance of the `InfluxDBClient` from environment variables.\n   *\n   * Supported variables:\n   *   - INFLUX_HOST - cloud/server URL (required)\n   *   - INFLUX_TOKEN - authentication token (required)\n   *   - INFLUX_AUTH_SCHEME - token authentication scheme. Not set for Cloud access, set to 'Bearer' for Core/Enterprise.\n   *   - INFLUX_TIMEOUT - I/O timeout\n   *   - INFLUX_DATABASE - database (bucket) name\n   *   - INFLUX_PRECISION - timestamp precision when writing data\n   *   - INFLUX_GZIP_THRESHOLD - payload size threshold for gzipping data\n   *   - INFLUX_WRITE_NO_SYNC - skip waiting for WAL persistence on write\n   *   - INFLUX_GRPC_OPTIONS - comma separated set of key=value pairs matching @grpc/grpc-js channel options.\n   */\n  constructor()\n\n  constructor(...args: Array<any>) {\n    let options: ClientOptions\n    switch (args.length) {\n      case 0: {\n        options = fromEnv()\n        break\n      }\n      case 1: {\n        if (args[0] == null) {\n          throw new IllegalArgumentError('No configuration specified!')\n        } else if (typeof args[0] === 'string') {\n          options = fromConnectionString(args[0])\n        } else {\n          options = args[0]\n        }\n        break\n      }\n      default: {\n        throw new IllegalArgumentError('Multiple arguments specified!')\n      }\n    }\n    this._options = {\n      ...DEFAULT_ConnectionOptions,\n      ...options,\n    }\n\n    // see list of grpcOptions in @grpc/grpc-js/README.md\n    // sync grpcOptions between ConnectionOptions (needed by transport)\n    // and QueryOptions (User friendly location also more accessible via env)\n    if (this._options.grpcOptions) {\n      this._options.queryOptions = {\n        ...options.queryOptions,\n        grpcOptions: {\n          ...this._options.grpcOptions,\n        },\n      }\n    } else {\n      if (options.queryOptions?.grpcOptions) {\n        this._options.grpcOptions = options.queryOptions?.grpcOptions\n      }\n    }\n    const host = this._options.host\n    if (typeof host !== 'string')\n      throw new IllegalArgumentError('No host specified!')\n    if (host.endsWith('/'))\n      this._options.host = host.substring(0, host.length - 1)\n    if (typeof this._options.token !== 'string')\n      throw new IllegalArgumentError('No token specified!')\n    this._queryApi = new QueryApiImpl({\n      ...this._options,\n      queryTimeout:\n        this._options.queryOptions?.timeout ?? this._options?.queryTimeout,\n    })\n\n    const writeTimeout =\n      this._options.timeout ??\n      this._options.writeOptions?.timeout ??\n      this._options.writeTimeout\n\n    this._transport = impl.writeTransport({\n      ...this._options,\n      writeTimeout: writeTimeout,\n    })\n    this._writeApi = new WriteApiImpl({\n      transport: this._transport,\n      ...this._options,\n    })\n  }\n\n  private _mergeWriteOptions = (writeOptions?: Partial<WriteOptions>) => {\n    const headerMerge: Record<string, string> = {\n      ...this._options.writeOptions?.headers,\n      ...writeOptions?.headers,\n    }\n    const result = {\n      ...this._options.writeOptions,\n      ...writeOptions,\n    }\n    result.headers = headerMerge\n    return result\n  }\n\n  private _mergeQueryOptions = (queryOptions?: Partial<QueryOptions>) => {\n    const headerMerge: Record<string, string> = {\n      ...this._options.queryOptions?.headers,\n      ...queryOptions?.headers,\n    }\n    const paramsMerge: Record<string, QParamType> = {\n      ...this._options.queryOptions?.params,\n      ...queryOptions?.params,\n    }\n    const result = {\n      ...this._options.queryOptions,\n      ...queryOptions,\n    }\n    result.headers = headerMerge\n    result.params = paramsMerge\n    return result\n  }\n\n  /**\n   * Write data into specified database.\n   * @param data - data to write\n   * @param database - database to write into\n   * @param org - organization to write into\n   * @param writeOptions - write options\n   */\n  async write(\n    data: WritableData,\n    database?: string,\n    org?: string,\n    writeOptions?: Partial<WriteOptions>\n  ): Promise<void> {\n    const options = this._mergeWriteOptions(writeOptions)\n\n    await this._writeApi.doWrite(\n      writableDataToLineProtocol(data, options?.defaultTags, options?.tagOrder),\n      database ??\n        this._options.database ??\n        throwReturn(new Error(argumentErrorMessage)),\n      org,\n      options\n    )\n  }\n\n  /**\n   * Execute a query and return the results as an async generator.\n   *\n   * @param query - The query string.\n   * @param database - The name of the database to query.\n   * @param queryOptions - The options for the query (default: \\{ type: 'sql' \\}).\n   * @example\n   * ```typescript\n   *    client.query('SELECT * from net', 'traffic_db', {\n   *       type: 'sql',\n   *       headers: {\n   *         'channel-pref': 'eu-west-7',\n   *         'notify': 'central',\n   *       },\n   *     })\n   * ```\n   * @returns An async generator that yields maps of string keys to any values.\n   */\n  query(\n    query: string,\n    database?: string,\n    queryOptions: Partial<QueryOptions> = this._options.queryOptions ??\n      DEFAULT_QueryOptions\n  ): AsyncGenerator<Record<string, any>, void, void> {\n    const options = this._mergeQueryOptions(queryOptions)\n    return this._queryApi.query(\n      query,\n      database ??\n        this._options.database ??\n        throwReturn(new Error(argumentErrorMessage)),\n      options as QueryOptions\n    )\n  }\n\n  /**\n   * Execute a query and return the results as an async generator.\n   *\n   * @param query - The query string.\n   * @param database - The name of the database to query.\n   * @param queryOptions - The type of query (default: \\{type: 'sql'\\}).\n   * @example\n   *\n   * ```typescript\n   * client.queryPoints('SELECT * FROM cpu', 'performance_db', {\n   *       type: 'sql',\n   *       params: {register: 'rax'},\n   *     })\n   * ```\n   *\n   * @returns An async generator that yields PointValues object.\n   */\n  queryPoints(\n    query: string,\n    database?: string,\n    queryOptions: Partial<QueryOptions> = this._options.queryOptions ??\n      DEFAULT_QueryOptions\n  ): AsyncGenerator<PointValues, void, void> {\n    const options = this._mergeQueryOptions(queryOptions)\n    return this._queryApi.queryPoints(\n      query,\n      database ??\n        this._options.database ??\n        throwReturn(new Error(argumentErrorMessage)),\n      options as QueryOptions\n    )\n  }\n\n  /**\n   * Retrieves the server version by making a request to the `/ping` endpoint.\n   * It attempts to return the version information from the response headers or the response body.\n   *\n   * @return {Promise<string | undefined>} A promise that resolves to the server version as a string, or undefined if it cannot be determined.\n   * Rejects the promise if an error occurs during the request.\n   */\n  async getServerVersion(): Promise<string | undefined> {\n    let version = undefined\n    try {\n      const responseBody = await this._transport.request(\n        '/ping',\n        null,\n        {\n          method: 'GET',\n        },\n        (headers, _) => {\n          version =\n            headers['X-Influxdb-Version'] ?? headers['x-influxdb-version']\n        }\n      )\n      if (responseBody && !version) {\n        version = responseBody['version']\n      }\n    } catch (error) {\n      return Promise.reject(error)\n    }\n\n    return Promise.resolve(version)\n  }\n\n  /**\n   * Closes the client and all its resources (connections, ...)\n   */\n  async close(): Promise<void> {\n    await this._writeApi.close()\n    await this._queryApi.close()\n  }\n}\n"],"mappings":"wKAEA,SAASA,GAAmBC,EAA+B,CACzD,GAAI,CAACA,GAAQ,OAAOA,GAAS,UAAY,MAAM,QAAQA,CAAI,EACzD,OAEF,IAAMC,EAAU,OAAOD,EAAK,SAAY,SAAWA,EAAK,QAAU,OAClE,GAAIC,EACF,OAAOA,EAGT,IAAMC,EAAY,OAAOF,EAAK,OAAU,SAAWA,EAAK,MAAQ,OAC1DG,EAAOH,EAAK,KAClB,GAAIE,GAAa,MAAM,QAAQC,CAAI,EAAG,CACpC,IAAMC,EAAoB,CAAC,EAC3B,QAAWC,KAAQF,EAAM,CACvB,GAAI,CAACE,GAAQ,OAAOA,GAAS,UAAY,MAAM,QAAQA,CAAI,EACzD,SAEF,IAAMC,EAAaD,EAAK,YAClBE,EAAeF,EAAK,cACpBG,EAAeH,EAAK,cAGxBC,GAAe,MACf,OAAOC,GAAiB,UACxBA,EAAa,OAAS,GACtB,OAAOC,GAAiB,UACxBA,EAAa,OAAS,EAEtBJ,EAAQ,KAAK,SAAUE,CAAU,KAAKC,CAAY,KAAKC,CAAY,GAAG,EAC7D,OAAOD,GAAiB,UAAYA,EAAa,OAAS,GACnEH,EAAQ,KAAK,IAAKG,CAAY,EAAE,CAEpC,CACA,OAAIH,EAAQ,OACH,GAAGF,CAAS;AAAA,EAAME,EAAQ,KAAK;AAAA,CAAI,CAAC,GAEtCF,CACT,CACA,GAAIC,GAAQ,OAAOA,GAAS,UAAY,CAAC,MAAM,QAAQA,CAAI,EAAG,CAC5D,IAAMI,EAAgBJ,EAAmC,cACzD,GAAI,OAAOI,GAAiB,UAAYA,EAAa,OAAS,EAC5D,OAAOA,CAEX,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U6B,GACE7B,EAAA+B,EAAQ,oBAAoB,IAA5B,KAAA/B,EAAiC+B,EAAQ,oBAAoB,CACjE,CACF,EACID,GAAgB,CAACD,IACnBA,EAAUC,EAAa,QAE3B,OAASG,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CAEA,OAAO,QAAQ,QAAQJ,CAAO,CAChC,CAKA,MAAM,OAAuB,CAC3B,MAAM,KAAK,UAAU,MAAM,EAC3B,MAAM,KAAK,UAAU,MAAM,CAC7B,CACF","names":["formatErrorMessage","node","message","errorText","data","details","item","lineNumber","errorMessage","originalLine","IllegalArgumentError","_IllegalArgumentError","HttpError","_HttpError","statusCode","statusMessage","body","contentType","headers","_a","__publicField","parsedMessage","e","RequestTimedOutError","_RequestTimedOutError","AbortError","_AbortError","createTextDecoderCombiner","decoder","first","second","retVal","chunk","start","end","DEFAULT_ConnectionOptions","DEFAULT_WriteOptions","DEFAULT_QueryOptions","fromConnectionString","connectionString","url","options","parsePrecision","parseBoolean","fromEnv","optionSets","optSet","kvPair","value","precisionToV2ApiString","precision","precisionToV3ApiString","consoleLogger","message","error","provider","Log","setLogger","logger","previous","createEscaper","characters","replacements","value","retVal","from","i","found","createQuotedEscaper","escaper","escape","zeroPadding","useHrTime","useProcessHrtime","use","startHrMillis","startHrTime","lastMillis","stepsInMillis","nanos","hrTime","millis","micros","seconds","currentTime","dateToProtocolTimestamp","d","convertTimeToNanos","value","convertTime","precision","throwReturn","err","isDefined","value","isArrayLike","x","createInt32Uint8Array","bytes","collectAll","generator","results","isNumber","isUnsignedNumber","writableDataToLineProtocol","data","defaultTags","tagOrder","arrayData","isArrayLike","p","isDefined","inferType","value","GetFieldTypeMissmatchError","_GetFieldTypeMissmatchError","fieldName","expectedType","actualType","PointValues","_PointValues","__publicField","name","val","strVal","code","type","fieldEntry","fields","copy","entry","measurement","Point","fieldToLPString","type","value","escape","collectDefaultTagNames","pointTagNames","defaultTags","pointTagNamesSet","name","applyPreferredTagOrder","tagNames","tagOrder","remaining","ordered","seen","tagName","sortedRemaining","Point","_Point","arg0","__publicField","PointValues","values","fields","convertTimePrecision","fieldsLine","lpStringValue","tagsLine","defaultTagNames","pointTagValue","time","convertTime","convertTimeToNanos","line","parse","http","https","Buffer","zlib","completeCommunicationObserver","callbacks","state","retVal","data","error","headers","statusCode","CLIENT_LIB_VERSION","CLIENT_LIB_USER_AGENT","pipeline","zlibOptions","zlib","emptyBuffer","Buffer","CancellableImpl","__publicField","NodeHttpTransport","connectionOptions","_a","_b","_c","_d","_e","_f","_g","_h","_url","proxyUrl","token","authScheme","transportOptions","nodeSupportedOptions","url","parse","key","Log","CLIENT_LIB_USER_AGENT","path","body","options","callbacks","cancellable","message","err","responseStarted","buffer","contentType","responseStatusCode","resolve","reject","headers","statusCode","data","responseType","e","terminationError","nestedReject","wrapReject","error","requestMessage","AbortError","response","req","RequestTimedOutError","res","chunk","sendOptions","bodyBuffer","contentEncoding","responseData","pipeline","isJson","s","HttpError","listeners","completeCommunicationObserver","resume","NodeHttpTransport_default","GrpcTransport","HTTP_PREFIX","HTTPS_PREFIX","replaceURLProtocolWithPort","url","safe","grpc","createTransport","host","timeout","clientOptions","url","safe","replaceURLProtocolWithPort","channelCredentials","interceptors","otherClientOptions","GrpcTransport","implementation","opts","NodeHttpTransport_default","createTransport","node_default","WriteApiImpl","_options","__publicField","_a","node_default","bucket","writeOptions","org","precision","path","query","precisionToV3ApiString","precisionToV2ApiString","lines","resolve","reject","promise","res","rej","writeOptionsOrDefault","DEFAULT_WriteOptions","responseStatusCode","headers","callbacks","_headers","statusCode","error","HttpError","Log","message","sendOptions","RecordBatchReader","ArrowType","ServiceType","typeofJsonValue","value","t","isJsonObject","encTable","decTable","i","base64decode","base64Str","es","bytes","bytePos","groupPos","b","p","base64encode","base64","UnknownFieldHandler","typeName","message","fieldNo","wireType","data","is","writer","no","all","uf","WireType","varint64read","lowBits","highBits","shift","b","middleByte","varint64write","lo","hi","bytes","i","hasNext","byte","splitBits","hasMoreBits","TWO_PWR_32_DBL","int64fromString","dec","minus","base","add1e6digit","begin","end","digit1e6","int64toString","bitsLow","bitsHigh","low","mid","high","digitA","digitB","digitC","decimalFrom1e7","digit1e7","needLeadingZeros","partial","varint32write","value","varint32read","result","readBytes","BI","detectBi","dv","assertBi","bi","RE_DECIMAL_STR","TWO_PWR_32_DBL","HALF_2_PWR_32","SharedPbLong","lo","hi","result","PbULong","_PbULong","value","minus","int64fromString","int64toString","PbLong","_PbLong","pbl","n","defaultsRead","bytes","BinaryReader","binaryReadOptions","options","buf","textDecoder","varint64read","varint32read","tag","fieldNo","wireType","start","WireType","len","t","zze","PbLong","PbULong","lo","hi","s","assert","condition","msg","FLOAT32_MAX","FLOAT32_MIN","UINT32_MAX","INT32_MAX","INT32_MIN","assertInt32","arg","assertUInt32","assertFloat32","defaultsWrite","BinaryWriter","binaryWriteOptions","options","textEncoder","len","bytes","offset","chunk","prev","fieldNo","type","value","assertUInt32","assertInt32","varint32write","assertFloat32","view","long","PbLong","PbULong","varint64write","sign","lo","hi","defaultsWrite","defaultsRead","jsonReadOptions","options","jsonWriteOptions","MESSAGE_TYPE","lowerCamelCase","snakeCase","capNext","sb","i","next","ScalarType","LongType","RepeatType","normalizeFieldInfo","field","_a","_b","_c","_d","lowerCamelCase","isOneofGroup","any","ReflectionTypeCheck","info","_a","req","known","oneofs","field","message","depth","allowExcessProperties","keys","data","n","k","name","group","isOneofGroup","f","arg","repeated","ScalarType","type","i","longType","argType","LongType","map","reflectionLongConvert","long","type","LongType","ReflectionJsonReader","info","_a","fieldsInput","field","condition","fieldName","jsonValue","what","typeofJsonValue","input","message","options","oneofsHandled","jsonKey","localName","target","isJsonObject","fieldObj","jsonObjKey","jsonObjValue","val","key","ScalarType","LongType","fieldArr","jsonItem","type","json","ignoreUnknownFields","assert","localEnumName","enumNumber","longType","e","float","assertFloat32","int32","assertUInt32","assertInt32","reflectionLongConvert","PbLong","PbULong","base64decode","error","ReflectionJsonWriter","info","_a","message","options","json","source","field","jsonValue","group","opt","assert","value","jsonObj","entryKey","entryValue","val","messageType","enumInfo","jsonArr","i","type","fieldName","optional","emitDefaultValues","enumAsInteger","ed","ScalarType","assertInt32","assertUInt32","assertFloat32","ulong","PbULong","long","PbLong","base64encode","reflectionScalarDefault","type","longType","LongType","ScalarType","reflectionLongConvert","PbULong","PbLong","ReflectionBinaryReader","info","_a","fieldsInput","field","reader","message","options","length","end","fieldNo","wireType","u","d","UnknownFieldHandler","target","repeated","localName","T","ScalarType","L","arr","WireType","e","msg","mapKey","mapVal","key","val","LongType","keyRaw","reflectionScalarDefault","type","longType","reflectionLongConvert","ReflectionBinaryWriter","info","fieldsInput","a","b","message","writer","options","field","value","emitDefault","repeated","localName","group","T","ScalarType","assert","RepeatType","item","key","val","u","UnknownFieldHandler","WireType","keyValue","handler","fieldNo","type","wireType","method","isDefault","i","t","m","d","PbLong","PbULong","reflectionCreate","type","msg","MESSAGE_TYPE","field","name","reflectionScalarDefault","reflectionMergePartial","info","target","source","fieldValue","input","output","field","name","group","i","T","k","reflectionEquals","info","a","b","field","localName","val_a","val_b","t","ScalarType","repeatedPrimitiveEq","primitiveEq","repeatedMsgEq","objectValues","T","type","ba","bb","i","baseDescriptors","messageTypeDescriptor","MESSAGE_TYPE","MessageType","name","fields","options","normalizeFieldInfo","ReflectionTypeCheck","ReflectionJsonReader","ReflectionJsonWriter","ReflectionBinaryReader","ReflectionBinaryWriter","value","message","reflectionCreate","reflectionMergePartial","copy","a","b","reflectionEquals","arg","depth","target","source","data","opt","binaryReadOptions","json","jsonReadOptions","jsonWriteOptions","_a","binaryWriteOptions","typeofJsonValue","writer","reader","length","Timestamp$Type","MessageType","msg","ms","PbLong","message","date","options","z","nanosStr","json","target","typeofJsonValue","matches","Timestamp","FlightDescriptor_DescriptorType","CancelStatus","HandshakeRequest$Type","MessageType","HandshakeRequest","HandshakeResponse$Type","HandshakeResponse","BasicAuth$Type","BasicAuth","Empty$Type","Empty","ActionType$Type","ActionType","Criteria$Type","Criteria","Action$Type","Action","CancelFlightInfoRequest$Type","FlightInfo","CancelFlightInfoRequest","RenewFlightEndpointRequest$Type","FlightEndpoint","RenewFlightEndpointRequest","Result$Type","Result","CancelFlightInfoResult$Type","CancelFlightInfoResult","SchemaResult$Type","SchemaResult","FlightDescriptor$Type","FlightDescriptor","FlightInfo$Type","PollInfo$Type","Timestamp","PollInfo","FlightEndpoint$Type","Ticket","Location","Location$Type","Ticket$Type","FlightData$Type","FlightData","PutResult$Type","PutResult","FlightService","ServiceType","stackIntercept","FlightServiceClient","_transport","__publicField","FlightService","options","method","opt","stackIntercept","input","rgxParam","queryHasParams","query","allParamsMatched","qParams","matches","match","throwReturn","ArrowType","getMappedValue","field","value","metaType","valueType","_fieldType","isNumber","isUnsignedNumber","QueryApiImpl","_options","__publicField","host","queryTimeout","grpcOptions","clientOptions","node_default","FlightServiceClient","database","query","options","ticketData","param","key","Ticket","headers","meta","CLIENT_LIB_USER_AGENT","token","_a","queryHasParams","allParamsMatched","client","ticket","rpcOptions","flightDataStream","binaryStream","flightData","createInt32Uint8Array","RecordBatchReader","batches","batch","batchRow","row","column","value","getMappedValue","rowIndex","values","PointValues","columnIndex","columnSchema","name","arrowTypeId","metaType","ArrowType","valueType","_fieldType","mappedValue","_b","argumentErrorMessage","InfluxDBClient","args","__publicField","writeOptions","_a","headerMerge","result","queryOptions","_b","paramsMerge","_c","_d","_e","_f","_g","_h","options","fromEnv","IllegalArgumentError","fromConnectionString","DEFAULT_ConnectionOptions","host","QueryApiImpl","writeTimeout","node_default","WriteApiImpl","data","database","org","writableDataToLineProtocol","throwReturn","query","DEFAULT_QueryOptions","version","responseBody","headers","_","error"]}