data-finder-ts 0.1.4 → 0.1.5
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/{chunk-4JVW4TAB.js → chunk-BGEX377Q.js} +58 -8
- package/dist/chunk-BGEX377Q.js.map +1 -0
- package/dist/chunk-BKPWV3OF.js +962 -0
- package/dist/chunk-BKPWV3OF.js.map +1 -0
- package/dist/{chunk-PMPLCEWQ.js → chunk-GPHWC533.js} +2 -2
- package/dist/{chunk-FJYA2ASS.js → chunk-KAK75RVS.js} +74 -12
- package/dist/chunk-KAK75RVS.js.map +1 -0
- package/dist/{chunk-4LNZV6EN.js → chunk-MGEL5RWM.js} +206 -78
- package/dist/chunk-MGEL5RWM.js.map +1 -0
- package/dist/chunk-PF6EJZHB.js +1015 -0
- package/dist/chunk-PF6EJZHB.js.map +1 -0
- package/dist/datafinder/attribute.cjs +537 -11
- package/dist/datafinder/attribute.cjs.map +1 -1
- package/dist/datafinder/attribute.d.cts +29 -7
- package/dist/datafinder/attribute.d.ts +29 -7
- package/dist/datafinder/attribute.js +2 -2
- package/dist/datafinder/runner.cjs +1267 -215
- package/dist/datafinder/runner.cjs.map +1 -1
- package/dist/datafinder/runner.d.cts +28 -5
- package/dist/datafinder/runner.d.ts +28 -5
- package/dist/datafinder/runner.js +6 -6
- package/dist/datafinder/sql-generator.cjs +1203 -206
- package/dist/datafinder/sql-generator.cjs.map +1 -1
- package/dist/datafinder/sql-generator.d.cts +19 -5
- package/dist/datafinder/sql-generator.d.ts +19 -5
- package/dist/datafinder/sql-generator.js +9 -5
- package/dist/datafinder/typed-attributes.cjs +693 -88
- package/dist/datafinder/typed-attributes.cjs.map +1 -1
- package/dist/datafinder/typed-attributes.d.cts +3 -242
- package/dist/datafinder/typed-attributes.d.ts +3 -242
- package/dist/datafinder/typed-attributes.js +3 -3
- package/dist/dialect-CogGPm_y.d.cts +38 -0
- package/dist/dialect-aaG1bDi5.d.ts +38 -0
- package/dist/index.cjs +1677 -408
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -5
- package/dist/index.d.ts +109 -5
- package/dist/index.js +321 -11
- package/dist/index.js.map +1 -1
- package/dist/model/milestoning.cjs +529 -0
- package/dist/model/milestoning.cjs.map +1 -1
- package/dist/model/milestoning.js +2 -2
- package/dist/model/relational.cjs +547 -16
- package/dist/model/relational.cjs.map +1 -1
- package/dist/model/relational.d.cts +421 -57
- package/dist/model/relational.d.ts +421 -57
- package/dist/model/relational.js +53 -3
- package/dist/typed-attributes-CUTf_6Ru.d.ts +328 -0
- package/dist/typed-attributes-CdWXq_78.d.cts +328 -0
- package/package.json +3 -2
- package/dist/chunk-4JVW4TAB.js.map +0 -1
- package/dist/chunk-4LNZV6EN.js.map +0 -1
- package/dist/chunk-FJYA2ASS.js.map +0 -1
- package/dist/chunk-MH4XMYVB.js +0 -696
- package/dist/chunk-MH4XMYVB.js.map +0 -1
- package/dist/chunk-UYMOE6YU.js +0 -509
- package/dist/chunk-UYMOE6YU.js.map +0 -1
- /package/dist/{chunk-PMPLCEWQ.js.map → chunk-GPHWC533.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/datafinder/typed-attributes.ts","../../src/model/relational.ts","../../src/datafinder/attribute.ts"],"sourcesContent":["import { Attribute } from './attribute';\nimport {\n ComparisonOperation,\n ComparisonOperator,\n Operation,\n StringConstantOperation,\n FloatConstantOperation,\n IntegerConstantOperation,\n DateConstantOperation,\n DateTimeConstantOperation,\n BooleanConstantOperation,\n DecimalConstantOperation,\n AggregateOperation,\n AggregateOperator,\n ScalarFunction,\n ScalarFunctionOperation,\n DatePart,\n DateExtractOperation,\n DateArithmeticOperation,\n DateDiffOperation,\n JoinTreeNodeOperation,\n} from '../model/relational';\n\nexport class StringAttribute extends Attribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded); }\n\n /** Convert every character to uppercase. */\n toUpperCase(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.UPPER, 'Upper ' + this.displayName());\n }\n /** Convert every character to lowercase. */\n toLowerCase(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.LOWER, 'Lower ' + this.displayName());\n }\n /** Remove leading and trailing whitespace. */\n trim(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.TRIM, 'Trim ' + this.displayName());\n }\n /** Remove leading whitespace. */\n trimStart(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.LTRIM, 'Trim Start ' + this.displayName());\n }\n /** Remove trailing whitespace. */\n trimEnd(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.RTRIM, 'Trim End ' + this.displayName());\n }\n /** Return the number of characters in the string. */\n length(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.LENGTH, 'Length ' + this.displayName());\n }\n /** Return the string with characters in reverse order. */\n reverse(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.REVERSE, 'Reverse ' + this.displayName());\n }\n /** Return the first `n` characters. */\n left(n: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.LEFT, 'Left ' + this.displayName(), n);\n }\n /** Return the last `n` characters. */\n right(n: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.RIGHT, 'Right ' + this.displayName(), n);\n }\n /** Return the string repeated `n` times. */\n repeat(n: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.REPEAT, 'Repeat ' + this.displayName(), n);\n }\n /** Replace all occurrences of `fromStr` with `toStr`. */\n replace(fromStr: string, toStr: string): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.REPLACE, 'Replace ' + this.displayName(), undefined, [fromStr, toStr]);\n }\n /**\n * Extract a portion of the string.\n * `start` is zero-based (following Python convention); `length` is optional.\n */\n substring(start: number, length?: number): ScalarFunctionOperation {\n // Python convention: 0-based start; SQL SUBSTRING is 1-based, so add 1\n const args: (number)[] = length !== undefined ? [start + 1, length] : [start + 1];\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.SUBSTRING, 'Substring ' + this.displayName(), undefined, args);\n }\n\n /** Filter to rows where this attribute equals `value`. */\n eq(value: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new StringConstantOperation(value));\n }\n /** Filter to rows where this attribute does not equal `value`. */\n ne(value: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new StringConstantOperation(value));\n }\n /** Filter to rows where this attribute contains `value` as a substring. */\n contains(value: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LIKE, new StringConstantOperation(`%${value}%`));\n }\n /** Filter to rows where this attribute begins with `prefix`. */\n startsWith(prefix: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LIKE, new StringConstantOperation(`${prefix}%`));\n }\n /** Filter to rows where this attribute ends with `suffix`. */\n endsWith(suffix: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LIKE, new StringConstantOperation(`%${suffix}`));\n }\n /** Filter to rows where this attribute does not contain `value` as a substring. */\n notContains(value: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_LIKE, new StringConstantOperation(`%${value}%`));\n }\n}\n\nexport abstract class NumericAttribute extends Attribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded); }\n\n /** Sum of all values in the group. */\n sum(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.SUM, 'Sum ' + this.displayName());\n }\n /** Smallest value in the group. */\n min(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.MIN, 'Min ' + this.displayName());\n }\n /** Largest value in the group. */\n max(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.MAX, 'Max ' + this.displayName());\n }\n /** Arithmetic mean of all values in the group. */\n average(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.AVERAGE, 'Average ' + this.displayName());\n }\n /** Absolute value (distance from zero, always non-negative). */\n abs(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.ABS, 'Abs ' + this.displayName());\n }\n /** Round up to the nearest integer. */\n ceil(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.CEILING, 'Ceil ' + this.displayName());\n }\n /** Round down to the nearest integer. */\n floor(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.FLOOR, 'Floor ' + this.displayName());\n }\n /** Square root. */\n sqrt(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.SQRT, 'Sqrt ' + this.displayName());\n }\n /** Remainder after dividing by `n`. */\n mod(n: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.MOD, 'Mod ' + this.displayName(), n);\n }\n /** Raise to the power of `n`. */\n power(n: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.POWER, 'Power ' + this.displayName(), n);\n }\n /** Round to `d` decimal places, or to the nearest integer when `d` is omitted. */\n round(d?: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.ROUND, 'Round ' + this.displayName(), d);\n }\n}\n\nexport class DoubleAttribute extends NumericAttribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded); }\n\n /** Filter to rows where this attribute equals `value`. */\n eq(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new FloatConstantOperation(value));\n }\n /** Filter to rows where this attribute does not equal `value`. */\n ne(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new FloatConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than `value`. */\n gt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new FloatConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than `value`. */\n lt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new FloatConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than or equal to `value`. */\n gte(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new FloatConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than or equal to `value`. */\n lte(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN_OR_EQUAL_TO, new FloatConstantOperation(value));\n }\n}\n\nexport const FloatAttribute = DoubleAttribute;\nexport type FloatAttribute = DoubleAttribute;\n\nexport class DecimalAttribute extends NumericAttribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded); }\n\n /** Filter to rows where this attribute equals `value`. */\n eq(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new DecimalConstantOperation(value));\n }\n /** Filter to rows where this attribute does not equal `value`. */\n ne(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new DecimalConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than `value`. */\n gt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new DecimalConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than `value`. */\n lt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new DecimalConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than or equal to `value`. */\n gte(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new DecimalConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than or equal to `value`. */\n lte(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN_OR_EQUAL_TO, new DecimalConstantOperation(value));\n }\n}\n\nexport class IntegerAttribute extends NumericAttribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded); }\n\n /** Filter to rows where this attribute equals `value`. */\n eq(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new IntegerConstantOperation(value));\n }\n /** Filter to rows where this attribute does not equal `value`. */\n ne(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new IntegerConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than `value`. */\n gt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new IntegerConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than `value`. */\n lt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new IntegerConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than or equal to `value`. */\n gte(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new IntegerConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than or equal to `value`. */\n lte(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN_OR_EQUAL_TO, new IntegerConstantOperation(value));\n }\n}\n\nexport class BooleanAttribute extends Attribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded); }\n\n /** Filter to rows where this attribute equals `value`. */\n eq(value: boolean): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new BooleanConstantOperation(value));\n }\n /** Filter to rows where this attribute is true. */\n isTrue(): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new BooleanConstantOperation(true));\n }\n /** Filter to rows where this attribute is false. */\n isFalse(): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new BooleanConstantOperation(false));\n }\n}\n\nfunction parseDate(value: Date | string): Date {\n if (value instanceof Date) return value;\n const d = new Date(value);\n if (isNaN(d.getTime())) throw new Error(`Cannot parse date: ${value}`);\n return d;\n}\n\nexport class DateAttribute extends Attribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded); }\n\n /** Filter to rows where this date equals `value`. */\n eq(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new DateConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this date does not equal `value`. */\n ne(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new DateConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this date is after `value`. */\n gt(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new DateConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this date is before `value`. */\n lt(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new DateConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this date is on or after `value`. */\n gte(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new DateConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this date is on or before `value`. */\n lte(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN_OR_EQUAL_TO, new DateConstantOperation(parseDate(value)));\n }\n\n /** Extract the four-digit calendar year. */\n year(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.YEAR, 'Year ' + this.displayName()); }\n /** Extract the month number (1–12). */\n month(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.MONTH, 'Month ' + this.displayName()); }\n /** Extract the day of the month (1–31). */\n day(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DAY, 'Day ' + this.displayName()); }\n /** Extract the quarter (1–4). */\n quarter(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.QUARTER, 'Quarter ' + this.displayName()); }\n /** Extract the ISO week number (1–53). */\n week(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.WEEK, 'Week ' + this.displayName()); }\n /** Extract the day of the week (0 = Sunday through 6 = Saturday). */\n dayOfWeek(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DOW, 'Day Of Week ' + this.displayName()); }\n\n /** Add `n` days to this date. */\n addDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, true, 'Add Days ' + this.displayName()); }\n /** Add `n` months to this date. */\n addMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, true, 'Add Months ' + this.displayName()); }\n /** Add `n` years to this date. */\n addYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, true, 'Add Years ' + this.displayName()); }\n /** Subtract `n` days from this date. */\n subtractDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, false, 'Subtract Days ' + this.displayName()); }\n /** Subtract `n` months from this date. */\n subtractMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, false, 'Subtract Months ' + this.displayName()); }\n /** Subtract `n` years from this date. */\n subtractYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, false, 'Subtract Years ' + this.displayName()); }\n\n /** Number of whole days between this date and `other`. */\n diffDays(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.DAY, 'Diff Days ' + this.displayName()); }\n /** Number of whole months between this date and `other`. */\n diffMonths(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.MONTH, 'Diff Months ' + this.displayName()); }\n /** Number of whole years between this date and `other`. */\n diffYears(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.YEAR, 'Diff Years ' + this.displayName()); }\n}\n\nexport class DateTimeAttribute extends Attribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded); }\n\n /** Filter to rows where this timestamp equals `value`. */\n eq(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new DateTimeConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this timestamp does not equal `value`. */\n ne(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new DateTimeConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this timestamp is after `value`. */\n gt(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new DateTimeConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this timestamp is before `value`. */\n lt(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new DateTimeConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this timestamp is on or after `value`. */\n gte(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new DateTimeConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this timestamp is on or before `value`. */\n lte(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN_OR_EQUAL_TO, new DateTimeConstantOperation(parseDate(value)));\n }\n\n /** Extract the four-digit calendar year. */\n year(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.YEAR, 'Year ' + this.displayName()); }\n /** Extract the month number (1–12). */\n month(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.MONTH, 'Month ' + this.displayName()); }\n /** Extract the day of the month (1–31). */\n day(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DAY, 'Day ' + this.displayName()); }\n /** Extract the hour (0–23). */\n hour(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.HOUR, 'Hour ' + this.displayName()); }\n /** Extract the minute (0–59). */\n minute(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.MINUTE, 'Minute ' + this.displayName()); }\n /** Extract the second (0–59). */\n second(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.SECOND, 'Second ' + this.displayName()); }\n /** Extract the quarter (1–4). */\n quarter(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.QUARTER, 'Quarter ' + this.displayName()); }\n /** Extract the ISO week number (1–53). */\n week(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.WEEK, 'Week ' + this.displayName()); }\n /** Extract the day of the week (0 = Sunday through 6 = Saturday). */\n dayOfWeek(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DOW, 'Day Of Week ' + this.displayName()); }\n\n /** Add `n` days to this timestamp. */\n addDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, true, 'Add Days ' + this.displayName()); }\n /** Add `n` months to this timestamp. */\n addMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, true, 'Add Months ' + this.displayName()); }\n /** Add `n` years to this timestamp. */\n addYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, true, 'Add Years ' + this.displayName()); }\n /** Add `n` hours to this timestamp. */\n addHours(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.HOUR, true, 'Add Hours ' + this.displayName()); }\n /** Add `n` minutes to this timestamp. */\n addMinutes(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MINUTE, true, 'Add Minutes ' + this.displayName()); }\n /** Add `n` seconds to this timestamp. */\n addSeconds(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.SECOND, true, 'Add Seconds ' + this.displayName()); }\n /** Subtract `n` days from this timestamp. */\n subtractDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, false, 'Subtract Days ' + this.displayName()); }\n /** Subtract `n` months from this timestamp. */\n subtractMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, false, 'Subtract Months ' + this.displayName()); }\n /** Subtract `n` years from this timestamp. */\n subtractYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, false, 'Subtract Years ' + this.displayName()); }\n /** Subtract `n` hours from this timestamp. */\n subtractHours(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.HOUR, false, 'Subtract Hours ' + this.displayName()); }\n /** Subtract `n` minutes from this timestamp. */\n subtractMinutes(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MINUTE, false, 'Subtract Minutes ' + this.displayName()); }\n /** Subtract `n` seconds from this timestamp. */\n subtractSeconds(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.SECOND, false, 'Subtract Seconds ' + this.displayName()); }\n\n /** Number of whole days between this timestamp and `other`. */\n diffDays(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.DAY, 'Diff Days ' + this.displayName()); }\n /** Number of whole months between this timestamp and `other`. */\n diffMonths(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.MONTH, 'Diff Months ' + this.displayName()); }\n /** Number of whole years between this timestamp and `other`. */\n diffYears(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.YEAR, 'Diff Years ' + this.displayName()); }\n /** Number of whole hours between this timestamp and `other`. */\n diffHours(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.HOUR, 'Diff Hours ' + this.displayName()); }\n /** Number of whole minutes between this timestamp and `other`. */\n diffMinutes(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.MINUTE, 'Diff Minutes ' + this.displayName()); }\n /** Number of whole seconds between this timestamp and `other`. */\n diffSeconds(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.SECOND, 'Diff Seconds ' + this.displayName()); }\n}\n","export enum ComparisonOperator {\n EQUAL = 'EQUAL',\n NOT_EQUAL = 'NOT_EQUAL',\n LESS_THAN = 'LESS_THAN',\n GREATER_THAN = 'GREATER_THAN',\n LESS_THAN_OR_EQUAL_TO = 'LESS_THAN_OR_EQUAL_TO',\n GREATER_THAN_OR_EQUAL_TO = 'GREATER_THAN_OR_EQUAL_TO',\n LIKE = 'LIKE',\n NOT_LIKE = 'NOT_LIKE',\n}\n\nexport enum LogicalOperator {\n AND = 'AND',\n OR = 'OR',\n}\n\nexport enum AggregateOperator {\n COUNT = 'COUNT',\n SUM = 'SUM',\n MIN = 'MIN',\n MAX = 'MAX',\n AVERAGE = 'AVERAGE',\n}\n\nexport enum ScalarFunction {\n ABS = 'ABS',\n CEILING = 'CEILING',\n FLOOR = 'FLOOR',\n MOD = 'MOD',\n POWER = 'POWER',\n SQRT = 'SQRT',\n ROUND = 'ROUND',\n UPPER = 'UPPER',\n LOWER = 'LOWER',\n TRIM = 'TRIM',\n LTRIM = 'LTRIM',\n RTRIM = 'RTRIM',\n LENGTH = 'LENGTH',\n REVERSE = 'REVERSE',\n LEFT = 'LEFT',\n RIGHT = 'RIGHT',\n REPEAT = 'REPEAT',\n REPLACE = 'REPLACE',\n SUBSTRING = 'SUBSTRING',\n}\n\nexport enum DatePart {\n YEAR = 'YEAR',\n MONTH = 'MONTH',\n DAY = 'DAY',\n HOUR = 'HOUR',\n MINUTE = 'MINUTE',\n SECOND = 'SECOND',\n QUARTER = 'QUARTER',\n WEEK = 'WEEK',\n DOW = 'DOW',\n}\n\nexport enum SortDirection {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport abstract class RelationalOperationElement {}\n\nexport abstract class Operation extends RelationalOperationElement {\n andOp(other: RelationalOperationElement): Operation {\n return new LogicalOperation(this, LogicalOperator.AND, other);\n }\n}\n\nexport class NoOperation extends Operation {\n andOp(other: RelationalOperationElement): Operation {\n return other as Operation;\n }\n}\n\nexport abstract class ConstantOperation extends RelationalOperationElement {}\n\nexport class IntegerConstantOperation extends ConstantOperation {\n constructor(readonly value: number) { super(); }\n}\n\nexport class FloatConstantOperation extends ConstantOperation {\n constructor(readonly value: number) { super(); }\n}\n\nexport class StringConstantOperation extends ConstantOperation {\n constructor(readonly value: string) { super(); }\n}\n\nexport class DateConstantOperation extends ConstantOperation {\n constructor(readonly value: Date) { super(); }\n}\n\nexport class DateTimeConstantOperation extends ConstantOperation {\n constructor(readonly value: Date) { super(); }\n}\n\nexport class DecimalConstantOperation extends ConstantOperation {\n constructor(readonly value: number) { super(); }\n}\n\nexport class BooleanConstantOperation extends ConstantOperation {\n constructor(readonly value: boolean) { super(); }\n}\n\nexport abstract class UnaryOperation extends Operation {\n constructor(readonly element: RelationalOperationElement) { super(); }\n}\n\nexport abstract class BinaryOperation extends Operation {\n constructor(\n readonly left: RelationalOperationElement,\n readonly right: RelationalOperationElement,\n ) { super(); }\n}\n\nexport class IsNullOperation extends UnaryOperation {}\n\nexport class IsNotNullOperation extends UnaryOperation {}\n\nexport class ComparisonOperation extends BinaryOperation {\n constructor(\n left: RelationalOperationElement,\n readonly operator: ComparisonOperator,\n right: RelationalOperationElement,\n ) { super(left, right); }\n}\n\nexport class LogicalOperation extends BinaryOperation {\n constructor(\n left: RelationalOperationElement,\n readonly operator: LogicalOperator,\n right: RelationalOperationElement,\n ) { super(left, right); }\n}\n\nexport class WindowSpecification {\n constructor(\n readonly partitionBy: RelationalOperationElement[] = [],\n readonly orderBy: SortOperation[] = [],\n ) {}\n}\n\nexport class AggregateOperation extends UnaryOperation {\n constructor(\n element: RelationalOperationElement,\n readonly operator: AggregateOperator,\n readonly displayName?: string,\n readonly window?: WindowSpecification,\n ) { super(element); }\n\n over(partitionBy?: RelationalOperationElement[], orderBy?: SortOperation[]): AggregateOperation {\n return new AggregateOperation(this.element, this.operator, this.displayName,\n new WindowSpecification(partitionBy ?? [], orderBy ?? []));\n }\n}\n\nexport enum WindowFunction {\n ROW_NUMBER = 'ROW_NUMBER',\n RANK = 'RANK',\n DENSE_RANK = 'DENSE_RANK',\n NTILE = 'NTILE',\n LAG = 'LAG',\n LEAD = 'LEAD',\n FIRST_VALUE = 'FIRST_VALUE',\n LAST_VALUE = 'LAST_VALUE',\n CUME_DIST = 'CUME_DIST',\n PERCENT_RANK = 'PERCENT_RANK',\n}\n\nexport class WindowFunctionOperation extends UnaryOperation {\n constructor(\n element: RelationalOperationElement | null,\n readonly func: WindowFunction,\n readonly displayName?: string,\n readonly secondArg?: number,\n readonly extraArgs: (string | number)[] = [],\n readonly window?: WindowSpecification,\n ) { super(element as RelationalOperationElement); }\n\n over(partitionBy?: RelationalOperationElement[], orderBy?: SortOperation[]): WindowFunctionOperation {\n return new WindowFunctionOperation(this.element, this.func, this.displayName, this.secondArg,\n [...this.extraArgs], new WindowSpecification(partitionBy ?? [], orderBy ?? []));\n }\n}\n\nexport class ScalarFunctionOperation extends UnaryOperation {\n constructor(\n element: RelationalOperationElement,\n readonly func: ScalarFunction,\n readonly displayName?: string,\n readonly secondArg?: number,\n readonly extraArgs: (string | number)[] = [],\n ) { super(element); }\n}\n\nexport class DateExtractOperation extends UnaryOperation {\n constructor(\n element: RelationalOperationElement,\n readonly part: DatePart,\n readonly displayName?: string,\n ) { super(element); }\n}\n\nexport class DateArithmeticOperation extends UnaryOperation {\n constructor(\n element: RelationalOperationElement,\n readonly n: number,\n readonly unit: DatePart,\n readonly isAdd: boolean = true,\n readonly displayName?: string,\n ) { super(element); }\n}\n\nexport class DateDiffOperation extends UnaryOperation {\n constructor(\n element: RelationalOperationElement,\n readonly other: Date,\n readonly unit: DatePart,\n readonly displayName?: string,\n ) { super(element); }\n}\n\nexport class Column extends RelationalOperationElement {\n table?: Table;\n\n constructor(\n readonly name: string,\n readonly type: string,\n readonly owner?: string,\n readonly primaryKey: boolean = false,\n ) { super(); }\n}\n\nexport class ForeignKey {\n constructor(readonly column: Column, readonly references: Column) {}\n}\n\nexport abstract class DataStore {\n readonly schemas: Schema[] = [];\n\n constructor(readonly name: string) {}\n\n abstract namespace(schemaName: string): string;\n}\n\nexport class Database extends DataStore {\n constructor(name: string, readonly location?: string) { super(name); }\n\n namespace(schemaName: string): string { return schemaName; }\n}\n\nexport class DataCatalog extends DataStore {\n constructor(name: string) { super(name); }\n\n namespace(schemaName: string): string { return `${this.name}.${schemaName}`; }\n}\n\nexport class Schema {\n readonly tables: Table[] = [];\n\n constructor(readonly name: string, readonly datastore?: DataStore) {\n datastore?.schemas.push(this);\n }\n}\n\nexport class Table {\n private readonly _columnsByName: Map<string, Column> = new Map();\n readonly foreignKeys: ForeignKey[] = [];\n\n constructor(readonly name: string, columns: Column[], readonly schema?: Schema) {\n for (const col of columns) {\n if (this._columnsByName.has(col.name)) {\n throw new Error(`Duplicate column name '${col.name}' in table '${name}'`);\n }\n this._columnsByName.set(col.name, col);\n col.table = this;\n }\n schema?.tables.push(this);\n }\n\n get columns(): Column[] {\n return Array.from(this._columnsByName.values());\n }\n\n get qualifiedName(): string {\n if (!this.schema) return this.name;\n if (!this.schema.datastore) return `${this.schema.name}.${this.name}`;\n return `${this.schema.datastore.namespace(this.schema.name)}.${this.name}`;\n }\n}\n\nexport class JoinOperation {\n filter?: RelationalOperationElement;\n /** Property-equality filters on the join target (property id -> value), set by a related finder given a filter. */\n filterKwargs: Record<string, unknown> = {};\n /** Maps property ids to [column, type, table] for `filterKwargs`. */\n filterColumnMap: Record<string, [string, string, string]> = {};\n\n constructor(\n readonly name: string,\n readonly target: Table,\n readonly left: Column,\n readonly right: Column,\n filter?: RelationalOperationElement,\n ) {\n this.filter = filter;\n }\n}\n\nexport class JoinTreeNodeOperation {\n constructor(\n readonly join: JoinOperation,\n readonly parent?: JoinTreeNodeOperation,\n ) {}\n}\n\nexport class ColumnWithJoin extends RelationalOperationElement {\n /**\n * `embedded` is an alternate reference to a flat (denormalized) column on the owning table that\n * holds the same value without the join; the SQL generator uses it when the join can be elided.\n */\n constructor(\n readonly column: Column,\n readonly parent?: JoinTreeNodeOperation,\n readonly embedded?: ColumnWithJoin,\n ) { super(); }\n}\n\nexport class SortOperation {\n constructor(\n readonly column: ColumnWithJoin,\n readonly direction: SortDirection,\n ) {}\n}\n\nexport class CountAllOperation extends RelationalOperationElement {\n constructor(readonly table: string) { super(); }\n}\n\nexport class Alias extends RelationalOperationElement {\n constructor(readonly element: RelationalOperationElement, readonly name: string) { super(); }\n}\n\n/** Returned by `RelatedFinder.exists()`. A backend translates it to a join-presence check. */\nexport class ExistsOperation extends RelationalOperationElement {\n constructor(readonly node: JoinTreeNodeOperation) { super(); }\n\n andOp(other: RelationalOperationElement): LogicalOperation {\n return new LogicalOperation(this, LogicalOperator.AND, other);\n }\n}\n\n/** Returned by `RelatedFinder.notExists()`. A backend translates it to a join-absence check. */\nexport class NotExistsOperation extends RelationalOperationElement {\n constructor(readonly node: JoinTreeNodeOperation) { super(); }\n\n andOp(other: RelationalOperationElement): LogicalOperation {\n return new LogicalOperation(this, LogicalOperator.AND, other);\n }\n}\n\nexport class SelectOperation {\n constructor(\n readonly display: RelationalOperationElement[],\n readonly filter: RelationalOperationElement,\n readonly orderBy: SortOperation[] = [],\n readonly groupBy: RelationalOperationElement[] = [],\n readonly limit?: number,\n readonly table?: Table,\n /**\n * Extra ON conditions for this query's joins (milestoning and property filters), keyed by join node.\n * Held here rather than on the shared JoinOperation, so queries that use the same node can't affect each other.\n */\n readonly joinFilters: ReadonlyMap<JoinTreeNodeOperation, Operation> = new Map(),\n ) {}\n}\n","import {\n Column,\n AggregateOperation,\n AggregateOperator,\n ColumnWithJoin,\n SortOperation,\n SortDirection,\n IsNullOperation,\n IsNotNullOperation,\n JoinTreeNodeOperation,\n WindowFunction,\n WindowFunctionOperation,\n WindowSpecification,\n} from '../model/relational';\n\nexport abstract class Attribute {\n private readonly _displayName: string;\n private readonly _column: Column;\n private readonly _owner: string;\n private readonly _parent?: JoinTreeNodeOperation;\n private readonly _embedded?: Attribute;\n\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n ) {\n this._displayName = displayName;\n this._column = new Column(columnName, columnDbType, owner);\n this._owner = owner;\n this._parent = parent;\n this._embedded = embedded;\n }\n\n column(): Column { return this._column; }\n owner(): string { return this._owner; }\n parent(): JoinTreeNodeOperation | undefined { return this._parent; }\n displayName(): string { return this._displayName; }\n\n /** Alternate attribute on a flat column of the owning table, used in place of this one when its join is elided. */\n embedded(): Attribute | undefined { return this._embedded; }\n\n cwj(): ColumnWithJoin {\n return new ColumnWithJoin(this._column, this._parent, this._embedded?.cwj());\n }\n\n /** Count the number of non-null values. Use in a projection with `groupByOp` to aggregate per group. */\n count(): AggregateOperation {\n return new AggregateOperation(\n this.cwj(),\n AggregateOperator.COUNT,\n this._displayName + ' Count',\n );\n }\n\n /** Sort this attribute in ascending order. Pass to `orderByOp` or a window function's `orderBy`. */\n ascending(): SortOperation {\n return new SortOperation(this.cwj(), SortDirection.ASC);\n }\n\n /** Sort this attribute in descending order. Pass to `orderByOp` or a window function's `orderBy`. */\n descending(): SortOperation {\n return new SortOperation(this.cwj(), SortDirection.DESC);\n }\n\n /** Filter to rows where this attribute has no value. */\n isNull(): IsNullOperation {\n return new IsNullOperation(this.cwj());\n }\n\n /** Filter to rows where this attribute has a value. */\n isNotNull(): IsNotNullOperation {\n return new IsNotNullOperation(this.cwj());\n }\n\n private _windowSpec(\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[],\n orderBy?: SortOperation | SortOperation[],\n ): WindowSpecification {\n const pbArr = partitionBy === undefined ? [] : Array.isArray(partitionBy) ? partitionBy : [partitionBy];\n const pb = pbArr.map(x => x instanceof Attribute ? x.cwj() : x);\n const ob = orderBy === undefined ? [] : Array.isArray(orderBy) ? orderBy : [orderBy];\n return new WindowSpecification(pb, ob);\n }\n\n /**\n * Assign a rank to each row within the ordered window, following pandas `Series.rank` conventions.\n *\n * `method` controls tie-breaking (default `'min'`):\n * - `'min'` — tied rows share the lowest rank; the next rank skips.\n * - `'dense'` — like `'min'` but ranks are contiguous (no gaps).\n * - `'first'` — each row gets a unique sequential integer (no ties).\n * - `'max'` — only meaningful with `pct: true` (see below).\n *\n * When `pct: true` the result is a relative rank between 0 and 1:\n * - `method: 'min'` (default) → fraction of values strictly below this row (PERCENT_RANK).\n * - `method: 'max'` → fraction of values at or below this row (cumulative distribution).\n *\n * `partitionBy` restarts the ranking within each group of distinct values.\n */\n rank(opts: {\n method?: 'min' | 'dense' | 'first' | 'max';\n pct?: boolean;\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n const { method = 'min', pct = false, partitionBy, orderBy } = opts;\n let func: WindowFunction;\n let name: string;\n if (pct) {\n if (method === 'max') { func = WindowFunction.CUME_DIST; name = 'Cume Dist'; }\n else { func = WindowFunction.PERCENT_RANK; name = 'Percent Rank'; }\n } else if (method === 'first') { func = WindowFunction.ROW_NUMBER; name = 'Row Number'; }\n else if (method === 'dense') { func = WindowFunction.DENSE_RANK; name = 'Dense Rank'; }\n else { func = WindowFunction.RANK; name = 'Rank'; }\n return new WindowFunctionOperation(null, func, name, undefined, [], this._windowSpec(partitionBy, orderBy));\n }\n\n /**\n * Split rows into `buckets` equal-sized quantile bins ordered by `orderBy`.\n * Each row receives a bucket number from 1 (lowest) to `buckets` (highest).\n * Named after `pandas.qcut`.\n */\n qcut(buckets: number, opts: {\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n return new WindowFunctionOperation(null, WindowFunction.NTILE, 'Quantile', buckets, [],\n this._windowSpec(opts.partitionBy, opts.orderBy));\n }\n\n /**\n * Return the value of this attribute from `periods` rows earlier (positive) or later (negative)\n * within the ordered window, following `pandas.Series.shift`.\n * Rows with no neighbour at the given offset return `null` (or `fillValue` if provided).\n */\n shift(periods = 1, opts: {\n fillValue?: string | number;\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n const extraArgs: (string | number)[] = opts.fillValue !== undefined ? [opts.fillValue] : [];\n const func = periods >= 0 ? WindowFunction.LAG : WindowFunction.LEAD;\n const label = periods >= 0 ? 'Lag' : 'Lead';\n return new WindowFunctionOperation(\n this.cwj(),\n func,\n label + ' ' + this._displayName,\n Math.abs(periods),\n extraArgs,\n this._windowSpec(opts.partitionBy, opts.orderBy),\n );\n }\n\n /**\n * Return the first value of this attribute in the window frame.\n * Use `partitionBy` to restart the frame for each group.\n */\n first(opts: {\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n return new WindowFunctionOperation(\n this.cwj(),\n WindowFunction.FIRST_VALUE,\n 'First ' + this._displayName,\n undefined, [],\n this._windowSpec(opts.partitionBy, opts.orderBy),\n );\n }\n\n /**\n * Return the last value of this attribute in the window frame.\n * Use `partitionBy` to restart the frame for each group.\n */\n last(opts: {\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n return new WindowFunctionOperation(\n this.cwj(),\n WindowFunction.LAST_VALUE,\n 'Last ' + this._displayName,\n undefined, [],\n this._windowSpec(opts.partitionBy, opts.orderBy),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC+DO,IAAe,6BAAf,MAA0C;AAAC;AAE3C,IAAe,YAAf,cAAiC,2BAA2B;AAAA,EACjE,MAAM,OAA8C;AAClD,WAAO,IAAI,iBAAiB,MAAM,iBAAqB,KAAK;AAAA,EAC9D;AACF;AAQO,IAAe,oBAAf,cAAyC,2BAA2B;AAAC;AAErE,IAAM,2BAAN,cAAuC,kBAAkB;AAAA,EAC9D,YAAqB,OAAe;AAAE,UAAM;AAAvB;AAAA,EAA0B;AAAA,EAA1B;AACvB;AAEO,IAAM,yBAAN,cAAqC,kBAAkB;AAAA,EAC5D,YAAqB,OAAe;AAAE,UAAM;AAAvB;AAAA,EAA0B;AAAA,EAA1B;AACvB;AAEO,IAAM,0BAAN,cAAsC,kBAAkB;AAAA,EAC7D,YAAqB,OAAe;AAAE,UAAM;AAAvB;AAAA,EAA0B;AAAA,EAA1B;AACvB;AAEO,IAAM,wBAAN,cAAoC,kBAAkB;AAAA,EAC3D,YAAqB,OAAa;AAAE,UAAM;AAArB;AAAA,EAAwB;AAAA,EAAxB;AACvB;AAEO,IAAM,4BAAN,cAAwC,kBAAkB;AAAA,EAC/D,YAAqB,OAAa;AAAE,UAAM;AAArB;AAAA,EAAwB;AAAA,EAAxB;AACvB;AAEO,IAAM,2BAAN,cAAuC,kBAAkB;AAAA,EAC9D,YAAqB,OAAe;AAAE,UAAM;AAAvB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AAK,IAAI,GAAG,8BAAwB,kBAAkB,KAAK,YAAY,CAAC;AAAA,EAAG;AAAA;AAAA,EAEtJ,YAAY,OAAgC;AAAE,WAAO,IAAI,kBAAkB,KAAK,IAAI,GAAG,8BAAwB,kBAAkB,KAAK,YAAY,CAAC;AAAA,EAAG;AACxJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/datafinder/typed-attributes.ts","../../src/model/relational.ts","../../src/datafinder/attribute.ts","../../src/datafinder/scalar-functions.ts"],"sourcesContent":["import { Attribute, AttributeValue } from './attribute';\nimport { NumericFunctions, StringFunctions } from './scalar-functions';\nimport {\n ComparisonOperation,\n ComparisonOperator,\n StringConstantOperation,\n FloatConstantOperation,\n IntegerConstantOperation,\n DateConstantOperation,\n DateTimeConstantOperation,\n ConstantOperation,\n DateOnly,\n escapeLike,\n applyMixins,\n Arithmetic,\n DATE_ONLY_PATTERN,\n BooleanConstantOperation,\n DecimalConstantOperation,\n AggregateOperation,\n AggregateOperator,\n SortOperation,\n ScalarFunction,\n ScalarFunctionOperation,\n DatePart,\n DateExtractOperation,\n DateTruncOperation,\n DateArithmeticOperation,\n DateDiffOperation,\n JoinTreeNodeOperation,\n ColumnWithJoin,\n sample,\n} from '../model/relational';\n\n/** The smallest and largest value of a group, for a column that can be ordered but not summed. */\nabstract class MinMax {\n abstract cwj(): ColumnWithJoin;\n abstract displayName(): string;\n\n /** Smallest value in the group. */\n min(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.MIN, 'Min ' + this.displayName());\n }\n /** Largest value in the group. */\n max(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.MAX, 'Max ' + this.displayName());\n }\n}\n\nexport class StringAttribute extends Attribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n nullable: boolean = true,\n optional: boolean = false,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional); }\n\n protected toConstant(value: AttributeValue): ConstantOperation {\n return new StringConstantOperation(String(value));\n }\n\n /**\n * Join the values of a group into one text with `separator` between them. `orderBy` is the order they are\n * joined in (`[f.name().ascending()]`); without it the order is not defined. Missing values are skipped.\n */\n join(separator: string = '', orderBy: SortOperation[] = []): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.STRING_AGG, 'Join ' + this.displayName(), undefined, separator, orderBy);\n }\n\n /** Filter to rows where this attribute equals `value`. */\n eq(value: string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new StringConstantOperation(value));\n }\n /** Filter to rows where this attribute does not equal `value`. */\n ne(value: string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new StringConstantOperation(value));\n }\n /** Filter to rows where this attribute contains `value` as a substring. */\n contains(value: string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LIKE, new StringConstantOperation(`%${escapeLike(value)}%`));\n }\n /** Filter to rows where this attribute begins with `prefix`. */\n startsWith(prefix: string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LIKE, new StringConstantOperation(`${escapeLike(prefix)}%`));\n }\n /** Filter to rows where this attribute ends with `suffix`. */\n endsWith(suffix: string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LIKE, new StringConstantOperation(`%${escapeLike(suffix)}`));\n }\n /** Filter to rows where this attribute does not contain `value` as a substring. */\n notContains(value: string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_LIKE, new StringConstantOperation(`%${escapeLike(value)}%`));\n }\n}\n\nexport interface StringAttribute extends MinMax, StringFunctions {}\napplyMixins(StringAttribute, [MinMax, StringFunctions]);\n\nexport abstract class NumericAttribute extends Attribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n nullable: boolean = true,\n optional: boolean = false,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional); }\n\n /** Sum of all values in the group. */\n sum(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.SUM, 'Sum ' + this.displayName());\n }\n /** Arithmetic mean of all values in the group. */\n average(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.AVERAGE, 'Average ' + this.displayName());\n }\n /** Standard deviation of the values in the group: the sample one by default, `ddof = 0` for the population one, as `Series.std`. */\n std(ddof = 1): AggregateOperation {\n const operator = sample(ddof) ? AggregateOperator.STDDEV_SAMP : AggregateOperator.STDDEV_POP;\n return new AggregateOperation(this.cwj(), operator, 'Std ' + this.displayName());\n }\n /** Variance of the values in the group: the sample one by default, `ddof = 0` for the population one, as `Series.var`. */\n var(ddof = 1): AggregateOperation {\n const operator = sample(ddof) ? AggregateOperator.VAR_SAMP : AggregateOperator.VAR_POP;\n return new AggregateOperation(this.cwj(), operator, 'Var ' + this.displayName());\n }\n}\n\nexport interface NumericAttribute extends MinMax, NumericFunctions, Arithmetic {}\napplyMixins(NumericAttribute, [MinMax, NumericFunctions, Arithmetic]);\n\nexport class DoubleAttribute extends NumericAttribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n nullable: boolean = true,\n optional: boolean = false,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional); }\n\n protected toConstant(value: AttributeValue): ConstantOperation {\n return new FloatConstantOperation(Number(value));\n }\n\n /** Filter to rows where this attribute equals `value`. */\n eq(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new FloatConstantOperation(value));\n }\n /** Filter to rows where this attribute does not equal `value`. */\n ne(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new FloatConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than `value`. */\n gt(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new FloatConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than `value`. */\n lt(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new FloatConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than or equal to `value`. */\n gte(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new FloatConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than or equal to `value`. */\n lte(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN_OR_EQUAL_TO, new FloatConstantOperation(value));\n }\n}\n\nexport const FloatAttribute = DoubleAttribute;\nexport type FloatAttribute = DoubleAttribute;\n\nexport class DecimalAttribute extends NumericAttribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n nullable: boolean = true,\n optional: boolean = false,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional); }\n\n protected toConstant(value: AttributeValue): ConstantOperation {\n return new DecimalConstantOperation(Number(value));\n }\n\n /** Filter to rows where this attribute equals `value`. */\n eq(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new DecimalConstantOperation(value));\n }\n /** Filter to rows where this attribute does not equal `value`. */\n ne(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new DecimalConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than `value`. */\n gt(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new DecimalConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than `value`. */\n lt(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new DecimalConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than or equal to `value`. */\n gte(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new DecimalConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than or equal to `value`. */\n lte(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN_OR_EQUAL_TO, new DecimalConstantOperation(value));\n }\n}\n\nexport class IntegerAttribute extends NumericAttribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n nullable: boolean = true,\n optional: boolean = false,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional); }\n\n protected toConstant(value: AttributeValue): ConstantOperation {\n return new IntegerConstantOperation(Number(value));\n }\n\n /** Filter to rows where this attribute equals `value`. */\n eq(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new IntegerConstantOperation(value));\n }\n /** Filter to rows where this attribute does not equal `value`. */\n ne(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new IntegerConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than `value`. */\n gt(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new IntegerConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than `value`. */\n lt(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new IntegerConstantOperation(value));\n }\n /** Filter to rows where this attribute is greater than or equal to `value`. */\n gte(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new IntegerConstantOperation(value));\n }\n /** Filter to rows where this attribute is less than or equal to `value`. */\n lte(value: number): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN_OR_EQUAL_TO, new IntegerConstantOperation(value));\n }\n}\n\nexport class BooleanAttribute extends Attribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n nullable: boolean = true,\n optional: boolean = false,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional); }\n\n protected toConstant(value: AttributeValue): ConstantOperation {\n return new BooleanConstantOperation(Boolean(value));\n }\n\n /** Filter to rows where this attribute equals `value`. */\n eq(value: boolean): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new BooleanConstantOperation(value));\n }\n /** Filter to rows where this attribute is true. */\n isTrue(): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new BooleanConstantOperation(true));\n }\n /** Filter to rows where this attribute is false. */\n isFalse(): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new BooleanConstantOperation(false));\n }\n}\n\nfunction parseDate(value: Date | string): Date {\n if (value instanceof Date) return value;\n const d = new Date(value);\n if (isNaN(d.getTime())) throw new Error(`Cannot parse date: ${value}`);\n return d;\n}\n\n/**\n * A timestamp comparison value: a `DateOnly` (or a `YYYY-MM-DD` string) is a date literal,\n * any other `Date` or string a timestamp literal.\n */\nfunction temporalConstant(value: Date | string): DateConstantOperation | DateTimeConstantOperation {\n if (typeof value === 'string' && DATE_ONLY_PATTERN.test(value)) return new DateConstantOperation(new DateOnly(value));\n const date = parseDate(value);\n return date instanceof DateOnly ? new DateConstantOperation(date) : new DateTimeConstantOperation(date);\n}\n\nexport class DateAttribute extends Attribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n nullable: boolean = true,\n optional: boolean = false,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional); }\n\n protected toConstant(value: AttributeValue): ConstantOperation {\n return new DateConstantOperation(parseDate(value as Date | string));\n }\n\n /** Filter to rows where this date equals `value`. */\n eq(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new DateConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this date does not equal `value`. */\n ne(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new DateConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this date is after `value`. */\n gt(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new DateConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this date is before `value`. */\n lt(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new DateConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this date is on or after `value`. */\n gte(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new DateConstantOperation(parseDate(value)));\n }\n /** Filter to rows where this date is on or before `value`. */\n lte(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN_OR_EQUAL_TO, new DateConstantOperation(parseDate(value)));\n }\n\n /** Extract the four-digit calendar year. */\n year(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.YEAR, 'Year ' + this.displayName()); }\n /** Extract the month number (1–12). */\n month(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.MONTH, 'Month ' + this.displayName()); }\n /** Extract the day of the month (1–31). */\n day(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DAY, 'Day ' + this.displayName()); }\n /** Extract the quarter (1–4). */\n quarter(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.QUARTER, 'Quarter ' + this.displayName()); }\n /** Extract the ISO week number (1–53). */\n week(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.WEEK, 'Week ' + this.displayName()); }\n /** Extract the day of the week (0 = Sunday through 6 = Saturday). */\n dayOfWeek(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DOW, 'Day Of Week ' + this.displayName()); }\n /** The date of the first day of the week the date falls in (a Monday). */\n firstDayOfWeek(): DateTruncOperation { return new DateTruncOperation(this.cwj(), DatePart.WEEK, 'First Day Of Week ' + this.displayName()); }\n /** The date of the first day of the month the date falls in. */\n firstDayOfMonth(): DateTruncOperation { return new DateTruncOperation(this.cwj(), DatePart.MONTH, 'First Day Of Month ' + this.displayName()); }\n /** The date of the first day of the quarter the date falls in. */\n firstDayOfQuarter(): DateTruncOperation { return new DateTruncOperation(this.cwj(), DatePart.QUARTER, 'First Day Of Quarter ' + this.displayName()); }\n /** The date of the first day of the year the date falls in. */\n firstDayOfYear(): DateTruncOperation { return new DateTruncOperation(this.cwj(), DatePart.YEAR, 'First Day Of Year ' + this.displayName()); }\n\n /** Add `n` days to this date. */\n addDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, true, 'Add Days ' + this.displayName()); }\n /** Add `n` months to this date. */\n addMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, true, 'Add Months ' + this.displayName()); }\n /** Add `n` years to this date. */\n addYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, true, 'Add Years ' + this.displayName()); }\n /** Subtract `n` days from this date. */\n subtractDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, false, 'Subtract Days ' + this.displayName()); }\n /** Subtract `n` months from this date. */\n subtractMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, false, 'Subtract Months ' + this.displayName()); }\n /** Subtract `n` years from this date. */\n subtractYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, false, 'Subtract Years ' + this.displayName()); }\n\n /** Number of whole days between this date and `other`. */\n diffDays(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.DAY, 'Diff Days ' + this.displayName()); }\n /** Number of whole months between this date and `other`. */\n diffMonths(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.MONTH, 'Diff Months ' + this.displayName()); }\n /** Number of whole years between this date and `other`. */\n diffYears(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.YEAR, 'Diff Years ' + this.displayName()); }\n}\n\nexport class DateTimeAttribute extends Attribute {\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n nullable: boolean = true,\n optional: boolean = false,\n ) { super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional); }\n\n protected toConstant(value: AttributeValue): ConstantOperation {\n return temporalConstant(value as Date | string);\n }\n\n /** Filter to rows where this timestamp equals `value`. */\n eq(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, temporalConstant(value));\n }\n /** Filter to rows where this timestamp does not equal `value`. */\n ne(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, temporalConstant(value));\n }\n /** Filter to rows where this timestamp is after `value`. */\n gt(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, temporalConstant(value));\n }\n /** Filter to rows where this timestamp is before `value`. */\n lt(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, temporalConstant(value));\n }\n /** Filter to rows where this timestamp is on or after `value`. */\n gte(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, temporalConstant(value));\n }\n /** Filter to rows where this timestamp is on or before `value`. */\n lte(value: Date | string): ComparisonOperation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN_OR_EQUAL_TO, temporalConstant(value));\n }\n\n /** Extract the four-digit calendar year. */\n year(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.YEAR, 'Year ' + this.displayName()); }\n /** Extract the month number (1–12). */\n month(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.MONTH, 'Month ' + this.displayName()); }\n /** Extract the day of the month (1–31). */\n day(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DAY, 'Day ' + this.displayName()); }\n /** Extract the hour (0–23). */\n hour(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.HOUR, 'Hour ' + this.displayName()); }\n /** Extract the minute (0–59). */\n minute(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.MINUTE, 'Minute ' + this.displayName()); }\n /** Extract the second (0–59). */\n second(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.SECOND, 'Second ' + this.displayName()); }\n /** Extract the quarter (1–4). */\n quarter(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.QUARTER, 'Quarter ' + this.displayName()); }\n /** Extract the ISO week number (1–53). */\n week(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.WEEK, 'Week ' + this.displayName()); }\n /** Extract the day of the week (0 = Sunday through 6 = Saturday). */\n dayOfWeek(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DOW, 'Day Of Week ' + this.displayName()); }\n /** The date of the first day of the week the date falls in (a Monday). */\n firstDayOfWeek(): DateTruncOperation { return new DateTruncOperation(this.cwj(), DatePart.WEEK, 'First Day Of Week ' + this.displayName()); }\n /** The date of the first day of the month the date falls in. */\n firstDayOfMonth(): DateTruncOperation { return new DateTruncOperation(this.cwj(), DatePart.MONTH, 'First Day Of Month ' + this.displayName()); }\n /** The date of the first day of the quarter the date falls in. */\n firstDayOfQuarter(): DateTruncOperation { return new DateTruncOperation(this.cwj(), DatePart.QUARTER, 'First Day Of Quarter ' + this.displayName()); }\n /** The date of the first day of the year the date falls in. */\n firstDayOfYear(): DateTruncOperation { return new DateTruncOperation(this.cwj(), DatePart.YEAR, 'First Day Of Year ' + this.displayName()); }\n\n /** Add `n` days to this timestamp. */\n addDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, true, 'Add Days ' + this.displayName()); }\n /** Add `n` months to this timestamp. */\n addMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, true, 'Add Months ' + this.displayName()); }\n /** Add `n` years to this timestamp. */\n addYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, true, 'Add Years ' + this.displayName()); }\n /** Add `n` hours to this timestamp. */\n addHours(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.HOUR, true, 'Add Hours ' + this.displayName()); }\n /** Add `n` minutes to this timestamp. */\n addMinutes(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MINUTE, true, 'Add Minutes ' + this.displayName()); }\n /** Add `n` seconds to this timestamp. */\n addSeconds(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.SECOND, true, 'Add Seconds ' + this.displayName()); }\n /** Subtract `n` days from this timestamp. */\n subtractDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, false, 'Subtract Days ' + this.displayName()); }\n /** Subtract `n` months from this timestamp. */\n subtractMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, false, 'Subtract Months ' + this.displayName()); }\n /** Subtract `n` years from this timestamp. */\n subtractYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, false, 'Subtract Years ' + this.displayName()); }\n /** Subtract `n` hours from this timestamp. */\n subtractHours(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.HOUR, false, 'Subtract Hours ' + this.displayName()); }\n /** Subtract `n` minutes from this timestamp. */\n subtractMinutes(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MINUTE, false, 'Subtract Minutes ' + this.displayName()); }\n /** Subtract `n` seconds from this timestamp. */\n subtractSeconds(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.SECOND, false, 'Subtract Seconds ' + this.displayName()); }\n\n /** Number of whole days between this timestamp and `other`. */\n diffDays(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.DAY, 'Diff Days ' + this.displayName()); }\n /** Number of whole months between this timestamp and `other`. */\n diffMonths(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.MONTH, 'Diff Months ' + this.displayName()); }\n /** Number of whole years between this timestamp and `other`. */\n diffYears(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.YEAR, 'Diff Years ' + this.displayName()); }\n /** Number of whole hours between this timestamp and `other`. */\n diffHours(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.HOUR, 'Diff Hours ' + this.displayName()); }\n /** Number of whole minutes between this timestamp and `other`. */\n diffMinutes(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.MINUTE, 'Diff Minutes ' + this.displayName()); }\n /** Number of whole seconds between this timestamp and `other`. */\n diffSeconds(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.SECOND, 'Diff Seconds ' + this.displayName()); }\n}\n\nexport interface DateAttribute extends MinMax {}\napplyMixins(DateAttribute, [MinMax]);\n\nexport interface DateTimeAttribute extends MinMax {}\napplyMixins(DateTimeAttribute, [MinMax]);\n","export enum ComparisonOperator {\n EQUAL = 'EQUAL',\n NOT_EQUAL = 'NOT_EQUAL',\n LESS_THAN = 'LESS_THAN',\n GREATER_THAN = 'GREATER_THAN',\n LESS_THAN_OR_EQUAL_TO = 'LESS_THAN_OR_EQUAL_TO',\n GREATER_THAN_OR_EQUAL_TO = 'GREATER_THAN_OR_EQUAL_TO',\n LIKE = 'LIKE',\n NOT_LIKE = 'NOT_LIKE',\n}\n\n/** The character that makes the next one literal in a LIKE pattern built from a value (`contains`, `startsWith`, ...). */\nexport const LIKE_ESCAPE = '!';\n\n/**\n * `value` as part of a LIKE pattern that matches it literally: `%`, `_` and the escape character itself\n * would otherwise be wildcards.\n */\nexport function escapeLike(value: string): string {\n return value.replaceAll(LIKE_ESCAPE, LIKE_ESCAPE + LIKE_ESCAPE).replaceAll('%', LIKE_ESCAPE + '%').replaceAll('_', LIKE_ESCAPE + '_');\n}\n\nexport enum LogicalOperator {\n AND = 'AND',\n OR = 'OR',\n}\n\nexport enum AggregateOperator {\n COUNT = 'COUNT',\n SUM = 'SUM',\n MIN = 'MIN',\n MAX = 'MAX',\n AVERAGE = 'AVERAGE',\n STRING_AGG = 'STRING_AGG',\n COUNT_DISTINCT = 'COUNT_DISTINCT',\n STDDEV_SAMP = 'STDDEV_SAMP',\n STDDEV_POP = 'STDDEV_POP',\n VAR_SAMP = 'VAR_SAMP',\n VAR_POP = 'VAR_POP',\n BOOL_AND = 'BOOL_AND',\n BOOL_OR = 'BOOL_OR',\n}\n\nexport enum ScalarFunction {\n ABS = 'ABS',\n CEILING = 'CEILING',\n FLOOR = 'FLOOR',\n MOD = 'MOD',\n POWER = 'POWER',\n SQRT = 'SQRT',\n ROUND = 'ROUND',\n UPPER = 'UPPER',\n LOWER = 'LOWER',\n TRIM = 'TRIM',\n LTRIM = 'LTRIM',\n RTRIM = 'RTRIM',\n LENGTH = 'LENGTH',\n REVERSE = 'REVERSE',\n LEFT = 'LEFT',\n RIGHT = 'RIGHT',\n REPEAT = 'REPEAT',\n REPLACE = 'REPLACE',\n SUBSTRING = 'SUBSTRING',\n COALESCE = 'COALESCE',\n}\n\nexport enum DatePart {\n YEAR = 'YEAR',\n MONTH = 'MONTH',\n DAY = 'DAY',\n HOUR = 'HOUR',\n MINUTE = 'MINUTE',\n SECOND = 'SECOND',\n QUARTER = 'QUARTER',\n WEEK = 'WEEK',\n DOW = 'DOW',\n}\n\nexport enum SortDirection {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport abstract class RelationalOperationElement {}\n\n/**\n * Something that can be a column of the result, so can be given a name there:\n * `f.price().sum().alias('Total')`. The name is held by an `Alias` that wraps the column.\n */\nexport interface Aliasable {\n alias(name: string): Alias;\n}\n\n/** Something the result can be ordered by: `f.id().count().ascending()`. */\nexport interface Sortable {\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation;\n /** Sort by this expression, largest first. */\n descending(): SortOperation;\n}\n\nexport abstract class Operation extends RelationalOperationElement implements Aliasable {\n /** Name this column in the result: `f.price().sum().alias('Total')`, `f.age().gt(30).alias('Adult')`. */\n alias(name: string): Alias { return new Alias(this, name); }\n\n and(other: RelationalOperationElement): Operation {\n return new LogicalOperation(this, LogicalOperator.AND, other);\n }\n\n /** Combine with `other` using OR. A chain reads left to right: `a.or(b).and(c)` is `(a OR b) AND c`. */\n or(other: RelationalOperationElement): Operation {\n return new LogicalOperation(this, LogicalOperator.OR, other);\n }\n}\n\nexport class NoOperation extends Operation {\n and(other: RelationalOperationElement): Operation {\n return other as Operation;\n }\n\n /** No filter matches every row, so OR-ing anything with it still matches every row. */\n or(_other: RelationalOperationElement): Operation {\n return this;\n }\n}\n\nexport abstract class ConstantOperation extends RelationalOperationElement implements Aliasable, Sortable {\n /** Name this column in the result. */\n alias(name: string): Alias { return new Alias(this, name); }\n\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, largest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n}\n\n/** A constant that is a number, so it can be an operand of arithmetic: `constant(100).minus(f.price())`. */\nexport abstract class NumericConstantOperation extends ConstantOperation {\n abstract readonly value: number;\n\n arithmeticOperand(): RelationalOperationElement { return this; }\n}\n\nexport class IntegerConstantOperation extends NumericConstantOperation {\n constructor(readonly value: number) { super(); }\n}\n\nexport class FloatConstantOperation extends NumericConstantOperation {\n constructor(readonly value: number) { super(); }\n}\n\nexport class StringConstantOperation extends ConstantOperation {\n constructor(readonly value: string) { super(); }\n}\n\n/** Matches a zone-less calendar date such as `2024-06-01`. */\nexport const DATE_ONLY_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/**\n * A calendar date, held as UTC midnight. JavaScript has no date-only type, so this marks a `Date`\n * that was given as a date rather than a timestamp, and is rendered as a date literal (`'2024-06-01'`)\n * instead of a timestamp literal (`'2024-06-01 00:00:00'`).\n */\nexport class DateOnly extends Date {}\n\nexport class DateConstantOperation extends ConstantOperation {\n constructor(readonly value: Date) { super(); }\n}\n\nexport class DateTimeConstantOperation extends ConstantOperation {\n constructor(readonly value: Date) { super(); }\n}\n\nexport class DecimalConstantOperation extends NumericConstantOperation {\n constructor(readonly value: number) { super(); }\n}\n\nexport class BooleanConstantOperation extends ConstantOperation {\n constructor(readonly value: boolean) { super(); }\n}\n\nexport abstract class UnaryOperation extends Operation {\n constructor(readonly element: RelationalOperationElement) { super(); }\n}\n\nexport abstract class BinaryOperation extends Operation {\n constructor(\n readonly left: RelationalOperationElement,\n readonly right: RelationalOperationElement,\n ) { super(); }\n}\n\nexport class IsNullOperation extends UnaryOperation {}\n\nexport class IsNotNullOperation extends UnaryOperation {}\n\n/** The element is one of `values` (`element IN (...)`). */\nexport class InOperation extends UnaryOperation {\n constructor(element: RelationalOperationElement, readonly values: ConstantOperation[]) { super(element); }\n}\n\n/** The element is none of `values` (`element NOT IN (...)`). */\nexport class NotInOperation extends UnaryOperation {\n constructor(element: RelationalOperationElement, readonly values: ConstantOperation[]) { super(element); }\n}\n\nexport class ComparisonOperation extends BinaryOperation {\n constructor(\n left: RelationalOperationElement,\n readonly operator: ComparisonOperator,\n right: RelationalOperationElement,\n ) { super(left, right); }\n}\n\nexport class LogicalOperation extends BinaryOperation {\n constructor(\n left: RelationalOperationElement,\n readonly operator: LogicalOperator,\n right: RelationalOperationElement,\n ) { super(left, right); }\n}\n\nexport class WindowSpecification {\n constructor(\n readonly partitionBy: RelationalOperationElement[] = [],\n readonly orderBy: SortOperation[] = [],\n ) {}\n}\n\nexport class AggregateOperation extends UnaryOperation implements Sortable {\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, largest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n\n constructor(\n element: RelationalOperationElement,\n readonly operator: AggregateOperator,\n readonly displayName?: string,\n readonly window?: WindowSpecification,\n /** For STRING_AGG: what goes between the values. */\n readonly separator?: string,\n /** For STRING_AGG: the order the values are joined in. */\n readonly orderBy: SortOperation[] = [],\n ) { super(element); }\n\n arithmeticOperand(): RelationalOperationElement { return this; }\n comparisonOperand(): RelationalOperationElement { return this; }\n\n over(partitionBy?: RelationalOperationElement[], orderBy?: SortOperation[]): AggregateOperation {\n return new AggregateOperation(this.element, this.operator, this.displayName,\n new WindowSpecification(partitionBy ?? [], orderBy ?? []), this.separator, this.orderBy);\n }\n}\n\nexport enum WindowFunction {\n ROW_NUMBER = 'ROW_NUMBER',\n RANK = 'RANK',\n DENSE_RANK = 'DENSE_RANK',\n NTILE = 'NTILE',\n LAG = 'LAG',\n LEAD = 'LEAD',\n FIRST_VALUE = 'FIRST_VALUE',\n LAST_VALUE = 'LAST_VALUE',\n CUME_DIST = 'CUME_DIST',\n PERCENT_RANK = 'PERCENT_RANK',\n}\n\nexport class WindowFunctionOperation extends UnaryOperation implements Sortable {\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, largest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n\n constructor(\n element: RelationalOperationElement | null,\n readonly func: WindowFunction,\n readonly displayName?: string,\n readonly secondArg?: number,\n readonly extraArgs: (string | number)[] = [],\n readonly window?: WindowSpecification,\n ) { super(element as RelationalOperationElement); }\n\n over(partitionBy?: RelationalOperationElement[], orderBy?: SortOperation[]): WindowFunctionOperation {\n return new WindowFunctionOperation(this.element, this.func, this.displayName, this.secondArg,\n [...this.extraArgs], new WindowSpecification(partitionBy ?? [], orderBy ?? []));\n }\n}\n\nexport class ScalarFunctionOperation extends UnaryOperation implements Sortable {\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, largest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n\n constructor(\n element: RelationalOperationElement,\n readonly func: ScalarFunction,\n readonly displayName?: string,\n readonly secondArg?: number,\n readonly extraArgs: (string | number | boolean)[] = [],\n ) { super(element); }\n\n /** This expression as an operand of a comparison. */\n comparisonOperand(): RelationalOperationElement { return this; }\n\n arithmeticOperand(): RelationalOperationElement { return this; }\n\n /** Only a function that gives a number can be used in arithmetic. */\n assertNumeric(): void {\n if (!NUMERIC_FUNCTIONS.has(this.func)) {\n throw new TypeError(`${this.func} does not give a number, so it cannot be used in arithmetic`);\n }\n }\n}\n\n/** The functions that give a number, which arithmetic and `Numeric` functions apply to. */\nexport const NUMERIC_FUNCTIONS: ReadonlySet<ScalarFunction> = new Set([\n ScalarFunction.ABS, ScalarFunction.CEILING, ScalarFunction.FLOOR, ScalarFunction.MOD,\n ScalarFunction.POWER, ScalarFunction.SQRT, ScalarFunction.ROUND, ScalarFunction.LENGTH,\n]);\n\nexport class DateExtractOperation extends UnaryOperation implements Sortable {\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, largest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n\n constructor(\n element: RelationalOperationElement,\n readonly part: DatePart,\n readonly displayName?: string,\n ) { super(element); }\n}\n\n/** The first day of the week, month, quarter or year that the date falls in, as a date. */\nexport class DateTruncOperation extends UnaryOperation implements Sortable {\n constructor(\n element: RelationalOperationElement,\n readonly part: DatePart,\n readonly displayName?: string,\n ) { super(element); }\n\n /** Sort by this expression, earliest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, latest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n\n comparisonOperand(): RelationalOperationElement { return this; }\n}\n\nexport class DateArithmeticOperation extends UnaryOperation implements Sortable {\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, largest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n\n constructor(\n element: RelationalOperationElement,\n readonly n: number,\n readonly unit: DatePart,\n readonly isAdd: boolean = true,\n readonly displayName?: string,\n ) { super(element); }\n}\n\nexport class DateDiffOperation extends UnaryOperation implements Sortable {\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, largest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n\n constructor(\n element: RelationalOperationElement,\n readonly other: Date,\n readonly unit: DatePart,\n readonly displayName?: string,\n ) { super(element); }\n}\n\nexport class Column extends RelationalOperationElement {\n table?: Table;\n /** Whether the column may hold NULL. As in Legend, a primary key is never null. */\n readonly nullable: boolean;\n\n constructor(\n readonly name: string,\n readonly type: string,\n readonly owner?: string,\n readonly primaryKey: boolean = false,\n nullable: boolean = true,\n ) {\n super();\n this.nullable = nullable && !primaryKey;\n }\n}\n\nexport class ForeignKey {\n constructor(readonly column: Column, readonly references: Column) {}\n}\n\nexport abstract class DataStore {\n readonly schemas: Schema[] = [];\n\n constructor(readonly name: string) {}\n\n abstract namespace(schemaName: string): string;\n}\n\nexport class Database extends DataStore {\n constructor(name: string, readonly location?: string) { super(name); }\n\n namespace(schemaName: string): string { return schemaName; }\n}\n\nexport class DataCatalog extends DataStore {\n constructor(name: string) { super(name); }\n\n namespace(schemaName: string): string { return `${this.name}.${schemaName}`; }\n}\n\nexport class Schema {\n readonly tables: Table[] = [];\n\n constructor(readonly name: string, readonly datastore?: DataStore) {\n datastore?.schemas.push(this);\n }\n}\n\nexport class Table {\n private readonly _columnsByName: Map<string, Column> = new Map();\n readonly foreignKeys: ForeignKey[] = [];\n\n constructor(readonly name: string, columns: Column[], readonly schema?: Schema) {\n for (const col of columns) {\n if (this._columnsByName.has(col.name)) {\n throw new Error(`Duplicate column name '${col.name}' in table '${name}'`);\n }\n this._columnsByName.set(col.name, col);\n col.table = this;\n }\n schema?.tables.push(this);\n }\n\n get columns(): Column[] {\n return Array.from(this._columnsByName.values());\n }\n\n get qualifiedName(): string {\n if (!this.schema) return this.name;\n if (!this.schema.datastore) return `${this.schema.name}.${this.name}`;\n return `${this.schema.datastore.namespace(this.schema.name)}.${this.name}`;\n }\n}\n\nexport class JoinOperation {\n filter?: RelationalOperationElement;\n /** Property-equality filters on the join target (property id -> value), set by a related finder given a filter. */\n filterKwargs: Record<string, unknown> = {};\n /** Maps property ids to [column, type, table] for `filterKwargs`. */\n filterColumnMap: Record<string, [string, string, string]> = {};\n\n constructor(\n readonly name: string,\n readonly target: Table,\n readonly left: Column,\n readonly right: Column,\n filter?: RelationalOperationElement,\n ) {\n this.filter = filter;\n }\n}\n\nexport class JoinTreeNodeOperation {\n constructor(\n readonly join: JoinOperation,\n readonly parent?: JoinTreeNodeOperation,\n /**\n * True when the property this step follows is to-many, so a value read through it repeats the row. As in\n * Pure, that is the multiplicity of the property, not something the join itself says.\n */\n readonly many: boolean = false,\n /** True when the property this step follows can be missing (its lower bound is 0). */\n readonly optional: boolean = false,\n ) {}\n}\n\nexport class ColumnWithJoin extends RelationalOperationElement {\n /**\n * `embedded` is an alternate reference to a flat (denormalized) column on the owning table that\n * holds the same value without the join; the SQL generator uses it when the join can be elided.\n */\n constructor(\n readonly column: Column,\n readonly parent?: JoinTreeNodeOperation,\n readonly embedded?: ColumnWithJoin,\n private readonly _optional: boolean = false,\n ) { super(); }\n\n /** Whether the value can be missing: its property is optional, or a navigation on the way to it is. */\n get optional(): boolean {\n for (let node = this.parent; node !== undefined; node = node.parent) {\n if (node.optional) return true;\n }\n return this._optional;\n }\n}\n\nexport class SortOperation {\n constructor(\n /** What the rows are ordered by: a column, or an expression such as an aggregate. */\n readonly column: RelationalOperationElement,\n readonly direction: SortDirection,\n ) {}\n}\n\nexport class CountAllOperation extends RelationalOperationElement implements Aliasable, Sortable {\n /** Name this column in the result. */\n alias(name: string): Alias { return new Alias(this, name); }\n\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, largest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n\n constructor(readonly table: string) { super(); }\n\n comparisonOperand(): RelationalOperationElement { return this; }\n}\n\n/**\n * A column of the result under another name, wrapping the column it names. Only things that can be a\n * column of the result have `alias()` (an `Attribute`, an aggregate, a function, a constant, ...), so a\n * filter cannot be aliased; aliasing an alias replaces its name.\n */\nexport class Alias extends RelationalOperationElement implements Aliasable, Sortable {\n constructor(readonly element: RelationalOperationElement, readonly name: string) { super(); }\n\n alias(name: string): Alias { return new Alias(this.element, name); }\n\n /** Sorts by the column the alias names. */\n ascending(): SortOperation { return new SortOperation(this.element, SortDirection.ASC); }\n\n /** Sorts by the column the alias names. */\n descending(): SortOperation { return new SortOperation(this.element, SortDirection.DESC); }\n}\n\n/** `CASE WHEN condition THEN then ELSE fallback END`; without a `fallback` the value is NULL. */\nexport class CaseOperation extends Operation {\n constructor(\n readonly condition: RelationalOperationElement,\n readonly then: RelationalOperationElement,\n readonly fallback?: RelationalOperationElement,\n readonly displayName?: string,\n ) { super(); }\n}\n\n/** Returned by `RelatedFinder.exists()`. A backend translates it to a join-presence check. */\nexport class ExistsOperation extends RelationalOperationElement implements Aliasable {\n /** Name this column in the result. */\n alias(name: string): Alias { return new Alias(this, name); }\n\n constructor(readonly node: JoinTreeNodeOperation) { super(); }\n\n and(other: RelationalOperationElement): LogicalOperation {\n return new LogicalOperation(this, LogicalOperator.AND, other);\n }\n\n or(other: RelationalOperationElement): LogicalOperation {\n return new LogicalOperation(this, LogicalOperator.OR, other);\n }\n}\n\n/** Returned by `RelatedFinder.notExists()`. A backend translates it to a join-absence check. */\nexport class NotExistsOperation extends RelationalOperationElement implements Aliasable {\n /** Name this column in the result. */\n alias(name: string): Alias { return new Alias(this, name); }\n\n constructor(readonly node: JoinTreeNodeOperation) { super(); }\n\n and(other: RelationalOperationElement): LogicalOperation {\n return new LogicalOperation(this, LogicalOperator.AND, other);\n }\n\n or(other: RelationalOperationElement): LogicalOperation {\n return new LogicalOperation(this, LogicalOperator.OR, other);\n }\n}\n\nexport class SelectOperation {\n constructor(\n readonly display: RelationalOperationElement[],\n readonly filter: RelationalOperationElement,\n readonly orderBy: SortOperation[] = [],\n readonly groupBy: RelationalOperationElement[] = [],\n readonly limit?: number,\n readonly table?: Table,\n /**\n * Extra ON conditions for this query's joins (milestoning and property filters), keyed by join node.\n * Held here rather than on the shared JoinOperation, so queries that use the same node can't affect each other.\n */\n readonly joinFilters: ReadonlyMap<JoinTreeNodeOperation, Operation> = new Map(),\n /** Whether each distinct row is returned once (`SELECT DISTINCT`). */\n readonly distinct: boolean = false,\n /** How many rows to skip before the first one returned. */\n readonly offset?: number,\n /** Keeps the groups that satisfy it (`HAVING`). */\n readonly having?: Operation,\n ) {}\n}\n\n/** Whether `op` holds an aggregate, a window function or a count. */\nexport function containsAggregateOrWindow(op: unknown): boolean {\n if (op instanceof AggregateOperation || op instanceof WindowFunctionOperation || op instanceof CountAllOperation) return true;\n if (op instanceof BinaryOperation) return containsAggregateOrWindow(op.left) || containsAggregateOrWindow(op.right);\n if (op instanceof UnaryOperation || op instanceof Alias) return containsAggregateOrWindow(op.element);\n return false;\n}\n\n/** Whether `op` collapses rows: an aggregate or a count. Window functions keep every row. */\nexport function containsAggregate(op: unknown): boolean {\n if (op instanceof AggregateOperation || op instanceof CountAllOperation) return true;\n if (op instanceof BinaryOperation) return containsAggregate(op.left) || containsAggregate(op.right);\n if (op instanceof UnaryOperation || op instanceof Alias) return containsAggregate(op.element);\n return false;\n}\n\n/** A plain value as the constant it compares with. */\nexport function valueOperand(value: unknown): ConstantOperation {\n if (typeof value === 'boolean') return new BooleanConstantOperation(value);\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Number.isInteger(value) ? new IntegerConstantOperation(value) : new FloatConstantOperation(value);\n }\n if (typeof value === 'string') return new StringConstantOperation(value);\n if (value instanceof DateOnly) return new DateConstantOperation(value); // before Date: DateOnly is a Date\n if (value instanceof Date) return new DateTimeConstantOperation(value);\n throw new TypeError(`A value to compare with is a boolean, a finite number, a string or a date, not ${value === null ? 'null' : typeof value}`);\n}\n\n/** The thing to compare or calculate with: an expression as it is, an attribute as its column, a value as a constant. */\nexport function operandOf(other: unknown): RelationalOperationElement {\n if (other instanceof RelationalOperationElement) return other;\n if (typeof (other as { cwj?: unknown } | null)?.cwj === 'function') return (other as { cwj(): ColumnWithJoin }).cwj();\n return valueOperand(other);\n}\n\n/**\n * Comparisons for an expression, as for a column: `f.name().toUpperCase().eq('ACME')`, `f.name().length().gt(10)`.\n * The other side is a value or another expression. Each gives a filter. Mixed into the expressions that have it.\n */\nexport abstract class Comparable {\n abstract comparisonOperand(): RelationalOperationElement;\n\n private _compared(operator: ComparisonOperator, other: unknown): ComparisonOperation {\n return new ComparisonOperation(this.comparisonOperand(), operator, operandOf(other));\n }\n\n /** Filter to rows where this expression equals `other`. */\n eq(other: unknown): ComparisonOperation { return this._compared(ComparisonOperator.EQUAL, other); }\n /** Filter to rows where this expression does not equal `other`. */\n ne(other: unknown): ComparisonOperation { return this._compared(ComparisonOperator.NOT_EQUAL, other); }\n /** Filter to rows where this expression is less than `other`. */\n lt(other: unknown): ComparisonOperation { return this._compared(ComparisonOperator.LESS_THAN, other); }\n /** Filter to rows where this expression is at most `other`. */\n lte(other: unknown): ComparisonOperation { return this._compared(ComparisonOperator.LESS_THAN_OR_EQUAL_TO, other); }\n /** Filter to rows where this expression is greater than `other`. */\n gt(other: unknown): ComparisonOperation { return this._compared(ComparisonOperator.GREATER_THAN, other); }\n /** Filter to rows where this expression is at least `other`. */\n gte(other: unknown): ComparisonOperation { return this._compared(ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, other); }\n}\n\n/** Whether a standard deviation or variance is the sample one (`ddof` 1) or the population one (0). */\nexport function sample(ddof: number): boolean {\n if (ddof !== 0 && ddof !== 1) throw new RangeError(`ddof is 0 (population) or 1 (sample), not ${ddof}`);\n return ddof === 1;\n}\n\n/**\n * Pattern tests on an expression that holds text, as on a column: `f.name().toUpperCase().startsWith('AC')`,\n * `f.name().join(',').contains('John')`. Mixed into the expressions that have it.\n */\nexport abstract class StringPredicates {\n abstract comparisonOperand(): RelationalOperationElement;\n\n private _like(pattern: string): ComparisonOperation {\n return new ComparisonOperation(this.comparisonOperand(), ComparisonOperator.LIKE, new StringConstantOperation(pattern));\n }\n\n /** Filter to rows where this text contains `value`. */\n contains(value: string): ComparisonOperation { return this._like(`%${escapeLike(value)}%`); }\n /** Filter to rows where this text starts with `prefix`. */\n startsWith(prefix: string): ComparisonOperation { return this._like(`${escapeLike(prefix)}%`); }\n /** Filter to rows where this text ends with `suffix`. */\n endsWith(suffix: string): ComparisonOperation { return this._like(`%${escapeLike(suffix)}`); }\n}\n\n/**\n * Aggregates of an expression, as a column has them: `f.price().times(f.quantity()).sum()`, `constant(1).sum()`,\n * `when(f.price().gt(10)).then(5.0).otherwise(1.0).sum()`. Mixed into the expressions that have it.\n */\nexport abstract class Aggregates {\n private _aggregate(operator: AggregateOperator, label: string): AggregateOperation {\n return new AggregateOperation(this as unknown as RelationalOperationElement, operator, label + ' Expression');\n }\n\n /** Sum of the values in the group. */\n sum(): AggregateOperation { return this._aggregate(AggregateOperator.SUM, 'Sum'); }\n /** Smallest value in the group. */\n min(): AggregateOperation { return this._aggregate(AggregateOperator.MIN, 'Min'); }\n /** Largest value in the group. */\n max(): AggregateOperation { return this._aggregate(AggregateOperator.MAX, 'Max'); }\n /** Arithmetic mean of the values in the group. */\n average(): AggregateOperation { return this._aggregate(AggregateOperator.AVERAGE, 'Average'); }\n /** Number of non-null values in the group. */\n count(): AggregateOperation { return this._aggregate(AggregateOperator.COUNT, 'Count'); }\n /** Standard deviation of the values in the group: the sample one by default, `ddof = 0` for the population one. */\n std(ddof = 1): AggregateOperation {\n return this._aggregate(sample(ddof) ? AggregateOperator.STDDEV_SAMP : AggregateOperator.STDDEV_POP, 'Std');\n }\n /** Variance of the values in the group: the sample one by default, `ddof = 0` for the population one. */\n var(ddof = 1): AggregateOperation {\n return this._aggregate(sample(ddof) ? AggregateOperator.VAR_SAMP : AggregateOperator.VAR_POP, 'Var');\n }\n}\n\n/**\n * Aggregates of a condition: `f.quantity().gt(20).all()` is true for a group where every row holds, `.any()` where at\n * least one does. Mixed into the conditions.\n */\nexport abstract class BooleanAggregates {\n /** True for a group where every row satisfies the condition. */\n all(): AggregateOperation {\n return new AggregateOperation(this as unknown as RelationalOperationElement, AggregateOperator.BOOL_AND, 'All Expression');\n }\n /** True for a group where at least one row satisfies the condition. */\n any(): AggregateOperation {\n return new AggregateOperation(this as unknown as RelationalOperationElement, AggregateOperator.BOOL_OR, 'Any Expression');\n }\n}\n\n/**\n * Mix the methods of the base classes into `derived`, the TypeScript handbook's way to inherit from more than\n * one class: the type side comes from an `interface Derived extends Base {}` beside the class.\n */\nexport function applyMixins(derived: { prototype: object }, bases: { prototype: object }[]): void {\n for (const base of bases) {\n for (const name of Object.getOwnPropertyNames(base.prototype)) {\n if (name === 'constructor' || Object.prototype.hasOwnProperty.call(derived.prototype, name)) continue;\n Object.defineProperty(derived.prototype, name, Object.getOwnPropertyDescriptor(base.prototype, name)!);\n }\n }\n}\n\nexport enum ArithmeticOperator {\n ADD = '+',\n SUBTRACT = '-',\n MULTIPLY = '*',\n DIVIDE = '/',\n}\n\n/** A number or a numeric expression: what arithmetic takes on the other side. */\nexport type ArithmeticOperand = number | { arithmeticOperand(): RelationalOperationElement };\n\n/**\n * `plus`, `minus`, `times` and `dividedBy` for an expression that holds a number: `f.price().times(f.quantity())`,\n * `f.price().plus(1.5)`, `constant(100).minus(f.price())`. The other operand is a number or another numeric\n * expression. Mixed into the expressions that have it.\n */\nexport abstract class Arithmetic {\n abstract arithmeticOperand(): RelationalOperationElement;\n\n /** Raises if this expression is not a number. */\n assertNumeric(): void {}\n\n private _arithmetic(operator: ArithmeticOperator, other: ArithmeticOperand): ArithmeticOperation {\n this.assertNumeric();\n let operand: RelationalOperationElement;\n if (typeof other === 'number') {\n if (!Number.isFinite(other)) throw new TypeError('Arithmetic is between numbers and numeric columns, not a non-finite number');\n operand = valueOperand(other);\n } else if (other !== null && typeof other === 'object' && typeof other.arithmeticOperand === 'function') {\n (other as unknown as Arithmetic).assertNumeric?.();\n operand = other.arithmeticOperand();\n } else {\n throw new TypeError(`Arithmetic is between numbers and numeric columns, not ${other === null ? 'null' : typeof other}`);\n }\n return new ArithmeticOperation(this.arithmeticOperand(), operator, operand);\n }\n\n /** `this + other`. */\n plus(other: ArithmeticOperand): ArithmeticOperation { return this._arithmetic(ArithmeticOperator.ADD, other); }\n /** `this - other`. */\n minus(other: ArithmeticOperand): ArithmeticOperation { return this._arithmetic(ArithmeticOperator.SUBTRACT, other); }\n /** `this * other`. */\n times(other: ArithmeticOperand): ArithmeticOperation { return this._arithmetic(ArithmeticOperator.MULTIPLY, other); }\n /** `this / other`. */\n dividedBy(other: ArithmeticOperand): ArithmeticOperation { return this._arithmetic(ArithmeticOperator.DIVIDE, other); }\n}\n\n/** `left operator right` on numbers, e.g. `price * quantity`. */\nexport class ArithmeticOperation extends BinaryOperation implements Sortable {\n constructor(\n left: RelationalOperationElement,\n readonly operator: ArithmeticOperator,\n right: RelationalOperationElement,\n readonly displayName?: string,\n ) { super(left, right); }\n\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, largest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n\n arithmeticOperand(): RelationalOperationElement { return this; }\n comparisonOperand(): RelationalOperationElement { return this; }\n}\n\n/** Text joined end to end. A NULL in any part makes the whole NULL, as with SQL's `||`. */\nexport class ConcatOperation extends Operation implements Sortable {\n constructor(\n readonly parts: RelationalOperationElement[],\n readonly displayName?: string,\n ) { super(); }\n\n /** Join more text on the end: `f.first().concat(' ', f.last())`. A concatenation joins into one. */\n concat(...more: ConcatPart[]): ConcatOperation { return concat(this, ...more); }\n\n /** Sort by this expression, smallest first. */\n ascending(): SortOperation { return new SortOperation(this, SortDirection.ASC); }\n\n /** Sort by this expression, largest first. */\n descending(): SortOperation { return new SortOperation(this, SortDirection.DESC); }\n\n comparisonOperand(): RelationalOperationElement { return this; }\n}\n\n/** What can be joined as text: a string, a text column, a function that gives text, or another concatenation. */\nexport type ConcatPart = string | { functionInput(): RelationalOperationElement } | ConcatOperation;\n\n/**\n * Join text: `concat(f.name(), ' (', f.category(), ')')`. A string is a constant; a concatenation among the\n * parts is flattened into one.\n */\nexport function concat(...parts: ConcatPart[]): ConcatOperation {\n const partsOf = (part: ConcatPart): RelationalOperationElement[] => {\n if (part instanceof ConcatOperation) return part.parts;\n if (typeof part === 'string') return [new StringConstantOperation(part)];\n if (part instanceof RelationalOperationElement) return [part];\n if (part !== null && typeof part === 'object' && typeof part.functionInput === 'function') return [part.functionInput()];\n throw new TypeError(`Text is joined with text, not ${part === null ? 'null' : typeof part}`);\n };\n return new ConcatOperation(parts.flatMap(partsOf));\n}\n\nexport interface ConcatOperation extends Comparable, StringPredicates {}\napplyMixins(ConcatOperation, [Comparable, StringPredicates]);\n\nexport interface DateTruncOperation extends Comparable {}\napplyMixins(DateTruncOperation, [Comparable]);\n\nexport interface ArithmeticOperation extends Arithmetic, Comparable {}\napplyMixins(ArithmeticOperation, [Arithmetic, Comparable]);\n\nexport interface ScalarFunctionOperation extends Comparable, Arithmetic, StringPredicates {}\napplyMixins(ScalarFunctionOperation, [Comparable, Arithmetic, StringPredicates]);\n\nexport interface AggregateOperation extends Arithmetic, Comparable, StringPredicates {}\napplyMixins(AggregateOperation, [Arithmetic, Comparable, StringPredicates]);\n\nexport interface CountAllOperation extends Comparable {}\napplyMixins(CountAllOperation, [Comparable]);\n\nexport interface NumericConstantOperation extends Arithmetic {}\napplyMixins(NumericConstantOperation, [Arithmetic]);\n\nexport interface ConstantOperation extends Aggregates {}\napplyMixins(ConstantOperation, [Aggregates]);\n\nexport interface ArithmeticOperation extends Aggregates {}\napplyMixins(ArithmeticOperation, [Aggregates]);\n\nexport interface ScalarFunctionOperation extends Aggregates {}\napplyMixins(ScalarFunctionOperation, [Aggregates]);\n\nexport interface CaseOperation extends Aggregates {}\napplyMixins(CaseOperation, [Aggregates]);\n\nexport interface IsNullOperation extends BooleanAggregates {}\napplyMixins(IsNullOperation, [BooleanAggregates]);\n\nexport interface IsNotNullOperation extends BooleanAggregates {}\napplyMixins(IsNotNullOperation, [BooleanAggregates]);\n\nexport interface InOperation extends BooleanAggregates {}\napplyMixins(InOperation, [BooleanAggregates]);\n\nexport interface NotInOperation extends BooleanAggregates {}\napplyMixins(NotInOperation, [BooleanAggregates]);\n\nexport interface ComparisonOperation extends BooleanAggregates {}\napplyMixins(ComparisonOperation, [BooleanAggregates]);\n\nexport interface LogicalOperation extends BooleanAggregates {}\napplyMixins(LogicalOperation, [BooleanAggregates]);\n","import {\n Column,\n AggregateOperation,\n AggregateOperator,\n ColumnWithJoin,\n SortOperation,\n SortDirection,\n IsNullOperation,\n IsNotNullOperation,\n InOperation,\n NotInOperation,\n ConstantOperation,\n JoinTreeNodeOperation,\n Alias,\n RelationalOperationElement,\n Aliasable,\n ScalarFunction,\n ScalarFunctionOperation,\n WindowFunction,\n WindowFunctionOperation,\n WindowSpecification,\n} from '../model/relational';\n\n/** A value an attribute can be compared with in `isIn` / `isNotIn`. */\nexport type AttributeValue = string | number | boolean | Date;\n\nexport abstract class Attribute implements Aliasable {\n private readonly _displayName: string;\n private readonly _column: Column;\n private readonly _owner: string;\n private readonly _parent?: JoinTreeNodeOperation;\n private readonly _embedded?: Attribute;\n private readonly _optional: boolean;\n\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n embedded?: Attribute,\n nullable: boolean = true,\n optional: boolean = false,\n ) {\n this._optional = optional;\n this._displayName = displayName;\n this._column = new Column(columnName, columnDbType, owner, false, nullable);\n this._owner = owner;\n this._parent = parent;\n this._embedded = embedded;\n }\n\n column(): Column { return this._column; }\n owner(): string { return this._owner; }\n parent(): JoinTreeNodeOperation | undefined { return this._parent; }\n displayName(): string { return this._displayName; }\n\n /** Alternate attribute on a flat column of the owning table, used in place of this one when its join is elided. */\n embedded(): Attribute | undefined { return this._embedded; }\n\n /** @internal The expression a function of this attribute applies to: its column. */\n functionInput(): RelationalOperationElement {\n return this.cwj();\n }\n\n /** @internal What a function of this attribute is labelled after: its display name. */\n functionLabel(): string {\n return this._displayName;\n }\n\n /** @internal This attribute as an operand of arithmetic: its column. */\n arithmeticOperand(): RelationalOperationElement {\n return this.cwj();\n }\n\n cwj(): ColumnWithJoin {\n return new ColumnWithJoin(this._column, this._parent, this._embedded?.cwj(), this._optional);\n }\n\n /** Count the number of non-null values. Use in a projection with `groupBy` to aggregate per group. */\n count(): AggregateOperation {\n return new AggregateOperation(\n this.cwj(),\n AggregateOperator.COUNT,\n this._displayName + ' Count',\n );\n }\n\n /** Name this column in the result: `f.price().sum().alias('Total')`. */\n alias(name: string): Alias {\n return new Alias(this, name);\n }\n\n /** The number of different non-NULL values in the group: `COUNT(DISTINCT column)`. Use with `groupBy` to count per group. */\n countDistinct(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.COUNT_DISTINCT, this._displayName + ' Count Distinct');\n }\n\n /** The value, or `defaultValue` when it is NULL: `name().orElse('N/A')`. Like `COALESCE` in SQL. */\n orElse(defaultValue: string | number | boolean): ScalarFunctionOperation {\n if (!['string', 'number', 'boolean'].includes(typeof defaultValue)) {\n throw new TypeError(`An orElse default is a string, number or boolean, not ${defaultValue === null ? 'null' : typeof defaultValue}`);\n }\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.COALESCE, 'Or Else ' + this._displayName, undefined, [defaultValue]);\n }\n\n /** Sort this attribute in ascending order. Pass to `orderBy` or a window function's `orderBy`. */\n ascending(): SortOperation {\n return new SortOperation(this.cwj(), SortDirection.ASC);\n }\n\n /** Sort this attribute in descending order. Pass to `orderBy` or a window function's `orderBy`. */\n descending(): SortOperation {\n return new SortOperation(this.cwj(), SortDirection.DESC);\n }\n\n /** Filter to rows where this attribute has no value. */\n isNull(): IsNullOperation {\n return new IsNullOperation(this.cwj());\n }\n\n /** Filter to rows where this attribute has a value. */\n isNotNull(): IsNotNullOperation {\n return new IsNotNullOperation(this.cwj());\n }\n\n /** Wrap a value as a constant of this attribute's type. Overridden by the typed attributes. */\n protected toConstant(_value: AttributeValue): ConstantOperation {\n throw new TypeError(`${this.constructor.name} does not support isIn / isNotIn`);\n }\n\n private _constants(values: readonly AttributeValue[]): ConstantOperation[] {\n const constants = values.map(v => this.toConstant(v));\n if (constants.length === 0) throw new Error('isIn / isNotIn need at least one value');\n return constants;\n }\n\n /** Filter to rows where this attribute equals any of `values`. */\n isIn(values: readonly AttributeValue[]): InOperation {\n return new InOperation(this.cwj(), this._constants(values));\n }\n\n /** Filter to rows where this attribute equals none of `values`. Rows with no value are excluded, as in SQL. */\n isNotIn(values: readonly AttributeValue[]): NotInOperation {\n return new NotInOperation(this.cwj(), this._constants(values));\n }\n\n private _windowSpec(\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[],\n orderBy?: SortOperation | SortOperation[],\n ): WindowSpecification {\n const pbArr = partitionBy === undefined ? [] : Array.isArray(partitionBy) ? partitionBy : [partitionBy];\n const pb = pbArr.map(x => x instanceof Attribute ? x.cwj() : x);\n const ob = orderBy === undefined ? [] : Array.isArray(orderBy) ? orderBy : [orderBy];\n return new WindowSpecification(pb, ob);\n }\n\n /**\n * Assign a rank to each row within the ordered window, following pandas `Series.rank` conventions.\n *\n * `method` controls tie-breaking (default `'min'`):\n * - `'min'` — tied rows share the lowest rank; the next rank skips.\n * - `'dense'` — like `'min'` but ranks are contiguous (no gaps).\n * - `'first'` — each row gets a unique sequential integer (no ties).\n * - `'max'` — only meaningful with `pct: true` (see below).\n *\n * When `pct: true` the result is a relative rank between 0 and 1:\n * - `method: 'min'` (default) → fraction of values strictly below this row (PERCENT_RANK).\n * - `method: 'max'` → fraction of values at or below this row (cumulative distribution).\n *\n * `partitionBy` restarts the ranking within each group of distinct values.\n */\n rank(opts: {\n method?: 'min' | 'dense' | 'first' | 'max';\n pct?: boolean;\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n const { method = 'min', pct = false, partitionBy, orderBy } = opts;\n let func: WindowFunction;\n let name: string;\n if (pct) {\n if (method === 'max') { func = WindowFunction.CUME_DIST; name = 'Cume Dist'; }\n else { func = WindowFunction.PERCENT_RANK; name = 'Percent Rank'; }\n } else if (method === 'first') { func = WindowFunction.ROW_NUMBER; name = 'Row Number'; }\n else if (method === 'dense') { func = WindowFunction.DENSE_RANK; name = 'Dense Rank'; }\n else { func = WindowFunction.RANK; name = 'Rank'; }\n return new WindowFunctionOperation(null, func, name, undefined, [], this._windowSpec(partitionBy, orderBy));\n }\n\n /**\n * Split rows into `buckets` equal-sized quantile bins ordered by `orderBy`.\n * Each row receives a bucket number from 1 (lowest) to `buckets` (highest).\n * Named after `pandas.qcut`.\n */\n qcut(buckets: number, opts: {\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n return new WindowFunctionOperation(null, WindowFunction.NTILE, 'Quantile', buckets, [],\n this._windowSpec(opts.partitionBy, opts.orderBy));\n }\n\n /**\n * Return the value of this attribute from `periods` rows earlier (positive) or later (negative)\n * within the ordered window, following `pandas.Series.shift`.\n * Rows with no neighbour at the given offset return `null` (or `fillValue` if provided).\n */\n shift(periods = 1, opts: {\n fillValue?: string | number;\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n const extraArgs: (string | number)[] = opts.fillValue !== undefined ? [opts.fillValue] : [];\n const func = periods >= 0 ? WindowFunction.LAG : WindowFunction.LEAD;\n const label = periods >= 0 ? 'Lag' : 'Lead';\n return new WindowFunctionOperation(\n this.cwj(),\n func,\n label + ' ' + this._displayName,\n Math.abs(periods),\n extraArgs,\n this._windowSpec(opts.partitionBy, opts.orderBy),\n );\n }\n\n /**\n * Return the first value of this attribute in the window frame.\n * Use `partitionBy` to restart the frame for each group.\n */\n first(opts: {\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n return new WindowFunctionOperation(\n this.cwj(),\n WindowFunction.FIRST_VALUE,\n 'First ' + this._displayName,\n undefined, [],\n this._windowSpec(opts.partitionBy, opts.orderBy),\n );\n }\n\n /**\n * Return the last value of this attribute in the window frame.\n * Use `partitionBy` to restart the frame for each group.\n */\n last(opts: {\n partitionBy?: Attribute | ColumnWithJoin | (Attribute | ColumnWithJoin)[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n return new WindowFunctionOperation(\n this.cwj(),\n WindowFunction.LAST_VALUE,\n 'Last ' + this._displayName,\n undefined, [],\n this._windowSpec(opts.partitionBy, opts.orderBy),\n );\n }\n}\n","/**\n * Scalar functions as methods, shared by attributes and by the results of other functions, so they chain:\n * `f.name().toUpperCase().length()`.\n *\n * TypeScript has no multiple inheritance, so each group of functions is a class whose methods are mixed into\n * every host with `applyMixins` (the handbook's pattern), the type side being an `interface Host extends Group {}`\n * beside the host. A host provides `functionInput()` and `functionLabel()`: an attribute reads its column and is\n * labelled by its display name; a function result is itself the input and is labelled by its own name.\n */\nimport {\n ConcatOperation,\n ConcatPart,\n RelationalOperationElement,\n concat,\n ScalarFunction,\n ScalarFunctionOperation,\n applyMixins,\n} from '../model/relational';\n\n/** A function result that gives text, which has the string functions too: `f.name().toUpperCase().length()`. */\nexport class StringFunctionOperation extends ScalarFunctionOperation {\n functionInput(): RelationalOperationElement { return this; }\n functionLabel(): string { return labelOf(this); }\n}\n\n/** A function result that gives a number, which has the numeric functions too. */\nexport class NumericFunctionOperation extends ScalarFunctionOperation {\n functionInput(): RelationalOperationElement { return this; }\n functionLabel(): string { return labelOf(this); }\n}\n\nfunction labelOf(operation: ScalarFunctionOperation): string {\n return operation.displayName ?? operation.func.charAt(0) + operation.func.slice(1).toLowerCase();\n}\n\nfunction stringFunction(\n element: RelationalOperationElement, func: ScalarFunction, label: string,\n secondArg?: number, extraArgs: (string | number)[] = [],\n): StringFunctionOperation {\n return new StringFunctionOperation(element, func, label, secondArg, extraArgs);\n}\n\nfunction numberFunction(\n element: RelationalOperationElement, func: ScalarFunction, label: string, secondArg?: number,\n): NumericFunctionOperation {\n return new NumericFunctionOperation(element, func, label, secondArg);\n}\n\n/** Functions of text. */\nexport abstract class StringFunctions {\n /** @internal The expression the function applies to. */\n abstract functionInput(): RelationalOperationElement;\n /** @internal What a function of this is labelled after. */\n abstract functionLabel(): string;\n\n /** Join text on the end: `f.first().concat(' ', f.last())`. A NULL part makes the whole NULL. */\n concat(...more: ConcatPart[]): ConcatOperation {\n return concat(this as unknown as ConcatPart, ...more);\n }\n\n /** Convert every character to uppercase. */\n toUpperCase(): StringFunctionOperation {\n return stringFunction(this.functionInput(), ScalarFunction.UPPER, 'Upper ' + this.functionLabel());\n }\n /** Convert every character to lowercase. */\n toLowerCase(): StringFunctionOperation {\n return stringFunction(this.functionInput(), ScalarFunction.LOWER, 'Lower ' + this.functionLabel());\n }\n /** Remove leading and trailing whitespace. */\n trim(): StringFunctionOperation {\n return stringFunction(this.functionInput(), ScalarFunction.TRIM, 'Trim ' + this.functionLabel());\n }\n /** Remove leading whitespace. */\n trimStart(): StringFunctionOperation {\n return stringFunction(this.functionInput(), ScalarFunction.LTRIM, 'Trim Start ' + this.functionLabel());\n }\n /** Remove trailing whitespace. */\n trimEnd(): StringFunctionOperation {\n return stringFunction(this.functionInput(), ScalarFunction.RTRIM, 'Trim End ' + this.functionLabel());\n }\n /** Return the number of characters in the string. */\n length(): NumericFunctionOperation {\n return numberFunction(this.functionInput(), ScalarFunction.LENGTH, 'Length ' + this.functionLabel());\n }\n /** Return the string with characters in reverse order. */\n reverse(): StringFunctionOperation {\n return stringFunction(this.functionInput(), ScalarFunction.REVERSE, 'Reverse ' + this.functionLabel());\n }\n /** Return the first `n` characters. */\n left(n: number): StringFunctionOperation {\n return stringFunction(this.functionInput(), ScalarFunction.LEFT, 'Left ' + this.functionLabel(), n);\n }\n /** Return the last `n` characters. */\n right(n: number): StringFunctionOperation {\n return stringFunction(this.functionInput(), ScalarFunction.RIGHT, 'Right ' + this.functionLabel(), n);\n }\n /** Return the string repeated `n` times. */\n repeat(n: number): StringFunctionOperation {\n return stringFunction(this.functionInput(), ScalarFunction.REPEAT, 'Repeat ' + this.functionLabel(), n);\n }\n /** Replace all occurrences of `fromStr` with `toStr`. */\n replace(fromStr: string, toStr: string): StringFunctionOperation {\n return stringFunction(this.functionInput(), ScalarFunction.REPLACE, 'Replace ' + this.functionLabel(), undefined, [fromStr, toStr]);\n }\n /**\n * Extract a portion of the string.\n * `start` is zero-based (following Python convention); `length` is optional.\n */\n substring(start: number, length?: number): StringFunctionOperation {\n // Python convention: 0-based start; SQL SUBSTRING is 1-based, so add 1\n const args = length !== undefined ? [start + 1, length] : [start + 1];\n return stringFunction(this.functionInput(), ScalarFunction.SUBSTRING, 'Substring ' + this.functionLabel(), undefined, args);\n }\n}\n\n/** Functions of a number. */\nexport abstract class NumericFunctions {\n /** @internal The expression the function applies to. */\n abstract functionInput(): RelationalOperationElement;\n /** @internal What a function of this is labelled after. */\n abstract functionLabel(): string;\n\n /** Absolute value (distance from zero, always non-negative). */\n abs(): NumericFunctionOperation {\n return numberFunction(this.functionInput(), ScalarFunction.ABS, 'Abs ' + this.functionLabel());\n }\n /** Round up to the nearest integer. */\n ceil(): NumericFunctionOperation {\n return numberFunction(this.functionInput(), ScalarFunction.CEILING, 'Ceil ' + this.functionLabel());\n }\n /** Round down to the nearest integer. */\n floor(): NumericFunctionOperation {\n return numberFunction(this.functionInput(), ScalarFunction.FLOOR, 'Floor ' + this.functionLabel());\n }\n /** Square root. */\n sqrt(): NumericFunctionOperation {\n return numberFunction(this.functionInput(), ScalarFunction.SQRT, 'Sqrt ' + this.functionLabel());\n }\n /** Remainder after dividing by `n`. */\n mod(n: number): NumericFunctionOperation {\n return numberFunction(this.functionInput(), ScalarFunction.MOD, 'Mod ' + this.functionLabel(), n);\n }\n /** Raise to the power of `n`. */\n power(n: number): NumericFunctionOperation {\n return numberFunction(this.functionInput(), ScalarFunction.POWER, 'Power ' + this.functionLabel(), n);\n }\n /** Round to `d` decimal places, or to the nearest integer when `d` is omitted. */\n round(d?: number): NumericFunctionOperation {\n return numberFunction(this.functionInput(), ScalarFunction.ROUND, 'Round ' + this.functionLabel(), d);\n }\n}\n\nexport interface StringFunctionOperation extends StringFunctions {}\napplyMixins(StringFunctionOperation, [StringFunctions]);\n\nexport interface NumericFunctionOperation extends NumericFunctions {}\napplyMixins(NumericFunctionOperation, [NumericFunctions]);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYO,IAAM,cAAc;AAMpB,SAAS,WAAW,OAAuB;AAChD,SAAO,MAAM,WAAW,aAAa,cAAc,WAAW,EAAE,WAAW,KAAK,cAAc,GAAG,EAAE,WAAW,KAAK,cAAc,GAAG;AACtI;AA+DO,IAAe,6BAAf,MAA0C;AAAC;AAkB3C,IAAe,YAAf,cAAiC,2BAAgD;AAAA;AAAA,EAEtF,MAAM,MA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