data-finder-ts 0.1.3 → 0.1.4

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.
Files changed (52) hide show
  1. package/README.md +17 -55
  2. package/dist/{chunk-V647VNMY.js → chunk-4JVW4TAB.js} +59 -14
  3. package/dist/chunk-4JVW4TAB.js.map +1 -0
  4. package/dist/{chunk-5K2Z3YDY.js → chunk-4LNZV6EN.js} +138 -31
  5. package/dist/chunk-4LNZV6EN.js.map +1 -0
  6. package/dist/{chunk-6QTCGJWX.js → chunk-FJYA2ASS.js} +46 -8
  7. package/dist/chunk-FJYA2ASS.js.map +1 -0
  8. package/dist/{chunk-DFYZVBII.js → chunk-MH4XMYVB.js} +186 -142
  9. package/dist/chunk-MH4XMYVB.js.map +1 -0
  10. package/dist/{chunk-EYXBYV2X.js → chunk-PMPLCEWQ.js} +2 -2
  11. package/dist/{chunk-3SSWFES4.js → chunk-UYMOE6YU.js} +64 -3
  12. package/dist/chunk-UYMOE6YU.js.map +1 -0
  13. package/dist/datafinder/attribute.cjs +64 -13
  14. package/dist/datafinder/attribute.cjs.map +1 -1
  15. package/dist/datafinder/attribute.d.cts +48 -7
  16. package/dist/datafinder/attribute.d.ts +48 -7
  17. package/dist/datafinder/attribute.js +2 -2
  18. package/dist/datafinder/runner.cjs +389 -140
  19. package/dist/datafinder/runner.cjs.map +1 -1
  20. package/dist/datafinder/runner.d.cts +14 -3
  21. package/dist/datafinder/runner.d.ts +14 -3
  22. package/dist/datafinder/runner.js +12 -6
  23. package/dist/datafinder/sql-generator.cjs +344 -138
  24. package/dist/datafinder/sql-generator.cjs.map +1 -1
  25. package/dist/datafinder/sql-generator.d.cts +4 -13
  26. package/dist/datafinder/sql-generator.d.ts +4 -13
  27. package/dist/datafinder/sql-generator.js +5 -7
  28. package/dist/datafinder/typed-attributes.cjs +199 -41
  29. package/dist/datafinder/typed-attributes.cjs.map +1 -1
  30. package/dist/datafinder/typed-attributes.d.cts +120 -13
  31. package/dist/datafinder/typed-attributes.d.ts +120 -13
  32. package/dist/datafinder/typed-attributes.js +3 -3
  33. package/dist/index.cjs +507 -176
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +16 -15
  36. package/dist/index.d.ts +16 -15
  37. package/dist/index.js +49 -9
  38. package/dist/index.js.map +1 -1
  39. package/dist/model/milestoning.cjs.map +1 -1
  40. package/dist/model/milestoning.js +2 -2
  41. package/dist/model/relational.cjs +66 -1
  42. package/dist/model/relational.cjs.map +1 -1
  43. package/dist/model/relational.d.cts +47 -2
  44. package/dist/model/relational.d.ts +47 -2
  45. package/dist/model/relational.js +9 -1
  46. package/package.json +4 -2
  47. package/dist/chunk-3SSWFES4.js.map +0 -1
  48. package/dist/chunk-5K2Z3YDY.js.map +0 -1
  49. package/dist/chunk-6QTCGJWX.js.map +0 -1
  50. package/dist/chunk-DFYZVBII.js.map +0 -1
  51. package/dist/chunk-V647VNMY.js.map +0 -1
  52. /package/dist/{chunk-EYXBYV2X.js.map → chunk-PMPLCEWQ.js.map} +0 -0
@@ -221,6 +221,10 @@ declare class JoinOperation {
221
221
  readonly left: Column;
222
222
  readonly right: Column;
223
223
  filter?: RelationalOperationElement;
224
+ /** Property-equality filters on the join target (property id -> value), set by a related finder given a filter. */
225
+ filterKwargs: Record<string, unknown>;
226
+ /** Maps property ids to [column, type, table] for `filterKwargs`. */
227
+ filterColumnMap: Record<string, [string, string, string]>;
224
228
  constructor(name: string, target: Table, left: Column, right: Column, filter?: RelationalOperationElement);
225
229
  }
226
230
  declare class JoinTreeNodeOperation {
@@ -231,7 +235,12 @@ declare class JoinTreeNodeOperation {
231
235
  declare class ColumnWithJoin extends RelationalOperationElement {
232
236
  readonly column: Column;
233
237
  readonly parent?: JoinTreeNodeOperation | undefined;
234
- constructor(column: Column, parent?: JoinTreeNodeOperation | undefined);
238
+ readonly embedded?: ColumnWithJoin | undefined;
239
+ /**
240
+ * `embedded` is an alternate reference to a flat (denormalized) column on the owning table that
241
+ * holds the same value without the join; the SQL generator uses it when the join can be elided.
242
+ */
243
+ constructor(column: Column, parent?: JoinTreeNodeOperation | undefined, embedded?: ColumnWithJoin | undefined);
235
244
  }
236
245
  declare class SortOperation {
237
246
  readonly column: ColumnWithJoin;
@@ -242,5 +251,41 @@ declare class CountAllOperation extends RelationalOperationElement {
242
251
  readonly table: string;
243
252
  constructor(table: string);
244
253
  }
254
+ declare class Alias extends RelationalOperationElement {
255
+ readonly element: RelationalOperationElement;
256
+ readonly name: string;
257
+ constructor(element: RelationalOperationElement, name: string);
258
+ }
259
+ /** Returned by `RelatedFinder.exists()`. A backend translates it to a join-presence check. */
260
+ declare class ExistsOperation extends RelationalOperationElement {
261
+ readonly node: JoinTreeNodeOperation;
262
+ constructor(node: JoinTreeNodeOperation);
263
+ andOp(other: RelationalOperationElement): LogicalOperation;
264
+ }
265
+ /** Returned by `RelatedFinder.notExists()`. A backend translates it to a join-absence check. */
266
+ declare class NotExistsOperation extends RelationalOperationElement {
267
+ readonly node: JoinTreeNodeOperation;
268
+ constructor(node: JoinTreeNodeOperation);
269
+ andOp(other: RelationalOperationElement): LogicalOperation;
270
+ }
271
+ declare class SelectOperation {
272
+ readonly display: RelationalOperationElement[];
273
+ readonly filter: RelationalOperationElement;
274
+ readonly orderBy: SortOperation[];
275
+ readonly groupBy: RelationalOperationElement[];
276
+ readonly limit?: number | undefined;
277
+ readonly table?: Table | undefined;
278
+ /**
279
+ * Extra ON conditions for this query's joins (milestoning and property filters), keyed by join node.
280
+ * Held here rather than on the shared JoinOperation, so queries that use the same node can't affect each other.
281
+ */
282
+ readonly joinFilters: ReadonlyMap<JoinTreeNodeOperation, Operation>;
283
+ constructor(display: RelationalOperationElement[], filter: RelationalOperationElement, orderBy?: SortOperation[], groupBy?: RelationalOperationElement[], limit?: number | undefined, table?: Table | undefined,
284
+ /**
285
+ * Extra ON conditions for this query's joins (milestoning and property filters), keyed by join node.
286
+ * Held here rather than on the shared JoinOperation, so queries that use the same node can't affect each other.
287
+ */
288
+ joinFilters?: ReadonlyMap<JoinTreeNodeOperation, Operation>);
289
+ }
245
290
 
246
- export { AggregateOperation, AggregateOperator, BinaryOperation, BooleanConstantOperation, Column, ColumnWithJoin, ComparisonOperation, ComparisonOperator, ConstantOperation, CountAllOperation, DataCatalog, DataStore, Database, DateArithmeticOperation, DateConstantOperation, DateDiffOperation, DateExtractOperation, DatePart, DateTimeConstantOperation, DecimalConstantOperation, FloatConstantOperation, ForeignKey, IntegerConstantOperation, IsNotNullOperation, IsNullOperation, JoinOperation, JoinTreeNodeOperation, LogicalOperation, LogicalOperator, NoOperation, Operation, RelationalOperationElement, ScalarFunction, ScalarFunctionOperation, Schema, SortDirection, SortOperation, StringConstantOperation, Table, UnaryOperation, WindowFunction, WindowFunctionOperation, WindowSpecification };
291
+ export { AggregateOperation, AggregateOperator, Alias, BinaryOperation, BooleanConstantOperation, Column, ColumnWithJoin, ComparisonOperation, ComparisonOperator, ConstantOperation, CountAllOperation, DataCatalog, DataStore, Database, DateArithmeticOperation, DateConstantOperation, DateDiffOperation, DateExtractOperation, DatePart, DateTimeConstantOperation, DecimalConstantOperation, ExistsOperation, FloatConstantOperation, ForeignKey, IntegerConstantOperation, IsNotNullOperation, IsNullOperation, JoinOperation, JoinTreeNodeOperation, LogicalOperation, LogicalOperator, NoOperation, NotExistsOperation, Operation, RelationalOperationElement, ScalarFunction, ScalarFunctionOperation, Schema, SelectOperation, SortDirection, SortOperation, StringConstantOperation, Table, UnaryOperation, WindowFunction, WindowFunctionOperation, WindowSpecification };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  AggregateOperation,
3
3
  AggregateOperator,
4
+ Alias,
4
5
  BinaryOperation,
5
6
  BooleanConstantOperation,
6
7
  Column,
@@ -19,6 +20,7 @@ import {
19
20
  DatePart,
20
21
  DateTimeConstantOperation,
21
22
  DecimalConstantOperation,
23
+ ExistsOperation,
22
24
  FloatConstantOperation,
23
25
  ForeignKey,
24
26
  IntegerConstantOperation,
@@ -29,11 +31,13 @@ import {
29
31
  LogicalOperation,
30
32
  LogicalOperator,
31
33
  NoOperation,
34
+ NotExistsOperation,
32
35
  Operation,
33
36
  RelationalOperationElement,
34
37
  ScalarFunction,
35
38
  ScalarFunctionOperation,
36
39
  Schema,
40
+ SelectOperation,
37
41
  SortDirection,
38
42
  SortOperation,
39
43
  StringConstantOperation,
@@ -42,10 +46,11 @@ import {
42
46
  WindowFunction,
43
47
  WindowFunctionOperation,
44
48
  WindowSpecification
45
- } from "../chunk-3SSWFES4.js";
49
+ } from "../chunk-UYMOE6YU.js";
46
50
  export {
47
51
  AggregateOperation,
48
52
  AggregateOperator,
53
+ Alias,
49
54
  BinaryOperation,
50
55
  BooleanConstantOperation,
51
56
  Column,
@@ -64,6 +69,7 @@ export {
64
69
  DatePart,
65
70
  DateTimeConstantOperation,
66
71
  DecimalConstantOperation,
72
+ ExistsOperation,
67
73
  FloatConstantOperation,
68
74
  ForeignKey,
69
75
  IntegerConstantOperation,
@@ -74,11 +80,13 @@ export {
74
80
  LogicalOperation,
75
81
  LogicalOperator,
76
82
  NoOperation,
83
+ NotExistsOperation,
77
84
  Operation,
78
85
  RelationalOperationElement,
79
86
  ScalarFunction,
80
87
  ScalarFunctionOperation,
81
88
  Schema,
89
+ SelectOperation,
82
90
  SortDirection,
83
91
  SortOperation,
84
92
  StringConstantOperation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-finder-ts",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "TypeScript runtime library for data-finder generated finders",
5
5
  "keywords": [
6
6
  "data",
@@ -75,7 +75,9 @@
75
75
  "test": "vitest run",
76
76
  "generate": "uv run python example/generate.py",
77
77
  "generate:dual-assoc": "uv run python example/generate_dual_assoc.py",
78
- "generate:examples": "uv run python example/generate_examples.py"
78
+ "generate:examples": "uv run python example/generate_examples.py",
79
+ "generate:graphql": "uv run python example/generate_graphql_examples.py",
80
+ "generate:specs": "uv run python scripts/generate_spec_tests.py"
79
81
  },
80
82
  "dependencies": {
81
83
  "vite-tsconfig-paths": "^6.1.1"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/model/relational.ts"],"sourcesContent":["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\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 constructor(\n readonly column: Column,\n readonly parent?: JoinTreeNodeOperation,\n ) { super(); }\n}\n\nexport class SortOperation {\n constructor(\n readonly column: ColumnWithJoin,\n readonly direction: SortDirection,\n ) {}\n}\n\nexport class CountAllOperation extends RelationalO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A,EAChE,YAAqB,OAAe;AAAE,UAAM;AAAvB;AAAA,EAA0B;AAAA,EAA1B;AACvB;","names":["ComparisonOperator","LogicalOperator","AggregateOperator","ScalarFunction","DatePart","SortDirection","WindowFunction"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/datafinder/typed-attributes.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 ) { super(displayName, columnName, columnDbType, owner, parent); }\n\n upper(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.UPPER, 'Upper ' + this.displayName());\n }\n lower(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.LOWER, 'Lower ' + this.displayName());\n }\n strip(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.TRIM, 'Strip ' + this.displayName());\n }\n lstrip(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.LTRIM, 'LStrip ' + this.displayName());\n }\n rstrip(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.RTRIM, 'RStrip ' + this.displayName());\n }\n length(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.LENGTH, 'Length ' + this.displayName());\n }\n reverse(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.REVERSE, 'Reverse ' + this.displayName());\n }\n left(n: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.LEFT, 'Left ' + this.displayName(), n);\n }\n right(n: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.RIGHT, 'Right ' + this.displayName(), n);\n }\n repeat(n: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.REPEAT, 'Repeat ' + this.displayName(), n);\n }\n replace(fromStr: string, toStr: string): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.REPLACE, 'Replace ' + this.displayName(), undefined, [fromStr, toStr]);\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 eq(value: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new StringConstantOperation(value));\n }\n ne(value: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new StringConstantOperation(value));\n }\n contains(value: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LIKE, new StringConstantOperation(`%${value}%`));\n }\n startsWith(prefix: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LIKE, new StringConstantOperation(`${prefix}%`));\n }\n endsWith(suffix: string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LIKE, new StringConstantOperation(`%${suffix}`));\n }\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 ) { super(displayName, columnName, columnDbType, owner, parent); }\n\n sum(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.SUM, this.displayName() + ' Sum');\n }\n min(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.MIN, this.displayName() + ' Min');\n }\n max(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.MAX, this.displayName() + ' Max');\n }\n average(): AggregateOperation {\n return new AggregateOperation(this.cwj(), AggregateOperator.AVERAGE, this.displayName() + ' Average');\n }\n abs(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.ABS, 'Abs ' + this.displayName());\n }\n ceil(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.CEILING, 'Ceil ' + this.displayName());\n }\n floor(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.FLOOR, 'Floor ' + this.displayName());\n }\n sqrt(): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.SQRT, 'Sqrt ' + this.displayName());\n }\n mod(n: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.MOD, 'Mod ' + this.displayName(), n);\n }\n power(n: number): ScalarFunctionOperation {\n return new ScalarFunctionOperation(this.cwj(), ScalarFunction.POWER, 'Power ' + this.displayName(), n);\n }\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 ) { super(displayName, columnName, columnDbType, owner, parent); }\n\n eq(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new FloatConstantOperation(value));\n }\n ne(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new FloatConstantOperation(value));\n }\n gt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new FloatConstantOperation(value));\n }\n lt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new FloatConstantOperation(value));\n }\n gte(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new FloatConstantOperation(value));\n }\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 ) { super(displayName, columnName, columnDbType, owner, parent); }\n\n eq(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new DecimalConstantOperation(value));\n }\n ne(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new DecimalConstantOperation(value));\n }\n gt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new DecimalConstantOperation(value));\n }\n lt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new DecimalConstantOperation(value));\n }\n gte(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new DecimalConstantOperation(value));\n }\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 ) { super(displayName, columnName, columnDbType, owner, parent); }\n\n eq(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new IntegerConstantOperation(value));\n }\n ne(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new IntegerConstantOperation(value));\n }\n gt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new IntegerConstantOperation(value));\n }\n lt(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new IntegerConstantOperation(value));\n }\n gte(value: number): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new IntegerConstantOperation(value));\n }\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 ) { super(displayName, columnName, columnDbType, owner, parent); }\n\n eq(value: boolean): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new BooleanConstantOperation(value));\n }\n isTrue(): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new BooleanConstantOperation(true));\n }\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 ) { super(displayName, columnName, columnDbType, owner, parent); }\n\n eq(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new DateConstantOperation(parseDate(value)));\n }\n ne(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new DateConstantOperation(parseDate(value)));\n }\n gt(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new DateConstantOperation(parseDate(value)));\n }\n lt(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new DateConstantOperation(parseDate(value)));\n }\n gte(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new DateConstantOperation(parseDate(value)));\n }\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 year(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.YEAR, 'Year ' + this.displayName()); }\n month(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.MONTH, 'Month ' + this.displayName()); }\n day(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DAY, 'Day ' + this.displayName()); }\n quarter(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.QUARTER, 'Quarter ' + this.displayName()); }\n week(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.WEEK, 'Week ' + this.displayName()); }\n dayOfWeek(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DOW, 'Day Of Week ' + this.displayName()); }\n\n addDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, true, 'Add Days ' + this.displayName()); }\n addMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, true, 'Add Months ' + this.displayName()); }\n addYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, true, 'Add Years ' + this.displayName()); }\n subtractDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, false, 'Subtract Days ' + this.displayName()); }\n subtractMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, false, 'Subtract Months ' + this.displayName()); }\n subtractYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, false, 'Subtract Years ' + this.displayName()); }\n\n diffDays(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.DAY, 'Diff Days ' + this.displayName()); }\n diffMonths(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.MONTH, 'Diff Months ' + this.displayName()); }\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 ) { super(displayName, columnName, columnDbType, owner, parent); }\n\n eq(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.EQUAL, new DateTimeConstantOperation(parseDate(value)));\n }\n ne(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.NOT_EQUAL, new DateTimeConstantOperation(parseDate(value)));\n }\n gt(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN, new DateTimeConstantOperation(parseDate(value)));\n }\n lt(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.LESS_THAN, new DateTimeConstantOperation(parseDate(value)));\n }\n gte(value: Date | string): Operation {\n return new ComparisonOperation(this.cwj(), ComparisonOperator.GREATER_THAN_OR_EQUAL_TO, new DateTimeConstantOperation(parseDate(value)));\n }\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 year(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.YEAR, 'Year ' + this.displayName()); }\n month(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.MONTH, 'Month ' + this.displayName()); }\n day(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DAY, 'Day ' + this.displayName()); }\n hour(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.HOUR, 'Hour ' + this.displayName()); }\n minute(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.MINUTE, 'Minute ' + this.displayName()); }\n second(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.SECOND, 'Second ' + this.displayName()); }\n quarter(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.QUARTER, 'Quarter ' + this.displayName()); }\n week(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.WEEK, 'Week ' + this.displayName()); }\n dayOfWeek(): DateExtractOperation { return new DateExtractOperation(this.cwj(), DatePart.DOW, 'Day Of Week ' + this.displayName()); }\n\n addDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, true, 'Add Days ' + this.displayName()); }\n addMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, true, 'Add Months ' + this.displayName()); }\n addYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, true, 'Add Years ' + this.displayName()); }\n addHours(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.HOUR, true, 'Add Hours ' + this.displayName()); }\n addMinutes(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MINUTE, true, 'Add Minutes ' + this.displayName()); }\n addSeconds(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.SECOND, true, 'Add Seconds ' + this.displayName()); }\n subtractDays(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.DAY, false, 'Subtract Days ' + this.displayName()); }\n subtractMonths(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MONTH, false, 'Subtract Months ' + this.displayName()); }\n subtractYears(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.YEAR, false, 'Subtract Years ' + this.displayName()); }\n subtractHours(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.HOUR, false, 'Subtract Hours ' + this.displayName()); }\n subtractMinutes(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.MINUTE, false, 'Subtract Minutes ' + this.displayName()); }\n subtractSeconds(n: number): DateArithmeticOperation { return new DateArithmeticOperation(this.cwj(), n, DatePart.SECOND, false, 'Subtract Seconds ' + this.displayName()); }\n\n diffDays(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.DAY, 'Diff Days ' + this.displayName()); }\n diffMonths(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.MONTH, 'Diff Months ' + this.displayName()); }\n diffYears(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.YEAR, 'Diff Years ' + this.displayName()); }\n diffHours(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.HOUR, 'Diff Hours ' + this.displayName()); }\n diffMinutes(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.MINUTE, 'Diff Minutes ' + this.displayName()); }\n diffSeconds(other: Date): DateDiffOperation { return new DateDiffOperation(this.cwj(), other, DatePart.SECOND, 'Diff Seconds ' + this.displayName()); }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBO,IAAM,kBAAN,cAA8B,UAAU;AAAA,EAC7C,YACE,aACA,YACA,cACA,OACA,QACA;AAAE,UAAM,aAAa,YAAY,cAAc,OAAO,MAAM;AAAA,EAAG;AAAA,EAEjE,QAAiC;AAC/B,WAAO,IAAI,wBAAwB,KAAK,IAAI,wBAAyB,WAAW,KAAK,YAAY,CAAC;AAAA,EACpG;AAAA,EACA,QAAiC;AAC/B,WAAO,IAAI,wBAAwB,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AA,EAC7I,WAAW,OAAgC;AAAE,WAAO,IAAI,kBAAkB,KAAK,IAAI,GAAG,4BAAuB,iBAAiB,KAAK,YAAY,CAAC;AAAA,EAAG;AAAA,EACnJ,UAAU,OAAgC;AAAE,WAAO,IAAI,kBAAkB,KAAK,IAAI,GAAG,0BAAsB,gBAAgB,KAAK,YAAY,CAAC;AAAA,EAAG;AAAA,EAChJ,UAAU,OAAgC;AAAE,WAAO,IAAI,kBAAkB,KAAK,IAAI,GAAG,0BAAsB,gBAAgB,KAAK,YAAY,CAAC;AAAA,EAAG;AAAA,EAChJ,YAAY,OAAgC;AAAE,WAAO,IAAI,kBAAkB,KAAK,IAAI,GAAG,8BAAwB,kBAAkB,KAAK,YAAY,CAAC;AAAA,EAAG;AAAA,EACtJ,YAAY,OAAgC;AAAE,WAAO,IAAI,kBAAkB,KAAK,IAAI,GAAG,8BAAwB,kBAAkB,KAAK,YAAY,CAAC;AAAA,EAAG;AACxJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/datafinder/runner.ts"],"sourcesContent":["import { Attribute } from './attribute';\nimport { toSql } from './sql-generator';\nimport {\n Table,\n Operation,\n SortOperation,\n NoOperation,\n RelationalOperationElement,\n} from '../model/relational';\n\nexport type Row = unknown[];\n\n/** Minimum interface satisfied by both Table (SQL) and GraphQLQuery (GraphQL). */\nexport interface QueryTarget {\n readonly name: string;\n}\n\nexport interface QueryRunner {\n select(\n businessDate: Date | null,\n processingDatetime: Date | null,\n columns: (Attribute | RelationalOperationElement)[],\n table: QueryTarget,\n op: RelationalOperationElement,\n orderBy?: SortOperation[],\n groupBy?: Attribute[],\n limit?: number,\n ): Promise<Row[]>;\n}\n\nlet _runner: QueryRunner | null = null;\n\nexport function registerRunner(runner: QueryRunner): void { _runner = runner; }\nexport function clearRunner(): void { _runner = null; }\nexport function getRunner(): QueryRunner {\n if (!_runner) throw new Error('No query runner registered. Call registerRunner() first.');\n return _runner;\n}\n\nexport class FinderResult {\n private _orderBy: SortOperation[] = [];\n private _groupBy: Attribute[] = [];\n private _limit?: number;\n\n constructor(\n private readonly _businessDate: Date | null,\n private readonly _processingDatetime: Date | null,\n private readonly _columns: (Attribute | RelationalOperationElement)[],\n private readonly _table: QueryTarget,\n private readonly _op: RelationalOperationElement,\n ) {}\n\n orderByOp(...sorts: SortOperation[]): this {\n this._orderBy = sorts;\n return this;\n }\n\n groupByOp(...attrs: Attribute[]): this {\n this._groupBy = attrs;\n return this;\n }\n\n limit(n: number): this {\n this._limit = n;\n return this;\n }\n\n toSql(): string {\n return toSql(\n this._businessDate,\n this._processingDatetime,\n this._columns,\n this._table as Table,\n this._op,\n this._orderBy,\n this._groupBy,\n this._limit,\n );\n }\n\n async toRows(): Promise<Row[]> {\n return getRunner().select(\n this._businessDate,\n this._processingDatetime,\n this._columns,\n this._table,\n this._op,\n this._orderBy,\n this._groupBy,\n this._limit,\n );\n }\n}\n\nfunction convertDate(value: Date | string | null): Date | null {\n if (value === null) return null;\n if (value instanceof Date) return value;\n // Date-only strings (YYYY-MM-DD) must be parsed as UTC to avoid timezone-shift bugs.\n // new Date('2023-01-15') already parses as UTC midnight, so this is consistent.\n const normalized = /^\\d{4}-\\d{2}-\\d{2}$/.test(value) ? value + 'T00:00:00Z' : value;\n const d = new Date(normalized);\n if (isNaN(d.getTime())) throw new Error(`Cannot parse date: ${value}`);\n return d;\n}\n\nexport function convertInputsAndSelect(\n businessDate: Date | string | null,\n processingDatetime: Date | string | null,\n columns: (Attribute | RelationalOperationElement)[],\n table: QueryTarget,\n op: RelationalOperationElement = new NoOperation(),\n): FinderResult {\n return new FinderResult(\n convertDate(businessDate),\n convertDate(processingDatetime),\n columns,\n table,\n op,\n );\n}\n"],"mappings":";;;;;;;;AA8BA,IAAI,UAA8B;AAE3B,SAAS,eAAe,QAA2B;AAAE,YAAU;AAAQ;AACvE,SAAS,cAAoB;AAAE,YAAU;AAAM;AAC/C,SAAS,YAAyB;AACvC,MAAI,CAAC,QAAS,OAAM,IAAI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,YAAY,YAAY;AAAA,IACxB,YAAY,kBAAkB;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/datafinder/finder.ts","../src/datafinder/sql-generator.ts"],"sourcesContent":["import { RelationalOperationElement, LogicalOperation, LogicalOperator, JoinTreeNodeOperation } from '../model/relational';\n\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\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 RelatedFinder {\n constructor(private readonly _node: JoinTreeNodeOperation) {}\n\n exists(): ExistsOperation {\n return new ExistsOperation(this._node);\n }\n\n notExists(): NotExistsOperation {\n return new NotExistsOperation(this._node);\n }\n}\n","import { Attribute } from './attribute';\nimport {\n RelationalOperationElement,\n Operation,\n NoOperation,\n ConstantOperation,\n StringConstantOperation,\n IntegerConstantOperation,\n FloatConstantOperation,\n DateConstantOperation,\n DateTimeConstantOperation,\n BooleanConstantOperation,\n DecimalConstantOperation,\n LogicalOperation,\n LogicalOperator,\n ComparisonOperation,\n ComparisonOperator,\n IsNullOperation,\n IsNotNullOperation,\n AggregateOperation,\n AggregateOperator,\n ScalarFunctionOperation,\n ScalarFunction,\n DateExtractOperation,\n DateArithmeticOperation,\n DateDiffOperation,\n WindowFunction,\n WindowFunctionOperation,\n WindowSpecification,\n Column,\n ColumnWithJoin,\n Table,\n JoinOperation,\n JoinTreeNodeOperation,\n SortOperation,\n SortDirection,\n CountAllOperation,\n UnaryOperation,\n} from '../model/relational';\nimport {\n MilestonedTable,\n BiTemporalColumns,\n BusinessDateAndProcessingTemporalColumns,\n ProcessingTemporalColumns,\n SingleBusinessDateColumn,\n} from '../model/milestoning';\nimport { DateAttribute, DateTimeAttribute } from './typed-attributes';\nimport { ExistsOperation, NotExistsOperation } from './finder';\n\nclass Alias {\n constructor(readonly element: RelationalOperationElement, readonly name: string) {}\n}\n\nclass TableAlias {\n constructor(readonly table: string, readonly alias: string) {}\n}\n\nclass TableAliasColumn extends RelationalOperationElement {\n constructor(readonly column: Column, readonly tableAlias: TableAlias) { super(); }\n}\n\nclass Join {\n constructor(\n readonly source: TableAliasColumn,\n readonly target: TableAliasColumn,\n readonly filterOp?: RelationalOperationElement,\n ) {}\n}\n\nclass SelectOperation {\n constructor(\n readonly display: (Attribute | RelationalOperationElement)[],\n readonly filter: RelationalOperationElement,\n readonly orderBy: SortOperation[] = [],\n readonly groupBy: Attribute[] = [],\n readonly limit?: number,\n readonly table?: Table,\n ) {}\n}\n\nfunction sqlFormatDatetime(value: Date): string {\n const pad = (n: number, w = 2) => String(n).padStart(w, '0');\n return `'${value.getUTCFullYear()}-${pad(value.getUTCMonth() + 1)}-${pad(value.getUTCDate())} ${pad(value.getUTCHours())}:${pad(value.getUTCMinutes())}:${pad(value.getUTCSeconds())}'`;\n}\n\nfunction sqlFormatDate(value: Date): string {\n const pad = (n: number) => String(n).padStart(2, '0');\n return `'${value.getUTCFullYear()}-${pad(value.getUTCMonth() + 1)}-${pad(value.getUTCDate())}'`;\n}\n\nconst LOGICAL_OPERATOR_STR: Record<LogicalOperator, string> = {\n [LogicalOperator.AND]: ' AND ',\n [LogicalOperator.OR]: ' OR ',\n};\n\nconst COMPARISON_OPERATOR_STR: Record<ComparisonOperator, string> = {\n [ComparisonOperator.EQUAL]: ' = ',\n [ComparisonOperator.NOT_EQUAL]: ' <> ',\n [ComparisonOperator.LESS_THAN]: ' < ',\n [ComparisonOperator.GREATER_THAN]: ' > ',\n [ComparisonOperator.LESS_THAN_OR_EQUAL_TO]: ' <= ',\n [ComparisonOperator.GREATER_THAN_OR_EQUAL_TO]: ' >= ',\n [ComparisonOperator.LIKE]: ' LIKE ',\n [ComparisonOperator.NOT_LIKE]: ' NOT LIKE ',\n};\n\nconst AGGREGATE_SQL_NAMES: Partial<Record<AggregateOperator, string>> = {\n [AggregateOperator.AVERAGE]: 'AVG',\n};\n\nconst WINDOW_SQL_NAMES: Record<WindowFunction, string> = {\n [WindowFunction.ROW_NUMBER]: 'ROW_NUMBER',\n [WindowFunction.RANK]: 'RANK',\n [WindowFunction.DENSE_RANK]: 'DENSE_RANK',\n [WindowFunction.NTILE]: 'NTILE',\n [WindowFunction.LAG]: 'LAG',\n [WindowFunction.LEAD]: 'LEAD',\n [WindowFunction.FIRST_VALUE]: 'FIRST_VALUE',\n [WindowFunction.LAST_VALUE]: 'LAST_VALUE',\n [WindowFunction.CUME_DIST]: 'CUME_DIST',\n [WindowFunction.PERCENT_RANK]: 'PERCENT_RANK',\n};\n\nconst SCALAR_SQL_NAMES: Record<ScalarFunction, string> = {\n [ScalarFunction.ABS]: 'ABS',\n [ScalarFunction.CEILING]: 'CEILING',\n [ScalarFunction.FLOOR]: 'FLOOR',\n [ScalarFunction.MOD]: 'MOD',\n [ScalarFunction.POWER]: 'POWER',\n [ScalarFunction.SQRT]: 'SQRT',\n [ScalarFunction.ROUND]: 'ROUND',\n [ScalarFunction.UPPER]: 'UPPER',\n [ScalarFunction.LOWER]: 'LOWER',\n [ScalarFunction.TRIM]: 'TRIM',\n [ScalarFunction.LTRIM]: 'LTRIM',\n [ScalarFunction.RTRIM]: 'RTRIM',\n [ScalarFunction.LENGTH]: 'LENGTH',\n [ScalarFunction.REVERSE]: 'REVERSE',\n [ScalarFunction.LEFT]: 'LEFT',\n [ScalarFunction.RIGHT]: 'RIGHT',\n [ScalarFunction.REPEAT]: 'REPEAT',\n [ScalarFunction.REPLACE]: 'REPLACE',\n [ScalarFunction.SUBSTRING]: 'SUBSTRING',\n};\n\nfunction constantValueString(op: ConstantOperation): string {\n if (op instanceof StringConstantOperation) return \"'\" + op.value + \"'\";\n if (op instanceof DateConstantOperation) return sqlFormatDate(op.value);\n if (op instanceof DateTimeConstantOperation) return sqlFormatDatetime(op.value);\n if (op instanceof IntegerConstantOperation) return String(op.value);\n if (op instanceof FloatConstantOperation) return String(op.value);\n if (op instanceof BooleanConstantOperation) return op.value ? 'TRUE' : 'FALSE';\n if (op instanceof DecimalConstantOperation) return String(op.value);\n throw new Error('Unknown constant operation');\n}\n\nfunction windowSpecToString(window: WindowSpecification): string {\n const parts: string[] = [];\n if (window.partitionBy.length > 0) {\n parts.push('PARTITION BY ' + window.partitionBy.map(p => sqlOperationToString(p)).join(', '));\n }\n if (window.orderBy.length > 0) {\n parts.push('ORDER BY ' + window.orderBy.map(s =>\n sqlOperationToString(s.column) + (s.direction === SortDirection.ASC ? ' ASC' : ' DESC'),\n ).join(', '));\n }\n return 'OVER (' + parts.join(' ') + ')';\n}\n\nfunction sqlOperationToString(operation: RelationalOperationElement): string {\n if (operation instanceof TableAliasColumn) {\n return operation.tableAlias.alias + '.' + operation.column.name;\n }\n if (operation instanceof WindowFunctionOperation) {\n const fn = WINDOW_SQL_NAMES[operation.func];\n const parts: string[] = [];\n if (operation.element !== null && operation.element !== undefined) {\n parts.push(sqlOperationToString(operation.element));\n }\n if (operation.secondArg !== undefined) parts.push(String(operation.secondArg));\n for (const arg of operation.extraArgs) {\n parts.push(typeof arg === 'string' ? \"'\" + arg + \"'\" : String(arg));\n }\n const sql = fn + '(' + parts.join(', ') + ')';\n return sql + (operation.window !== undefined ? ' ' + windowSpecToString(operation.window) : ' OVER ()');\n }\n if (operation instanceof AggregateOperation) {\n const fn = AGGREGATE_SQL_NAMES[operation.operator] ?? operation.operator;\n let sql = fn + '(' + sqlOperationToString(operation.element) + ')';\n if (operation.window !== undefined) {\n sql += ' ' + windowSpecToString(operation.window);\n }\n return sql;\n }\n if (operation instanceof ScalarFunctionOperation) {\n const fn = SCALAR_SQL_NAMES[operation.func];\n const parts: string[] = [sqlOperationToString(operation.element)];\n if (operation.secondArg !== undefined) parts.push(String(operation.secondArg));\n for (const arg of operation.extraArgs) {\n parts.push(typeof arg === 'string' ? \"'\" + arg + \"'\" : String(arg));\n }\n return fn + '(' + parts.join(', ') + ')';\n }\n if (operation instanceof DateExtractOperation) {\n return 'EXTRACT(' + operation.part + ' FROM ' + sqlOperationToString(operation.element) + ')';\n }\n if (operation instanceof DateArithmeticOperation) {\n const op = operation.isAdd ? '+' : '-';\n return sqlOperationToString(operation.element) + ' ' + op + ' INTERVAL ' + operation.n + ' ' + operation.unit;\n }\n if (operation instanceof DateDiffOperation) {\n const otherSql = sqlFormatDatetime(operation.other);\n return \"DATE_DIFF('\" + operation.unit.toLowerCase() + \"', \" + sqlOperationToString(operation.element) + ', ' + otherSql + ')';\n }\n if (operation instanceof CountAllOperation) return 'COUNT(*)';\n if (operation instanceof Alias) {\n return sqlOperationToString(operation.element) + ' AS \"' + operation.name + '\"';\n }\n throw new TypeError('Unknown operation in sqlOperationToString: ' + operation.constructor.name);\n}\n\nfunction findColumn(operation: RelationalOperationElement): ColumnWithJoin {\n if (operation instanceof UnaryOperation) return findColumn(operation.element);\n if (operation instanceof ColumnWithJoin) return operation;\n throw new TypeError('Cannot find ColumnWithJoin in: ' + operation.constructor.name);\n}\n\nfunction openEndClause(\n endAttr: DateTimeAttribute | DateAttribute,\n value: Date,\n infiniteDatetime?: string,\n): Operation {\n const gtOp = endAttr instanceof DateTimeAttribute ? endAttr.gt(value) : endAttr.gt(value);\n if (infiniteDatetime === undefined) {\n const colRef = new ColumnWithJoin(endAttr.column(), endAttr.parent());\n return new LogicalOperation(gtOp, LogicalOperator.OR, new IsNullOperation(colRef));\n }\n return gtOp;\n}\n\nfunction buildMilestoningFilterOperation(\n businessDate: Date | null,\n processingDatetime: Date | null,\n table: MilestonedTable,\n joinNode?: JoinTreeNodeOperation,\n): Operation | null {\n const mc = table.milestoningColumns;\n const ops: Operation[] = [];\n\n if (mc instanceof BiTemporalColumns) {\n if (businessDate !== null) {\n const dateFrom = new DateAttribute('business_date_from', mc.businessDateFromColumn.name, mc.businessDateFromColumn.type, mc.businessDateFromColumn.table!.qualifiedName, joinNode);\n const dateTo = new DateAttribute('business_date_to', mc.businessDateToColumn.name, mc.businessDateToColumn.type, mc.businessDateToColumn.table!.qualifiedName, joinNode);\n ops.push(new LogicalOperation(dateFrom.lte(businessDate), LogicalOperator.AND, openEndClause(dateTo, businessDate, mc.infiniteDatetime)));\n }\n if (processingDatetime !== null) {\n const startAt = new DateTimeAttribute('start_at', mc.startAtColumn.name, mc.startAtColumn.type, mc.startAtColumn.table!.qualifiedName, joinNode);\n const endAt = new DateTimeAttribute('end_at', mc.endAtColumn.name, mc.endAtColumn.type, mc.endAtColumn.table!.qualifiedName, joinNode);\n ops.push(new LogicalOperation(startAt.lte(processingDatetime), LogicalOperator.AND, openEndClause(endAt, processingDatetime, mc.infiniteDatetime)));\n }\n } else if (mc instanceof BusinessDateAndProcessingTemporalColumns) {\n if (businessDate !== null) {\n const businessAtt = new DateAttribute('business_date', mc.businessDateColumn.name, mc.businessDateColumn.type, mc.businessDateColumn.table!.qualifiedName, joinNode);\n ops.push(businessAtt.eq(businessDate));\n }\n if (processingDatetime !== null) {\n const startAt = new DateTimeAttribute('start_at', mc.startAtColumn.name, mc.startAtColumn.type, mc.startAtColumn.table!.qualifiedName, joinNode);\n const endAt = new DateTimeAttribute('end_at', mc.endAtColumn.name, mc.endAtColumn.type, mc.endAtColumn.table!.qualifiedName, joinNode);\n ops.push(new LogicalOperation(startAt.lte(processingDatetime), LogicalOperator.AND, openEndClause(endAt, processingDatetime, mc.infiniteDatetime)));\n }\n } else if (mc instanceof ProcessingTemporalColumns && processingDatetime !== null) {\n const startAt = new DateTimeAttribute('start_at', mc.startAtColumn.name, mc.startAtColumn.type, mc.startAtColumn.table!.qualifiedName, joinNode);\n const endAt = new DateTimeAttribute('end_at', mc.endAtColumn.name, mc.endAtColumn.type, mc.endAtColumn.table!.qualifiedName, joinNode);\n ops.push(new LogicalOperation(startAt.lte(processingDatetime), LogicalOperator.AND, openEndClause(endAt, processingDatetime, mc.infiniteDatetime)));\n } else if (mc instanceof SingleBusinessDateColumn && businessDate !== null) {\n const businessAtt = new DateAttribute('business_date', mc.businessDateColumn.name, mc.businessDateColumn.type, mc.businessDateColumn.table!.qualifiedName, joinNode);\n ops.push(businessAtt.eq(businessDate));\n }\n\n if (ops.length === 0) return null;\n if (ops.length === 1) return ops[0];\n return new LogicalOperation(ops[0], LogicalOperator.AND, ops[1]);\n}\n\nfunction buildQueryOperation(\n businessDate: Date | null,\n processingDatetime: Date | null,\n columns: (Attribute | RelationalOperationElement)[],\n table: Table,\n op: RelationalOperationElement,\n orderBy: SortOperation[] = [],\n groupBy: Attribute[] = [],\n limit?: number,\n): SelectOperation {\n let filter = op;\n\n if (table instanceof MilestonedTable) {\n const milestonedOp = buildMilestoningFilterOperation(businessDate, processingDatetime, table);\n if (milestonedOp !== null) {\n filter = filter instanceof NoOperation\n ? milestonedOp\n : new LogicalOperation(filter, LogicalOperator.AND, milestonedOp);\n }\n }\n\n const requiredJoins: JoinTreeNodeOperation[] = [];\n const requiredJoinIds = new Set<JoinTreeNodeOperation>();\n\n for (const col of columns) {\n if (col instanceof CountAllOperation) continue;\n let node: JoinTreeNodeOperation | undefined;\n if (col instanceof Attribute) {\n node = col.parent();\n } else {\n node = findColumn(col as RelationalOperationElement).parent;\n }\n if (node !== undefined && !requiredJoinIds.has(node)) {\n requiredJoinIds.add(node);\n requiredJoins.push(node);\n }\n }\n\n for (const node of requiredJoins) {\n if (node.join.target instanceof MilestonedTable) {\n const milestonedOp = buildMilestoningFilterOperation(businessDate, processingDatetime, node.join.target, node);\n if (milestonedOp !== null) {\n node.join.filter = milestonedOp;\n }\n }\n }\n\n return new SelectOperation(columns, filter, orderBy, groupBy, limit, table);\n}\n\nclass SQLQueryGenerator {\n private _select: Alias[] = [];\n private _from: Set<TableAlias> = new Set();\n private _join: Join[] = [];\n private _groupByParts: string[] = [];\n private _orderByParts: string[] = [];\n private _where = '';\n private _limit?: number;\n private _tableAliasIncr = 0;\n private _tableAliasesByTable = new Map<unknown, TableAlias>();\n private _addedJoinIds = new Set<JoinTreeNodeOperation>();\n private _rootTable?: Table;\n\n generate(select: SelectOperation): void {\n this._rootTable = select.table;\n if (this._rootTable !== undefined) {\n this._from.add(this._tableAliasForTable(this._rootTable.qualifiedName, this._rootTable.qualifiedName));\n }\n this.processSelect(select.display);\n this._where = this.buildFilter(select.filter);\n const groupByJoins = new Map<JoinTreeNodeOperation, JoinTreeNodeOperation>();\n for (const expr of select.groupBy) {\n this._collectRequiredJoins(expr, groupByJoins);\n }\n for (const node of groupByJoins.values()) {\n this._addJoin(node);\n }\n this._groupByParts = select.groupBy.map(a => this._attrToColString(a));\n this._orderByParts = select.orderBy.map(s =>\n this.buildFilter(s.column) + (s.direction === SortDirection.ASC ? ' ASC' : ' DESC'),\n );\n this._limit = select.limit;\n }\n\n private _attrToColString(attr: Attribute): string {\n const node = attr.parent();\n const ta = this._tableAliasForTable(attr.owner(), node ?? attr.owner());\n return ta.alias + '.' + attr.column().name;\n }\n\n private _collectRequiredJoins(op: RelationalOperationElement | null | undefined, out: Map<JoinTreeNodeOperation, JoinTreeNodeOperation>): void {\n if (op === null || op === undefined) return;\n if (op instanceof Attribute) {\n const p = op.parent();\n if (p !== undefined) out.set(p, p);\n } else if (op instanceof ColumnWithJoin) {\n if (op.parent !== undefined) out.set(op.parent, op.parent);\n } else if (op instanceof AggregateOperation) {\n this._collectRequiredJoins(op.element, out);\n if (op.window) this._collectRequiredJoins(op.window as unknown as RelationalOperationElement, out);\n } else if (op instanceof WindowFunctionOperation) {\n if (op.element) this._collectRequiredJoins(op.element, out);\n if (op.window) this._collectRequiredJoinsFromWindowSpec(op.window, out);\n } else if (op instanceof ScalarFunctionOperation || op instanceof DateExtractOperation ||\n op instanceof DateArithmeticOperation || op instanceof DateDiffOperation) {\n this._collectRequiredJoins((op as UnaryOperation).element, out);\n } else if (op instanceof SortOperation) {\n this._collectRequiredJoins(op.column, out);\n } else if (op instanceof LogicalOperation || op instanceof ComparisonOperation) {\n this._collectRequiredJoins((op as any).left, out);\n this._collectRequiredJoins((op as any).right, out);\n }\n }\n\n private _collectRequiredJoinsFromWindowSpec(window: WindowSpecification, out: Map<JoinTreeNodeOperation, JoinTreeNodeOperation>): void {\n for (const p of window.partitionBy) {\n this._collectRequiredJoins(p, out);\n }\n for (const s of window.orderBy) {\n this._collectRequiredJoins(s.column, out);\n }\n }\n\n private _rewriteWindowSpec(window: WindowSpecification): WindowSpecification {\n const partitionBy = window.partitionBy.map(p => this._rewriteOperation(p));\n const orderBy = window.orderBy.map(s => new SortOperation(this._rewriteOperation(s.column) as ColumnWithJoin, s.direction));\n return new WindowSpecification(partitionBy, orderBy);\n }\n\n private _rewriteOperation(op: RelationalOperationElement): RelationalOperationElement {\n if (op instanceof Attribute) {\n const ta = this._tableAliasForTable(op.owner(), op.parent() ?? op.owner());\n return new TableAliasColumn(op.column(), ta);\n }\n if (op instanceof ColumnWithJoin) {\n const ta = op.parent !== undefined\n ? this._tableAliasForTable(op.column.owner!, op.parent)\n : this._tableAliasForTable(op.column.owner!, op.column.owner!);\n return new TableAliasColumn(op.column, ta);\n }\n if (op instanceof Column) {\n const ta = this._tableAliasForTable(op.owner!, op.owner!);\n return new TableAliasColumn(op, ta);\n }\n if (op instanceof AggregateOperation) {\n return new AggregateOperation(\n this._rewriteOperation(op.element), op.operator, op.displayName,\n op.window ? this._rewriteWindowSpec(op.window) : undefined,\n );\n }\n if (op instanceof WindowFunctionOperation) {\n const el = op.element ? this._rewriteOperation(op.element) : null;\n return new WindowFunctionOperation(el, op.func, op.displayName, op.secondArg, [...op.extraArgs],\n op.window ? this._rewriteWindowSpec(op.window) : undefined);\n }\n if (op instanceof ScalarFunctionOperation) {\n return new ScalarFunctionOperation(this._rewriteOperation(op.element), op.func, op.displayName, op.secondArg, op.extraArgs);\n }\n if (op instanceof DateExtractOperation) {\n return new DateExtractOperation(this._rewriteOperation(op.element), op.part, op.displayName);\n }\n if (op instanceof DateArithmeticOperation) {\n return new DateArithmeticOperation(this._rewriteOperation(op.element), op.n, op.unit, op.isAdd, op.displayName);\n }\n if (op instanceof DateDiffOperation) {\n return new DateDiffOperation(this._rewriteOperation(op.element), (op as DateDiffOperation).other, (op as DateDiffOperation).unit, op.displayName);\n }\n return op;\n }\n\n private processSelect(cols: (Attribute | RelationalOperationElement)[]): void {\n const requiredJoins = new Map<JoinTreeNodeOperation, JoinTreeNodeOperation>();\n\n for (const col of cols) {\n this._collectRequiredJoins(col, requiredJoins);\n }\n for (const node of requiredJoins.values()) {\n this._addJoin(node);\n }\n\n for (const col of cols) {\n if (col instanceof Attribute) {\n const node = col.parent();\n let ta: TableAlias;\n if (node !== undefined) {\n ta = this._tableAliasForTable(col.owner(), node);\n } else {\n ta = this._tableAliasForTable(col.owner(), col.owner());\n this._from.add(ta);\n }\n this._select.push(new Alias(new TableAliasColumn(col.column(), ta), col.displayName()));\n } else if (col instanceof WindowFunctionOperation) {\n const rewritten = this._rewriteOperation(col) as WindowFunctionOperation;\n let alias: string;\n if (col.displayName) {\n alias = col.displayName;\n } else if ([WindowFunction.ROW_NUMBER, WindowFunction.RANK, WindowFunction.DENSE_RANK].includes(col.func)) {\n alias = col.func.replace(/_/g, ' ').replace(/\\b\\w/g, c => c.toUpperCase());\n } else if (col.element) {\n alias = col.func + ' ' + findColumn(col).column.name;\n } else {\n alias = col.func;\n }\n this._select.push(new Alias(rewritten, alias));\n } else if (col instanceof AggregateOperation) {\n const colNested = findColumn(col);\n const node = colNested.parent;\n let ta: TableAlias;\n if (node !== undefined) {\n ta = this._tableAliasForTable(colNested.column.owner!, node);\n } else {\n ta = this._tableAliasForTable(colNested.column.owner!, colNested.column.owner!);\n this._from.add(ta);\n }\n const alias = col.displayName ?? col.operator + ' ' + colNested.column.name;\n const rewrittenAgg = new AggregateOperation(\n new TableAliasColumn(colNested.column, ta), col.operator, undefined,\n col.window ? this._rewriteWindowSpec(col.window) : undefined,\n );\n this._select.push(new Alias(rewrittenAgg, alias));\n } else if (col instanceof ScalarFunctionOperation) {\n const colNested = findColumn(col);\n const node = colNested.parent;\n let ta: TableAlias;\n if (node !== undefined) {\n ta = this._tableAliasForTable(colNested.column.owner!, node);\n } else {\n ta = this._tableAliasForTable(colNested.column.owner!, colNested.column.owner!);\n this._from.add(ta);\n }\n const alias = col.displayName ?? col.func + ' ' + colNested.column.name;\n this._select.push(new Alias(\n new ScalarFunctionOperation(new TableAliasColumn(colNested.column, ta), col.func, undefined, col.secondArg, col.extraArgs),\n alias,\n ));\n } else if (col instanceof DateExtractOperation || col instanceof DateArithmeticOperation || col instanceof DateDiffOperation) {\n const colNested = findColumn(col as RelationalOperationElement);\n const node = colNested.parent;\n let ta: TableAlias;\n if (node !== undefined) {\n ta = this._tableAliasForTable(colNested.column.owner!, node);\n } else {\n ta = this._tableAliasForTable(colNested.column.owner!, colNested.column.owner!);\n this._from.add(ta);\n }\n const alias = (col as DateExtractOperation).displayName ?? colNested.column.name;\n let aliasedOp: RelationalOperationElement;\n if (col instanceof DateExtractOperation) {\n aliasedOp = new DateExtractOperation(new TableAliasColumn(colNested.column, ta), col.part);\n } else if (col instanceof DateArithmeticOperation) {\n aliasedOp = new DateArithmeticOperation(new TableAliasColumn(colNested.column, ta), col.n, col.unit, col.isAdd);\n } else {\n aliasedOp = new DateDiffOperation(new TableAliasColumn(colNested.column, ta), (col as DateDiffOperation).other, (col as DateDiffOperation).unit);\n }\n this._select.push(new Alias(aliasedOp, alias));\n } else if (col instanceof CountAllOperation) {\n const ta = this._tableAliasForTable(col.table, col.table);\n this._from.add(ta);\n this._select.push(new Alias(col, 'Count'));\n }\n }\n }\n\n private _addJoin(node: JoinTreeNodeOperation): void {\n if (this._addedJoinIds.has(node)) return;\n if (node.parent !== undefined) this._addJoin(node.parent);\n this._addedJoinIds.add(node);\n\n const join = node.join;\n const left = join.left;\n const srcTa = this._tableAliasForTable(left.owner!, node.parent ?? left.owner!);\n if (node.parent === undefined) this._from.add(srcTa);\n const sc = new TableAliasColumn(left, srcTa);\n const right = join.right;\n const tc = new TableAliasColumn(right, this._tableAliasForTable(right.owner!, node));\n this._join.push(new Join(sc, tc, join.filter));\n }\n\n buildFilter(op: RelationalOperationElement): string {\n if (op instanceof NoOperation) return '';\n if (op instanceof ExistsOperation) {\n const col = op.node.join.right;\n return this.buildFilter(new ColumnWithJoin(col, op.node)) + ' IS NOT NULL';\n }\n if (op instanceof NotExistsOperation) {\n const col = op.node.join.right;\n return this.buildFilter(new ColumnWithJoin(col, op.node)) + ' IS NULL';\n }\n if (op instanceof IsNotNullOperation) return this.buildFilter(op.element) + ' IS NOT NULL';\n if (op instanceof IsNullOperation) return this.buildFilter(op.element) + ' IS NULL';\n if (op instanceof LogicalOperation) {\n let left = this.buildFilter(op.left);\n let right = this.buildFilter(op.right);\n if (op.left instanceof LogicalOperation) left = '(' + left + ')';\n if (op.right instanceof LogicalOperation) right = '(' + right + ')';\n return left + LOGICAL_OPERATOR_STR[op.operator] + right;\n }\n if (op instanceof ComparisonOperation) {\n return this.buildFilter(op.left) + COMPARISON_OPERATOR_STR[op.operator] + this.buildFilter(op.right);\n }\n if (op instanceof ConstantOperation) return constantValueString(op);\n if (op instanceof ColumnWithJoin) {\n const node = op.parent;\n let ta: TableAlias;\n if (node !== undefined) {\n ta = this._tableAliasForTable(op.column.owner!, node);\n this._addJoin(node);\n } else {\n ta = this._tableAliasForTable(op.column.owner!, op.column.owner!);\n }\n return ta.alias + '.' + op.column.name;\n }\n if (op instanceof Column) {\n const ta = this._tableAliasForTable(op.owner!, op.owner!);\n return ta.alias + '.' + op.name;\n }\n throw new Error('Unknown operation in buildFilter: ' + op.constructor.name);\n }\n\n private _tableAliasForTable(table: string, key: unknown): TableAlias {\n if (this._tableAliasesByTable.has(key)) {\n return this._tableAliasesByTable.get(key)!;\n }\n const ta = new TableAlias(table, 't' + this._tableAliasIncr++);\n this._tableAliasesByTable.set(key, ta);\n return ta;\n }\n\n buildQueryString(): string {\n const joins = this._join.map(j =>\n ' LEFT OUTER JOIN ' + j.target.tableAlias.table + ' AS ' + j.target.tableAlias.alias +\n ' ON ' + j.source.tableAlias.alias + '.' + j.source.column.name +\n ' = ' + j.target.tableAlias.alias + '.' + j.target.column.name +\n (j.filterOp ? ' AND ' + this.buildFilter(j.filterOp) : ''),\n );\n\n return 'SELECT ' + this._select.map(ca => sqlOperationToString(ca)).join(',') +\n ' FROM ' + Array.from(this._from).map(ta => ta.table + ' AS ' + ta.alias).join(',') +\n joins.join('') +\n this._buildWhere() +\n this._buildGroupBy() +\n this._buildOrderBy() +\n this._buildLimit();\n }\n\n private _buildWhere(): string {\n return this._where.length > 0 ? ' WHERE ' + this._where : '';\n }\n private _buildGroupBy(): string {\n return this._groupByParts.length > 0 ? ' GROUP BY ' + this._groupByParts.join(', ') : '';\n }\n private _buildOrderBy(): string {\n return this._orderByParts.length > 0 ? ' ORDER BY ' + this._orderByParts.join(', ') : '';\n }\n private _buildLimit(): string {\n return this._limit !== undefined ? ' LIMIT ' + this._limit : '';\n }\n}\n\nexport function selectSqlToString(selectOperation: SelectOperation): string {\n const qg = new SQLQueryGenerator();\n qg.generate(selectOperation);\n return qg.buildQueryString();\n}\n\nexport function toSql(\n businessDate: Date | null,\n processingDatetime: Date | null,\n columns: (Attribute | RelationalOperationElement)[],\n table: Table,\n op: RelationalOperationElement,\n orderBy: SortOperation[] = [],\n groupBy: Attribute[] = [],\n limit?: number,\n): string {\n const selectOp = buildQueryOperation(businessDate, processingDatetime, columns, table, op, orderBy, groupBy, limit);\n return selectSqlToString(selectOp);\n}\n\nexport { buildQueryOperation, SelectOperation };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAM,kBAAN,cAA8B,2BAA2B;AAAA,EAC9D,YAAqB,MAA6B;AAAE,UAAM;AAArC;AAAA,EAAwC;AAAA,EAAxC;AAAA,EAErB,MAAM,OAAqD;AACzD,WAAO,IAAI,iBAAiB,uBAA2B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AC5B,WAAO,KAAK,WAAW,SAAY,YAAY,KAAK,SAAS;AAAA,EAC/D;AACF;AAEO,SAAS,kBAAkB,iBAA0C;AAC1E,QAAM,KAAK,IAAI,kBAAkB;AACjC,KAAG,SAAS,eAAe;AAC3B,SAAO,GAAG,iBAAiB;AAC7B;AAEO,SAAS,MACd,cACA,oBACA,SACA,OACA,IACA,UAA2B,CAAC,GAC5B,UAAuB,CAAC,GACxB,OACQ;AACR,QAAM,WAAW,oBAAoB,cAAc,oBAAoB,SAAS,OAAO,IAAI,SAAS,SAAS,KAAK;AAClH,SAAO,kBAAkB,QAAQ;AACnC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/datafinder/attribute.ts"],"sourcesContent":["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\n constructor(\n displayName: string,\n columnName: string,\n columnDbType: string,\n owner: string,\n parent?: JoinTreeNodeOperation,\n ) {\n this._displayName = displayName;\n this._column = new Column(columnName, columnDbType, owner);\n this._owner = owner;\n this._parent = parent;\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 cwj(): ColumnWithJoin {\n return new ColumnWithJoin(this._column, this._parent);\n }\n\n count(): AggregateOperation {\n return new AggregateOperation(\n new ColumnWithJoin(this._column, this._parent),\n AggregateOperator.COUNT,\n this._displayName + ' Count',\n );\n }\n\n ascending(): SortOperation {\n return new SortOperation(new ColumnWithJoin(this._column, this._parent), SortDirection.ASC);\n }\n\n descending(): SortOperation {\n return new SortOperation(new ColumnWithJoin(this._column, this._parent), SortDirection.DESC);\n }\n\n isNull(): IsNullOperation {\n return new IsNullOperation(new ColumnWithJoin(this._column, this._parent));\n }\n\n isNotNull(): IsNotNullOperation {\n return new IsNotNullOperation(new ColumnWithJoin(this._column, this._parent));\n }\n\n private _windowSpec(\n partitionBy?: ColumnWithJoin | ColumnWithJoin[],\n orderBy?: SortOperation | SortOperation[],\n ): WindowSpecification {\n const pb = partitionBy === undefined ? [] : Array.isArray(partitionBy) ? partitionBy : [partitionBy];\n const ob = orderBy === undefined ? [] : Array.isArray(orderBy) ? orderBy : [orderBy];\n return new WindowSpecification(pb, ob);\n }\n\n rank(opts: {\n method?: 'min' | 'dense' | 'first';\n pct?: boolean;\n partitionBy?: ColumnWithJoin | 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' as string) { 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 qcut(buckets: number, opts: {\n partitionBy?: ColumnWithJoin | 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 shift(periods = 1, opts: {\n fillValue?: string | number;\n partitionBy?: ColumnWithJoin | 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 new ColumnWithJoin(this._column, this._parent),\n func,\n label + ' ' + this._displayName,\n Math.abs(periods),\n extraArgs,\n this._windowSpec(opts.partitionBy, opts.orderBy),\n );\n }\n\n first(opts: {\n partitionBy?: ColumnWithJoin | ColumnWithJoin[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n return new WindowFunctionOperation(\n new ColumnWithJoin(this._column, this._parent),\n WindowFunction.FIRST_VALUE,\n 'First ' + this._displayName,\n undefined, [],\n this._windowSpec(opts.partitionBy, opts.orderBy),\n );\n }\n\n last(opts: {\n partitionBy?: ColumnWithJoin | ColumnWithJoin[];\n orderBy?: SortOperation | SortOperation[];\n } = {}): WindowFunctionOperation {\n return new WindowFunctionOperation(\n new ColumnWithJoin(this._column, this._parent),\n WindowFunction.LAST_VALUE,\n 'Last ' + this._displayName,\n undefined, [],\n this._windowSpec(opts.partitionBy, opts.orderBy),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAeO,IAAe,YAAf,MAAyB;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YACE,aACA,YACA,cACA,OACA,QACA;AACA,SAAK,eAAe;AACpB,SAAK,UAAU,IAAI,OAAO,YAAY,cAAc,KAAK;AACzD,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,SAAiB;AAAE,WAAO,KAAK;AAAA,EAAS;AAAA,EACxC,QAAgB;AAAE,WAAO,KAAK;AAAA,EAAQ;AAAA,EACtC,SAA4C;AAAE,WAAO,KAAK;AAAA,EAAS;AAAA,EACnE,cAAsB;AAAE,WAAO,KAAK;AAAA,EAAc;AAAA,EAElD,MAAsB;AACpB,WAAO,IAAI,eAAe,KAAK,SAAS,KAAK,OAAO;AAAA,EACtD;AAAA,EAEA,QAA4B;AAC1B,WAAO,IAAI;AAAA,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