1 line
140 KiB
Plaintext
1 line
140 KiB
Plaintext
|
{"version":3,"sources":["../src/results/chunkCombiner.ts","../src/results/chunksToLines.ts","../src/results/chunksToLinesIterable.ts","../src/results/LineSplitter.ts","../src/results/FluxTableColumn.ts","../src/errors.ts","../src/results/FluxTableMetaData.ts","../src/results/linesToTables.ts","../src/results/linesToRowsIterable.ts","../src/results/stringToLines.ts","../src/observable/symbol.ts","../src/results/ObservableQuery.ts","../src/options.ts","../src/util/escape.ts","../src/util/currentTime.ts","../src/util/logger.ts","../src/query/flux.ts","../src/Point.ts","../src/impl/retryStrategy.ts","../src/impl/RetryBuffer.ts","../src/util/utf8Length.ts","../src/impl/WriteApiImpl.ts","../src/impl/completeCommunicationObserver.ts","../src/impl/browser/FetchTransport.ts","../src/impl/QueryApiImpl.ts","../src/results/AnnotatedCSVResponseImpl.ts","../src/InfluxDB.ts"],"sourcesContent":["/**\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 {ChunkCombiner, createTextDecoderCombiner} from './chunkCombiner'\nimport {CommunicationObserver} from './CommunicationObserver'\nimport {Cancellable} from './Cancellable'\n\n/**\n * ChunksToLines is a transformation that accepts Uint8Array instances\n * and emmits strings representing CSV lines.\n * @param target - target to emmit CSV lines to\n * @param chunkCombiner - chunk combiner\n * @returns communication obrver to accept Uint8Arrays\n */\nexport function chunksToLines(\n target: CommunicationObserver<string>,\n chunkCombiner?: ChunkCombiner\n): CommunicationObserver<Uint8Array> {\n const chunks = chunkCombiner ?? createTextDecoderCombiner()\n let previous: Uint8Array | undefined\n let finished = false\n let quoted = false\n let paused = false\n let resumeChunks: (() => void) | undefined\n\n function bufferReceived(chunk: Uint8Array): void {\n let index: number\n let start = 0\n if (previous) {\n // inspect the whole remaining data upon empty chunk\n // empty chunk signalizes to restart of receiving\n index = chunk.length === 0 ? 0 : (previous as Uint8Array).length\n chunk = chunks.concat(previous, chunk)\n } else {\n index = 0\n
|