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.
- package/README.md +17 -55
- package/dist/{chunk-V647VNMY.js → chunk-4JVW4TAB.js} +59 -14
- package/dist/chunk-4JVW4TAB.js.map +1 -0
- package/dist/{chunk-5K2Z3YDY.js → chunk-4LNZV6EN.js} +138 -31
- package/dist/chunk-4LNZV6EN.js.map +1 -0
- package/dist/{chunk-6QTCGJWX.js → chunk-FJYA2ASS.js} +46 -8
- package/dist/chunk-FJYA2ASS.js.map +1 -0
- package/dist/{chunk-DFYZVBII.js → chunk-MH4XMYVB.js} +186 -142
- package/dist/chunk-MH4XMYVB.js.map +1 -0
- package/dist/{chunk-EYXBYV2X.js → chunk-PMPLCEWQ.js} +2 -2
- package/dist/{chunk-3SSWFES4.js → chunk-UYMOE6YU.js} +64 -3
- package/dist/chunk-UYMOE6YU.js.map +1 -0
- package/dist/datafinder/attribute.cjs +64 -13
- package/dist/datafinder/attribute.cjs.map +1 -1
- package/dist/datafinder/attribute.d.cts +48 -7
- package/dist/datafinder/attribute.d.ts +48 -7
- package/dist/datafinder/attribute.js +2 -2
- package/dist/datafinder/runner.cjs +389 -140
- package/dist/datafinder/runner.cjs.map +1 -1
- package/dist/datafinder/runner.d.cts +14 -3
- package/dist/datafinder/runner.d.ts +14 -3
- package/dist/datafinder/runner.js +12 -6
- package/dist/datafinder/sql-generator.cjs +344 -138
- package/dist/datafinder/sql-generator.cjs.map +1 -1
- package/dist/datafinder/sql-generator.d.cts +4 -13
- package/dist/datafinder/sql-generator.d.ts +4 -13
- package/dist/datafinder/sql-generator.js +5 -7
- package/dist/datafinder/typed-attributes.cjs +199 -41
- package/dist/datafinder/typed-attributes.cjs.map +1 -1
- package/dist/datafinder/typed-attributes.d.cts +120 -13
- package/dist/datafinder/typed-attributes.d.ts +120 -13
- package/dist/datafinder/typed-attributes.js +3 -3
- package/dist/index.cjs +507 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -15
- package/dist/index.d.ts +16 -15
- package/dist/index.js +49 -9
- package/dist/index.js.map +1 -1
- package/dist/model/milestoning.cjs.map +1 -1
- package/dist/model/milestoning.js +2 -2
- package/dist/model/relational.cjs +66 -1
- package/dist/model/relational.cjs.map +1 -1
- package/dist/model/relational.d.cts +47 -2
- package/dist/model/relational.d.ts +47 -2
- package/dist/model/relational.js +9 -1
- package/package.json +4 -2
- package/dist/chunk-3SSWFES4.js.map +0 -1
- package/dist/chunk-5K2Z3YDY.js.map +0 -1
- package/dist/chunk-6QTCGJWX.js.map +0 -1
- package/dist/chunk-DFYZVBII.js.map +0 -1
- package/dist/chunk-V647VNMY.js.map +0 -1
- /package/dist/{chunk-EYXBYV2X.js.map → chunk-PMPLCEWQ.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { Attribute } from './datafinder/attribute.cjs';
|
|
2
2
|
export { getRelatedFinderClass, registerRelatedFinderClass } from './datafinder/finder-registry.cjs';
|
|
3
3
|
export { BooleanAttribute, DateAttribute, DateTimeAttribute, DecimalAttribute, DoubleAttribute, FloatAttribute, IntegerAttribute, NumericAttribute, StringAttribute } from './datafinder/typed-attributes.cjs';
|
|
4
4
|
export { selectSqlToString, toSql } from './datafinder/sql-generator.cjs';
|
|
5
|
-
import {
|
|
6
|
-
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, LogicalOperator, NoOperation, Operation, ScalarFunction, ScalarFunctionOperation, Schema, SortDirection, SortOperation, StringConstantOperation, Table, UnaryOperation, WindowFunction, WindowFunctionOperation, WindowSpecification } from './model/relational.cjs';
|
|
7
|
-
export { FinderResult, QueryRunner, QueryTarget, Row, clearRunner, convertInputsAndSelect, getRunner, registerRunner } from './datafinder/runner.cjs';
|
|
5
|
+
import { JoinTreeNodeOperation, ExistsOperation, NotExistsOperation } from './model/relational.cjs';
|
|
6
|
+
export { AggregateOperation, AggregateOperator, Alias, BinaryOperation, BooleanConstantOperation, Column, ColumnWithJoin, ComparisonOperation, ComparisonOperator, ConstantOperation, CountAllOperation, DataCatalog, DataStore, Database, DateArithmeticOperation, DateConstantOperation, DateDiffOperation, DateExtractOperation, DatePart, DateTimeConstantOperation, DecimalConstantOperation, FloatConstantOperation, ForeignKey, IntegerConstantOperation, IsNotNullOperation, IsNullOperation, JoinOperation, LogicalOperation, LogicalOperator, NoOperation, Operation, RelationalOperationElement, ScalarFunction, ScalarFunctionOperation, Schema, SelectOperation, SortDirection, SortOperation, StringConstantOperation, Table, UnaryOperation, WindowFunction, WindowFunctionOperation, WindowSpecification } from './model/relational.cjs';
|
|
7
|
+
export { DEFAULT_TIMEOUT_MS, FinderResult, QueryRunner, QueryTarget, QueryTimeoutError, Row, clearRunner, convertInputsAndSelect, convertInputsAndSelectForDateRange, getRunner, registerRunner } from './datafinder/runner.cjs';
|
|
8
8
|
export { BiTemporalColumns, BusinessDateAndProcessingTemporalColumns, MilestonedTable, MilestoningColumns, ProcessingTemporalColumns, SingleBusinessDateColumn } from './model/milestoning.cjs';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
/** Python's `str.title()`: uppercase the first letter of each alphabetic run and lowercase the rest. */
|
|
11
|
+
declare function titleCase(value: string): string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Join-less alternates for a related class's properties, keyed by dotted property path relative to
|
|
15
|
+
* that class (e.g. `name`, `branch.city`). The attributes point at flat columns on the owning table.
|
|
16
|
+
*/
|
|
17
|
+
type EmbeddedAttributes = Record<string, Attribute>;
|
|
18
|
+
/** The alternates under `prefix` (e.g. `branch.`), re-keyed relative to it; undefined when there are none. */
|
|
19
|
+
declare function embeddedUnder(embedded: EmbeddedAttributes | undefined, prefix: string): EmbeddedAttributes | undefined;
|
|
20
|
+
|
|
20
21
|
declare class RelatedFinder {
|
|
21
22
|
private readonly _node;
|
|
22
23
|
constructor(_node: JoinTreeNodeOperation);
|
|
@@ -24,4 +25,4 @@ declare class RelatedFinder {
|
|
|
24
25
|
notExists(): NotExistsOperation;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export { ExistsOperation, JoinTreeNodeOperation,
|
|
28
|
+
export { Attribute, type EmbeddedAttributes, ExistsOperation, JoinTreeNodeOperation, NotExistsOperation, RelatedFinder, embeddedUnder, titleCase };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { Attribute } from './datafinder/attribute.js';
|
|
2
2
|
export { getRelatedFinderClass, registerRelatedFinderClass } from './datafinder/finder-registry.js';
|
|
3
3
|
export { BooleanAttribute, DateAttribute, DateTimeAttribute, DecimalAttribute, DoubleAttribute, FloatAttribute, IntegerAttribute, NumericAttribute, StringAttribute } from './datafinder/typed-attributes.js';
|
|
4
4
|
export { selectSqlToString, toSql } from './datafinder/sql-generator.js';
|
|
5
|
-
import {
|
|
6
|
-
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, LogicalOperator, NoOperation, Operation, ScalarFunction, ScalarFunctionOperation, Schema, SortDirection, SortOperation, StringConstantOperation, Table, UnaryOperation, WindowFunction, WindowFunctionOperation, WindowSpecification } from './model/relational.js';
|
|
7
|
-
export { FinderResult, QueryRunner, QueryTarget, Row, clearRunner, convertInputsAndSelect, getRunner, registerRunner } from './datafinder/runner.js';
|
|
5
|
+
import { JoinTreeNodeOperation, ExistsOperation, NotExistsOperation } from './model/relational.js';
|
|
6
|
+
export { AggregateOperation, AggregateOperator, Alias, BinaryOperation, BooleanConstantOperation, Column, ColumnWithJoin, ComparisonOperation, ComparisonOperator, ConstantOperation, CountAllOperation, DataCatalog, DataStore, Database, DateArithmeticOperation, DateConstantOperation, DateDiffOperation, DateExtractOperation, DatePart, DateTimeConstantOperation, DecimalConstantOperation, FloatConstantOperation, ForeignKey, IntegerConstantOperation, IsNotNullOperation, IsNullOperation, JoinOperation, LogicalOperation, LogicalOperator, NoOperation, Operation, RelationalOperationElement, ScalarFunction, ScalarFunctionOperation, Schema, SelectOperation, SortDirection, SortOperation, StringConstantOperation, Table, UnaryOperation, WindowFunction, WindowFunctionOperation, WindowSpecification } from './model/relational.js';
|
|
7
|
+
export { DEFAULT_TIMEOUT_MS, FinderResult, QueryRunner, QueryTarget, QueryTimeoutError, Row, clearRunner, convertInputsAndSelect, convertInputsAndSelectForDateRange, getRunner, registerRunner } from './datafinder/runner.js';
|
|
8
8
|
export { BiTemporalColumns, BusinessDateAndProcessingTemporalColumns, MilestonedTable, MilestoningColumns, ProcessingTemporalColumns, SingleBusinessDateColumn } from './model/milestoning.js';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
/** Python's `str.title()`: uppercase the first letter of each alphabetic run and lowercase the rest. */
|
|
11
|
+
declare function titleCase(value: string): string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Join-less alternates for a related class's properties, keyed by dotted property path relative to
|
|
15
|
+
* that class (e.g. `name`, `branch.city`). The attributes point at flat columns on the owning table.
|
|
16
|
+
*/
|
|
17
|
+
type EmbeddedAttributes = Record<string, Attribute>;
|
|
18
|
+
/** The alternates under `prefix` (e.g. `branch.`), re-keyed relative to it; undefined when there are none. */
|
|
19
|
+
declare function embeddedUnder(embedded: EmbeddedAttributes | undefined, prefix: string): EmbeddedAttributes | undefined;
|
|
20
|
+
|
|
20
21
|
declare class RelatedFinder {
|
|
21
22
|
private readonly _node;
|
|
22
23
|
constructor(_node: JoinTreeNodeOperation);
|
|
@@ -24,4 +25,4 @@ declare class RelatedFinder {
|
|
|
24
25
|
notExists(): NotExistsOperation;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export { ExistsOperation, JoinTreeNodeOperation,
|
|
28
|
+
export { Attribute, type EmbeddedAttributes, ExistsOperation, JoinTreeNodeOperation, NotExistsOperation, RelatedFinder, embeddedUnder, titleCase };
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DEFAULT_TIMEOUT_MS,
|
|
2
3
|
FinderResult,
|
|
4
|
+
QueryTimeoutError,
|
|
3
5
|
clearRunner,
|
|
4
6
|
convertInputsAndSelect,
|
|
7
|
+
convertInputsAndSelectForDateRange,
|
|
5
8
|
getRunner,
|
|
6
9
|
registerRunner
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FJYA2ASS.js";
|
|
8
11
|
import {
|
|
9
12
|
getRelatedFinderClass,
|
|
10
13
|
registerRelatedFinderClass
|
|
11
14
|
} from "./chunk-FLEIUDZZ.js";
|
|
12
15
|
import {
|
|
13
|
-
ExistsOperation,
|
|
14
|
-
NotExistsOperation,
|
|
15
|
-
RelatedFinder,
|
|
16
16
|
selectSqlToString,
|
|
17
17
|
toSql
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-MH4XMYVB.js";
|
|
19
19
|
import {
|
|
20
20
|
BiTemporalColumns,
|
|
21
21
|
BusinessDateAndProcessingTemporalColumns,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
MilestoningColumns,
|
|
24
24
|
ProcessingTemporalColumns,
|
|
25
25
|
SingleBusinessDateColumn
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-PMPLCEWQ.js";
|
|
27
27
|
import {
|
|
28
28
|
BooleanAttribute,
|
|
29
29
|
DateAttribute,
|
|
@@ -34,13 +34,14 @@ import {
|
|
|
34
34
|
IntegerAttribute,
|
|
35
35
|
NumericAttribute,
|
|
36
36
|
StringAttribute
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4LNZV6EN.js";
|
|
38
38
|
import {
|
|
39
39
|
Attribute
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-4JVW4TAB.js";
|
|
41
41
|
import {
|
|
42
42
|
AggregateOperation,
|
|
43
43
|
AggregateOperator,
|
|
44
|
+
Alias,
|
|
44
45
|
BinaryOperation,
|
|
45
46
|
BooleanConstantOperation,
|
|
46
47
|
Column,
|
|
@@ -59,6 +60,7 @@ import {
|
|
|
59
60
|
DatePart,
|
|
60
61
|
DateTimeConstantOperation,
|
|
61
62
|
DecimalConstantOperation,
|
|
63
|
+
ExistsOperation,
|
|
62
64
|
FloatConstantOperation,
|
|
63
65
|
ForeignKey,
|
|
64
66
|
IntegerConstantOperation,
|
|
@@ -69,11 +71,13 @@ import {
|
|
|
69
71
|
LogicalOperation,
|
|
70
72
|
LogicalOperator,
|
|
71
73
|
NoOperation,
|
|
74
|
+
NotExistsOperation,
|
|
72
75
|
Operation,
|
|
73
76
|
RelationalOperationElement,
|
|
74
77
|
ScalarFunction,
|
|
75
78
|
ScalarFunctionOperation,
|
|
76
79
|
Schema,
|
|
80
|
+
SelectOperation,
|
|
77
81
|
SortDirection,
|
|
78
82
|
SortOperation,
|
|
79
83
|
StringConstantOperation,
|
|
@@ -82,10 +86,40 @@ import {
|
|
|
82
86
|
WindowFunction,
|
|
83
87
|
WindowFunctionOperation,
|
|
84
88
|
WindowSpecification
|
|
85
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-UYMOE6YU.js";
|
|
90
|
+
|
|
91
|
+
// src/datafinder/naming.ts
|
|
92
|
+
function titleCase(value) {
|
|
93
|
+
return value.replace(/[A-Za-z]+/g, (w) => w[0].toUpperCase() + w.slice(1).toLowerCase());
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/datafinder/embedded.ts
|
|
97
|
+
function embeddedUnder(embedded, prefix) {
|
|
98
|
+
if (!embedded) return void 0;
|
|
99
|
+
const result = {};
|
|
100
|
+
for (const [key, attr] of Object.entries(embedded)) {
|
|
101
|
+
if (key.startsWith(prefix)) result[key.slice(prefix.length)] = attr;
|
|
102
|
+
}
|
|
103
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/datafinder/finder.ts
|
|
107
|
+
var RelatedFinder = class {
|
|
108
|
+
constructor(_node) {
|
|
109
|
+
this._node = _node;
|
|
110
|
+
}
|
|
111
|
+
_node;
|
|
112
|
+
exists() {
|
|
113
|
+
return new ExistsOperation(this._node);
|
|
114
|
+
}
|
|
115
|
+
notExists() {
|
|
116
|
+
return new NotExistsOperation(this._node);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
86
119
|
export {
|
|
87
120
|
AggregateOperation,
|
|
88
121
|
AggregateOperator,
|
|
122
|
+
Alias,
|
|
89
123
|
Attribute,
|
|
90
124
|
BiTemporalColumns,
|
|
91
125
|
BinaryOperation,
|
|
@@ -98,6 +132,7 @@ export {
|
|
|
98
132
|
ComparisonOperator,
|
|
99
133
|
ConstantOperation,
|
|
100
134
|
CountAllOperation,
|
|
135
|
+
DEFAULT_TIMEOUT_MS,
|
|
101
136
|
DataCatalog,
|
|
102
137
|
DataStore,
|
|
103
138
|
Database,
|
|
@@ -132,11 +167,13 @@ export {
|
|
|
132
167
|
NumericAttribute,
|
|
133
168
|
Operation,
|
|
134
169
|
ProcessingTemporalColumns,
|
|
170
|
+
QueryTimeoutError,
|
|
135
171
|
RelatedFinder,
|
|
136
172
|
RelationalOperationElement,
|
|
137
173
|
ScalarFunction,
|
|
138
174
|
ScalarFunctionOperation,
|
|
139
175
|
Schema,
|
|
176
|
+
SelectOperation,
|
|
140
177
|
SingleBusinessDateColumn,
|
|
141
178
|
SortDirection,
|
|
142
179
|
SortOperation,
|
|
@@ -149,11 +186,14 @@ export {
|
|
|
149
186
|
WindowSpecification,
|
|
150
187
|
clearRunner,
|
|
151
188
|
convertInputsAndSelect,
|
|
189
|
+
convertInputsAndSelectForDateRange,
|
|
190
|
+
embeddedUnder,
|
|
152
191
|
getRelatedFinderClass,
|
|
153
192
|
getRunner,
|
|
154
193
|
registerRelatedFinderClass,
|
|
155
194
|
registerRunner,
|
|
156
195
|
selectSqlToString,
|
|
196
|
+
titleCase,
|
|
157
197
|
toSql
|
|
158
198
|
};
|
|
159
199
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/datafinder/naming.ts","../src/datafinder/embedded.ts","../src/datafinder/finder.ts"],"sourcesContent":["/** Python's `str.title()`: uppercase the first letter of each alphabetic run and lowercase the rest. */\nexport function titleCase(value: string): string {\n return value.replace(/[A-Za-z]+/g, w => w[0].toUpperCase() + w.slice(1).toLowerCase());\n}\n","import type { Attribute } from './attribute';\n\n/**\n * Join-less alternates for a related class's properties, keyed by dotted property path relative to\n * that class (e.g. `name`, `branch.city`). The attributes point at flat columns on the owning table.\n */\nexport type EmbeddedAttributes = Record<string, Attribute>;\n\n/** The alternates under `prefix` (e.g. `branch.`), re-keyed relative to it; undefined when there are none. */\nexport function embeddedUnder(embedded: EmbeddedAttributes | undefined, prefix: string): EmbeddedAttributes | undefined {\n if (!embedded) return undefined;\n const result: EmbeddedAttributes = {};\n for (const [key, attr] of Object.entries(embedded)) {\n if (key.startsWith(prefix)) result[key.slice(prefix.length)] = attr;\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n","import { ExistsOperation, NotExistsOperation, JoinTreeNodeOperation } from '../model/relational';\nimport { titleCase } from './naming';\n\n/**\n * The display-name prefix for a column reached through a join: the relation names from the root, so\n * `account().branch().city()` is \"Account Branch City\" and not just \"Branch City\".\n */\nexport function displayPrefix(relationName: string, parentJoin?: JoinTreeNodeOperation): string {\n const names = [relationName];\n for (let node = parentJoin; node !== undefined; node = node.parent) names.push(node.join.name);\n return names.reverse().map(titleCase).join(' ');\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACO,SAAS,UAAU,OAAuB;AAC/C,SAAO,MAAM,QAAQ,cAAc,OAAK,EAAE,CAAC,EAAE,YAAY,IAAI,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC;AACvF;;;ACMO,SAAS,cAAc,UAA0C,QAAgD;AACtH,MAAI,CAAC,SAAU,QAAO;AACtB,QAAM,SAA6B,CAAC;AACpC,aAAW,CAAC,KAAK,IAAI,KAAK,OAAO,QAAQ,QAAQ,GAAG;AAClD,QAAI,IAAI,WAAW,MAAM,EAAG,QAAO,IAAI,MAAM,OAAO,MAAM,CAAC,IAAI;AAAA,EACjE;AACA,SAAO,OAAO,KAAK,MAAM,EAAE,SAAS,IAAI,SAAS;AACnD;;;ACHO,IAAM,gBAAN,MAAoB;AAAA,EACzB,YAA6B,OAA8B;AAA9B;AAAA,EAA+B;AAAA,EAA/B;AAAA,EAE7B,SAA0B;AACxB,WAAO,IAAI,gBAAgB,KAAK,KAAK;AAAA,EACvC;AAAA,EAEA,YAAgC;AAC9B,WAAO,IAAI,mBAAmB,KAAK,KAAK;AAAA,EAC1C;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/milestoning.ts","../../src/model/relational.ts"],"sourcesContent":["import { Column, Table, Schema } from './relational';\n\nexport abstract class MilestoningColumns {\n abstract columns(): Column[];\n}\n\nexport class ProcessingTemporalColumns extends MilestoningColumns {\n constructor(\n readonly startAtColumn: Column,\n readonly endAtColumn: Column,\n readonly infiniteDatetime?: string,\n ) { super(); }\n\n columns(): Column[] { return [this.startAtColumn, this.endAtColumn]; }\n}\n\nexport class SingleBusinessDateColumn extends MilestoningColumns {\n constructor(readonly businessDateColumn: Column) { super(); }\n\n columns(): Column[] { return [this.businessDateColumn]; }\n}\n\nexport class BusinessDateAndProcessingTemporalColumns extends MilestoningColumns {\n constructor(\n readonly businessDateColumn: Column,\n readonly startAtColumn: Column,\n readonly endAtColumn: Column,\n readonly infiniteDatetime?: string,\n ) { super(); }\n\n columns(): Column[] {\n return [this.businessDateColumn, this.startAtColumn, this.endAtColumn];\n }\n}\n\nexport class BiTemporalColumns extends MilestoningColumns {\n constructor(\n readonly businessDateFromColumn: Column,\n readonly businessDateToColumn: Column,\n readonly startAtColumn: Column,\n readonly endAtColumn: Column,\n readonly infiniteDatetime?: string,\n ) { super(); }\n\n columns(): Column[] {\n return [\n this.businessDateFromColumn,\n this.businessDateToColumn,\n this.startAtColumn,\n this.endAtColumn,\n ];\n }\n}\n\nexport class MilestonedTable extends Table {\n constructor(\n name: string,\n columns: Column[],\n readonly milestoningColumns: MilestoningColumns,\n schema?: Schema,\n ) {\n super(name, columns, schema);\n for (const col of milestoningColumns.columns()) {\n col.table = this;\n }\n }\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\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 RelationalOperationElement {\n constructor(readonly table: string) { super(); }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC4QO,IAAM,QAAN,MAAY;AAAA,EAIjB,YAAqB,MAAc,SAA4B,QAAiB;AAA3D;AAA0C;AAC7D,eAA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ACE;AAAA,EAJF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGX,UAAoB;AAClB,WAAO,CAAC,KAAK,oBAAoB,KAAK,eAAe,KAAK,WAAW;AAAA,EACvE;AACF;AAEO,IAAM,oBAAN,cAAgC,mBAAmB;AAAA,EACxD,YACW,wBACA,sBACA,eACA,aACA,kBACT;AAAE,UAAM;AALC;AACA;AACA;AACA;AACA;AAAA,EACE;AAAA,EALF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGX,UAAoB;AAClB,WAAO;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF;AACF;AAEO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC,YACE,MACA,SACS,oBACT,QACA;AACA,UAAM,MAAM,SAAS,MAAM;AAHlB;AAIT,eAAW,OAAO,mBAAmB,QAAQ,GAAG;AAC9C,UAAI,QAAQ;AAAA,IACd;AAAA,EACF;AAAA,EAPW;AAQb;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/model/milestoning.ts","../../src/model/relational.ts"],"sourcesContent":["import { Column, Table, Schema } from './relational';\n\nexport abstract class MilestoningColumns {\n abstract columns(): Column[];\n}\n\nexport class ProcessingTemporalColumns extends MilestoningColumns {\n constructor(\n readonly startAtColumn: Column,\n readonly endAtColumn: Column,\n readonly infiniteDatetime?: string,\n ) { super(); }\n\n columns(): Column[] { return [this.startAtColumn, this.endAtColumn]; }\n}\n\nexport class SingleBusinessDateColumn extends MilestoningColumns {\n constructor(readonly businessDateColumn: Column) { super(); }\n\n columns(): Column[] { return [this.businessDateColumn]; }\n}\n\nexport class BusinessDateAndProcessingTemporalColumns extends MilestoningColumns {\n constructor(\n readonly businessDateColumn: Column,\n readonly startAtColumn: Column,\n readonly endAtColumn: Column,\n readonly infiniteDatetime?: string,\n ) { super(); }\n\n columns(): Column[] {\n return [this.businessDateColumn, this.startAtColumn, this.endAtColumn];\n }\n}\n\nexport class BiTemporalColumns extends MilestoningColumns {\n constructor(\n readonly businessDateFromColumn: Column,\n readonly businessDateToColumn: Column,\n readonly startAtColumn: Column,\n readonly endAtColumn: Column,\n readonly infiniteDatetime?: string,\n ) { super(); }\n\n columns(): Column[] {\n return [\n this.businessDateFromColumn,\n this.businessDateToColumn,\n this.startAtColumn,\n this.endAtColumn,\n ];\n }\n}\n\nexport class MilestonedTable extends Table {\n constructor(\n name: string,\n columns: Column[],\n readonly milestoningColumns: MilestoningColumns,\n schema?: Schema,\n ) {\n super(name, columns, schema);\n for (const col of milestoningColumns.columns()) {\n col.table = this;\n }\n }\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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AAA,EAC/D,YAAqB,oBAA4B;AAAE,UAAM;AAApC;AAAA,EAAuC;AAAA,EAAvC;AAAA,EAErB,UAAoB;AAAE,WAAO,CAAC,KAAK,kBAAkB;AAAA,EAAG;AAC1D;AAEO,IAAM,2CAAN,cAAuD,mBAAmB;AAAA,EAC/E,YACW,oBACA,eACA,aACA,kBACT;AAAE,UAAM;AAJC;AACA;AACA;AACA;AAAA,EACE;AAAA,EAJF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGX,UAAoB;AAClB,WAAO,CAAC,KAAK,oBAAoB,KAAK,eAAe,KAAK,WAAW;AAAA,EACvE;AACF;AAEO,IAAM,oBAAN,cAAgC,mBAAmB;AAAA,EACxD,YACW,wBACA,sBACA,eACA,aACA,kBACT;AAAE,UAAM;AALC;AACA;AACA;AACA;AACA;AAAA,EACE;AAAA,EALF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGX,UAAoB;AAClB,WAAO;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF;AACF;AAEO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC,YACE,MACA,SACS,oBACT,QACA;AACA,UAAM,MAAM,SAAS,MAAM;AAHlB;AAIT,eAAW,OAAO,mBAAmB,QAAQ,GAAG;AAC9C,UAAI,QAAQ;AAAA,IACd;AAAA,EACF;AAAA,EAPW;AAQb;","names":[]}
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
MilestoningColumns,
|
|
6
6
|
ProcessingTemporalColumns,
|
|
7
7
|
SingleBusinessDateColumn
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-PMPLCEWQ.js";
|
|
9
|
+
import "../chunk-UYMOE6YU.js";
|
|
10
10
|
export {
|
|
11
11
|
BiTemporalColumns,
|
|
12
12
|
BusinessDateAndProcessingTemporalColumns,
|
|
@@ -22,6 +22,7 @@ var relational_exports = {};
|
|
|
22
22
|
__export(relational_exports, {
|
|
23
23
|
AggregateOperation: () => AggregateOperation,
|
|
24
24
|
AggregateOperator: () => AggregateOperator,
|
|
25
|
+
Alias: () => Alias,
|
|
25
26
|
BinaryOperation: () => BinaryOperation,
|
|
26
27
|
BooleanConstantOperation: () => BooleanConstantOperation,
|
|
27
28
|
Column: () => Column,
|
|
@@ -40,6 +41,7 @@ __export(relational_exports, {
|
|
|
40
41
|
DatePart: () => DatePart,
|
|
41
42
|
DateTimeConstantOperation: () => DateTimeConstantOperation,
|
|
42
43
|
DecimalConstantOperation: () => DecimalConstantOperation,
|
|
44
|
+
ExistsOperation: () => ExistsOperation,
|
|
43
45
|
FloatConstantOperation: () => FloatConstantOperation,
|
|
44
46
|
ForeignKey: () => ForeignKey,
|
|
45
47
|
IntegerConstantOperation: () => IntegerConstantOperation,
|
|
@@ -50,11 +52,13 @@ __export(relational_exports, {
|
|
|
50
52
|
LogicalOperation: () => LogicalOperation,
|
|
51
53
|
LogicalOperator: () => LogicalOperator,
|
|
52
54
|
NoOperation: () => NoOperation,
|
|
55
|
+
NotExistsOperation: () => NotExistsOperation,
|
|
53
56
|
Operation: () => Operation,
|
|
54
57
|
RelationalOperationElement: () => RelationalOperationElement,
|
|
55
58
|
ScalarFunction: () => ScalarFunction,
|
|
56
59
|
ScalarFunctionOperation: () => ScalarFunctionOperation,
|
|
57
60
|
Schema: () => Schema,
|
|
61
|
+
SelectOperation: () => SelectOperation,
|
|
58
62
|
SortDirection: () => SortDirection,
|
|
59
63
|
SortOperation: () => SortOperation,
|
|
60
64
|
StringConstantOperation: () => StringConstantOperation,
|
|
@@ -432,6 +436,10 @@ var JoinOperation = class {
|
|
|
432
436
|
left;
|
|
433
437
|
right;
|
|
434
438
|
filter;
|
|
439
|
+
/** Property-equality filters on the join target (property id -> value), set by a related finder given a filter. */
|
|
440
|
+
filterKwargs = {};
|
|
441
|
+
/** Maps property ids to [column, type, table] for `filterKwargs`. */
|
|
442
|
+
filterColumnMap = {};
|
|
435
443
|
};
|
|
436
444
|
var JoinTreeNodeOperation = class {
|
|
437
445
|
constructor(join, parent) {
|
|
@@ -442,13 +450,19 @@ var JoinTreeNodeOperation = class {
|
|
|
442
450
|
parent;
|
|
443
451
|
};
|
|
444
452
|
var ColumnWithJoin = class extends RelationalOperationElement {
|
|
445
|
-
|
|
453
|
+
/**
|
|
454
|
+
* `embedded` is an alternate reference to a flat (denormalized) column on the owning table that
|
|
455
|
+
* holds the same value without the join; the SQL generator uses it when the join can be elided.
|
|
456
|
+
*/
|
|
457
|
+
constructor(column, parent, embedded) {
|
|
446
458
|
super();
|
|
447
459
|
this.column = column;
|
|
448
460
|
this.parent = parent;
|
|
461
|
+
this.embedded = embedded;
|
|
449
462
|
}
|
|
450
463
|
column;
|
|
451
464
|
parent;
|
|
465
|
+
embedded;
|
|
452
466
|
};
|
|
453
467
|
var SortOperation = class {
|
|
454
468
|
constructor(column, direction) {
|
|
@@ -465,10 +479,58 @@ var CountAllOperation = class extends RelationalOperationElement {
|
|
|
465
479
|
}
|
|
466
480
|
table;
|
|
467
481
|
};
|
|
482
|
+
var Alias = class extends RelationalOperationElement {
|
|
483
|
+
constructor(element, name) {
|
|
484
|
+
super();
|
|
485
|
+
this.element = element;
|
|
486
|
+
this.name = name;
|
|
487
|
+
}
|
|
488
|
+
element;
|
|
489
|
+
name;
|
|
490
|
+
};
|
|
491
|
+
var ExistsOperation = class extends RelationalOperationElement {
|
|
492
|
+
constructor(node) {
|
|
493
|
+
super();
|
|
494
|
+
this.node = node;
|
|
495
|
+
}
|
|
496
|
+
node;
|
|
497
|
+
andOp(other) {
|
|
498
|
+
return new LogicalOperation(this, "AND" /* AND */, other);
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
var NotExistsOperation = class extends RelationalOperationElement {
|
|
502
|
+
constructor(node) {
|
|
503
|
+
super();
|
|
504
|
+
this.node = node;
|
|
505
|
+
}
|
|
506
|
+
node;
|
|
507
|
+
andOp(other) {
|
|
508
|
+
return new LogicalOperation(this, "AND" /* AND */, other);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
var SelectOperation = class {
|
|
512
|
+
constructor(display, filter, orderBy = [], groupBy = [], limit, table, joinFilters = /* @__PURE__ */ new Map()) {
|
|
513
|
+
this.display = display;
|
|
514
|
+
this.filter = filter;
|
|
515
|
+
this.orderBy = orderBy;
|
|
516
|
+
this.groupBy = groupBy;
|
|
517
|
+
this.limit = limit;
|
|
518
|
+
this.table = table;
|
|
519
|
+
this.joinFilters = joinFilters;
|
|
520
|
+
}
|
|
521
|
+
display;
|
|
522
|
+
filter;
|
|
523
|
+
orderBy;
|
|
524
|
+
groupBy;
|
|
525
|
+
limit;
|
|
526
|
+
table;
|
|
527
|
+
joinFilters;
|
|
528
|
+
};
|
|
468
529
|
// Annotate the CommonJS export names for ESM import in node:
|
|
469
530
|
0 && (module.exports = {
|
|
470
531
|
AggregateOperation,
|
|
471
532
|
AggregateOperator,
|
|
533
|
+
Alias,
|
|
472
534
|
BinaryOperation,
|
|
473
535
|
BooleanConstantOperation,
|
|
474
536
|
Column,
|
|
@@ -487,6 +549,7 @@ var CountAllOperation = class extends RelationalOperationElement {
|
|
|
487
549
|
DatePart,
|
|
488
550
|
DateTimeConstantOperation,
|
|
489
551
|
DecimalConstantOperation,
|
|
552
|
+
ExistsOperation,
|
|
490
553
|
FloatConstantOperation,
|
|
491
554
|
ForeignKey,
|
|
492
555
|
IntegerConstantOperation,
|
|
@@ -497,11 +560,13 @@ var CountAllOperation = class extends RelationalOperationElement {
|
|
|
497
560
|
LogicalOperation,
|
|
498
561
|
LogicalOperator,
|
|
499
562
|
NoOperation,
|
|
563
|
+
NotExistsOperation,
|
|
500
564
|
Operation,
|
|
501
565
|
RelationalOperationElement,
|
|
502
566
|
ScalarFunction,
|
|
503
567
|
ScalarFunctionOperation,
|
|
504
568
|
Schema,
|
|
569
|
+
SelectOperation,
|
|
505
570
|
SortDirection,
|
|
506
571
|
SortOperation,
|
|
507
572
|
StringConstantOperation,
|
|
@@ -1 +1 @@
|
|
|
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 RelationalOperationElement {\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AAAA,EAFQ;AAAA,EACA;AAEb;AAEO,IAAM,iBAAN,cAA6B,2BAA2B;AAAA,EAC7D,YACW,QACA,QACT;AAAE,UAAM;AAFC;AACA;AAAA,EACE;AAAA,EAFF;AAAA,EACA;AAEb;AAEO,IAAM,gBAAN,MAAoB;AAAA,EACzB,YACW,QACA,WACT;AAFS;AACA;AAAA,EACR;AAAA,EAFQ;AAAA,EACA;AAEb;AAEO,IAAM,oBAAN,cAAgC,2BAA2B;AAAA,EAChE,YAAqB,OAAe;AAAE,UAAM;AAAvB;AAAA,EAA0B;AAAA,EAA1B;AACvB;","names":["ComparisonOperator","LogicalOperator","AggregateOperator","ScalarFunction","DatePart","SortDirection","WindowFunction"]}
|
|
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 /** 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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAK,qBAAL,kBAAKA,wBAAL;AACL,EAAAA,oBAAA,WAAQ;AACR,EAAAA,oBAAA,eAAY;AACZ,EAAAA,oBAAA,eAAY;AACZ,EAAAA,oBAAA,kBAAe;AACf,EAAAA,oBAAA,2BAAwB;AACxB,EAAAA,oBAAA,8BAA2B;AAC3B,EAAAA,oBAAA,UAAO;AACP,EAAAA,oBAAA,cAAW;AARD,SAAAA;AAAA,GAAA;AAWL,IAAK,kBAAL,kBAAKC,qBAAL;AACL,EAAAA,iBAAA,SAAM;AACN,EAAAA,iBAAA,QAAK;AAFK,SAAAA;AAAA,GAAA;AAKL,IAAK,oBAAL,kBAAKC,uBAAL;AACL,EAAAA,mBAAA,WAAQ;AACR,EAAAA,mBAAA,SAAM;AACN,EAAAA,mBAAA,SAAM;AACN,EAAAA,mBAAA,SAAM;AACN,EAAAA,mBAAA,aAAU;AALA,SAAAA;AAAA,GAAA;AAQL,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,SAAM;AACN,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,SAAM;AACN,EAAAA,gBAAA,WAAQ;AACR,EA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C5B,UAAwC,CAAC,GACzC,OACA,OAKA,cAA6D,oBAAI,IAAI,GAC9E;AAXS;AACA;AACA;AACA;AACA;AACA;AAKA;AAAA,EACR;AAAA,EAXQ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAKA;AAEb;","names":["ComparisonOperator","LogicalOperator","AggregateOperator","ScalarFunction","DatePart","SortDirection","WindowFunction"]}
|
|
@@ -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
|
-
|
|
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 };
|