@milaboratories/ptabler-expression-js 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/expressions.cjs +867 -0
- package/dist/expressions.cjs.map +1 -0
- package/dist/expressions.d.ts +297 -0
- package/dist/expressions.d.ts.map +1 -0
- package/dist/expressions.js +840 -0
- package/dist/expressions.js.map +1 -0
- package/dist/functions.cjs +180 -0
- package/dist/functions.cjs.map +1 -0
- package/dist/functions.d.ts +80 -0
- package/dist/functions.d.ts.map +1 -0
- package/dist/functions.js +166 -0
- package/dist/functions.js.map +1 -0
- package/dist/index.cjs +47 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +39 -0
- package/src/expressions.ts +944 -0
- package/src/functions.ts +183 -0
- package/src/index.ts +11 -0
- package/src/types.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressions.js","sources":["../src/expressions.ts"],"sourcesContent":["/**\n * Base expressionImpl classes and interfaces for PTabler JavaScript implementation\n */\n\nimport type {\n AggregationType,\n BinaryArithmeticExpression,\n BinaryArithmeticOperator,\n BooleanLogicExpression,\n ColumnReferenceExpression,\n ComparisonExpression,\n ComparisonOperator,\n ConstantValueExpression,\n CumsumExpression,\n Expression,\n ExtendedUnaryStringExpression,\n FillNaNExpression,\n FillNullExpression,\n FuzzyFilterDistanceMetric,\n FuzzyStringFilterExpression,\n MinMaxExpression,\n MinMaxOperator,\n NotExpression,\n RankExpression,\n StringContainsExpression,\n StringDistanceExpression,\n StringDistanceMetric,\n StringJoinExpression,\n StringReplaceExpression,\n SubstringExpression,\n UnaryArithmeticExpression,\n UnaryArithmeticOperator,\n WhenThenOtherwiseExpression,\n WindowExpression,\n} from './types';\n\n/**\n * Base abstract class for all expressions\n */\nexport abstract class ExpressionImpl {\n protected _alias?: string;\n\n /**\n * Convert the expressionImpl to JSON format compatible with PTabler schema\n */\n abstract toJSON(): Expression;\n\n /**\n * Get the alias for this expressionImpl (defaults to a generated name)\n */\n abstract getAlias(): string;\n\n /**\n * Set an alias for this expression\n */\n alias(name: string): ExpressionImpl {\n const cloned = this.clone();\n cloned._alias = name;\n return cloned;\n }\n\n /**\n * Clone this expression\n */\n protected abstract clone(): ExpressionImpl;\n\n // Arithmetic operations\n plus(other: ExpressionImpl | number | string): ArithmeticExpressionImpl {\n return new ArithmeticExpressionImpl('plus', this, coerceToExpression(other));\n }\n\n minus(other: ExpressionImpl | number | string): ArithmeticExpressionImpl {\n return new ArithmeticExpressionImpl('minus', this, coerceToExpression(other));\n }\n\n multiply(other: ExpressionImpl | number | string): ArithmeticExpressionImpl {\n return new ArithmeticExpressionImpl('multiply', this, coerceToExpression(other));\n }\n\n truediv(other: ExpressionImpl | number | string): ArithmeticExpressionImpl {\n return new ArithmeticExpressionImpl('truediv', this, coerceToExpression(other));\n }\n\n floordiv(other: ExpressionImpl | number | string): ArithmeticExpressionImpl {\n return new ArithmeticExpressionImpl('floordiv', this, coerceToExpression(other));\n }\n\n // Comparison operations\n gt(other: ExpressionImpl | number | string): ComparisonExpressionImpl {\n return new ComparisonExpressionImpl('gt', this, coerceToExpression(other));\n }\n\n ge(other: ExpressionImpl | number | string): ComparisonExpressionImpl {\n return new ComparisonExpressionImpl('ge', this, coerceToExpression(other));\n }\n\n eq(other: ExpressionImpl | number | string): ComparisonExpressionImpl {\n return new ComparisonExpressionImpl('eq', this, coerceToExpression(other));\n }\n\n lt(other: ExpressionImpl | number | string): ComparisonExpressionImpl {\n return new ComparisonExpressionImpl('lt', this, coerceToExpression(other));\n }\n\n le(other: ExpressionImpl | number | string): ComparisonExpressionImpl {\n return new ComparisonExpressionImpl('le', this, coerceToExpression(other));\n }\n\n neq(other: ExpressionImpl | number | string): ComparisonExpressionImpl {\n return new ComparisonExpressionImpl('neq', this, coerceToExpression(other));\n }\n\n // Logical operations\n and(...others: ExpressionImpl[]): LogicalExpressionImpl {\n return new LogicalExpressionImpl('and', [this, ...others]);\n }\n\n or(...others: ExpressionImpl[]): LogicalExpressionImpl {\n return new LogicalExpressionImpl('or', [this, ...others]);\n }\n\n not(): LogicalExpressionImpl {\n return new LogicalExpressionImpl('not', [this]);\n }\n\n // Unary arithmetic operations\n abs(): UnaryArithmeticExpressionImpl {\n return new UnaryArithmeticExpressionImpl('abs', this);\n }\n\n sqrt(): UnaryArithmeticExpressionImpl {\n return new UnaryArithmeticExpressionImpl('sqrt', this);\n }\n\n log(): UnaryArithmeticExpressionImpl {\n return new UnaryArithmeticExpressionImpl('log', this);\n }\n\n log10(): UnaryArithmeticExpressionImpl {\n return new UnaryArithmeticExpressionImpl('log10', this);\n }\n\n log2(): UnaryArithmeticExpressionImpl {\n return new UnaryArithmeticExpressionImpl('log2', this);\n }\n\n floor(): UnaryArithmeticExpressionImpl {\n return new UnaryArithmeticExpressionImpl('floor', this);\n }\n\n ceil(): UnaryArithmeticExpressionImpl {\n return new UnaryArithmeticExpressionImpl('ceil', this);\n }\n\n round(): UnaryArithmeticExpressionImpl {\n return new UnaryArithmeticExpressionImpl('round', this);\n }\n\n negate(): UnaryArithmeticExpressionImpl {\n return new UnaryArithmeticExpressionImpl('negate', this);\n }\n\n // Null checks\n isNull(): NullCheckExpressionImpl {\n return new NullCheckExpressionImpl('is_na', this);\n }\n\n isNotNull(): NullCheckExpressionImpl {\n return new NullCheckExpressionImpl('is_not_na', this);\n }\n\n // Fill null/NaN\n fillNull(value: ExpressionImpl): FillNullExpressionImpl {\n return new FillNullExpressionImpl(this, coerceToExpression(value));\n }\n\n fillNaN(value: ExpressionImpl): FillNaNExpressionImpl {\n return new FillNaNExpressionImpl(this, coerceToExpression(value));\n }\n\n // String operations\n strConcat(...others: (ExpressionImpl | string)[]): StringConcatExpressionImpl {\n return new StringConcatExpressionImpl([this, ...others.map(coerceToExpression)]);\n }\n\n substring(start: number, length?: number): SubstringExpressionImpl {\n return new SubstringExpressionImpl(this, start, length);\n }\n\n strReplace(pattern: string, value: string, options?: Pick<StringReplaceExpression, 'replaceAll' | 'literal'>): StringReplaceExpressionImpl {\n return new StringReplaceExpressionImpl(this, pattern, value, options);\n }\n\n strContains(pattern: ExpressionImpl | string, literal?: boolean, strict?: boolean): StringContainsExpressionImpl {\n return new StringContainsExpressionImpl(this, coerceToExpression(pattern), literal, strict);\n }\n\n strToUpper(): StringCaseExpressionImpl {\n return new StringCaseExpressionImpl('to_upper', this);\n }\n\n strToLower(): StringCaseExpressionImpl {\n return new StringCaseExpressionImpl('to_lower', this);\n }\n\n strStartsWith(pattern: ExpressionImpl | string): StringStartsWithExpressionImpl {\n return new StringStartsWithExpressionImpl(this, coerceToExpression(pattern));\n }\n\n strEndsWith(pattern: ExpressionImpl | string): StringEndsWithExpressionImpl {\n return new StringEndsWithExpressionImpl(this, coerceToExpression(pattern));\n }\n\n // Aggregation operations\n sum(): AggregationExpressionImpl {\n return new AggregationExpressionImpl('sum', this);\n }\n\n mean(): AggregationExpressionImpl {\n return new AggregationExpressionImpl('mean', this);\n }\n\n count(): AggregationExpressionImpl {\n return new AggregationExpressionImpl('count', this);\n }\n\n min(): AggregationExpressionImpl {\n return new AggregationExpressionImpl('min', this);\n }\n\n max(): AggregationExpressionImpl {\n return new AggregationExpressionImpl('max', this);\n }\n\n first(): AggregationExpressionImpl {\n return new AggregationExpressionImpl('first', this);\n }\n\n last(): AggregationExpressionImpl {\n return new AggregationExpressionImpl('last', this);\n }\n\n cumsum(): CumsumExpressionImpl {\n return new CumsumExpressionImpl(this);\n }\n\n // Fuzzy operations\n stringDistance(other: ExpressionImpl | string, metric: StringDistanceMetric, returnSimilarity?: boolean): StringDistanceExpressionImpl {\n return new StringDistanceExpressionImpl(\n this,\n coerceToExpression(other),\n metric,\n returnSimilarity,\n );\n }\n\n fuzzyStringFilter(pattern: ExpressionImpl | string, metric: FuzzyFilterDistanceMetric, bound: number): FuzzyStringFilterExpressionImpl {\n return new FuzzyStringFilterExpressionImpl(\n this,\n coerceToExpression(pattern),\n metric,\n bound,\n );\n }\n}\n\nexport class ColumnExpressionImpl extends ExpressionImpl {\n constructor(private readonly columnName: string) {\n super();\n }\n\n toJSON(): ColumnReferenceExpression {\n return {\n type: 'col',\n name: this.columnName,\n };\n }\n\n getAlias(): string {\n return this._alias || this.columnName;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new ColumnExpressionImpl(this.columnName);\n cloned._alias = this._alias;\n return cloned;\n }\n\n /**\n * Get the column name\n */\n getColumnName(): string {\n return this.columnName;\n }\n}\n\n/**\n * Helper function to coerce values to expressions\n */\nexport function coerceToExpression(value: ExpressionImpl | LiteralValue): ExpressionImpl {\n if (value instanceof ExpressionImpl) {\n return value;\n }\n return new LiteralExpressionImpl(value);\n}\n\nexport class MinMaxExpressionImpl extends ExpressionImpl {\n constructor(private readonly op: MinMaxOperator, private readonly ops: ExpressionImpl[]) {\n super();\n }\n\n toJSON(): MinMaxExpression {\n return {\n type: this.op,\n operands: this.ops.map((o) => o.toJSON()),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.op}_${this.ops.map((o) => o.getAlias()).join('_')}`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new MinMaxExpressionImpl(this.op, this.ops);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\n// Forward declarations for concrete expressionImpl classes\n// These will be imported from their respective modules\nexport class ArithmeticExpressionImpl extends ExpressionImpl {\n constructor(\n private readonly operator: BinaryArithmeticOperator,\n private readonly lhs: ExpressionImpl,\n private readonly rhs: ExpressionImpl,\n ) {\n super();\n }\n\n toJSON(): BinaryArithmeticExpression {\n return {\n type: this.operator,\n lhs: this.lhs.toJSON(),\n rhs: this.rhs.toJSON(),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.lhs.getAlias()}_${this.operator}_${this.rhs.getAlias()}`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new ArithmeticExpressionImpl(this.operator, this.lhs, this.rhs);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class ComparisonExpressionImpl extends ExpressionImpl {\n constructor(\n private readonly operator: ComparisonOperator,\n private readonly lhs: ExpressionImpl,\n private readonly rhs: ExpressionImpl,\n ) {\n super();\n }\n\n toJSON(): ComparisonExpression {\n return {\n type: this.operator,\n lhs: this.lhs.toJSON(),\n rhs: this.rhs.toJSON(),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.lhs.getAlias()}_${this.operator}_${this.rhs.getAlias()}`;\n }\n\n protected clone(): ComparisonExpressionImpl {\n const cloned = new ComparisonExpressionImpl(this.operator, this.lhs, this.rhs);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class LogicalExpressionImpl extends ExpressionImpl {\n constructor(\n private readonly operator: 'and' | 'or' | 'not',\n private readonly operands: ExpressionImpl[],\n ) {\n super();\n }\n\n toJSON(): NotExpression | BooleanLogicExpression {\n if (this.operator === 'not') {\n return {\n type: 'not',\n value: this.operands[0].toJSON(),\n };\n }\n return {\n type: this.operator,\n operands: this.operands.map((op) => op.toJSON()),\n };\n }\n\n getAlias(): string {\n if (this._alias) return this._alias;\n if (this.operator === 'not') {\n return `not_${this.operands[0].getAlias()}`;\n }\n return this.operands.map((op) => op.getAlias()).join(`_${this.operator}_`);\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new LogicalExpressionImpl(this.operator, this.operands);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class UnaryArithmeticExpressionImpl extends ExpressionImpl {\n constructor(\n private readonly operator: UnaryArithmeticOperator,\n private readonly value: ExpressionImpl,\n ) {\n super();\n }\n\n toJSON(): UnaryArithmeticExpression {\n return {\n type: this.operator,\n value: this.value.toJSON(),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.operator}_${this.value.getAlias()}`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new UnaryArithmeticExpressionImpl(this.operator, this.value);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class NullCheckExpressionImpl extends ExpressionImpl {\n constructor(\n private readonly operator: 'is_na' | 'is_not_na',\n private readonly value: ExpressionImpl,\n ) {\n super();\n }\n\n toJSON(): Expression {\n return {\n type: this.operator,\n value: this.value.toJSON(),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.value.getAlias()}_${this.operator}`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new NullCheckExpressionImpl(this.operator, this.value);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport type LiteralValue = string | number | boolean | null;\n\nexport class LiteralExpressionImpl extends ExpressionImpl {\n constructor(private readonly value: LiteralValue) {\n super();\n }\n\n toJSON(): ConstantValueExpression {\n return {\n type: 'const',\n value: this.value,\n };\n }\n\n getAlias(): string {\n return this._alias || this.generateDefaultAlias();\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new LiteralExpressionImpl(this.value);\n cloned._alias = this._alias;\n return cloned;\n }\n\n /**\n * Get the literal value\n */\n getValue(): string | number | boolean | null {\n return this.value;\n }\n\n /**\n * Generate a default alias based on the value\n */\n private generateDefaultAlias(): string {\n if (this.value === null || this.value === undefined) {\n return 'null';\n }\n if (typeof this.value === 'string') {\n // For string values, truncate if too long and make safe for column names\n const safe = this.value.replace(/[^a-zA-Z0-9_]/g, '_');\n return safe.length > 20 ? safe.substring(0, 17) + '...' : safe;\n }\n if (typeof this.value === 'boolean') {\n return this.value ? 'true' : 'false';\n }\n if (typeof this.value === 'number') {\n return String(this.value);\n }\n if (Array.isArray(this.value)) {\n return 'array';\n }\n if (typeof this.value === 'object') {\n return 'object';\n }\n return 'literal';\n }\n}\n\nexport class FillNullExpressionImpl extends ExpressionImpl {\n constructor(private readonly expr: ExpressionImpl, private readonly fillValue: ExpressionImpl) {\n super();\n }\n\n toJSON(): FillNullExpression {\n return {\n type: 'fill_null',\n input: this.expr.toJSON(),\n fillValue: this.fillValue.toJSON(),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.expr.getAlias()}_fill_null`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new FillNullExpressionImpl(this.expr, this.fillValue);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class FillNaNExpressionImpl extends ExpressionImpl {\n constructor(private readonly expr: ExpressionImpl, private readonly fillValue: ExpressionImpl) {\n super();\n }\n\n toJSON(): FillNaNExpression {\n return {\n type: 'fill_nan',\n input: this.expr.toJSON(),\n fillValue: this.fillValue.toJSON(),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.expr.getAlias()}_fill_nan`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new FillNaNExpressionImpl(this.expr, this.fillValue);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class StringConcatExpressionImpl extends ExpressionImpl {\n constructor(private readonly operands: ExpressionImpl[], private readonly delimiter: string = '') {\n super();\n }\n\n toJSON(): StringJoinExpression {\n return {\n type: 'str_join',\n operands: this.operands.map((o) => o.toJSON()),\n delimiter: this.delimiter,\n };\n }\n\n getAlias(): string {\n return this._alias || this.operands.map((o) => o.getAlias()).join('_');\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new StringConcatExpressionImpl(this.operands);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class SubstringExpressionImpl extends ExpressionImpl {\n constructor(private readonly expr: ExpressionImpl, private readonly start: number, private readonly length?: number) {\n super();\n }\n\n toJSON(): SubstringExpression {\n return {\n type: 'substring',\n value: this.expr.toJSON(),\n start: { type: 'const', value: this.start },\n length: this.length !== undefined ? { type: 'const', value: this.length } : undefined,\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.expr.getAlias()}_substring`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new SubstringExpressionImpl(this.expr, this.start, this.length);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class StringReplaceExpressionImpl extends ExpressionImpl {\n constructor(private readonly expr: ExpressionImpl, private readonly pattern: string, private readonly value: string, private readonly options?: Pick<StringReplaceExpression, 'replaceAll' | 'literal'>) {\n super();\n }\n\n toJSON(): StringReplaceExpression {\n return {\n type: 'str_replace',\n value: this.expr.toJSON(),\n pattern: this.pattern,\n replacement: this.value,\n replaceAll: this.options?.replaceAll || false,\n literal: this.options?.literal || false,\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.expr.getAlias()}_replace`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new StringReplaceExpressionImpl(this.expr, this.pattern, this.value, this.options);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class StringContainsExpressionImpl extends ExpressionImpl {\n constructor(private readonly expr: ExpressionImpl, private readonly pattern: ExpressionImpl, private readonly literal?: boolean, private readonly strict?: boolean) {\n super();\n }\n\n toJSON(): StringContainsExpression {\n return {\n type: 'str_contains',\n value: this.expr.toJSON(),\n pattern: this.pattern.toJSON(),\n literal: this.literal || false,\n strict: this.strict !== undefined ? this.strict : true,\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.expr.getAlias()}_contains`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new StringContainsExpressionImpl(this.expr, this.pattern, this.literal, this.strict);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class StringCaseExpressionImpl extends ExpressionImpl {\n constructor(private readonly operation: 'to_upper' | 'to_lower', private readonly expr: ExpressionImpl) {\n super();\n }\n\n toJSON(): ExtendedUnaryStringExpression {\n return {\n type: this.operation,\n value: this.expr.toJSON(),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.expr.getAlias()}_${this.operation}`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new StringCaseExpressionImpl(this.operation, this.expr);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class StringStartsWithExpressionImpl extends ExpressionImpl {\n constructor(private readonly expr: ExpressionImpl, private readonly pattern: ExpressionImpl) {\n super();\n }\n\n toJSON(): Expression {\n return {\n type: 'str_starts_with',\n value: this.expr.toJSON(),\n prefix: this.pattern.toJSON(),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.expr.getAlias()}_starts_with`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new StringStartsWithExpressionImpl(this.expr, this.pattern);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class StringEndsWithExpressionImpl extends ExpressionImpl {\n constructor(private readonly expr: ExpressionImpl, private readonly pattern: ExpressionImpl) {\n super();\n }\n\n toJSON(): Expression {\n return {\n type: 'str_ends_with',\n value: this.expr.toJSON(),\n suffix: this.pattern.toJSON(),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.expr.getAlias()}_ends_with`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new StringEndsWithExpressionImpl(this.expr, this.pattern);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class CumsumExpressionImpl extends ExpressionImpl {\n constructor(private readonly value: ExpressionImpl, private readonly additionalOrderBy: ExpressionImpl[] = [], private readonly partitionBy: ExpressionImpl[] = [], private readonly descending?: boolean) {\n super();\n }\n\n toJSON(): CumsumExpression {\n return {\n type: 'cumsum',\n value: this.value.toJSON(),\n additionalOrderBy: this.additionalOrderBy.map((expr) => expr.toJSON()),\n partitionBy: this.partitionBy.map((expr) => expr.toJSON()),\n descending: this.descending,\n };\n }\n\n getAlias(): string {\n return this._alias || `cumsum_${this.value.getAlias()}`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new CumsumExpressionImpl(this.value, this.additionalOrderBy, this.partitionBy, this.descending);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class AggregationExpressionImpl extends ExpressionImpl {\n constructor(public operation: AggregationType, public expr?: ExpressionImpl) {\n super();\n }\n\n toJSON(): WindowExpression {\n return {\n type: 'aggregate',\n aggregation: this.operation,\n value: this.expr?.toJSON() || { type: 'const', value: 1 },\n partitionBy: [],\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.operation}${this.expr ? '_' + this.expr.getAlias() : ''}`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new AggregationExpressionImpl(this.operation, this.expr);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class WindowExpressionImpl extends ExpressionImpl {\n constructor(private readonly expr: ExpressionImpl, private readonly aggregation: AggregationType, private readonly partitionBy: ExpressionImpl[]) {\n super();\n }\n\n toJSON(): WindowExpression {\n return {\n type: 'aggregate',\n aggregation: this.aggregation,\n value: this.expr.toJSON(),\n partitionBy: this.partitionBy.map((expr) => expr.toJSON()),\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.expr.getAlias()}_window`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new WindowExpressionImpl(this.expr, this.aggregation, this.partitionBy);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class StringDistanceExpressionImpl extends ExpressionImpl {\n constructor(private readonly string1: ExpressionImpl, private readonly string2: ExpressionImpl, private readonly metric: StringDistanceMetric, private readonly returnSimilarity?: boolean) {\n super();\n }\n\n toJSON(): StringDistanceExpression {\n return {\n type: 'string_distance',\n metric: this.metric,\n string1: this.string1.toJSON(),\n string2: this.string2.toJSON(),\n returnSimilarity: this.returnSimilarity || false,\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.string1.getAlias()}_distance_${this.string2.getAlias()}`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new StringDistanceExpressionImpl(this.string1, this.string2, this.metric, this.returnSimilarity);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class FuzzyStringFilterExpressionImpl extends ExpressionImpl {\n constructor(private readonly expr: ExpressionImpl, private readonly pattern: ExpressionImpl, private readonly metric: FuzzyFilterDistanceMetric, private readonly bound: number) {\n super();\n }\n\n toJSON(): FuzzyStringFilterExpression {\n return {\n type: 'fuzzy_string_filter',\n metric: this.metric,\n value: this.expr.toJSON(),\n pattern: this.pattern.toJSON(),\n bound: this.bound,\n };\n }\n\n getAlias(): string {\n return this._alias || `${this.expr.getAlias()}_fuzzy_filter`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new FuzzyStringFilterExpressionImpl(this.expr, this.pattern, this.metric, this.bound);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class RankExpressionImpl extends ExpressionImpl {\n constructor(\n private readonly orderBy: ExpressionImpl[],\n private readonly partitionBy: ExpressionImpl[],\n private readonly descending: boolean,\n ) {\n super();\n }\n\n toJSON(): RankExpression {\n return {\n type: 'rank',\n orderBy: this.orderBy.map((e) => e.toJSON()),\n partitionBy: this.partitionBy.map((e) => e.toJSON()),\n descending: this.descending || undefined,\n };\n }\n\n getAlias(): string {\n const order = this.orderBy.map((e) => e.getAlias()).join('_');\n const part = this.partitionBy.map((e) => e.getAlias()).join('_');\n const dir = this.descending ? 'desc' : 'asc';\n return this._alias || `rank_${order}${part ? `_over_${part}` : ''}_${dir}`;\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new RankExpressionImpl(this.orderBy, this.partitionBy, this.descending);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n\nexport class WhenThenOtherwiseExpressionImpl extends ExpressionImpl {\n constructor(\n private readonly conditions: Array<{ when: ExpressionImpl; then: ExpressionImpl }>,\n private readonly otherwiseValue: ExpressionImpl,\n ) {\n super();\n }\n\n toJSON(): WhenThenOtherwiseExpression {\n return {\n type: 'when_then_otherwise',\n conditions: this.conditions.map((clause) => ({\n when: clause.when.toJSON(),\n then: clause.then.toJSON(),\n })),\n otherwise: this.otherwiseValue.toJSON(),\n };\n }\n\n getAlias(): string {\n return this._alias || 'conditional';\n }\n\n protected clone(): ExpressionImpl {\n const cloned = new WhenThenOtherwiseExpressionImpl(this.conditions, this.otherwiseValue);\n cloned._alias = this._alias;\n return cloned;\n }\n}\n"],"names":[],"mappings":"AAAA;;AAEG;AAkCH;;AAEG;MACmB,cAAc,CAAA;AACxB,IAAA,MAAM;AAYhB;;AAEG;AACH,IAAA,KAAK,CAAC,IAAY,EAAA;AAChB,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE;AAC3B,QAAA,MAAM,CA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C,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC;AACtF,QAAA,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;AAC3B,QAAA,OAAO,MAAM;IACf;AACD;AAEK,MAAO,+BAAgC,SAAQ,cAAc,CAAA;AAE9C,IAAA,UAAA;AACA,IAAA,cAAA;IAFnB,WAAA,CACmB,UAAiE,EACjE,cAA8B,EAAA;AAE/C,QAAA,KAAK,EAAE;QAHU,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,cAAc,GAAd,cAAc;IAGjC;IAEA,MAAM,GAAA;QACJ,OAAO;AACL,YAAA,IAAI,EAAE,qBAAqB;AAC3B,YAAA,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,MAAM;AAC3C,gBAAA,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE;AAC1B,gBAAA,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE;AAC3B,aAAA,CAAC,CAAC;AACH,YAAA,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;SACxC;IACH;IAEA,QAAQ,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,MAAM,IAAI,aAAa;IACrC;IAEU,KAAK,GAAA;AACb,QAAA,MAAM,MAAM,GAAG,IAAI,+BAA+B,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC;AACxF,QAAA,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;AAC3B,QAAA,OAAO,MAAM;IACf;AACD;;;;"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var expressions = require('./expressions.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Factory functions for creating expressions - mirrors Tengo pt library API
|
|
7
|
+
*/
|
|
8
|
+
// Internal helpers mirroring Tengo behavior
|
|
9
|
+
function isExpression(v) {
|
|
10
|
+
return v instanceof expressions.ExpressionImpl;
|
|
11
|
+
}
|
|
12
|
+
function asExprFromString(value, interpretation) {
|
|
13
|
+
return interpretation === 'col' ? col(value) : lit(value);
|
|
14
|
+
}
|
|
15
|
+
function coerceToExpressionList(items, interpretationForString) {
|
|
16
|
+
const arr = Array.isArray(items) ? items : [items];
|
|
17
|
+
return arr.map((it) => (typeof it === 'string' ? asExprFromString(it, interpretationForString) : it));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Create a column reference expression
|
|
21
|
+
* @param name Column name
|
|
22
|
+
*/
|
|
23
|
+
function col(name) {
|
|
24
|
+
return new expressions.ColumnExpressionImpl(name);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create a literal value expression
|
|
28
|
+
* @param value Literal value (number, string, boolean, null, etc.)
|
|
29
|
+
*/
|
|
30
|
+
function lit(value) {
|
|
31
|
+
return new expressions.LiteralExpressionImpl(value);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create an AND expression with multiple operands (horizontal AND)
|
|
35
|
+
* @param expressions Array of expressions to AND together
|
|
36
|
+
*/
|
|
37
|
+
function allHorizontal(...expressions$1) {
|
|
38
|
+
// Interpret string args as column names. We don't flatten nested ANDs to keep implementation simple.
|
|
39
|
+
const processed = expressions$1.map((e) => (typeof e === 'string' ? col(e) : e));
|
|
40
|
+
return new expressions.LogicalExpressionImpl('and', processed);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create an OR expression with multiple operands (horizontal OR)
|
|
44
|
+
* @param expressions Array of expressions to OR together
|
|
45
|
+
*/
|
|
46
|
+
function anyHorizontal(...expressions$1) {
|
|
47
|
+
// Interpret string args as column names. We don't flatten nested ORs to keep implementation simple.
|
|
48
|
+
const processed = expressions$1.map((e) => (typeof e === 'string' ? col(e) : e));
|
|
49
|
+
return new expressions.LogicalExpressionImpl('or', processed);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create an AND expression with multiple operands
|
|
53
|
+
* @param expressions Array of expressions to AND together
|
|
54
|
+
*/
|
|
55
|
+
function and(...expressions) {
|
|
56
|
+
return allHorizontal(...expressions);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Create an OR expression with multiple operands
|
|
60
|
+
* @param expressions Array of expressions to OR together
|
|
61
|
+
*/
|
|
62
|
+
function or(...expressions) {
|
|
63
|
+
return anyHorizontal(...expressions);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Concatenate string representations with optional delimiter (Tengo: concatStr)
|
|
67
|
+
* String inputs are treated as literals.
|
|
68
|
+
*/
|
|
69
|
+
function concatStr(expressions$1, options) {
|
|
70
|
+
if (!Array.isArray(expressions$1) || expressions$1.length === 0) {
|
|
71
|
+
throw new Error('concatStr requires a non-empty array of expressions');
|
|
72
|
+
}
|
|
73
|
+
const ops = coerceToExpressionList(expressions$1, 'lit');
|
|
74
|
+
const delimiter = options?.delimiter ?? '';
|
|
75
|
+
return new expressions.StringConcatExpressionImpl(ops, delimiter);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.
|
|
79
|
+
*/
|
|
80
|
+
function minHorizontal(expressions$1) {
|
|
81
|
+
if (!Array.isArray(expressions$1) || expressions$1.length === 0) {
|
|
82
|
+
throw new Error('minHorizontal requires a non-empty array of expressions');
|
|
83
|
+
}
|
|
84
|
+
const ops = coerceToExpressionList(expressions$1, 'col');
|
|
85
|
+
return new expressions.MinMaxExpressionImpl('min', ops);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.
|
|
89
|
+
*/
|
|
90
|
+
function maxHorizontal(expressions$1) {
|
|
91
|
+
if (!Array.isArray(expressions$1) || expressions$1.length === 0) {
|
|
92
|
+
throw new Error('maxHorizontal requires a non-empty array of expressions');
|
|
93
|
+
}
|
|
94
|
+
const ops = coerceToExpressionList(expressions$1, 'col');
|
|
95
|
+
return new expressions.MinMaxExpressionImpl('max', ops);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Create a conditional when-then expression builder
|
|
99
|
+
* @param condition Boolean expression condition
|
|
100
|
+
*/
|
|
101
|
+
function when(condition) {
|
|
102
|
+
return WhenThenBuilder.start(condition);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Create a rank expression
|
|
106
|
+
* @param expression Expression to rank
|
|
107
|
+
* @param options Ranking options
|
|
108
|
+
*/
|
|
109
|
+
function rank(orderBy, descending = false) {
|
|
110
|
+
const orderByList = coerceToExpressionList(orderBy, 'col');
|
|
111
|
+
return new RankBuilder(orderByList, descending);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Builder class for when-then-otherwise conditional expressions
|
|
115
|
+
*/
|
|
116
|
+
class WhenThenBuilder {
|
|
117
|
+
clauses;
|
|
118
|
+
currentWhen;
|
|
119
|
+
constructor(clauses, currentWhen) {
|
|
120
|
+
this.clauses = clauses;
|
|
121
|
+
this.currentWhen = currentWhen;
|
|
122
|
+
}
|
|
123
|
+
static start(condition) {
|
|
124
|
+
if (!isExpression(condition))
|
|
125
|
+
throw new Error('when() expects an Expression');
|
|
126
|
+
return new WhenThenBuilder([], condition);
|
|
127
|
+
}
|
|
128
|
+
when(condition) {
|
|
129
|
+
if (this.currentWhen)
|
|
130
|
+
throw new Error('.when() must follow a .then()');
|
|
131
|
+
if (!isExpression(condition))
|
|
132
|
+
throw new Error('.when() expects an Expression');
|
|
133
|
+
return new WhenThenBuilder(this.clauses, condition);
|
|
134
|
+
}
|
|
135
|
+
then(value) {
|
|
136
|
+
if (!this.currentWhen)
|
|
137
|
+
throw new Error('.then() must follow a .when()');
|
|
138
|
+
const expr = isExpression(value) ? value : lit(value);
|
|
139
|
+
const nextClauses = this.clauses.slice();
|
|
140
|
+
nextClauses.push({ when: this.currentWhen, then: expr });
|
|
141
|
+
return new WhenThenBuilder(nextClauses, undefined);
|
|
142
|
+
}
|
|
143
|
+
otherwise(value) {
|
|
144
|
+
if (this.currentWhen)
|
|
145
|
+
throw new Error('.otherwise() must follow a .then()');
|
|
146
|
+
if (this.clauses.length === 0) {
|
|
147
|
+
throw new Error('At least one .when().then() clause is required before .otherwise()');
|
|
148
|
+
}
|
|
149
|
+
const expr = isExpression(value) ? value : lit(value);
|
|
150
|
+
return new expressions.WhenThenOtherwiseExpressionImpl(this.clauses, expr);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Rank builder and expression
|
|
154
|
+
class RankBuilder {
|
|
155
|
+
orderBy;
|
|
156
|
+
descending;
|
|
157
|
+
constructor(orderBy, descending) {
|
|
158
|
+
this.orderBy = orderBy;
|
|
159
|
+
this.descending = descending;
|
|
160
|
+
}
|
|
161
|
+
over(partitionBy) {
|
|
162
|
+
const partitionByList = coerceToExpressionList(partitionBy, 'col');
|
|
163
|
+
return new expressions.RankExpressionImpl(this.orderBy, partitionByList, this.descending);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
exports.RankBuilder = RankBuilder;
|
|
168
|
+
exports.WhenThenBuilder = WhenThenBuilder;
|
|
169
|
+
exports.allHorizontal = allHorizontal;
|
|
170
|
+
exports.and = and;
|
|
171
|
+
exports.anyHorizontal = anyHorizontal;
|
|
172
|
+
exports.col = col;
|
|
173
|
+
exports.concatStr = concatStr;
|
|
174
|
+
exports.lit = lit;
|
|
175
|
+
exports.maxHorizontal = maxHorizontal;
|
|
176
|
+
exports.minHorizontal = minHorizontal;
|
|
177
|
+
exports.or = or;
|
|
178
|
+
exports.rank = rank;
|
|
179
|
+
exports.when = when;
|
|
180
|
+
//# sourceMappingURL=functions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.cjs","sources":["../src/functions.ts"],"sourcesContent":["/**\n * Factory functions for creating expressions - mirrors Tengo pt library API\n */\n\nimport type { LiteralValue } from './expressions';\nimport { ColumnExpressionImpl, ExpressionImpl, LiteralExpressionImpl, LogicalExpressionImpl, MinMaxExpressionImpl, RankExpressionImpl, StringConcatExpressionImpl, WhenThenOtherwiseExpressionImpl } from './expressions';\n\n// Internal helpers mirroring Tengo behavior\nfunction isExpression(v: unknown): v is ExpressionImpl {\n return v instanceof ExpressionImpl;\n}\n\nfunction asExprFromString(value: string, interpretation: 'col' | 'lit'): ExpressionImpl {\n return interpretation === 'col' ? col(value) : lit(value);\n}\n\nfunction coerceToExpressionList(\n items: Array<ExpressionImpl | string> | ExpressionImpl | string,\n interpretationForString: 'col' | 'lit',\n): ExpressionImpl[] {\n const arr = Array.isArray(items) ? items : [items];\n return arr.map((it) => (typeof it === 'string' ? asExprFromString(it, interpretationForString) : it));\n}\n\n/**\n * Create a column reference expression\n * @param name Column name\n */\nexport function col(name: string): ColumnExpressionImpl {\n return new ColumnExpressionImpl(name);\n}\n\n/**\n * Create a literal value expression\n * @param value Literal value (number, string, boolean, null, etc.)\n */\nexport function lit(value: LiteralValue): LiteralExpressionImpl {\n return new LiteralExpressionImpl(value);\n}\n\n/**\n * Create an AND expression with multiple operands (horizontal AND)\n * @param expressions Array of expressions to AND together\n */\nexport function allHorizontal(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n // Interpret string args as column names. We don't flatten nested ANDs to keep implementation simple.\n const processed: ExpressionImpl[] = expressions.map((e) => (typeof e === 'string' ? col(e) : e));\n return new LogicalExpressionImpl('and', processed);\n}\n\n/**\n * Create an OR expression with multiple operands (horizontal OR)\n * @param expressions Array of expressions to OR together\n */\nexport function anyHorizontal(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n // Interpret string args as column names. We don't flatten nested ORs to keep implementation simple.\n const processed: ExpressionImpl[] = expressions.map((e) => (typeof e === 'string' ? col(e) : e));\n return new LogicalExpressionImpl('or', processed);\n}\n\n/**\n * Create an AND expression with multiple operands\n * @param expressions Array of expressions to AND together\n */\nexport function and(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n return allHorizontal(...expressions);\n}\n\n/**\n * Create an OR expression with multiple operands\n * @param expressions Array of expressions to OR together\n */\nexport function or(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n return anyHorizontal(...expressions);\n}\n\n/**\n * Concatenate string representations with optional delimiter (Tengo: concatStr)\n * String inputs are treated as literals.\n */\nexport function concatStr(\n expressions: Array<ExpressionImpl | string>,\n options?: { delimiter?: string },\n): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error('concatStr requires a non-empty array of expressions');\n }\n const ops = coerceToExpressionList(expressions, 'lit');\n const delimiter = options?.delimiter ?? '';\n return new StringConcatExpressionImpl(ops, delimiter);\n}\n\n/**\n * Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.\n */\nexport function minHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error('minHorizontal requires a non-empty array of expressions');\n }\n\n const ops = coerceToExpressionList(expressions, 'col');\n return new MinMaxExpressionImpl('min', ops);\n}\n\n/**\n * Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.\n */\nexport function maxHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error('maxHorizontal requires a non-empty array of expressions');\n }\n const ops = coerceToExpressionList(expressions, 'col');\n return new MinMaxExpressionImpl('max', ops);\n}\n\n/**\n * Create a conditional when-then expression builder\n * @param condition Boolean expression condition\n */\nexport function when(condition: ExpressionImpl): WhenThenBuilder {\n return WhenThenBuilder.start(condition);\n}\n\n/**\n * Create a rank expression\n * @param expression Expression to rank\n * @param options Ranking options\n */\nexport function rank(orderBy: ExpressionImpl | string | Array<ExpressionImpl | string>, descending = false): RankBuilder {\n const orderByList = coerceToExpressionList(orderBy, 'col');\n return new RankBuilder(orderByList, descending);\n}\n\n/**\n * Builder class for when-then-otherwise conditional expressions\n */\nexport class WhenThenBuilder {\n private constructor(\n private readonly clauses: Array<{ when: ExpressionImpl; then: ExpressionImpl }>,\n private readonly currentWhen?: ExpressionImpl,\n ) {}\n\n static start(condition: ExpressionImpl): WhenThenBuilder {\n if (!isExpression(condition)) throw new Error('when() expects an Expression');\n return new WhenThenBuilder([], condition);\n }\n\n when(condition: ExpressionImpl): WhenThenBuilder {\n if (this.currentWhen) throw new Error('.when() must follow a .then()');\n if (!isExpression(condition)) throw new Error('.when() expects an Expression');\n return new WhenThenBuilder(this.clauses, condition);\n }\n\n then(value: ExpressionImpl | LiteralValue): WhenThenBuilder {\n if (!this.currentWhen) throw new Error('.then() must follow a .when()');\n const expr = isExpression(value) ? value : lit(value);\n const nextClauses = this.clauses.slice();\n nextClauses.push({ when: this.currentWhen, then: expr });\n return new WhenThenBuilder(nextClauses, undefined);\n }\n\n otherwise(value: ExpressionImpl | LiteralValue): WhenThenOtherwiseExpressionImpl {\n if (this.currentWhen) throw new Error('.otherwise() must follow a .then()');\n if (this.clauses.length === 0) {\n throw new Error('At least one .when().then() clause is required before .otherwise()');\n }\n const expr = isExpression(value) ? value : lit(value);\n return new WhenThenOtherwiseExpressionImpl(this.clauses, expr);\n }\n}\n\n// Rank builder and expression\nexport class RankBuilder {\n constructor(\n private readonly orderBy: ExpressionImpl[],\n private readonly descending: boolean,\n ) {}\n\n over(partitionBy: ExpressionImpl | string | Array<ExpressionImpl | string>): RankExpressionImpl {\n const partitionByList = coerceToExpressionList(partitionBy, 'col');\n return new RankExpressionImpl(this.orderBy, partitionByList, this.descending);\n }\n}\n"],"names":["ExpressionImpl","ColumnExpressionImpl","LiteralExpressionImpl","expressions","LogicalExpressionImpl","StringConcatExpressionImpl","MinMaxExpressionImpl","WhenThenOtherwiseExpressionImpl","RankExpressionImpl"],"mappings":";;;;AAAA;;AAEG;AAKH;AACA,SAAS,YAAY,CAAC,CAAU,EAAA;IAC9B,OAAO,CAAC,YAAYA,0BAAc;AACpC;AAEA,SAAS,gBAAgB,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rors Tengo pt library API
|
|
3
|
+
*/
|
|
4
|
+
import type { LiteralValue } from './expressions';
|
|
5
|
+
import { ColumnExpressionImpl, ExpressionImpl, LiteralExpressionImpl, LogicalExpressionImpl, RankExpressionImpl, WhenThenOtherwiseExpressionImpl } from './expressions';
|
|
6
|
+
/**
|
|
7
|
+
* Create a column reference expression
|
|
8
|
+
* @param name Column name
|
|
9
|
+
*/
|
|
10
|
+
export declare function col(name: string): ColumnExpressionImpl;
|
|
11
|
+
/**
|
|
12
|
+
* Create a literal value expression
|
|
13
|
+
* @param value Literal value (number, string, boolean, null, etc.)
|
|
14
|
+
*/
|
|
15
|
+
export declare function lit(value: LiteralValue): LiteralExpressionImpl;
|
|
16
|
+
/**
|
|
17
|
+
* Create an AND expression with multiple operands (horizontal AND)
|
|
18
|
+
* @param expressions Array of expressions to AND together
|
|
19
|
+
*/
|
|
20
|
+
export declare function allHorizontal(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
|
|
21
|
+
/**
|
|
22
|
+
* Create an OR expression with multiple operands (horizontal OR)
|
|
23
|
+
* @param expressions Array of expressions to OR together
|
|
24
|
+
*/
|
|
25
|
+
export declare function anyHorizontal(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
|
|
26
|
+
/**
|
|
27
|
+
* Create an AND expression with multiple operands
|
|
28
|
+
* @param expressions Array of expressions to AND together
|
|
29
|
+
*/
|
|
30
|
+
export declare function and(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
|
|
31
|
+
/**
|
|
32
|
+
* Create an OR expression with multiple operands
|
|
33
|
+
* @param expressions Array of expressions to OR together
|
|
34
|
+
*/
|
|
35
|
+
export declare function or(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
|
|
36
|
+
/**
|
|
37
|
+
* Concatenate string representations with optional delimiter (Tengo: concatStr)
|
|
38
|
+
* String inputs are treated as literals.
|
|
39
|
+
*/
|
|
40
|
+
export declare function concatStr(expressions: Array<ExpressionImpl | string>, options?: {
|
|
41
|
+
delimiter?: string;
|
|
42
|
+
}): ExpressionImpl;
|
|
43
|
+
/**
|
|
44
|
+
* Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.
|
|
45
|
+
*/
|
|
46
|
+
export declare function minHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl;
|
|
47
|
+
/**
|
|
48
|
+
* Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.
|
|
49
|
+
*/
|
|
50
|
+
export declare function maxHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl;
|
|
51
|
+
/**
|
|
52
|
+
* Create a conditional when-then expression builder
|
|
53
|
+
* @param condition Boolean expression condition
|
|
54
|
+
*/
|
|
55
|
+
export declare function when(condition: ExpressionImpl): WhenThenBuilder;
|
|
56
|
+
/**
|
|
57
|
+
* Create a rank expression
|
|
58
|
+
* @param expression Expression to rank
|
|
59
|
+
* @param options Ranking options
|
|
60
|
+
*/
|
|
61
|
+
export declare function rank(orderBy: ExpressionImpl | string | Array<ExpressionImpl | string>, descending?: boolean): RankBuilder;
|
|
62
|
+
/**
|
|
63
|
+
* Builder class for when-then-otherwise conditional expressions
|
|
64
|
+
*/
|
|
65
|
+
export declare class WhenThenBuilder {
|
|
66
|
+
private readonly clauses;
|
|
67
|
+
private readonly currentWhen?;
|
|
68
|
+
private constructor();
|
|
69
|
+
static start(condition: ExpressionImpl): WhenThenBuilder;
|
|
70
|
+
when(condition: ExpressionImpl): WhenThenBuilder;
|
|
71
|
+
then(value: ExpressionImpl | LiteralValue): WhenThenBuilder;
|
|
72
|
+
otherwise(value: ExpressionImpl | LiteralValue): WhenThenOtherwiseExpressionImpl;
|
|
73
|
+
}
|
|
74
|
+
export declare class RankBuilder {
|
|
75
|
+
private readonly orderBy;
|
|
76
|
+
private readonly descending;
|
|
77
|
+
constructor(orderBy: ExpressionImpl[], descending: boolean);
|
|
78
|
+
over(partitionBy: ExpressionImpl | string | Array<ExpressionImpl | string>): RankExpressionImpl;
|
|
79
|
+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G;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,cAAc,CAMzF;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,SAAS,EAAE,cAAc,GAAG,eAAe,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,EAAE,UAAU,UAAQ,GAAG,WAAW,CAGvH;AAED;;GAEG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAF/B,OAAO;IAKP,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,cAAc,GAAG,eAAe;IAKxD,IAAI,CAAC,SAAS,EAAE,cAAc,GAAG,eAAe;IAMhD,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,GAAG,eAAe;IAQ3D,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,GAAG,+BAA+B;CAQjF;AAGD,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,OAAO,EAAE,cAAc,EAAE,EACzB,UAAU,EAAE,OAAO;IAGtC,IAAI,CAAC,WAAW,EAAE,cAAc,GAAG,MAAM,GAAG,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,kBAAkB;CAIhG"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { ColumnExpressionImpl, LiteralExpressionImpl, LogicalExpressionImpl, StringConcatExpressionImpl, MinMaxExpressionImpl, WhenThenOtherwiseExpressionImpl, RankExpressionImpl, ExpressionImpl } from './expressions.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Factory functions for creating expressions - mirrors Tengo pt library API
|
|
5
|
+
*/
|
|
6
|
+
// Internal helpers mirroring Tengo behavior
|
|
7
|
+
function isExpression(v) {
|
|
8
|
+
return v instanceof ExpressionImpl;
|
|
9
|
+
}
|
|
10
|
+
function asExprFromString(value, interpretation) {
|
|
11
|
+
return interpretation === 'col' ? col(value) : lit(value);
|
|
12
|
+
}
|
|
13
|
+
function coerceToExpressionList(items, interpretationForString) {
|
|
14
|
+
const arr = Array.isArray(items) ? items : [items];
|
|
15
|
+
return arr.map((it) => (typeof it === 'string' ? asExprFromString(it, interpretationForString) : it));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create a column reference expression
|
|
19
|
+
* @param name Column name
|
|
20
|
+
*/
|
|
21
|
+
function col(name) {
|
|
22
|
+
return new ColumnExpressionImpl(name);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a literal value expression
|
|
26
|
+
* @param value Literal value (number, string, boolean, null, etc.)
|
|
27
|
+
*/
|
|
28
|
+
function lit(value) {
|
|
29
|
+
return new LiteralExpressionImpl(value);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create an AND expression with multiple operands (horizontal AND)
|
|
33
|
+
* @param expressions Array of expressions to AND together
|
|
34
|
+
*/
|
|
35
|
+
function allHorizontal(...expressions) {
|
|
36
|
+
// Interpret string args as column names. We don't flatten nested ANDs to keep implementation simple.
|
|
37
|
+
const processed = expressions.map((e) => (typeof e === 'string' ? col(e) : e));
|
|
38
|
+
return new LogicalExpressionImpl('and', processed);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create an OR expression with multiple operands (horizontal OR)
|
|
42
|
+
* @param expressions Array of expressions to OR together
|
|
43
|
+
*/
|
|
44
|
+
function anyHorizontal(...expressions) {
|
|
45
|
+
// Interpret string args as column names. We don't flatten nested ORs to keep implementation simple.
|
|
46
|
+
const processed = expressions.map((e) => (typeof e === 'string' ? col(e) : e));
|
|
47
|
+
return new LogicalExpressionImpl('or', processed);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create an AND expression with multiple operands
|
|
51
|
+
* @param expressions Array of expressions to AND together
|
|
52
|
+
*/
|
|
53
|
+
function and(...expressions) {
|
|
54
|
+
return allHorizontal(...expressions);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Create an OR expression with multiple operands
|
|
58
|
+
* @param expressions Array of expressions to OR together
|
|
59
|
+
*/
|
|
60
|
+
function or(...expressions) {
|
|
61
|
+
return anyHorizontal(...expressions);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Concatenate string representations with optional delimiter (Tengo: concatStr)
|
|
65
|
+
* String inputs are treated as literals.
|
|
66
|
+
*/
|
|
67
|
+
function concatStr(expressions, options) {
|
|
68
|
+
if (!Array.isArray(expressions) || expressions.length === 0) {
|
|
69
|
+
throw new Error('concatStr requires a non-empty array of expressions');
|
|
70
|
+
}
|
|
71
|
+
const ops = coerceToExpressionList(expressions, 'lit');
|
|
72
|
+
const delimiter = options?.delimiter ?? '';
|
|
73
|
+
return new StringConcatExpressionImpl(ops, delimiter);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.
|
|
77
|
+
*/
|
|
78
|
+
function minHorizontal(expressions) {
|
|
79
|
+
if (!Array.isArray(expressions) || expressions.length === 0) {
|
|
80
|
+
throw new Error('minHorizontal requires a non-empty array of expressions');
|
|
81
|
+
}
|
|
82
|
+
const ops = coerceToExpressionList(expressions, 'col');
|
|
83
|
+
return new MinMaxExpressionImpl('min', ops);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.
|
|
87
|
+
*/
|
|
88
|
+
function maxHorizontal(expressions) {
|
|
89
|
+
if (!Array.isArray(expressions) || expressions.length === 0) {
|
|
90
|
+
throw new Error('maxHorizontal requires a non-empty array of expressions');
|
|
91
|
+
}
|
|
92
|
+
const ops = coerceToExpressionList(expressions, 'col');
|
|
93
|
+
return new MinMaxExpressionImpl('max', ops);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Create a conditional when-then expression builder
|
|
97
|
+
* @param condition Boolean expression condition
|
|
98
|
+
*/
|
|
99
|
+
function when(condition) {
|
|
100
|
+
return WhenThenBuilder.start(condition);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Create a rank expression
|
|
104
|
+
* @param expression Expression to rank
|
|
105
|
+
* @param options Ranking options
|
|
106
|
+
*/
|
|
107
|
+
function rank(orderBy, descending = false) {
|
|
108
|
+
const orderByList = coerceToExpressionList(orderBy, 'col');
|
|
109
|
+
return new RankBuilder(orderByList, descending);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Builder class for when-then-otherwise conditional expressions
|
|
113
|
+
*/
|
|
114
|
+
class WhenThenBuilder {
|
|
115
|
+
clauses;
|
|
116
|
+
currentWhen;
|
|
117
|
+
constructor(clauses, currentWhen) {
|
|
118
|
+
this.clauses = clauses;
|
|
119
|
+
this.currentWhen = currentWhen;
|
|
120
|
+
}
|
|
121
|
+
static start(condition) {
|
|
122
|
+
if (!isExpression(condition))
|
|
123
|
+
throw new Error('when() expects an Expression');
|
|
124
|
+
return new WhenThenBuilder([], condition);
|
|
125
|
+
}
|
|
126
|
+
when(condition) {
|
|
127
|
+
if (this.currentWhen)
|
|
128
|
+
throw new Error('.when() must follow a .then()');
|
|
129
|
+
if (!isExpression(condition))
|
|
130
|
+
throw new Error('.when() expects an Expression');
|
|
131
|
+
return new WhenThenBuilder(this.clauses, condition);
|
|
132
|
+
}
|
|
133
|
+
then(value) {
|
|
134
|
+
if (!this.currentWhen)
|
|
135
|
+
throw new Error('.then() must follow a .when()');
|
|
136
|
+
const expr = isExpression(value) ? value : lit(value);
|
|
137
|
+
const nextClauses = this.clauses.slice();
|
|
138
|
+
nextClauses.push({ when: this.currentWhen, then: expr });
|
|
139
|
+
return new WhenThenBuilder(nextClauses, undefined);
|
|
140
|
+
}
|
|
141
|
+
otherwise(value) {
|
|
142
|
+
if (this.currentWhen)
|
|
143
|
+
throw new Error('.otherwise() must follow a .then()');
|
|
144
|
+
if (this.clauses.length === 0) {
|
|
145
|
+
throw new Error('At least one .when().then() clause is required before .otherwise()');
|
|
146
|
+
}
|
|
147
|
+
const expr = isExpression(value) ? value : lit(value);
|
|
148
|
+
return new WhenThenOtherwiseExpressionImpl(this.clauses, expr);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Rank builder and expression
|
|
152
|
+
class RankBuilder {
|
|
153
|
+
orderBy;
|
|
154
|
+
descending;
|
|
155
|
+
constructor(orderBy, descending) {
|
|
156
|
+
this.orderBy = orderBy;
|
|
157
|
+
this.descending = descending;
|
|
158
|
+
}
|
|
159
|
+
over(partitionBy) {
|
|
160
|
+
const partitionByList = coerceToExpressionList(partitionBy, 'col');
|
|
161
|
+
return new RankExpressionImpl(this.orderBy, partitionByList, this.descending);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { RankBuilder, WhenThenBuilder, allHorizontal, and, anyHorizontal, col, concatStr, lit, maxHorizontal, minHorizontal, or, rank, when };
|
|
166
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sources":["../src/functions.ts"],"sourcesContent":["/**\n * Factory functions for creating expressions - mirrors Tengo pt library API\n */\n\nimport type { LiteralValue } from './expressions';\nimport { ColumnExpressionImpl, ExpressionImpl, LiteralExpressionImpl, LogicalExpressionImpl, MinMaxExpressionImpl, RankExpressionImpl, StringConcatExpressionImpl, WhenThenOtherwiseExpressionImpl } from './expressions';\n\n// Internal helpers mirroring Tengo behavior\nfunction isExpression(v: unknown): v is ExpressionImpl {\n return v instanceof ExpressionImpl;\n}\n\nfunction asExprFromString(value: string, interpretation: 'col' | 'lit'): ExpressionImpl {\n return interpretation === 'col' ? col(value) : lit(value);\n}\n\nfunction coerceToExpressionList(\n items: Array<ExpressionImpl | string> | ExpressionImpl | string,\n interpretationForString: 'col' | 'lit',\n): ExpressionImpl[] {\n const arr = Array.isArray(items) ? items : [items];\n return arr.map((it) => (typeof it === 'string' ? asExprFromString(it, interpretationForString) : it));\n}\n\n/**\n * Create a column reference expression\n * @param name Column name\n */\nexport function col(name: string): ColumnExpressionImpl {\n return new ColumnExpressionImpl(name);\n}\n\n/**\n * Create a literal value expression\n * @param value Literal value (number, string, boolean, null, etc.)\n */\nexport function lit(value: LiteralValue): LiteralExpressionImpl {\n return new LiteralExpressionImpl(value);\n}\n\n/**\n * Create an AND expression with multiple operands (horizontal AND)\n * @param expressions Array of expressions to AND together\n */\nexport function allHorizontal(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n // Interpret string args as column names. We don't flatten nested ANDs to keep implementation simple.\n const processed: ExpressionImpl[] = expressions.map((e) => (typeof e === 'string' ? col(e) : e));\n return new LogicalExpressionImpl('and', processed);\n}\n\n/**\n * Create an OR expression with multiple operands (horizontal OR)\n * @param expressions Array of expressions to OR together\n */\nexport function anyHorizontal(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n // Interpret string args as column names. We don't flatten nested ORs to keep implementation simple.\n const processed: ExpressionImpl[] = expressions.map((e) => (typeof e === 'string' ? col(e) : e));\n return new LogicalExpressionImpl('or', processed);\n}\n\n/**\n * Create an AND expression with multiple operands\n * @param expressions Array of expressions to AND together\n */\nexport function and(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n return allHorizontal(...expressions);\n}\n\n/**\n * Create an OR expression with multiple operands\n * @param expressions Array of expressions to OR together\n */\nexport function or(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n return anyHorizontal(...expressions);\n}\n\n/**\n * Concatenate string representations with optional delimiter (Tengo: concatStr)\n * String inputs are treated as literals.\n */\nexport function concatStr(\n expressions: Array<ExpressionImpl | string>,\n options?: { delimiter?: string },\n): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error('concatStr requires a non-empty array of expressions');\n }\n const ops = coerceToExpressionList(expressions, 'lit');\n const delimiter = options?.delimiter ?? '';\n return new StringConcatExpressionImpl(ops, delimiter);\n}\n\n/**\n * Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.\n */\nexport function minHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error('minHorizontal requires a non-empty array of expressions');\n }\n\n const ops = coerceToExpressionList(expressions, 'col');\n return new MinMaxExpressionImpl('min', ops);\n}\n\n/**\n * Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.\n */\nexport function maxHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error('maxHorizontal requires a non-empty array of expressions');\n }\n const ops = coerceToExpressionList(expressions, 'col');\n return new MinMaxExpressionImpl('max', ops);\n}\n\n/**\n * Create a conditional when-then expression builder\n * @param condition Boolean expression condition\n */\nexport function when(condition: ExpressionImpl): WhenThenBuilder {\n return WhenThenBuilder.start(condition);\n}\n\n/**\n * Create a rank expression\n * @param expression Expression to rank\n * @param options Ranking options\n */\nexport function rank(orderBy: ExpressionImpl | string | Array<ExpressionImpl | string>, descending = false): RankBuilder {\n const orderByList = coerceToExpressionList(orderBy, 'col');\n return new RankBuilder(orderByList, descending);\n}\n\n/**\n * Builder class for when-then-otherwise conditional expressions\n */\nexport class WhenThenBuilder {\n private constructor(\n private readonly clauses: Array<{ when: ExpressionImpl; then: ExpressionImpl }>,\n private readonly currentWhen?: ExpressionImpl,\n ) {}\n\n static start(condition: ExpressionImpl): WhenThenBuilder {\n if (!isExpression(condition)) throw new Error('when() expects an Expression');\n return new WhenThenBuilder([], condition);\n }\n\n when(condition: ExpressionImpl): WhenThenBuilder {\n if (this.currentWhen) throw new Error('.when() must follow a .then()');\n if (!isExpression(condition)) throw new Error('.when() expects an Expression');\n return new WhenThenBuilder(this.clauses, condition);\n }\n\n then(value: ExpressionImpl | LiteralValue): WhenThenBuilder {\n if (!this.currentWhen) throw new Error('.then() must follow a .when()');\n const expr = isExpression(value) ? value : lit(value);\n const nextClauses = this.clauses.slice();\n nextClauses.push({ when: this.currentWhen, then: expr });\n return new WhenThenBuilder(nextClauses, undefined);\n }\n\n otherwise(value: ExpressionImpl | LiteralValue): WhenThenOtherwiseExpressionImpl {\n if (this.currentWhen) throw new Error('.otherwise() must follow a .then()');\n if (this.clauses.length === 0) {\n throw new Error('At least one .when().then() clause is required before .otherwise()');\n }\n const expr = isExpression(value) ? value : lit(value);\n return new WhenThenOtherwiseExpressionImpl(this.clauses, expr);\n }\n}\n\n// Rank builder and expression\nexport class RankBuilder {\n constructor(\n private readonly orderBy: ExpressionImpl[],\n private readonly descending: boolean,\n ) {}\n\n over(partitionBy: ExpressionImpl | string | Array<ExpressionImpl | string>): RankExpressionImpl {\n const partitionByList = coerceToExpressionList(partitionBy, 'col');\n return new RankExpressionImpl(this.orderBy, partitionByList, this.descending);\n }\n}\n"],"names":[],"mappings":";;AAAA;;AAEG;AAKH;AACA,SAAS,YAAY,CAAC,CAAU,EAAA;IAC9B,OAAO,CAAC,YAAY,cAAc;AACpC;AAEA,SAAS,gBAAgB,CAAC,KAAa,EAAE,cAA6B,EAAA;AACpE,IAAA,OAAO,cAAc,KAAK,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC;AAC3D;AAEA,SAAS,sBAAsB,CAC7B,KAA+D,EAC/D,uBAAsC,EAAA;AAEtC,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;AAClD,IAAA,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,OAAO,EAAE,KAAK,QAAQ,GAAG,gBAAgB,CAAC,EAAE,EAAE,uBAAuB,CAAC,GAAG,EAAE,CAAC,CAAC;AACvG;AAEA;;;A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