import * as dtypes from './type.js'; import { Data, DataProps } from './data.js'; import { BuilderType, JavaScriptDataType } from './interfaces.js'; import { Vector } from './vector.js'; import { Builder, BuilderOptions } from './builder.js'; import { ArrayDataType, BigIntArray, JavaScriptArrayDataType, TypedArray, TypedArrayDataType } from './interfaces.js'; import { Table } from './table.js'; export declare function makeBuilder(options: BuilderOptions): BuilderType; /** * Creates a Vector from a JavaScript array via a {@link Builder}. * Use {@link makeVector} if you only want to create a vector from a typed array. * * @example * ```ts * const vf64 = vectorFromArray([1, 2, 3]); * const vi8 = vectorFromArray([1, 2, 3], new Int8); * const vdict = vectorFromArray(['foo', 'bar']); * const vstruct = vectorFromArray([{a: 'foo', b: 42}, {a: 'bar', b: 12}]); * ``` */ export declare function vectorFromArray(values: readonly (null | undefined)[], type?: dtypes.Null): Vector; export declare function vectorFromArray(values: readonly (null | undefined | boolean)[], type?: dtypes.Bool): Vector; export declare function vectorFromArray = dtypes.Dictionary>(values: readonly (null | undefined | string)[], type?: T): Vector; export declare function vectorFromArray(values: readonly (null | undefined | Date)[], type?: T): Vector; export declare function vectorFromArray(values: readonly (null | undefined | number)[], type: T): Vector; export declare function vectorFromArray(values: readonly (null | undefined | bigint)[], type?: T): Vector; export declare function vectorFromArray(values: readonly (null | undefined | number)[], type?: T): Vector; export declare function vectorFromArray(values: readonly (unknown)[], type: T): Vector; export declare function vectorFromArray(values: T): Vector>; /** Creates a Vector from a typed array via {@link makeVector}. */ export declare function vectorFromArray(data: T): Vector>; export declare function vectorFromArray(data: Data): Vector; export declare function vectorFromArray(data: Vector): Vector; export declare function vectorFromArray(data: DataProps): Vector; export declare function vectorFromArray(data: T): Vector>; /** * Creates a {@link Table} from an array of objects. * * @param array A table of objects. */ export declare function tableFromJSON>(array: T[]): Table<{ [P in keyof T]: JavaScriptDataType; }>; /** * A set of options to create an Iterable or AsyncIterable `Builder` transform function. * @see {@link builderThroughIterable} * @see {@link builderThroughAsyncIterable} */ export interface IterableBuilderOptions extends BuilderOptions { highWaterMark?: number; queueingStrategy?: 'bytes' | 'count'; dictionaryHashFunction?: (value: any) => string | number; valueToChildTypeId?: (builder: Builder, value: any, offset: number) => number; } /** @ignore */ type ThroughIterable = (source: Iterable) => IterableIterator>; /** * Transform a synchronous `Iterable` of arbitrary JavaScript values into a * sequence of Arrow Vector following the chunking semantics defined in * the supplied `options` argument. * * This function returns a function that accepts an `Iterable` of values to * transform. When called, this function returns an Iterator of `Vector`. * * The resulting `Iterator>` yields Vectors based on the * `queueingStrategy` and `highWaterMark` specified in the `options` argument. * * * If `queueingStrategy` is `"count"` (or omitted), The `Iterator>` * will flush the underlying `Builder` (and yield a new `Vector`) once the * Builder's `length` reaches or exceeds the supplied `highWaterMark`. * * If `queueingStrategy` is `"bytes"`, the `Iterator>` will flush * the underlying `Builder` (and yield a new `Vector`) once its `byteLength` * reaches or exceeds the supplied `highWaterMark`. * * @param {IterableBuilderOptions} options An object of properties which determine the `Builder` to create and the chunking semantics to use. * @returns A function which accepts a JavaScript `Iterable` of values to * write, and returns an `Iterator` that yields Vectors according * to the chunking semantics defined in the `options` argument. * @nocollapse */ export declare function builderThroughIterable(options: IterableBuilderOptions): ThroughIterable; /** @ignore */ type ThroughAsyncIterable = (source: Iterable | AsyncIterable) => AsyncIterableIterator>; /** * Transform an `AsyncIterable` of arbitrary JavaScript values into a * sequence of Arrow Vector following the chunking semantics defined in * the supplied `options` argument. * * This function returns a function that accepts an `AsyncIterable` of values to * transform. When called, this function returns an AsyncIterator of `Vector`. * * The resulting `AsyncIterator>` yields Vectors based on the * `queueingStrategy` and `highWaterMark` specified in the `options` argument. * * * If `queueingStrategy` is `"count"` (or omitted), The `AsyncIterator>` * will flush the underlying `Builder` (and yield a new `Vector`) once the * Builder's `length` reaches or exceeds the supplied `highWaterMark`. * * If `queueingStrategy` is `"bytes"`, the `AsyncIterator>` will flush * the underlying `Builder` (and yield a new `Vector`) once its `byteLength` * reaches or exceeds the supplied `highWaterMark`. * * @param {IterableBuilderOptions} options An object of properties which determine the `Builder` to create and the chunking semantics to use. * @returns A function which accepts a JavaScript `AsyncIterable` of values * to write, and returns an `AsyncIterator` that yields Vectors * according to the chunking semantics defined in the `options` * argument. * @nocollapse */ export declare function builderThroughAsyncIterable(options: IterableBuilderOptions): ThroughAsyncIterable; export {};