data-finder-ts 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3SSWFES4.js +448 -0
- package/dist/chunk-3SSWFES4.js.map +1 -0
- package/dist/chunk-5K2Z3YDY.js +393 -0
- package/dist/chunk-5K2Z3YDY.js.map +1 -0
- package/dist/chunk-6QTCGJWX.js +98 -0
- package/dist/chunk-6QTCGJWX.js.map +1 -0
- package/dist/chunk-DFYZVBII.js +652 -0
- package/dist/chunk-DFYZVBII.js.map +1 -0
- package/dist/chunk-EYXBYV2X.js +90 -0
- package/dist/chunk-EYXBYV2X.js.map +1 -0
- package/dist/chunk-FLEIUDZZ.js +14 -0
- package/dist/chunk-FLEIUDZZ.js.map +1 -0
- package/dist/chunk-V647VNMY.js +135 -0
- package/dist/chunk-V647VNMY.js.map +1 -0
- package/dist/datafinder/attribute.cjs +269 -0
- package/dist/datafinder/attribute.cjs.map +1 -0
- package/dist/datafinder/attribute.d.cts +45 -0
- package/dist/datafinder/attribute.d.ts +45 -0
- package/dist/datafinder/attribute.js +8 -0
- package/dist/datafinder/attribute.js.map +1 -0
- package/dist/datafinder/finder-registry.cjs +39 -0
- package/dist/datafinder/finder-registry.cjs.map +1 -0
- package/dist/datafinder/finder-registry.d.cts +4 -0
- package/dist/datafinder/finder-registry.d.ts +4 -0
- package/dist/datafinder/finder-registry.js +9 -0
- package/dist/datafinder/finder-registry.js.map +1 -0
- package/dist/datafinder/runner.cjs +1346 -0
- package/dist/datafinder/runner.cjs.map +1 -0
- package/dist/datafinder/runner.d.cts +33 -0
- package/dist/datafinder/runner.d.ts +33 -0
- package/dist/datafinder/runner.js +20 -0
- package/dist/datafinder/runner.js.map +1 -0
- package/dist/datafinder/sql-generator.cjs +1261 -0
- package/dist/datafinder/sql-generator.cjs.map +1 -0
- package/dist/datafinder/sql-generator.d.cts +17 -0
- package/dist/datafinder/sql-generator.d.ts +17 -0
- package/dist/datafinder/sql-generator.js +17 -0
- package/dist/datafinder/sql-generator.js.map +1 -0
- package/dist/datafinder/typed-attributes.cjs +751 -0
- package/dist/datafinder/typed-attributes.cjs.map +1 -0
- package/dist/datafinder/typed-attributes.d.cts +135 -0
- package/dist/datafinder/typed-attributes.d.ts +135 -0
- package/dist/datafinder/typed-attributes.js +25 -0
- package/dist/datafinder/typed-attributes.js.map +1 -0
- package/dist/index.cjs +1822 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +159 -0
- package/dist/index.js.map +1 -0
- package/dist/model/milestoning.cjs +145 -0
- package/dist/model/milestoning.cjs.map +1 -0
- package/dist/model/milestoning.d.cts +40 -0
- package/dist/model/milestoning.d.ts +40 -0
- package/dist/model/milestoning.js +18 -0
- package/dist/model/milestoning.js.map +1 -0
- package/dist/model/relational.cjs +514 -0
- package/dist/model/relational.cjs.map +1 -0
- package/dist/model/relational.d.cts +246 -0
- package/dist/model/relational.d.ts +246 -0
- package/dist/model/relational.js +91 -0
- package/dist/model/relational.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Attribute
|
|
3
|
+
} from "./chunk-V647VNMY.js";
|
|
4
|
+
import {
|
|
5
|
+
AggregateOperation,
|
|
6
|
+
BooleanConstantOperation,
|
|
7
|
+
ComparisonOperation,
|
|
8
|
+
DateArithmeticOperation,
|
|
9
|
+
DateConstantOperation,
|
|
10
|
+
DateDiffOperation,
|
|
11
|
+
DateExtractOperation,
|
|
12
|
+
DateTimeConstantOperation,
|
|
13
|
+
DecimalConstantOperation,
|
|
14
|
+
FloatConstantOperation,
|
|
15
|
+
IntegerConstantOperation,
|
|
16
|
+
ScalarFunctionOperation,
|
|
17
|
+
StringConstantOperation
|
|
18
|
+
} from "./chunk-3SSWFES4.js";
|
|
19
|
+
|
|
20
|
+
// src/datafinder/typed-attributes.ts
|
|
21
|
+
var StringAttribute = class extends Attribute {
|
|
22
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
23
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
24
|
+
}
|
|
25
|
+
upper() {
|
|
26
|
+
return new ScalarFunctionOperation(this.cwj(), "UPPER" /* UPPER */, "Upper " + this.displayName());
|
|
27
|
+
}
|
|
28
|
+
lower() {
|
|
29
|
+
return new ScalarFunctionOperation(this.cwj(), "LOWER" /* LOWER */, "Lower " + this.displayName());
|
|
30
|
+
}
|
|
31
|
+
strip() {
|
|
32
|
+
return new ScalarFunctionOperation(this.cwj(), "TRIM" /* TRIM */, "Strip " + this.displayName());
|
|
33
|
+
}
|
|
34
|
+
lstrip() {
|
|
35
|
+
return new ScalarFunctionOperation(this.cwj(), "LTRIM" /* LTRIM */, "LStrip " + this.displayName());
|
|
36
|
+
}
|
|
37
|
+
rstrip() {
|
|
38
|
+
return new ScalarFunctionOperation(this.cwj(), "RTRIM" /* RTRIM */, "RStrip " + this.displayName());
|
|
39
|
+
}
|
|
40
|
+
length() {
|
|
41
|
+
return new ScalarFunctionOperation(this.cwj(), "LENGTH" /* LENGTH */, "Length " + this.displayName());
|
|
42
|
+
}
|
|
43
|
+
reverse() {
|
|
44
|
+
return new ScalarFunctionOperation(this.cwj(), "REVERSE" /* REVERSE */, "Reverse " + this.displayName());
|
|
45
|
+
}
|
|
46
|
+
left(n) {
|
|
47
|
+
return new ScalarFunctionOperation(this.cwj(), "LEFT" /* LEFT */, "Left " + this.displayName(), n);
|
|
48
|
+
}
|
|
49
|
+
right(n) {
|
|
50
|
+
return new ScalarFunctionOperation(this.cwj(), "RIGHT" /* RIGHT */, "Right " + this.displayName(), n);
|
|
51
|
+
}
|
|
52
|
+
repeat(n) {
|
|
53
|
+
return new ScalarFunctionOperation(this.cwj(), "REPEAT" /* REPEAT */, "Repeat " + this.displayName(), n);
|
|
54
|
+
}
|
|
55
|
+
replace(fromStr, toStr) {
|
|
56
|
+
return new ScalarFunctionOperation(this.cwj(), "REPLACE" /* REPLACE */, "Replace " + this.displayName(), void 0, [fromStr, toStr]);
|
|
57
|
+
}
|
|
58
|
+
substring(start, length) {
|
|
59
|
+
const args = length !== void 0 ? [start + 1, length] : [start + 1];
|
|
60
|
+
return new ScalarFunctionOperation(this.cwj(), "SUBSTRING" /* SUBSTRING */, "Substring " + this.displayName(), void 0, args);
|
|
61
|
+
}
|
|
62
|
+
eq(value) {
|
|
63
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new StringConstantOperation(value));
|
|
64
|
+
}
|
|
65
|
+
ne(value) {
|
|
66
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new StringConstantOperation(value));
|
|
67
|
+
}
|
|
68
|
+
contains(value) {
|
|
69
|
+
return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`%${value}%`));
|
|
70
|
+
}
|
|
71
|
+
startsWith(prefix) {
|
|
72
|
+
return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`${prefix}%`));
|
|
73
|
+
}
|
|
74
|
+
endsWith(suffix) {
|
|
75
|
+
return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`%${suffix}`));
|
|
76
|
+
}
|
|
77
|
+
notContains(value) {
|
|
78
|
+
return new ComparisonOperation(this.cwj(), "NOT_LIKE" /* NOT_LIKE */, new StringConstantOperation(`%${value}%`));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var NumericAttribute = class extends Attribute {
|
|
82
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
83
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
84
|
+
}
|
|
85
|
+
sum() {
|
|
86
|
+
return new AggregateOperation(this.cwj(), "SUM" /* SUM */, this.displayName() + " Sum");
|
|
87
|
+
}
|
|
88
|
+
min() {
|
|
89
|
+
return new AggregateOperation(this.cwj(), "MIN" /* MIN */, this.displayName() + " Min");
|
|
90
|
+
}
|
|
91
|
+
max() {
|
|
92
|
+
return new AggregateOperation(this.cwj(), "MAX" /* MAX */, this.displayName() + " Max");
|
|
93
|
+
}
|
|
94
|
+
average() {
|
|
95
|
+
return new AggregateOperation(this.cwj(), "AVERAGE" /* AVERAGE */, this.displayName() + " Average");
|
|
96
|
+
}
|
|
97
|
+
abs() {
|
|
98
|
+
return new ScalarFunctionOperation(this.cwj(), "ABS" /* ABS */, "Abs " + this.displayName());
|
|
99
|
+
}
|
|
100
|
+
ceil() {
|
|
101
|
+
return new ScalarFunctionOperation(this.cwj(), "CEILING" /* CEILING */, "Ceil " + this.displayName());
|
|
102
|
+
}
|
|
103
|
+
floor() {
|
|
104
|
+
return new ScalarFunctionOperation(this.cwj(), "FLOOR" /* FLOOR */, "Floor " + this.displayName());
|
|
105
|
+
}
|
|
106
|
+
sqrt() {
|
|
107
|
+
return new ScalarFunctionOperation(this.cwj(), "SQRT" /* SQRT */, "Sqrt " + this.displayName());
|
|
108
|
+
}
|
|
109
|
+
mod(n) {
|
|
110
|
+
return new ScalarFunctionOperation(this.cwj(), "MOD" /* MOD */, "Mod " + this.displayName(), n);
|
|
111
|
+
}
|
|
112
|
+
power(n) {
|
|
113
|
+
return new ScalarFunctionOperation(this.cwj(), "POWER" /* POWER */, "Power " + this.displayName(), n);
|
|
114
|
+
}
|
|
115
|
+
round(d) {
|
|
116
|
+
return new ScalarFunctionOperation(this.cwj(), "ROUND" /* ROUND */, "Round " + this.displayName(), d);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var DoubleAttribute = class extends NumericAttribute {
|
|
120
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
121
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
122
|
+
}
|
|
123
|
+
eq(value) {
|
|
124
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new FloatConstantOperation(value));
|
|
125
|
+
}
|
|
126
|
+
ne(value) {
|
|
127
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new FloatConstantOperation(value));
|
|
128
|
+
}
|
|
129
|
+
gt(value) {
|
|
130
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new FloatConstantOperation(value));
|
|
131
|
+
}
|
|
132
|
+
lt(value) {
|
|
133
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new FloatConstantOperation(value));
|
|
134
|
+
}
|
|
135
|
+
gte(value) {
|
|
136
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new FloatConstantOperation(value));
|
|
137
|
+
}
|
|
138
|
+
lte(value) {
|
|
139
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new FloatConstantOperation(value));
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
var FloatAttribute = DoubleAttribute;
|
|
143
|
+
var DecimalAttribute = class extends NumericAttribute {
|
|
144
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
145
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
146
|
+
}
|
|
147
|
+
eq(value) {
|
|
148
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DecimalConstantOperation(value));
|
|
149
|
+
}
|
|
150
|
+
ne(value) {
|
|
151
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DecimalConstantOperation(value));
|
|
152
|
+
}
|
|
153
|
+
gt(value) {
|
|
154
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DecimalConstantOperation(value));
|
|
155
|
+
}
|
|
156
|
+
lt(value) {
|
|
157
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DecimalConstantOperation(value));
|
|
158
|
+
}
|
|
159
|
+
gte(value) {
|
|
160
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DecimalConstantOperation(value));
|
|
161
|
+
}
|
|
162
|
+
lte(value) {
|
|
163
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DecimalConstantOperation(value));
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
var IntegerAttribute = class extends NumericAttribute {
|
|
167
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
168
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
169
|
+
}
|
|
170
|
+
eq(value) {
|
|
171
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new IntegerConstantOperation(value));
|
|
172
|
+
}
|
|
173
|
+
ne(value) {
|
|
174
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new IntegerConstantOperation(value));
|
|
175
|
+
}
|
|
176
|
+
gt(value) {
|
|
177
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new IntegerConstantOperation(value));
|
|
178
|
+
}
|
|
179
|
+
lt(value) {
|
|
180
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new IntegerConstantOperation(value));
|
|
181
|
+
}
|
|
182
|
+
gte(value) {
|
|
183
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new IntegerConstantOperation(value));
|
|
184
|
+
}
|
|
185
|
+
lte(value) {
|
|
186
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new IntegerConstantOperation(value));
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
var BooleanAttribute = class extends Attribute {
|
|
190
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
191
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
192
|
+
}
|
|
193
|
+
eq(value) {
|
|
194
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(value));
|
|
195
|
+
}
|
|
196
|
+
isTrue() {
|
|
197
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(true));
|
|
198
|
+
}
|
|
199
|
+
isFalse() {
|
|
200
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(false));
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
function parseDate(value) {
|
|
204
|
+
if (value instanceof Date) return value;
|
|
205
|
+
const d = new Date(value);
|
|
206
|
+
if (isNaN(d.getTime())) throw new Error(`Cannot parse date: ${value}`);
|
|
207
|
+
return d;
|
|
208
|
+
}
|
|
209
|
+
var DateAttribute = class extends Attribute {
|
|
210
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
211
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
212
|
+
}
|
|
213
|
+
eq(value) {
|
|
214
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DateConstantOperation(parseDate(value)));
|
|
215
|
+
}
|
|
216
|
+
ne(value) {
|
|
217
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DateConstantOperation(parseDate(value)));
|
|
218
|
+
}
|
|
219
|
+
gt(value) {
|
|
220
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DateConstantOperation(parseDate(value)));
|
|
221
|
+
}
|
|
222
|
+
lt(value) {
|
|
223
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DateConstantOperation(parseDate(value)));
|
|
224
|
+
}
|
|
225
|
+
gte(value) {
|
|
226
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DateConstantOperation(parseDate(value)));
|
|
227
|
+
}
|
|
228
|
+
lte(value) {
|
|
229
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DateConstantOperation(parseDate(value)));
|
|
230
|
+
}
|
|
231
|
+
year() {
|
|
232
|
+
return new DateExtractOperation(this.cwj(), "YEAR" /* YEAR */, "Year " + this.displayName());
|
|
233
|
+
}
|
|
234
|
+
month() {
|
|
235
|
+
return new DateExtractOperation(this.cwj(), "MONTH" /* MONTH */, "Month " + this.displayName());
|
|
236
|
+
}
|
|
237
|
+
day() {
|
|
238
|
+
return new DateExtractOperation(this.cwj(), "DAY" /* DAY */, "Day " + this.displayName());
|
|
239
|
+
}
|
|
240
|
+
quarter() {
|
|
241
|
+
return new DateExtractOperation(this.cwj(), "QUARTER" /* QUARTER */, "Quarter " + this.displayName());
|
|
242
|
+
}
|
|
243
|
+
week() {
|
|
244
|
+
return new DateExtractOperation(this.cwj(), "WEEK" /* WEEK */, "Week " + this.displayName());
|
|
245
|
+
}
|
|
246
|
+
dayOfWeek() {
|
|
247
|
+
return new DateExtractOperation(this.cwj(), "DOW" /* DOW */, "Day Of Week " + this.displayName());
|
|
248
|
+
}
|
|
249
|
+
addDays(n) {
|
|
250
|
+
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, true, "Add Days " + this.displayName());
|
|
251
|
+
}
|
|
252
|
+
addMonths(n) {
|
|
253
|
+
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, true, "Add Months " + this.displayName());
|
|
254
|
+
}
|
|
255
|
+
addYears(n) {
|
|
256
|
+
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, true, "Add Years " + this.displayName());
|
|
257
|
+
}
|
|
258
|
+
subtractDays(n) {
|
|
259
|
+
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, false, "Subtract Days " + this.displayName());
|
|
260
|
+
}
|
|
261
|
+
subtractMonths(n) {
|
|
262
|
+
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, false, "Subtract Months " + this.displayName());
|
|
263
|
+
}
|
|
264
|
+
subtractYears(n) {
|
|
265
|
+
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, false, "Subtract Years " + this.displayName());
|
|
266
|
+
}
|
|
267
|
+
diffDays(other) {
|
|
268
|
+
return new DateDiffOperation(this.cwj(), other, "DAY" /* DAY */, "Diff Days " + this.displayName());
|
|
269
|
+
}
|
|
270
|
+
diffMonths(other) {
|
|
271
|
+
return new DateDiffOperation(this.cwj(), other, "MONTH" /* MONTH */, "Diff Months " + this.displayName());
|
|
272
|
+
}
|
|
273
|
+
diffYears(other) {
|
|
274
|
+
return new DateDiffOperation(this.cwj(), other, "YEAR" /* YEAR */, "Diff Years " + this.displayName());
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
var DateTimeAttribute = class extends Attribute {
|
|
278
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
279
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
280
|
+
}
|
|
281
|
+
eq(value) {
|
|
282
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DateTimeConstantOperation(parseDate(value)));
|
|
283
|
+
}
|
|
284
|
+
ne(value) {
|
|
285
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DateTimeConstantOperation(parseDate(value)));
|
|
286
|
+
}
|
|
287
|
+
gt(value) {
|
|
288
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DateTimeConstantOperation(parseDate(value)));
|
|
289
|
+
}
|
|
290
|
+
lt(value) {
|
|
291
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DateTimeConstantOperation(parseDate(value)));
|
|
292
|
+
}
|
|
293
|
+
gte(value) {
|
|
294
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DateTimeConstantOperation(parseDate(value)));
|
|
295
|
+
}
|
|
296
|
+
lte(value) {
|
|
297
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DateTimeConstantOperation(parseDate(value)));
|
|
298
|
+
}
|
|
299
|
+
year() {
|
|
300
|
+
return new DateExtractOperation(this.cwj(), "YEAR" /* YEAR */, "Year " + this.displayName());
|
|
301
|
+
}
|
|
302
|
+
month() {
|
|
303
|
+
return new DateExtractOperation(this.cwj(), "MONTH" /* MONTH */, "Month " + this.displayName());
|
|
304
|
+
}
|
|
305
|
+
day() {
|
|
306
|
+
return new DateExtractOperation(this.cwj(), "DAY" /* DAY */, "Day " + this.displayName());
|
|
307
|
+
}
|
|
308
|
+
hour() {
|
|
309
|
+
return new DateExtractOperation(this.cwj(), "HOUR" /* HOUR */, "Hour " + this.displayName());
|
|
310
|
+
}
|
|
311
|
+
minute() {
|
|
312
|
+
return new DateExtractOperation(this.cwj(), "MINUTE" /* MINUTE */, "Minute " + this.displayName());
|
|
313
|
+
}
|
|
314
|
+
second() {
|
|
315
|
+
return new DateExtractOperation(this.cwj(), "SECOND" /* SECOND */, "Second " + this.displayName());
|
|
316
|
+
}
|
|
317
|
+
quarter() {
|
|
318
|
+
return new DateExtractOperation(this.cwj(), "QUARTER" /* QUARTER */, "Quarter " + this.displayName());
|
|
319
|
+
}
|
|
320
|
+
week() {
|
|
321
|
+
return new DateExtractOperation(this.cwj(), "WEEK" /* WEEK */, "Week " + this.displayName());
|
|
322
|
+
}
|
|
323
|
+
dayOfWeek() {
|
|
324
|
+
return new DateExtractOperation(this.cwj(), "DOW" /* DOW */, "Day Of Week " + this.displayName());
|
|
325
|
+
}
|
|
326
|
+
addDays(n) {
|
|
327
|
+
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, true, "Add Days " + this.displayName());
|
|
328
|
+
}
|
|
329
|
+
addMonths(n) {
|
|
330
|
+
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, true, "Add Months " + this.displayName());
|
|
331
|
+
}
|
|
332
|
+
addYears(n) {
|
|
333
|
+
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, true, "Add Years " + this.displayName());
|
|
334
|
+
}
|
|
335
|
+
addHours(n) {
|
|
336
|
+
return new DateArithmeticOperation(this.cwj(), n, "HOUR" /* HOUR */, true, "Add Hours " + this.displayName());
|
|
337
|
+
}
|
|
338
|
+
addMinutes(n) {
|
|
339
|
+
return new DateArithmeticOperation(this.cwj(), n, "MINUTE" /* MINUTE */, true, "Add Minutes " + this.displayName());
|
|
340
|
+
}
|
|
341
|
+
addSeconds(n) {
|
|
342
|
+
return new DateArithmeticOperation(this.cwj(), n, "SECOND" /* SECOND */, true, "Add Seconds " + this.displayName());
|
|
343
|
+
}
|
|
344
|
+
subtractDays(n) {
|
|
345
|
+
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, false, "Subtract Days " + this.displayName());
|
|
346
|
+
}
|
|
347
|
+
subtractMonths(n) {
|
|
348
|
+
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, false, "Subtract Months " + this.displayName());
|
|
349
|
+
}
|
|
350
|
+
subtractYears(n) {
|
|
351
|
+
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, false, "Subtract Years " + this.displayName());
|
|
352
|
+
}
|
|
353
|
+
subtractHours(n) {
|
|
354
|
+
return new DateArithmeticOperation(this.cwj(), n, "HOUR" /* HOUR */, false, "Subtract Hours " + this.displayName());
|
|
355
|
+
}
|
|
356
|
+
subtractMinutes(n) {
|
|
357
|
+
return new DateArithmeticOperation(this.cwj(), n, "MINUTE" /* MINUTE */, false, "Subtract Minutes " + this.displayName());
|
|
358
|
+
}
|
|
359
|
+
subtractSeconds(n) {
|
|
360
|
+
return new DateArithmeticOperation(this.cwj(), n, "SECOND" /* SECOND */, false, "Subtract Seconds " + this.displayName());
|
|
361
|
+
}
|
|
362
|
+
diffDays(other) {
|
|
363
|
+
return new DateDiffOperation(this.cwj(), other, "DAY" /* DAY */, "Diff Days " + this.displayName());
|
|
364
|
+
}
|
|
365
|
+
diffMonths(other) {
|
|
366
|
+
return new DateDiffOperation(this.cwj(), other, "MONTH" /* MONTH */, "Diff Months " + this.displayName());
|
|
367
|
+
}
|
|
368
|
+
diffYears(other) {
|
|
369
|
+
return new DateDiffOperation(this.cwj(), other, "YEAR" /* YEAR */, "Diff Years " + this.displayName());
|
|
370
|
+
}
|
|
371
|
+
diffHours(other) {
|
|
372
|
+
return new DateDiffOperation(this.cwj(), other, "HOUR" /* HOUR */, "Diff Hours " + this.displayName());
|
|
373
|
+
}
|
|
374
|
+
diffMinutes(other) {
|
|
375
|
+
return new DateDiffOperation(this.cwj(), other, "MINUTE" /* MINUTE */, "Diff Minutes " + this.displayName());
|
|
376
|
+
}
|
|
377
|
+
diffSeconds(other) {
|
|
378
|
+
return new DateDiffOperation(this.cwj(), other, "SECOND" /* SECOND */, "Diff Seconds " + this.displayName());
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
export {
|
|
383
|
+
StringAttribute,
|
|
384
|
+
NumericAttribute,
|
|
385
|
+
DoubleAttribute,
|
|
386
|
+
FloatAttribute,
|
|
387
|
+
DecimalAttribute,
|
|
388
|
+
IntegerAttribute,
|
|
389
|
+
BooleanAttribute,
|
|
390
|
+
DateAttribute,
|
|
391
|
+
DateTimeAttribute
|
|
392
|
+
};
|
|
393
|
+
//# sourceMappingURL=chunk-5K2Z3YDY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,KAAK,IAAI,wBAAyB,WAAW,KAAK,YAAY,CAAC;AAAA,EACpG;AAAA,EACA,QAAiC;AAC/B,WAAO,IAAI,wBAAwB,KAAK,IAAI,sBAAwB,WAAW,KAAK,YAAY,CAAC;AAAA,EACnG;AAAA,EACA,SAAkC;AAChC,WAAO,IAAI,wBAAwB,KAAK,IAAI,wBAAyB,YAAY,KAAK,YAAY,CAAC;AAAA,EACrG;AAAA,EACA,SAAkC;AAChC,WAAO,IAAI,wBAAwB,KAAK,IAAI,wBAAyB,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K,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":[]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toSql
|
|
3
|
+
} from "./chunk-DFYZVBII.js";
|
|
4
|
+
import {
|
|
5
|
+
NoOperation
|
|
6
|
+
} from "./chunk-3SSWFES4.js";
|
|
7
|
+
|
|
8
|
+
// src/datafinder/runner.ts
|
|
9
|
+
var _runner = null;
|
|
10
|
+
function registerRunner(runner) {
|
|
11
|
+
_runner = runner;
|
|
12
|
+
}
|
|
13
|
+
function clearRunner() {
|
|
14
|
+
_runner = null;
|
|
15
|
+
}
|
|
16
|
+
function getRunner() {
|
|
17
|
+
if (!_runner) throw new Error("No query runner registered. Call registerRunner() first.");
|
|
18
|
+
return _runner;
|
|
19
|
+
}
|
|
20
|
+
var FinderResult = class {
|
|
21
|
+
constructor(_businessDate, _processingDatetime, _columns, _table, _op) {
|
|
22
|
+
this._businessDate = _businessDate;
|
|
23
|
+
this._processingDatetime = _processingDatetime;
|
|
24
|
+
this._columns = _columns;
|
|
25
|
+
this._table = _table;
|
|
26
|
+
this._op = _op;
|
|
27
|
+
}
|
|
28
|
+
_businessDate;
|
|
29
|
+
_processingDatetime;
|
|
30
|
+
_columns;
|
|
31
|
+
_table;
|
|
32
|
+
_op;
|
|
33
|
+
_orderBy = [];
|
|
34
|
+
_groupBy = [];
|
|
35
|
+
_limit;
|
|
36
|
+
orderByOp(...sorts) {
|
|
37
|
+
this._orderBy = sorts;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
groupByOp(...attrs) {
|
|
41
|
+
this._groupBy = attrs;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
limit(n) {
|
|
45
|
+
this._limit = n;
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
toSql() {
|
|
49
|
+
return toSql(
|
|
50
|
+
this._businessDate,
|
|
51
|
+
this._processingDatetime,
|
|
52
|
+
this._columns,
|
|
53
|
+
this._table,
|
|
54
|
+
this._op,
|
|
55
|
+
this._orderBy,
|
|
56
|
+
this._groupBy,
|
|
57
|
+
this._limit
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
async toRows() {
|
|
61
|
+
return getRunner().select(
|
|
62
|
+
this._businessDate,
|
|
63
|
+
this._processingDatetime,
|
|
64
|
+
this._columns,
|
|
65
|
+
this._table,
|
|
66
|
+
this._op,
|
|
67
|
+
this._orderBy,
|
|
68
|
+
this._groupBy,
|
|
69
|
+
this._limit
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
function convertDate(value) {
|
|
74
|
+
if (value === null) return null;
|
|
75
|
+
if (value instanceof Date) return value;
|
|
76
|
+
const normalized = /^\d{4}-\d{2}-\d{2}$/.test(value) ? value + "T00:00:00Z" : value;
|
|
77
|
+
const d = new Date(normalized);
|
|
78
|
+
if (isNaN(d.getTime())) throw new Error(`Cannot parse date: ${value}`);
|
|
79
|
+
return d;
|
|
80
|
+
}
|
|
81
|
+
function convertInputsAndSelect(businessDate, processingDatetime, columns, table, op = new NoOperation()) {
|
|
82
|
+
return new FinderResult(
|
|
83
|
+
convertDate(businessDate),
|
|
84
|
+
convertDate(processingDatetime),
|
|
85
|
+
columns,
|
|
86
|
+
table,
|
|
87
|
+
op
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
registerRunner,
|
|
93
|
+
clearRunner,
|
|
94
|
+
getRunner,
|
|
95
|
+
FinderResult,
|
|
96
|
+
convertInputsAndSelect
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=chunk-6QTCGJWX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,MAAM,0DAA0D;AACxF,SAAO;AACT;AAEO,IAAM,eAAN,MAAmB;AAAA,EAKxB,YACmB,eACA,qBACA,UACA,QACA,KACjB;AALiB;AACA;AACA;AACA;AACA;AAAA,EAChB;AAAA,EALgB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EATX,WAA4B,CAAC;AAAA,EAC7B,WAAwB,CAAC;AAAA,EACzB;AAAA,EAUR,aAAa,OAA8B;AACzC,SAAK,WAAW;AAChB,WAAO;AAAA,EACT;AAAA,EAEA,aAAa,OAA0B;AACrC,SAAK,WAAW;AAChB,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,GAAiB;AACrB,SAAK,SAAS;AACd,WAAO;AAAA,EACT;AAAA,EAEA,QAAgB;AACd,WAAO;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;A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