import { Stream, TypeToFields } from '../data'; import { AggregationDefinition, PrimitiveType } from '../east'; import { EastFunction, Variable } from '../east/functions'; import { ArrayType, BlobType, BooleanType, DictType, EastType, FloatType, IntegerType, Nullable, SetType, StringType, StructType } from '../east/types'; import { Builder, ModulePath, Template } from '../template'; import { Op } from './Pipeline'; import { ModuleBuilder } from '../template/ModuleBuilder'; import { Geo } from '../layout/Geo'; /** * A `PipelineBuilder` to build a data {@link Pipeline}. * * Methods on the `PipelineBuilder` enable you to directly transform data * `from` any {@link Stream} by applying a `transform` operation. If the {@link Stream} is tabular, * specialised operations can be applied to `select`, `filter`, `join`, `aggregate`, * `disaggregate` and `offset` each entry in the {@link Stream}. * * Quality of data can be observed using `assert` and `warn` by providing expression based conditions * and messages to the whole {@link Stream}. * * A corresponding {@link Template} can be created using `.toTemplate()`. * * @remarks See [Transform Data](https://learn.elaraai.com/courses/development-essentials/03_transform_data/) for a related learning module. * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .error({ * if: username => Equal(username, ""), * message: "Username is empty" * }) * .input({ name: "password", stream: password }) * .warn({ * if: (_, { password }) => Equal(password, ""), * message: () => Const("Password is empty") * }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .transform(str => AsciiToBase64(str)) * .toTemplate(); * ``` **/ export declare class PipelineBuilder { private name; private module; /** * Create a `PipelineBuilder` to build a data {@link Pipeline}. * * Methods on the `PipelineBuilder` enable you to directly transform data * `from` any {@link Stream} by applying a `transform` operation. If the {@link Stream} is tabular, * specialised operations can be applied to `select`, `filter`, `join`, `aggregate`, * `disaggregate` and `offset` each entry in the {@link Stream}. * * Quality of data can be observed using `assert` and `warn` by providing expression based conditions * and messages to the whole {@link Stream}. * * A corresponding {@link Template} can be created using `.toTemplate()`. * * @param name the name of the {@link Pipeline} to create * * @remarks See [Transform Data](https://learn.elaraai.com/courses/development-essentials/03_transform_data/) for a related learning module. * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .error({ * if: username => Equal(username, ""), * message: "Username is empty" * }) * .input({ name: "password", stream: password }) * .warn({ * if: (_, { password }) => Equal(password, ""), * message: () => Const("Password is empty") * }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .transform(str => AsciiToBase64(str)) * .toTemplate(); * ``` **/ constructor(name: string, module?: ModuleBuilder | ModulePath); /** * Define the {@link Stream} to construct the {@link Pipeline} from. * * @param stream the input {@link Stream} for the {@link Pipeline} * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .toTemplate(); * * ``` **/ from(stream: Stream): T extends DictType ? TabularPipelineBuilder : T extends BlobType ? BlobPipelineBuilder : GenericPipelineBuilder; } /** * A `GenericPipelineBuilder` to build a data {@link Pipeline}. * * Methods on the `GenericPipelineBuilder` enable you to directly transform data * `from` any {@link Stream} by applying a `transform` operation. * * Quality of data can be observed using `assert` and `warn` by providing expression based conditions * and messages to the whole {@link Stream}. * * A corresponding {@link Template} can be created using `.toTemplate()`. * * @remarks See [Transform Data](https://learn.elaraai.com/courses/development-essentials/03_transform_data/) for a related learning module. * * @category Pipeline * * @example * ```typescript * // get a predefined pipeline table * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .error({ * if: username => Equal(username, ""), * message: "Username is empty" * }) * .input({ name: "password", stream: password }) * .warn({ * if: (_, { password }) => Equal(password, ""), * message: () => Const("Password is empty") * }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .transform(str => AsciiToBase64(str)) * .toTemplate(); * * ``` **/ export declare class GenericPipelineBuilder> extends Builder { private inputs; private input_streams; private output_type; protected operations: Op[]; private random_seed; /** @internal */ constructor(name: string, module: ModulePath, inputs: Inputs, input_streams: Record, output_type: Output, operations: Op[], random_seed: string); /** * Convert the built pipeline into an {@link Template}, for usage in * an EDK project. * * @returns a {@link Template} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * * const template = new PipelineBuilder("BasicAuth") * .from(username) * .toTemplate(); * ``` **/ toTemplate(): Template; /** * Return the {@link Stream} containing the output of the pipeline. * * @category Pipeline * * @example * ```typescript * // Create a datastream where a password can be written by end-user at runtime. * const hourly = new SourceBuilder("DatabasePassword") * .writeable(StringType) * .outputStream() * ``` */ outputStream(): Stream; /** * Add an additional named input {@link Stream} to the {@link Pipeline}. * * @param config the input `stream` and the resulting variable `name` * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .input({ name: "password", stream: password }) * .toTemplate(); * ``` **/ input(config: { name: Name & Name extends "input" | keyof Inputs ? never : Name; stream: Stream; }): GenericPipelineBuilder; }>; /** * Give a name to the current {@link Pipeline} output to be used as an * input later in the {@link Pipeline} (i.e. after the next operation) * * @param config the input `stream` and the resulting variable `name` * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .let("username") * .input({ name: "password", stream: password }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .transform((str, inputs) => Struct({ * Username: inputs.username, * Hash: str * })) * .toTemplate(); * ``` **/ let(name: Name & Name extends "input" | keyof Inputs ? never : Name): GenericPipelineBuilder; }>; /** * Add an assertion on the pipeline inputs and output to identify errors. When the `if` predicate returns `true` * the pipeline will be terminated with an error message and output data will not be produced. * * @param config the error message and predicate * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .error({ * if: username => Equal(username, ""), * message: "Username is empty" * }) * .input({ name: "password", stream: password }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .error({ * if: str => Equal(str, ":"), * message: () => Const("Unexpected string") * }) * .toTemplate(); * ``` */ error(config: { /** If true an error will be created */ if: (value: Variable, inputs: Inputs) => EastFunction; /** The message in the case that an error is created */ message: ((value: Variable, inputs: Inputs) => EastFunction) | string; }): GenericPipelineBuilder; /** * Add a warning on the pipeline inputs and ouputs to identify problems. When the `if` predicate returns `true` the * pipeline will register a warning with a message, but will proceed to proceed to produce output data. * * @param config the warning message and predicate * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .warn({ * if: username => Equal(username, ""), * message: "Username is empty" * }) * .input({ name: "password", stream: password }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .warn({ * if: str => Equal(str, ":"), * message: () => Const("Unexpected string") * }) * .toTemplate(); * ``` */ warn(config: { /** If true a warning will be produced */ if: (value: Variable, inputs: Inputs) => EastFunction; /** The message in the case that a warning is produced */ message: ((value: Variable, inputs: Inputs) => EastFunction) | string; }): GenericPipelineBuilder; /** * Produce a log message depending on the pipeline inputs and ouputs. When the `if` the predicate returns `true` the * pipeline will produce a log message and proceed. * * @param config the log message and optional predicate * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .log({ * if: username => Equal(username, ""), * message: "Username is empty" * }) * .input({ name: "password", stream: password }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .log({ * if: str => Equal(str, ":"), * message: () => Const("Unexpected string") * }) * .toTemplate(); * ``` */ log(config: { /** If true a log message will be produced (optional) */ if?: (value: Variable, inputs: Inputs) => EastFunction; /** The log message */ message: ((value: Variable, inputs: Inputs) => EastFunction) | string; }): GenericPipelineBuilder; /** * Transform the entire input {@link Stream} based on an {@link EastFunction}. * * @param f an {@link EastFunction} function that generates the output {@link Expression} * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .input({ name: "password", stream: password }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .toTemplate(); * ``` **/ transform, inputs: Inputs) => EastFunction>(f: F): ReturnType["type"] extends DictType ? TabularPipelineBuilder["type"], Inputs> : GenericPipelineBuilder["type"], Inputs>; /** * Unparse a {@link Stream} into a {@link BlobType} {@link Stream} containing JSON data. * * @param config the configuration of the JSON parsing * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .toJson({ * value: (value) => value * }) * .toTemplate(); * ``` **/ toJson, inputs: Inputs) => EastFunction>(config: { /** the function to parse the value */ value: S; }): BlobPipelineBuilder; /** * Set the seed of the random number generator used in the pipeline expressions. * This is useful to compare two different calculations with the same random noise. * * @remarks A hash of the seed string is used to initialize the random number generator. The pipeline name is used by default. * * @param seed a string to seed the random number generator. * * @category Pipeline */ randomSeed(seed: string): GenericPipelineBuilder; } /** * A `BlobPipelineBuilder` to build a data {@link Pipeline}. * * Methods on the `BlobPipelineBuilder` enable you to directly transform data * `from` any {@link Stream} by applying a `transform` operation, or alternatively * parse files in formats such as jsonl, json, csv, xlsx. * * Quality of data can be observed using `assert` and `warn` by providing expression based conditions * and messages to the whole {@link Stream}. * * A corresponding {@link Template} can be created using `.toTemplate()`. * * @remarks See [Transform Data](https://learn.elaraai.com/courses/development-essentials/03_transform_data/) for a related learning module. * * @category Pipeline * * @example * ```typescript * // get a predefined pipeline table * const file = Stream("File", BlobType); * * const pipeline = new PipelineBuilder("ReadJson") * .from(file) * .error({ * if: file => Equal(Size(file), 0n), * message: "File is empty" * }) * .fromJson({ * type: StructType({ * float: FloatType, * }), * }) * .toTemplate(); * ``` **/ export declare class BlobPipelineBuilder> extends Builder { private inputs; private input_streams; private output_type; protected operations: Op[]; private random_seed; /** @internal */ constructor(name: string, module: ModulePath, inputs: Inputs, input_streams: Record, output_type: Output, operations: Op[], random_seed: string); /** * Convert the built pipeline into an {@link Template}, for usage in * an EDK project. * * @returns a {@link Template} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * * const template = new PipelineBuilder("BasicAuth") * .from(username) * .toTemplate(); * ``` **/ toTemplate(): Template; /** * Return the {@link Stream} containing the output of the pipeline. * * @category Pipeline * * @example * ```typescript * // Create a datastream where a password can be written by end-user at runtime. * const hourly = new SourceBuilder("DatabasePassword") * .writeable(StringType) * .outputStream() * ``` */ outputStream(): Stream; /** * Add an additional named input {@link Stream} to the {@link Pipeline}. * * @param config the input `stream` and the resulting variable `name` * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .input({ name: "password", stream: password }) * .toTemplate(); * ``` **/ input(config: { /** the name to give the config {@link Variable} */ name: Name & Name extends "input" | keyof Inputs ? never : Name; /** the input stream configuration (the stream and associated preconditions) */ stream: Stream; }): BlobPipelineBuilder; }>; /** * Give a name to the current {@link Pipeline} output to be used as an * input later in the {@link Pipeline} (i.e. after the next operation) * * @param name the input `stream` and the resulting variable `name` * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .let("username") * .input({ name: "password", stream: password }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .transform((str, inputs) => Struct({ * Username: inputs.username, * Hash: str * })) * .toTemplate(); * ``` **/ let(name: Name & Name extends "input" | keyof Inputs ? never : Name): BlobPipelineBuilder; }>; /** * Add an assertion on the pipeline inputs and output to identify errors. When the `if` predicate returns `true` * the pipeline will be terminated with an error message and output data will not be produced. * * @param config the error message and predicate * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .error({ * if: username => Equal(username, ""), * message: "Username is empty" * }) * .input({ name: "password", stream: password }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .error({ * if: str => Equal(str, ":"), * message: () => Const("Unexpected string") * }) * .toTemplate(); * ``` */ error(config: { /** If true an error will be created */ if: (value: Variable, inputs: Inputs) => EastFunction; /** The message in the case that an error is created */ message: ((value: Variable, inputs: Inputs) => EastFunction) | string; }): BlobPipelineBuilder; /** * Add a warning on the pipeline inputs and ouputs to identify problems. When the `if` predicate returns `true` the * pipeline will register a warning with a message, but will proceed to proceed to produce output data. * * @param config the warning message and predicate * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .warn({ * if: username => Equal(username, ""), * message: "Username is empty" * }) * .input({ name: "password", stream: password }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .warn({ * if: str => Equal(str, ":"), * message: () => Const("Unexpected string") * }) * .toTemplate(); * ``` */ warn(config: { /** If true a warning will be produced */ if: (value: Variable, inputs: Inputs) => EastFunction; /** The message in the case that a warning is produced */ message: ((value: Variable, inputs: Inputs) => EastFunction) | string; }): BlobPipelineBuilder; /** * Produce a log message depending on the pipeline inputs and ouputs. When the `if` the predicate returns `true` the * pipeline will produce a log message and proceed. * * @param config the log message and optional predicate * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .log({ * if: username => Equal(username, ""), * message: "Username is empty" * }) * .input({ name: "password", stream: password }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .log({ * if: str => Equal(str, ":"), * message: () => Const("Unexpected string") * }) * .toTemplate(); * ``` */ log(config: { /** If true a log message will be produced (optional) */ if?: (value: Variable, inputs: Inputs) => EastFunction; /** The log message */ message: ((value: Variable, inputs: Inputs) => EastFunction) | string; }): BlobPipelineBuilder; /** * Transform the entire input {@link Stream} based on an {@link EastFunction}. * * @param f an {@link EastFunction} function that generates the output {@link Expression} * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * const password = Stream("Password", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .from(username) * .input({ name: "password", stream: password }) * .transform((username, { password }) => StringJoin`${username}:${password}`) * .toTemplate(); * ``` **/ transform, inputs: Inputs) => EastFunction>(f: F): ReturnType["type"] extends DictType ? TabularPipelineBuilder["type"], Inputs> : GenericPipelineBuilder["type"], Inputs>; /** * Parse a {@link BlobType} {@link Stream} containing CSV data to construct a tabular {@link Stream}. * * @param config the configuration of the CSV parsing * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .input({ name: "password", stream: password }) * .fromCsv({ * fields: { * float: FloatType, * }, * skip_n: 20n, * delimiter: "|", * output_key: (fields, inputs) => StringJoin`${fields.float}.${inputs.password}` * }) * .toTemplate(); * ``` **/ fromCsv>(config: { /** The field types to parse */ fields: S; /** Skip this many rows from the top of the file */ skip_n?: bigint; /** The delimiter to seperate columns (default `","`) */ delimiter?: string; /** The delimiter to seperate rows (default `"\n"`, "\r\n"` or `"\r"`) */ newline?: string; /** The str used for empty values */ null_str?: string; /** output key for the parsed data */ output_key: (fields: { [K in keyof S]: Variable; }, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder>, Inputs>; /** * Parse a {@link BlobType} {@link Stream} containing JSONLines data to construct a tabular {@link Stream}. * * @param config the configuration of the JSONLines parsing * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .input({ name: "password", stream: password }) * .fromJsonLines({ * fields: { * float: FloatType, * }, * output_key: (fields, inputs) => StringJoin`${fields.float}.${inputs.password}` * }) * .toTemplate(); * ``` **/ fromJsonLines>(config: { /** The field types to parse */ fields: S; /** output key for the parsed data */ output_key: (fields: { [K in keyof S]: Variable; }, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder>, Inputs>; /** * Parse a {@link BlobType} {@link Stream} containing XLSX data to construct a tabular {@link Stream}. * * @param config the configuration of the XLSX parsing * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .input({ name: "password", stream: password }) * .fromXlsx({ * fields: { * float: FloatType, * }, * sheet: "Sheet2", * output_key: (fields, inputs) => StringJoin`${fields.float}.${inputs.password}` * }) * .toTemplate(); * ``` **/ fromXlsx>(config: { /** The worksheet containing the data */ sheet?: string; /** The field types to parse */ fields: S; /** The str used for empty values */ null_str?: string; /** output key for the parsed data */ output_key: (fields: { [K in keyof S]: Variable; }, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder>, Inputs>; /** * Parse a {@link BlobType} {@link Stream} containing JSON data to construct a {@link Stream}. * * @param config the configuration of the JSON parsing * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", StringType); * * const pipeline = new PipelineBuilder("BasicAuth") * .fromJson({ * type: StructType({ * float: FloatType, * }), * }) * .toTemplate(); * ``` **/ fromJson(config: { /** The type to parse */ type: T; }): T extends DictType ? TabularPipelineBuilder : GenericPipelineBuilder; /** * Parse a {@link BlobType} {@link Stream} containing GeoJSON data to construct a {@link Stream}. * * @param config the configuration of the GeoJSON parsing * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const geojson = Stream("GeoJson", BlobType); * * const pipeline = new PipelineBuilder("GeoData") * .fromGeoJson() * .toTemplate(); * ``` **/ fromGeoJson(): GenericPipelineBuilder; /** * Set the seed of the random number generator used in the pipeline expressions. * This is useful to compare two different calculations with the same random noise. * * @remarks A hash of the seed string is used to initialize the random number generator. The pipeline name is used by default. * * @param seed a string to seed the random number generator. * * @category Pipeline */ randomSeed(seed: string): BlobPipelineBuilder; } /** * A `TabularPipelineBuilder` to build a data {@link Pipeline}. * * Methods on the `TabularPipelineBuilder` enable you to directly transform data * `from` a tabular {@link Stream} by applying a `transform` operation to the whole {@link Stream}, * or applying `select`, `filter`, `join`, `aggregate`, `disaggregate` and `offset` each entry in the {@link Stream}. * * Quality of data can be observed using `assert` and `warn` by providing expression based conditions * and messages, either to the whole {@link Stream}, or to every entry in the {@link Stream}. * * A corresponding {@link Template} can be created using `.toTemplate()`. * * @remarks See [Transform Data](https://learn.elaraai.com/courses/development-essentials/03_transform_data/) for a related learning module. * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Non-Admin Users") * .from(users) * .error({ * if: (value) => Equal(Size(value), 0n), * message: () => Const("No users defined") * }) * .input({ name: "admin", stream: admin }) * .error({ * if: (_, { admin }) => Equal(admin, ""), * message: () => Const("Admin user can't be empty") * }) * .filter((fields, _, inputs) => NotEqual(fields.username, inputs.admin)) * .warnEvery({ * if: (fields) => Equal(fields.password, ""), * message: (fields) => StringJoin`User ${fields.username} has empty password` * }) * .toTemplate(); * * ``` **/ export declare class TabularPipelineBuilder, Inputs extends Record> extends Builder { private inputs; private input_streams; private output_type; protected operations: Op[]; private random_seed; /** @internal */ constructor(name: string, module: ModulePath, inputs: Inputs, input_streams: Record, output_type: Output, operations: Op[], random_seed: string); /** * Convert the built pipeline into an {@link Template}, for usage in * an EDK project. * * @param name the name of the pipeline to create in the {@link Template} * @returns a {@link Template} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const template = new PipelineBuilder("Non-Admin Users") * .from(users) * .error({ * if: (value) => Equal(Size(value), 0n), * message: () => Const("No users defined") * }) * .input({ name: "admin", stream: admin }) * .error({ * if: (_, { admin }) => Equal(admin, ""), * message: () => Const("Admin user can't be empty") * }) * .filter((fields, _, inputs) => NotEqual(fields.username, inputs.admin)) * .warnEvery({ * predicate: (fields) => Equal(fields.password, ""), * message: (fields) => StringJoin`User ${fields.username} has empty password` * }) * .toTemplate(); * ``` **/ toTemplate(): Template; /** * Return the {@link Stream} containing the output of the pipeline. * * @category Pipeline * * @example * ```typescript * // Create a datastream where a password can be written by end-user at runtime. * const hourly = new SourceBuilder("DatabasePassword") * .writeable(StringType) * .outputStream() * ``` */ outputStream(): Stream; /** * Add an additional named input {@link Stream} to the {@link Pipeline}. * * @param config the input `stream` and the resulting variable `name` * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Non-Admin Users") * .from(users) * .input({ name: "admin", stream: admin }) * .toTemplate(); * ``` **/ input(config: { /** the name to give the input {@link Variable} */ name: Name & Name extends "input" | keyof Inputs ? never : Name; /** the input stream (the stream and associated preconditions) */ stream: Stream; }): TabularPipelineBuilder; }>; /** * Give a name to the current {@link Pipeline} output to be used as an * input later in the {@link Pipeline} (i.e. after the next operation) * * @param name the input `stream` and the resulting variable `name` * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * // create a stream of non admin users, and seperate admin user * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Users") * .from(users) * .let("all") * .input({ name: "admin", stream: admin }) * .filter((fields, _, inputs) => NotEqual(fields.username, inputs.admin)) * .transform((users, inputs) => Struct({ * "Non-Admin Users": users, * "Admin User": Get(inputs.all, inputs.admin) * })) * .toTemplate(); * ``` **/ let(name: Name & Name extends "input" | keyof Inputs ? never : Name): TabularPipelineBuilder; }>; /** * Add an assertion on the pipeline inputs and output to identify errors. When the `if` predicate returns `true` * the pipeline will be terminated with an error message and output data will not be produced. * * @param config the error message and predicate * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Non-Admin Users") * .from(users) * .error({ * if: (value) => Equal(Size(value), 0n), * message: () => Const("No users defined") * }) * .input({ name: "admin", stream: admin }) * .error({ * predicate: (_, { admin }) => Equal(admin, ""), * message: () => Const("Admin user can't be empty") * }) * .toTemplate(); * ``` */ error(config: { /** If true an error will be created */ if: (value: Variable, inputs: Inputs) => EastFunction; /** The message in the case that an error is created */ message: ((value: Variable, inputs: Inputs) => EastFunction) | string; }): TabularPipelineBuilder; /** * Add an assertion on every row of the pipeline output to identify errors. For each row, when the `if` predicate returns `true` * the pipeline will be terminated with an error message and output data will not be produced. * * @param config the error message and predicate * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Non-Admin Users") * .from(users) * .input({ name: "admin", stream: admin }) * .filter((fields, _, inputs) => NotEqual(fields.username, inputs.admin)) * .errorEvery({ * if: (fields) => Equal(fields.password, ""), * message: (fields) => StringJoin`User ${fields.username} has empty password` * }) * .toTemplate(); * ``` */ errorEvery(config: { /** If true an error will be created */ if: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** The message in the case that an error is created */ message: ((fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction) | string; }): TabularPipelineBuilder; /** * Add a warning on the pipeline inputs and ouputs to identify problems. When the `if` predicate returns `true` the * pipeline will register a warning with a message, but will proceed to proceed to produce output data. * * @param config the warning message and predicate * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Non-Admin Users") * .from(users) * .warn({ * if: (value) => Equal(Size(value), 0n), * message: () => Const("No users defined") * }) * .input({ name: "admin", stream: admin }) * .warn({ * if: (_, { admin }) => Equal(admin, ""), * message: () => Const("Admin user can't be empty") * }) * .filter((fields, _, inputs) => NotEqual(fields.username, inputs.admin)) * .toTemplate(); * ``` */ warn(config: { /** If true a warning will be created */ if: (value: Variable, inputs: Inputs) => EastFunction; /** The message in the case that an warning is created */ message: ((value: Variable, inputs: Inputs) => EastFunction) | string; }): TabularPipelineBuilder; /** * Add a warning on every row ofthe pipeline ouput to identify problems. For each row, when the `if` predicate returns `true` the * pipeline will register a warning with a message, but will proceed to proceed to produce output data. * * @param config the warning message and predicate * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Non-Admin Users") * .from(users) * .input({ name: "admin", stream: admin }) * .filter((fields, _, inputs) => NotEqual(fields.username, inputs.admin)) * .warnEvery({ * if: (fields) => Equal(fields.password, ""), * message: (fields) => StringJoin`User ${fields.username} has empty password` * }) * .toTemplate(); * ``` */ warnEvery(config: { /** If true a warning will be created */ if: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** The message in the case that a warning is created */ message: ((fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction) | string; }): TabularPipelineBuilder; /** * Produce a log message depending on the pipeline inputs and ouputs. When the `if` the predicate returns `true` the * pipeline will produce a log message and proceed. * * @param config the log message and optional predicate * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Non-Admin Users") * .from(users) * .log({ * if: (value) => Equal(Size(value), 0n), * message: () => Const("No users defined") * }) * .input({ name: "admin", stream: admin }) * .log({ * if: (_, { admin }) => Equal(admin, ""), * message: () => Const("Admin user can't be empty") * }) * .filter((fields, _, inputs) => NotEqual(fields.username, inputs.admin)) * .toTemplate(); * ``` */ log(config: { /** If true a log message will be created */ if: (value: Variable, inputs: Inputs) => EastFunction; /** The log message */ message: ((value: Variable, inputs: Inputs) => EastFunction) | string; }): TabularPipelineBuilder; /** * Produce a log message for every row of the pipeline ouput. For each row, when the `if` the predicate returns `true` the * pipeline will produce a log message and proceed. * * @param config the log message and optional predicate * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Non-Admin Users") * .from(users) * .input({ name: "admin", stream: admin }) * .filter((fields, _, inputs) => NotEqual(fields.username, inputs.admin)) * .logEvery({ * if: (fields) => Equal(fields.password, ""), * message: (fields) => StringJoin`User ${fields.username} has empty password` * }) * .toTemplate(); * ``` */ logEvery(config: { /** If true a log message will be created */ if?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** The log message */ message: ((fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction) | string; }): TabularPipelineBuilder; /** * Transform the entire input {@link Stream} based on an {@link EastFunction}. * * @param f an {@link EastFunction} function that generates the output {@link Expression} * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * * // create a stream of the total number of users * const pipeline = new PipelineBuilder("Number Of Users") * .from(users) * .transform((users) => Size(users)) * .toTemplate(); * ``` **/ transform, inputs: Inputs) => EastFunction>(f: F): ReturnType["type"] extends DictType ? TabularPipelineBuilder["type"], Inputs> : GenericPipelineBuilder["type"], Inputs>; /** * Apply a filter to the input data based on a user-defined predicate. * Rows where the `predicate` evaluates to `true` are kept, and rows where `predicate` * is `false` are discarded. * * @param predicate: a function that generates a Boolean {@link Expression} * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Non-Admin Users") * .from(users) * .input({ name: "admin", stream: admin }) * .filter((fields, _, inputs) => NotEqual(fields.username, inputs.admin)) * .toTemplate(); * ``` **/ filter(predicate: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction): TabularPipelineBuilder; /** * Apply a selection to the input data based on user-defined expressions. * Optionally, a new primary key may be specified - if so the user must ensure the keys remain distinct. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * * // create a stream of non admin users, from all users * const pipeline = new PipelineBuilder("Non-Admin Users") * .from(users) * .input({ name: "admin", stream: admin }) * .select({ * keep_all: true, * selections: { * hash: (fields, _, inputs) => AsciiToBase64(StringJoin`${fields.username}.${inputs.admin}`) * } * }) * .toTemplate(); * ``` **/ select, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** If `true`, append the selections to the existing fields */ keep_all: true; /** An object containing functions generating {@link Expression}s for output field values based on the available fields */ selections: S; /** A function that generates an {@link Expression} that identifies the row uniquely based on the output fields */ output_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]; } & { [K in Exclude]: Output["value"]["value"]["value"][K]; }>>, Inputs>; select, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** If `true`, append the selections to the existing fields */ keep_all?: false; /** An object containing functions generating {@link Expression}s for output field values based on the available fields */ selections: S; /** A function that generates an {@link Expression} that identifies the row uniquely based on the output fields */ output_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]; }>>, Inputs>; /** Concatenate one-or-more other tabular data sets of the same type to the input data. * * To avoid clashes with primary key an optional discriminator may be provided to prepend the keys of each table. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```ts * const pipeline = new PipelineBuilder("Concatenator") * .from(stream) * .input({ name: "other", stream: other_stream }) * .concatenate({ * discriminator_value: "A", * inputs: [{ input: inputs => inputs.other, discriminator_value: "B" }] * }); * ```` * */ concatenate(config: { /** The discriminator name to insert into the output */ discriminator_name: DiscriminatorName; /** The discriminator to prepend to the primary key of the input table */ discriminator_value: string; /** The other tabular data to prepend to the primary key of the input */ inputs: { /** The name of the input */ input: (inputs: Inputs) => Variable; /** The discriminator to prepend to the primary key of this input table */ discriminator_value: string; }[]; }): TabularPipelineBuilder>, Inputs>; concatenate(config: { /** The discriminator to prepend to the primary key of the input table */ discriminator_value: string; /** The other tabular data to prepend to the primary key of the input */ inputs: { /** The name of the input */ input: (inputs: Inputs) => Variable; /** The discriminator to prepend to the primary key of this input table */ discriminator_value: string; }[]; }): TabularPipelineBuilder>, Inputs>; concatenate(config: { /** The other tabular data to prepend to the primary key of the input */ inputs: { /** The name of the input */ input: (inputs: Inputs) => Variable; }[]; }): TabularPipelineBuilder>, Inputs>; /** * Apply a disaggregation to an array in each row, producing one row per entry in the array. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * roles: ArrayType(StringType) * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * // create a stream of users roles * const pipeline = new PipelineBuilder("User Roles") * .from(users) * .input({ name: "admin", stream: admin }) * .disaggregateArray({ * collection: fields => fields.roles, * keep_all: true, * selections: { * role: (_, __, value) => value, * hash: (fields, _, __, ___, inputs) => AsciiToBase64(StringJoin`${fields.username}.${inputs.admin}`) * } * }) * .toTemplate(); * ``` **/ disaggregateArray, input_key: Variable, inputs: Inputs) => EastFunction, S extends Record, value: Variable["type"]["value"]>, collection_key: Variable, input_key: Variable, inputs: Inputs) => EastFunction>>(config: { /** A function that generates an {@link Expression} for the array to disaggregate based on the input fields */ collection: C; /** An object containing functions generating {@link Expression}s for output field values based on the input fields and each value and key from the array */ selections: S; /** A function that generates an {@link Expression} that identifies the row uniquely based on the output fields */ output_key?: (fields: TypeToFields, value: Variable["type"]["value"]>, collection_key: Variable, input_key: Variable, inputs: Inputs) => EastFunction; /** If `true`, append the selections to the existing fields */ keep_all: true; }): TabularPipelineBuilder["type"]; } & { [K in Exclude]: Output["value"]["value"]["value"][K]; }>>, Inputs>; disaggregateArray, input_key: Variable, inputs: Inputs) => EastFunction, S extends Record, value: Variable["type"]["value"]>, collection_key: Variable, input_key: Variable, inputs: Inputs) => EastFunction>>(config: { /** A function that generates an {@link Expression} for the array to disaggregate based on the input fields */ collection: C; /** An object containing functions generating {@link Expression}s for output field values based on the input fields and each value and key from the array */ selections: S; /** A function that generates an {@link Expression} that identifies the row uniquely based on the output fields */ output_key?: (fields: TypeToFields, value: Variable["type"]["value"]>, collection_key: Variable, input_key: Variable, inputs: Inputs) => EastFunction; /** If `true`, append the selections to the existing fields */ keep_all?: false; }): TabularPipelineBuilder["type"]; }>>, Inputs>; /** * Apply a disaggregation to a set in each row, producing one row per entry in the set. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * roles: SetType(StringType) * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * // create a stream of users roles * const pipeline = new PipelineBuilder("User Roles") * .from(users) * .input({ name: "admin", stream: admin }) * .disaggregateSet({ * collection: fields => fields.roles, * keep_all: true, * selections: { * role: (_, __, value) => value, * hash: (fields, _, __, inputs) => AsciiToBase64(StringJoin`${fields.username}.${inputs.admin}`) * } * }) * .toTemplate(); * ``` **/ disaggregateSet, input_key: Variable, inputs: Inputs) => EastFunction, S extends Record, collection_key: Variable["type"]["value"]>, input_key: Variable, inputs: Inputs) => EastFunction>>(config: { /** A function that generates an {@link Expression} for the set to disaggregate based on the input fields */ collection: C; /** An object containing functions generating {@link Expression}s for output field values based on the input fields and each key from the set */ selections: S; /** A function that generates an {@link Expression} that identifies the row uniquely based on the output fields */ output_key?: (fields: TypeToFields, collection_key: Variable, input_key: Variable, inputs: Inputs) => EastFunction; /** If `true`, append the selections to the existing fields */ keep_all: true; }): TabularPipelineBuilder["type"]; } & { [K in Exclude]: Output["value"]["value"]["value"][K]; }>>, Inputs>; disaggregateSet, input_key: Variable, inputs: Inputs) => EastFunction, S extends Record, collection_key: Variable["type"]["value"]>, input_key: Variable, inputs: Inputs) => EastFunction>>(config: { /** A function that generates an {@link Expression} for the set to disaggregate based on the input fields */ collection: C; /** An object containing functions generating {@link Expression}s for output field values based on the input fields and each key from the set */ selections: S; /** A function that generates an {@link Expression} that identifies the row uniquely based on the output fields */ output_key?: (fields: TypeToFields, collection_key: Variable, input_key: Variable, inputs: Inputs) => EastFunction; /** If `true`, append the selections to the existing fields */ keep_all?: false; }): TabularPipelineBuilder["type"]; }>>, Inputs>; /** * Apply a disaggregation to a dictionary in each row, producing one row per entry in the dictionary. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * roles: DictType(StringType, FloatType) * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * // create a stream of users roles * const pipeline = new PipelineBuilder("User Roles") * .from(users) * .input({ name: "admin", stream: admin }) * .disaggregateDict({ * collection: fields => fields.roles, * keep_all: true, * selections: { * role: (_, __, value) => value, * hash: (fields, _, __, ___, inputs) => AsciiToBase64(StringJoin`${fields.username}.${inputs.admin}`) * } * }) * .toTemplate(); * ``` **/ disaggregateDict, input_key: Variable, inputs: Inputs) => EastFunction, S extends Record, value: Variable["type"]["value"]["value"]>, collection_key: Variable["type"]["value"]["key"]>, input_key: Variable, inputs: Inputs) => EastFunction>>(config: { /** A function that generates an {@link Expression} for the dictionary to disaggregate based on the input fields */ collection: C; /** An object containing functions generating {@link Expression}s for output field values based on the input fields and each value and key from the dictionary */ selections: S; /** A function that generates an {@link Expression} that identifies the row uniquely based on the output fields */ output_key?: (fields: TypeToFields, value: Variable["type"]["value"]["value"]>, collection_key: Variable["type"]["value"]["key"]>, input_key: Variable, inputs: Inputs) => EastFunction; /** If `true`, append the selections to the existing fields */ keep_all: true; }): TabularPipelineBuilder["type"]; } & { [K in Exclude]: Output["value"]["value"]["value"][K]; }>>, Inputs>; disaggregateDict, input_key: Variable, inputs: Inputs) => EastFunction, S extends Record, value: Variable["type"]["value"]["value"]>, collection_key: Variable["type"]["value"]["key"]>, input_key: Variable, inputs: Inputs) => EastFunction>>(config: { /** A function that generates an {@link Expression} for the dictionary to disaggregate based on the input fields */ collection: C; /** An object containing functions generating {@link Expression}s for output field values based on the input fields and each value and key from the dictionary */ selections: S; /** A function that generates an {@link Expression} that identifies the row uniquely based on the output fields */ output_key?: (fields: TypeToFields, value: Variable["type"]["value"]["value"]>, collection_key: Variable["type"]["value"]["key"]>, input_key: Variable, inputs: Inputs) => EastFunction; /** If `true`, append the selections to the existing fields */ keep_all?: false; }): TabularPipelineBuilder["type"]; }>>, Inputs>; /** * A aggregate (or group) a row into based with defined methods. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * role: StringType * }) * ) * const users = Stream("Users", UsersType); * const admin = Stream("Admin", StringType); * // create a stream with the count of non admin users per role * const pipeline = new PipelineBuilder("Non-Admin Roles Count") * .from(users) * .input({ name: "admin", stream: admin }) * .aggregate({ * group_name: "group", * group_value: (fields) => fields.role, * aggregations: { * sum: (fields, _key, inputs) => Sum(IfElse(Equal(fields.email, inputs.admin), 0,1)) * } * }) * .toTemplate(); * ``` **/ aggregate, key: Variable, inputs: Inputs) => EastFunction, A extends Record, key: Variable, inputs: Inputs) => AggregationDefinition>>(config: { /** A name of the group variable created */ group_name: GroupName; /** A function that generates an {@link Expression} for the value of the group */ group_value: G; /** A function the generates a colleciton of {@link Expression}'s for the group values */ aggregations: A; }): TabularPipelineBuilder["type"]; } & { [K in keyof A]: ReturnType["type"]; }>>, Inputs>; aggregate, key: Variable, inputs: Inputs) => EastFunction, A extends Record, key: Variable, inputs: Inputs) => AggregationDefinition>>(config: { /** A function that generates an {@link Expression} for the value of the group */ group_value: G; /** A function the generates a colleciton of {@link Expression}'s for the group values */ aggregations: A; }): TabularPipelineBuilder["type"]; }>>, Inputs>; aggregate, key: Variable, inputs: Inputs) => AggregationDefinition>>(config: { /** A function the generates a collection of {@link Expression}'s for the group values */ aggregations: A; }): GenericPipelineBuilder["type"]; }>, Inputs>; /** * Apply a transformation on a row-by-row basis by pulling in data from related rows. * * Rows can (optionally) be grouped by a group key, and are sorted by a sort key. The `offset` indicates * the offset to the requested row within the group according to the sort order. For * example, an `offset` of `1` would relate to the next row in sorted order, and `-1` * would relate to the previous row in sort order. If such a row does not exist, the * provided fields are `null`. An `offset_exists` variable is provided to indicate * whether the row exists or not. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const TasksType = DictType( * StringType, * StructType({ * username: StringType, * task: StringType, * date: DateTimeType * }) * ) * const tasks = Stream("Task", TasksType); * // create a stream with tasks, including next task date * const pipeline = new PipelineBuilder("Tasks with Next") * .from(tasks) * .offset({ * group_key: fields => fields.username, * sort_key: fields => fields.date, * offset: 1, * offset_selections: { * next_date: (fields) => fields.date * } * }) * .toTemplate(); * ``` **/ offset>; }, key: Variable, offset_exists: Variable, inputs: Inputs) => EastFunction>>(config: { /** The offset of the row to provide to `offset_selections` */ offset: number; /** A function returning an {@link Expression} for the value to group the rows by */ group_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function returning an {@link Expression} for the value to sort the rows by */ sort_key: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** An object containing functions generating {@link Expression}s for output field values based on the available fields in the offset row, as well as a variable indicating if the row exists */ offset_selections: S; }): TabularPipelineBuilder["type"]; } & { [K in Exclude]: Output["value"]["value"]["value"][K]; }>>, Inputs>; /** * Transform data to obtain a histogram of data in the rows, optionally by group. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const TasksType = DictType( * StringType, * StructType({ * username: StringType, * task: StringType, * duration: FloatType * }) * ) * const tasks = Stream("Task", TasksType); * // create a stream of historgram of task duration per user * const pipeline = new PipelineBuilder("User Roles") * .from(tasks) * .histogram({ * group: fields => fields.username, * samples: (fields) => fields.duration, * normalization: "PercentDensity", * }) * .toTemplate(); * ``` **/ histogram, input_key: Variable, inputs: Inputs) => EastFunction>(config: { /** the function for the value samples */ samples: (fields: TypeToFields, input_key: Variable, inputs: Inputs) => EastFunction; /** an optional {@link Expression} defining the group key */ group: GK; /** If true, calculate a cumulative distribution (default `false`)*/ cumulative?: boolean; /** Whether the probabilities should be interpretted as a density and scaled by the step size (default `false`) */ density?: boolean; /** the normalization of the histogram - `'count'` (default), `'percentage'` or `'probability'` */ normalization?: 'count' | 'percentage' | 'probability'; /** the minimum value to consider in the distribution */ minimum?: number; /** the numbe rof bins in the histogram */ n_bins?: number; /** the histogram step size to apply */ step?: number; }): TabularPipelineBuilder["type"]; bin_start: FloatType; bin_end: FloatType; histogram: FloatType; bin: IntegerType; }>>, Inputs>; histogram(config: { /** the function for the value samples */ samples: (fields: TypeToFields, input_key: Variable, inputs: Inputs) => EastFunction; /** If true, calculate a cumulative distribution (default `false`)*/ cumulative?: boolean; /** Whether the probabilities should be interpretted as a density and scaled by the step size (default `false`) */ density?: boolean; /** the normalization of the histogram - `'count'` (default), `'percentage'` or `'probability'` */ normalization?: 'count' | 'percentage' | 'probability'; /** the minimum value to consider in the distribution */ minimum?: number; /** the numbe rof bins in the histogram */ n_bins?: number; /** the histogram step size to apply */ step?: number; }): TabularPipelineBuilder>, Inputs>; /** * Apply an inner join operation, matching rows from the current ("left") table with * an additional "right" table. Rows without matching join keys are discarded. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * role: StringType * }) * ) * const users = Stream("Users", UsersType); * const RoleType = DictType( * StringType, * StructType({ * role: StringType, * expert: BooleanType * }) * ) * const roles = Stream("Roles", RoleType); * // create a stream that combines a user with their role * const pipeline = new PipelineBuilder("User with Role") * .from(users) * .input({ name: "roles", stream: roles }) * .innerJoin({ * right_input: inputs => inputs.roles, * left_selections: { * username: fields => fields.username, * email: fields => fields.email, * role: fields => fields.role, * }, * right_selections: { * role: fields => fields.role, * expert: fields => fields.expert * }, * output_key: fields => fields.role * }) * .toTemplate(); * ``` **/ innerJoin Variable>, LS extends Record, key: Variable, inputs: Inputs) => EastFunction>, RS extends Record["type"]>, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "left" table (defaults to all fields) */ left_selections: LS; /** A record of functions to build {@link Expression}s for the fields to output from the "right" table (defaults to all fields) */ right_selections: RS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key: (fields: { [K in keyof LS]: Variable["type"]>; } & { [K in keyof RS]: Variable["type"]>; }, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]; } & { [K in keyof RS]: ReturnType["type"]; }>>, Inputs>; innerJoin Variable>, RS extends Record["type"]>, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "right" table (defaults to all fields) */ right_selections: RS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key?: (fields: TypeToFields & { [K in keyof RS]: Variable["type"]>; }, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]; }>>, Inputs>; innerJoin Variable>, LS extends Record, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "left" table (defaults to all fields) */ left_selections: LS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key: (fields: { [K in keyof LS]: Variable["type"]>; } & TypeToFields["type"]>, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]; } & { [K in keyof ReturnType["type"]["value"]["value"]["value"]]: ReturnType["type"]["value"]["value"]["value"][K]; }>>, Inputs>; innerJoin Variable>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key?: (fields: TypeToFields & TypeToFields["type"]>, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]["value"]["value"]["value"]]: ReturnType["type"]["value"]["value"]["value"][K]; }>>, Inputs>; /** * Apply a left join operation, matching rows from the current ("left") table with * an additional "right" table. If a left row does not have any matching right rows, * the right row's selections are taken to be `null`. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * role: StringType * }) * ) * const users = Stream("Users", UsersType); * const RoleType = DictType( * StringType, * StructType({ * role: StringType, * expert: BooleanType * }) * ) * const roles = Stream("Roles", RoleType); * // create a stream that combines a user with their role * const pipeline = new PipelineBuilder("User with Role") * .from(users) * .input({ name: "roles", stream: roles }) * .leftJoin({ * right_input: inputs => inputs.roles, * left_selections: { * username: fields => fields.username, * email: fields => fields.email, * role: fields => fields.role, * }, * right_selections: { * role: fields => fields.role, * expert: fields => fields.expert * }, * output_key: fields => fields.role * }) * .toTemplate(); * ``` **/ leftJoin Variable>, LS extends Record, key: Variable, inputs: Inputs) => EastFunction>, RS extends Record["type"]>, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "left" table (defaults to all fields) */ left_selections: LS; /** A record of functions to build {@link Expression}s for the fields to output from the "right" table (defaults to all fields) */ right_selections: RS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key: (fields: { [K in keyof LS]: Variable["type"]>; }, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]; } & { [K in Exclude]: Nullable["type"]>; }>>, Inputs>; leftJoin Variable>, RS extends Record["type"]>, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "right" table (defaults to all fields) */ right_selections: RS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key?: (fields: TypeToFields, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder]: Nullable["type"]>; }>>, Inputs>; leftJoin Variable>, LS extends Record, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "left" table (defaults to all fields) */ left_selections: LS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key: (fields: { [K in keyof LS]: Variable["type"]>; }, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]; } & { [K in Exclude["type"]["value"]["value"]["value"], keyof LS>]: Nullable["type"]["value"]["value"]["value"][K]>; }>>, Inputs>; leftJoin Variable>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key?: (fields: TypeToFields, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]["value"]["value"]["value"], keyof Output["value"]["value"]["value"]>]: Nullable["type"]["value"]["value"]["value"][K]>; }>>, Inputs>; /** * Apply a right join operation, matching rows from the current ("left") table with * an additional "right" table. If a right row does not have any matching left rows, * the left row's selections are taken to be `null`. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * role: StringType * }) * ) * const users = Stream("Users", UsersType); * const RoleType = DictType( * StringType, * StructType({ * role: StringType, * expert: BooleanType * }) * ) * const roles = Stream("Roles", RoleType); * // create a stream that combines a user with their role * const pipeline = new PipelineBuilder("User with Role") * .from(users) * .input({ name: "roles", stream: roles }) * .rightJoin({ * right_input: inputs => inputs.roles, * left_selections: { * username: fields => fields.username, * email: fields => fields.email, * role: fields => fields.role, * }, * right_selections: { * role: fields => fields.role, * expert: fields => fields.expert * }, * output_key: fields => fields.role * }) * .toTemplate(); * ``` **/ rightJoin Variable>, LS extends Record, key: Variable, inputs: Inputs) => EastFunction>, RS extends Record["type"]>, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "left" table (defaults to all fields) */ left_selections: LS; /** A record of functions to build {@link Expression}s for the fields to output from the "right" table (defaults to all fields) */ right_selections: RS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the right table's primary key) */ output_key: (fields: { [K in keyof RS]: Variable["type"]>; }, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder]: Nullable["type"]>; } & { [K in keyof RS]: ReturnType["type"]; }>>, Inputs>; rightJoin Variable>, RS extends Record["type"]>, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "right" table (defaults to all fields) */ right_selections: RS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the right table's primary key) */ output_key: (fields: { [K in keyof RS]: Variable["type"]>; }, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder]: Nullable; } & { [K in keyof RS]: ReturnType["type"]; }>>, Inputs>; rightJoin Variable>, LS extends Record, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "left" table (defaults to all fields) */ left_selections: LS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the right table's primary key) */ output_key?: (fields: TypeToFields["type"]>, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]["value"]["value"]["value"]>]: Nullable["type"]>; } & { [K in keyof ReturnType["type"]["value"]["value"]["value"]]: ReturnType["type"]["value"]["value"]["value"][K]; }>>, Inputs>; rightJoin Variable>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the right table's primary key) */ output_key?: (fields: TypeToFields["type"]>, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]["value"]["value"]["value"]>]: Nullable; } & { [K in keyof ReturnType["type"]["value"]["value"]["value"]]: ReturnType["type"]["value"]["value"]["value"][K]; }>>, Inputs>; /** * Apply a full outer join operation, matching rows from the current ("left") table with * an additional "right" table. If a left row does not have any matching right rows, * the right row's selections are taken to be `null`. Furthermore, if a right row does * not have any matching left rows, the left row's selections are taken to be `null`. * * @param config: the desired operation * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const UsersType = DictType( * StringType, * StructType({ * username: StringType, * email: StringType, * role: StringType * }) * ) * const users = Stream("Users", UsersType); * const RoleType = DictType( * StringType, * StructType({ * role: StringType, * expert: BooleanType * }) * ) * const roles = Stream("Roles", RoleType); * // create a stream that combines a user with their role * const pipeline = new PipelineBuilder("User with Role") * .from(users) * .input({ name: "roles", stream: roles }) * .outerJoin({ * right_input: inputs => inputs.roles, * left_selections: { * username: fields => fields.username, * email: fields => fields.email, * role: fields => fields.role, * }, * right_selections: { * role: fields => fields.role, * expert: fields => fields.expert * }, * output_key: fields => fields.role * }) * .toTemplate(); * ``` **/ outerJoin Variable>, LS extends Record, key: Variable, inputs: Inputs) => EastFunction>, RS extends Record["type"]>, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "left" table (defaults to all fields) */ left_selections: LS; /** A record of functions to build {@link Expression}s for the fields to output from the "right" table (defaults to all fields) */ right_selections: RS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key: (fields: { [K in keyof LS & keyof RS]: Variable["type"]>; }, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]; } & { [K in Exclude]: Nullable["type"]>; } & { [K in Exclude]: Nullable["type"]>; }>>, Inputs>; outerJoin Variable>, RS extends Record["type"]>, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "right" table (defaults to all fields) */ right_selections: RS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key?: (fields: { [K in keyof Output["value"]["value"]["value"] & keyof RS]: Variable; }, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder]: Nullable; } & { [K in Exclude]: Nullable["type"]>; }>>, Inputs>; outerJoin Variable>, LS extends Record, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A record of functions to build {@link Expression}s for the fields to output from the "left" table (defaults to all fields) */ left_selections: LS; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key: (fields: { [K in keyof LS & keyof ReturnType["type"]["value"]["value"]["value"]]: Variable["type"]>; }, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]["value"]["value"]["value"]]: ReturnType["type"]; } & { [K in Exclude["type"]["value"]["value"]["value"]>]: Nullable["type"]>; } & { [K in Exclude["type"]["value"]["value"]["value"], keyof LS>]: Nullable["type"]["value"]["value"]["value"][K]>; }>>, Inputs>; outerJoin Variable>>(config: { /** The tabular stream holding data for the "right" side of the join operation */ right_input: RI; /** A function to build an {@link Expression} for the join key on the "left" table (defaults to the left table's primary key) */ left_key?: (fields: TypeToFields, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the join key on the "right" table (defaults to the right table's primary key) */ right_key?: (fields: TypeToFields["type"]>, key: Variable, inputs: Inputs) => EastFunction; /** A function to build an {@link Expression} for the primary key of the output of the join operation (defaults to the left table's primary key) */ output_key?: (fields: { [K in keyof Output["value"]["value"]["value"] & keyof ReturnType["type"]["value"]["value"]["value"]]: Variable; }, left_input_key: Variable, right_input_key: Variable, inputs: Inputs) => EastFunction; }): TabularPipelineBuilder["type"]["value"]["value"]["value"]]: Output["value"]["value"]["value"][K]; } & { [K in Exclude["type"]["value"]["value"]["value"]>]: Nullable; } & { [K in Exclude["type"]["value"]["value"]["value"], keyof Output["value"]["value"]["value"]>]: Nullable["type"]["value"]["value"]["value"][K]>; }>>, Inputs>; /** * Unparse tabular {@link Stream} into a CSV formatted {@link BlobType} {@link Stream}. * * @param config the configuration of the CSV unparsing * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", DictType(StringType, StructType({ float: FloatType }))); * const float = Stream("float", FloatType); * * const pipeline = new PipelineBuilder("BasicAuth") * .input({ name: "float", stream: float }) * .toCsv({ * selections: { * float: (fields, _key, inputs) => Add(fields.float, inputs.float) * }, * skip_n: 20n, * delimiter: "|", * }) * .toTemplate(); * ``` **/ toCsv, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The selections to unparse into */ selections: S; /** Skip this many rows from the top of the file */ skip_n?: bigint; /** The delimiter to seperate columns (default `","`) */ delimiter?: string; /** The delimiter to seperate rows (default `"\n"`) */ newline?: string; /** The str used for empty values */ null_str?: string; }): BlobPipelineBuilder; /** * Unparse tabular {@link Stream} into a JSONLines formatted {@link BlobType} {@link Stream}. * * @param config the configuration of the JSONLines unparsing * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", DictType(StringType, StructType({ float: FloatType }))); * const float = Stream("float", FloatType); * * const pipeline = new PipelineBuilder("BasicAuth") * .input({ name: "float", stream: float }) * .toJsonLines({ * selections: { * float: (fields, _key, inputs) => Add(fields.float, inputs.float) * }, * }) * .toTemplate(); * ``` **/ toJsonLines, key: Variable, inputs: Inputs) => EastFunction>>(config: { /** The selections to unparse into */ selections: S; }): BlobPipelineBuilder; /** * Unparse tabular {@link Stream} into a XLSX formatted {@link BlobType} {@link Stream}. * * @param config the configuration of the XLSX unparsing * @returns a new {@link PipelineBuilder} * * @category Pipeline * * @example * ```typescript * const username = Stream("Username", DictType(StringType, StructType({ float: FloatType }))); * const float = Stream("float", FloatType); * * const pipeline = new PipelineBuilder("BasicAuth") * .input({ name: "float", stream: float }) * .toXlsx({ * selections: { * float: (fields, _key, inputs) => Add(fields.float, inputs.float) * }, * skip_n: 20n, * delimiter: "|", * }) * .toTemplate(); * ``` **/ toXlsx, key: Variable, inputs: Inputs) => EastFunction>>(config: { sheet?: string; null_str?: string; selections: S; }): BlobPipelineBuilder; /** * Set the seed of the random number generator used in the pipeline expressions. * This is useful to compare two different calculations with the same random noise. * * @remarks A hash of the seed string is used to initialize the random number generator. The pipeline name is used by default. * * @param seed a string to seed the random number generator. * * @category Pipeline */ randomSeed(seed: string): TabularPipelineBuilder; }