data-finder-ts 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +17 -55
  2. package/dist/chunk-BGEX377Q.js +230 -0
  3. package/dist/chunk-BGEX377Q.js.map +1 -0
  4. package/dist/chunk-BKPWV3OF.js +962 -0
  5. package/dist/chunk-BKPWV3OF.js.map +1 -0
  6. package/dist/{chunk-EYXBYV2X.js → chunk-GPHWC533.js} +2 -2
  7. package/dist/chunk-KAK75RVS.js +198 -0
  8. package/dist/chunk-KAK75RVS.js.map +1 -0
  9. package/dist/chunk-MGEL5RWM.js +628 -0
  10. package/dist/chunk-MGEL5RWM.js.map +1 -0
  11. package/dist/chunk-PF6EJZHB.js +1015 -0
  12. package/dist/chunk-PF6EJZHB.js.map +1 -0
  13. package/dist/datafinder/attribute.cjs +595 -18
  14. package/dist/datafinder/attribute.cjs.map +1 -1
  15. package/dist/datafinder/attribute.d.cts +73 -10
  16. package/dist/datafinder/attribute.d.ts +73 -10
  17. package/dist/datafinder/attribute.js +2 -2
  18. package/dist/datafinder/runner.cjs +1589 -288
  19. package/dist/datafinder/runner.cjs.map +1 -1
  20. package/dist/datafinder/runner.d.cts +41 -7
  21. package/dist/datafinder/runner.d.ts +41 -7
  22. package/dist/datafinder/runner.js +12 -6
  23. package/dist/datafinder/sql-generator.cjs +1484 -281
  24. package/dist/datafinder/sql-generator.cjs.map +1 -1
  25. package/dist/datafinder/sql-generator.d.cts +19 -14
  26. package/dist/datafinder/sql-generator.d.ts +19 -14
  27. package/dist/datafinder/sql-generator.js +9 -7
  28. package/dist/datafinder/typed-attributes.cjs +856 -93
  29. package/dist/datafinder/typed-attributes.cjs.map +1 -1
  30. package/dist/datafinder/typed-attributes.d.cts +3 -135
  31. package/dist/datafinder/typed-attributes.d.ts +3 -135
  32. package/dist/datafinder/typed-attributes.js +3 -3
  33. package/dist/dialect-CogGPm_y.d.cts +38 -0
  34. package/dist/dialect-aaG1bDi5.d.ts +38 -0
  35. package/dist/index.cjs +2080 -480
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +119 -14
  38. package/dist/index.d.ts +119 -14
  39. package/dist/index.js +362 -12
  40. package/dist/index.js.map +1 -1
  41. package/dist/model/milestoning.cjs +529 -0
  42. package/dist/model/milestoning.cjs.map +1 -1
  43. package/dist/model/milestoning.js +2 -2
  44. package/dist/model/relational.cjs +608 -12
  45. package/dist/model/relational.cjs.map +1 -1
  46. package/dist/model/relational.d.cts +456 -47
  47. package/dist/model/relational.d.ts +456 -47
  48. package/dist/model/relational.js +61 -3
  49. package/dist/typed-attributes-CUTf_6Ru.d.ts +328 -0
  50. package/dist/typed-attributes-CdWXq_78.d.cts +328 -0
  51. package/package.json +5 -2
  52. package/dist/chunk-3SSWFES4.js +0 -448
  53. package/dist/chunk-3SSWFES4.js.map +0 -1
  54. package/dist/chunk-5K2Z3YDY.js +0 -393
  55. package/dist/chunk-5K2Z3YDY.js.map +0 -1
  56. package/dist/chunk-6QTCGJWX.js +0 -98
  57. package/dist/chunk-6QTCGJWX.js.map +0 -1
  58. package/dist/chunk-DFYZVBII.js +0 -652
  59. package/dist/chunk-DFYZVBII.js.map +0 -1
  60. package/dist/chunk-V647VNMY.js +0 -135
  61. package/dist/chunk-V647VNMY.js.map +0 -1
  62. /package/dist/{chunk-EYXBYV2X.js.map → chunk-GPHWC533.js.map} +0 -0
@@ -0,0 +1,628 @@
1
+ import {
2
+ Attribute
3
+ } from "./chunk-BGEX377Q.js";
4
+ import {
5
+ AggregateOperation,
6
+ Arithmetic,
7
+ BooleanConstantOperation,
8
+ ComparisonOperation,
9
+ DATE_ONLY_PATTERN,
10
+ DateArithmeticOperation,
11
+ DateConstantOperation,
12
+ DateDiffOperation,
13
+ DateExtractOperation,
14
+ DateOnly,
15
+ DateTimeConstantOperation,
16
+ DateTruncOperation,
17
+ DecimalConstantOperation,
18
+ FloatConstantOperation,
19
+ IntegerConstantOperation,
20
+ ScalarFunctionOperation,
21
+ StringConstantOperation,
22
+ applyMixins,
23
+ concat,
24
+ escapeLike,
25
+ sample
26
+ } from "./chunk-PF6EJZHB.js";
27
+
28
+ // src/datafinder/scalar-functions.ts
29
+ var StringFunctionOperation = class extends ScalarFunctionOperation {
30
+ functionInput() {
31
+ return this;
32
+ }
33
+ functionLabel() {
34
+ return labelOf(this);
35
+ }
36
+ };
37
+ var NumericFunctionOperation = class extends ScalarFunctionOperation {
38
+ functionInput() {
39
+ return this;
40
+ }
41
+ functionLabel() {
42
+ return labelOf(this);
43
+ }
44
+ };
45
+ function labelOf(operation) {
46
+ return operation.displayName ?? operation.func.charAt(0) + operation.func.slice(1).toLowerCase();
47
+ }
48
+ function stringFunction(element, func, label, secondArg, extraArgs = []) {
49
+ return new StringFunctionOperation(element, func, label, secondArg, extraArgs);
50
+ }
51
+ function numberFunction(element, func, label, secondArg) {
52
+ return new NumericFunctionOperation(element, func, label, secondArg);
53
+ }
54
+ var StringFunctions = class {
55
+ /** Join text on the end: `f.first().concat(' ', f.last())`. A NULL part makes the whole NULL. */
56
+ concat(...more) {
57
+ return concat(this, ...more);
58
+ }
59
+ /** Convert every character to uppercase. */
60
+ toUpperCase() {
61
+ return stringFunction(this.functionInput(), "UPPER" /* UPPER */, "Upper " + this.functionLabel());
62
+ }
63
+ /** Convert every character to lowercase. */
64
+ toLowerCase() {
65
+ return stringFunction(this.functionInput(), "LOWER" /* LOWER */, "Lower " + this.functionLabel());
66
+ }
67
+ /** Remove leading and trailing whitespace. */
68
+ trim() {
69
+ return stringFunction(this.functionInput(), "TRIM" /* TRIM */, "Trim " + this.functionLabel());
70
+ }
71
+ /** Remove leading whitespace. */
72
+ trimStart() {
73
+ return stringFunction(this.functionInput(), "LTRIM" /* LTRIM */, "Trim Start " + this.functionLabel());
74
+ }
75
+ /** Remove trailing whitespace. */
76
+ trimEnd() {
77
+ return stringFunction(this.functionInput(), "RTRIM" /* RTRIM */, "Trim End " + this.functionLabel());
78
+ }
79
+ /** Return the number of characters in the string. */
80
+ length() {
81
+ return numberFunction(this.functionInput(), "LENGTH" /* LENGTH */, "Length " + this.functionLabel());
82
+ }
83
+ /** Return the string with characters in reverse order. */
84
+ reverse() {
85
+ return stringFunction(this.functionInput(), "REVERSE" /* REVERSE */, "Reverse " + this.functionLabel());
86
+ }
87
+ /** Return the first `n` characters. */
88
+ left(n) {
89
+ return stringFunction(this.functionInput(), "LEFT" /* LEFT */, "Left " + this.functionLabel(), n);
90
+ }
91
+ /** Return the last `n` characters. */
92
+ right(n) {
93
+ return stringFunction(this.functionInput(), "RIGHT" /* RIGHT */, "Right " + this.functionLabel(), n);
94
+ }
95
+ /** Return the string repeated `n` times. */
96
+ repeat(n) {
97
+ return stringFunction(this.functionInput(), "REPEAT" /* REPEAT */, "Repeat " + this.functionLabel(), n);
98
+ }
99
+ /** Replace all occurrences of `fromStr` with `toStr`. */
100
+ replace(fromStr, toStr) {
101
+ return stringFunction(this.functionInput(), "REPLACE" /* REPLACE */, "Replace " + this.functionLabel(), void 0, [fromStr, toStr]);
102
+ }
103
+ /**
104
+ * Extract a portion of the string.
105
+ * `start` is zero-based (following Python convention); `length` is optional.
106
+ */
107
+ substring(start, length) {
108
+ const args = length !== void 0 ? [start + 1, length] : [start + 1];
109
+ return stringFunction(this.functionInput(), "SUBSTRING" /* SUBSTRING */, "Substring " + this.functionLabel(), void 0, args);
110
+ }
111
+ };
112
+ var NumericFunctions = class {
113
+ /** Absolute value (distance from zero, always non-negative). */
114
+ abs() {
115
+ return numberFunction(this.functionInput(), "ABS" /* ABS */, "Abs " + this.functionLabel());
116
+ }
117
+ /** Round up to the nearest integer. */
118
+ ceil() {
119
+ return numberFunction(this.functionInput(), "CEILING" /* CEILING */, "Ceil " + this.functionLabel());
120
+ }
121
+ /** Round down to the nearest integer. */
122
+ floor() {
123
+ return numberFunction(this.functionInput(), "FLOOR" /* FLOOR */, "Floor " + this.functionLabel());
124
+ }
125
+ /** Square root. */
126
+ sqrt() {
127
+ return numberFunction(this.functionInput(), "SQRT" /* SQRT */, "Sqrt " + this.functionLabel());
128
+ }
129
+ /** Remainder after dividing by `n`. */
130
+ mod(n) {
131
+ return numberFunction(this.functionInput(), "MOD" /* MOD */, "Mod " + this.functionLabel(), n);
132
+ }
133
+ /** Raise to the power of `n`. */
134
+ power(n) {
135
+ return numberFunction(this.functionInput(), "POWER" /* POWER */, "Power " + this.functionLabel(), n);
136
+ }
137
+ /** Round to `d` decimal places, or to the nearest integer when `d` is omitted. */
138
+ round(d) {
139
+ return numberFunction(this.functionInput(), "ROUND" /* ROUND */, "Round " + this.functionLabel(), d);
140
+ }
141
+ };
142
+ applyMixins(StringFunctionOperation, [StringFunctions]);
143
+ applyMixins(NumericFunctionOperation, [NumericFunctions]);
144
+
145
+ // src/datafinder/typed-attributes.ts
146
+ var MinMax = class {
147
+ /** Smallest value in the group. */
148
+ min() {
149
+ return new AggregateOperation(this.cwj(), "MIN" /* MIN */, "Min " + this.displayName());
150
+ }
151
+ /** Largest value in the group. */
152
+ max() {
153
+ return new AggregateOperation(this.cwj(), "MAX" /* MAX */, "Max " + this.displayName());
154
+ }
155
+ };
156
+ var StringAttribute = class extends Attribute {
157
+ constructor(displayName, columnName, columnDbType, owner, parent, embedded, nullable = true, optional = false) {
158
+ super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional);
159
+ }
160
+ toConstant(value) {
161
+ return new StringConstantOperation(String(value));
162
+ }
163
+ /**
164
+ * Join the values of a group into one text with `separator` between them. `orderBy` is the order they are
165
+ * joined in (`[f.name().ascending()]`); without it the order is not defined. Missing values are skipped.
166
+ */
167
+ join(separator = "", orderBy = []) {
168
+ return new AggregateOperation(this.cwj(), "STRING_AGG" /* STRING_AGG */, "Join " + this.displayName(), void 0, separator, orderBy);
169
+ }
170
+ /** Filter to rows where this attribute equals `value`. */
171
+ eq(value) {
172
+ return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new StringConstantOperation(value));
173
+ }
174
+ /** Filter to rows where this attribute does not equal `value`. */
175
+ ne(value) {
176
+ return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new StringConstantOperation(value));
177
+ }
178
+ /** Filter to rows where this attribute contains `value` as a substring. */
179
+ contains(value) {
180
+ return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`%${escapeLike(value)}%`));
181
+ }
182
+ /** Filter to rows where this attribute begins with `prefix`. */
183
+ startsWith(prefix) {
184
+ return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`${escapeLike(prefix)}%`));
185
+ }
186
+ /** Filter to rows where this attribute ends with `suffix`. */
187
+ endsWith(suffix) {
188
+ return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`%${escapeLike(suffix)}`));
189
+ }
190
+ /** Filter to rows where this attribute does not contain `value` as a substring. */
191
+ notContains(value) {
192
+ return new ComparisonOperation(this.cwj(), "NOT_LIKE" /* NOT_LIKE */, new StringConstantOperation(`%${escapeLike(value)}%`));
193
+ }
194
+ };
195
+ applyMixins(StringAttribute, [MinMax, StringFunctions]);
196
+ var NumericAttribute = class extends Attribute {
197
+ constructor(displayName, columnName, columnDbType, owner, parent, embedded, nullable = true, optional = false) {
198
+ super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional);
199
+ }
200
+ /** Sum of all values in the group. */
201
+ sum() {
202
+ return new AggregateOperation(this.cwj(), "SUM" /* SUM */, "Sum " + this.displayName());
203
+ }
204
+ /** Arithmetic mean of all values in the group. */
205
+ average() {
206
+ return new AggregateOperation(this.cwj(), "AVERAGE" /* AVERAGE */, "Average " + this.displayName());
207
+ }
208
+ /** Standard deviation of the values in the group: the sample one by default, `ddof = 0` for the population one, as `Series.std`. */
209
+ std(ddof = 1) {
210
+ const operator = sample(ddof) ? "STDDEV_SAMP" /* STDDEV_SAMP */ : "STDDEV_POP" /* STDDEV_POP */;
211
+ return new AggregateOperation(this.cwj(), operator, "Std " + this.displayName());
212
+ }
213
+ /** Variance of the values in the group: the sample one by default, `ddof = 0` for the population one, as `Series.var`. */
214
+ var(ddof = 1) {
215
+ const operator = sample(ddof) ? "VAR_SAMP" /* VAR_SAMP */ : "VAR_POP" /* VAR_POP */;
216
+ return new AggregateOperation(this.cwj(), operator, "Var " + this.displayName());
217
+ }
218
+ };
219
+ applyMixins(NumericAttribute, [MinMax, NumericFunctions, Arithmetic]);
220
+ var DoubleAttribute = class extends NumericAttribute {
221
+ constructor(displayName, columnName, columnDbType, owner, parent, embedded, nullable = true, optional = false) {
222
+ super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional);
223
+ }
224
+ toConstant(value) {
225
+ return new FloatConstantOperation(Number(value));
226
+ }
227
+ /** Filter to rows where this attribute equals `value`. */
228
+ eq(value) {
229
+ return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new FloatConstantOperation(value));
230
+ }
231
+ /** Filter to rows where this attribute does not equal `value`. */
232
+ ne(value) {
233
+ return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new FloatConstantOperation(value));
234
+ }
235
+ /** Filter to rows where this attribute is greater than `value`. */
236
+ gt(value) {
237
+ return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new FloatConstantOperation(value));
238
+ }
239
+ /** Filter to rows where this attribute is less than `value`. */
240
+ lt(value) {
241
+ return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new FloatConstantOperation(value));
242
+ }
243
+ /** Filter to rows where this attribute is greater than or equal to `value`. */
244
+ gte(value) {
245
+ return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new FloatConstantOperation(value));
246
+ }
247
+ /** Filter to rows where this attribute is less than or equal to `value`. */
248
+ lte(value) {
249
+ return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new FloatConstantOperation(value));
250
+ }
251
+ };
252
+ var FloatAttribute = DoubleAttribute;
253
+ var DecimalAttribute = class extends NumericAttribute {
254
+ constructor(displayName, columnName, columnDbType, owner, parent, embedded, nullable = true, optional = false) {
255
+ super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional);
256
+ }
257
+ toConstant(value) {
258
+ return new DecimalConstantOperation(Number(value));
259
+ }
260
+ /** Filter to rows where this attribute equals `value`. */
261
+ eq(value) {
262
+ return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DecimalConstantOperation(value));
263
+ }
264
+ /** Filter to rows where this attribute does not equal `value`. */
265
+ ne(value) {
266
+ return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DecimalConstantOperation(value));
267
+ }
268
+ /** Filter to rows where this attribute is greater than `value`. */
269
+ gt(value) {
270
+ return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DecimalConstantOperation(value));
271
+ }
272
+ /** Filter to rows where this attribute is less than `value`. */
273
+ lt(value) {
274
+ return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DecimalConstantOperation(value));
275
+ }
276
+ /** Filter to rows where this attribute is greater than or equal to `value`. */
277
+ gte(value) {
278
+ return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DecimalConstantOperation(value));
279
+ }
280
+ /** Filter to rows where this attribute is less than or equal to `value`. */
281
+ lte(value) {
282
+ return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DecimalConstantOperation(value));
283
+ }
284
+ };
285
+ var IntegerAttribute = class extends NumericAttribute {
286
+ constructor(displayName, columnName, columnDbType, owner, parent, embedded, nullable = true, optional = false) {
287
+ super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional);
288
+ }
289
+ toConstant(value) {
290
+ return new IntegerConstantOperation(Number(value));
291
+ }
292
+ /** Filter to rows where this attribute equals `value`. */
293
+ eq(value) {
294
+ return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new IntegerConstantOperation(value));
295
+ }
296
+ /** Filter to rows where this attribute does not equal `value`. */
297
+ ne(value) {
298
+ return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new IntegerConstantOperation(value));
299
+ }
300
+ /** Filter to rows where this attribute is greater than `value`. */
301
+ gt(value) {
302
+ return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new IntegerConstantOperation(value));
303
+ }
304
+ /** Filter to rows where this attribute is less than `value`. */
305
+ lt(value) {
306
+ return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new IntegerConstantOperation(value));
307
+ }
308
+ /** Filter to rows where this attribute is greater than or equal to `value`. */
309
+ gte(value) {
310
+ return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new IntegerConstantOperation(value));
311
+ }
312
+ /** Filter to rows where this attribute is less than or equal to `value`. */
313
+ lte(value) {
314
+ return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new IntegerConstantOperation(value));
315
+ }
316
+ };
317
+ var BooleanAttribute = class extends Attribute {
318
+ constructor(displayName, columnName, columnDbType, owner, parent, embedded, nullable = true, optional = false) {
319
+ super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional);
320
+ }
321
+ toConstant(value) {
322
+ return new BooleanConstantOperation(Boolean(value));
323
+ }
324
+ /** Filter to rows where this attribute equals `value`. */
325
+ eq(value) {
326
+ return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(value));
327
+ }
328
+ /** Filter to rows where this attribute is true. */
329
+ isTrue() {
330
+ return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(true));
331
+ }
332
+ /** Filter to rows where this attribute is false. */
333
+ isFalse() {
334
+ return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(false));
335
+ }
336
+ };
337
+ function parseDate(value) {
338
+ if (value instanceof Date) return value;
339
+ const d = new Date(value);
340
+ if (isNaN(d.getTime())) throw new Error(`Cannot parse date: ${value}`);
341
+ return d;
342
+ }
343
+ function temporalConstant(value) {
344
+ if (typeof value === "string" && DATE_ONLY_PATTERN.test(value)) return new DateConstantOperation(new DateOnly(value));
345
+ const date = parseDate(value);
346
+ return date instanceof DateOnly ? new DateConstantOperation(date) : new DateTimeConstantOperation(date);
347
+ }
348
+ var DateAttribute = class extends Attribute {
349
+ constructor(displayName, columnName, columnDbType, owner, parent, embedded, nullable = true, optional = false) {
350
+ super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional);
351
+ }
352
+ toConstant(value) {
353
+ return new DateConstantOperation(parseDate(value));
354
+ }
355
+ /** Filter to rows where this date equals `value`. */
356
+ eq(value) {
357
+ return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DateConstantOperation(parseDate(value)));
358
+ }
359
+ /** Filter to rows where this date does not equal `value`. */
360
+ ne(value) {
361
+ return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DateConstantOperation(parseDate(value)));
362
+ }
363
+ /** Filter to rows where this date is after `value`. */
364
+ gt(value) {
365
+ return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DateConstantOperation(parseDate(value)));
366
+ }
367
+ /** Filter to rows where this date is before `value`. */
368
+ lt(value) {
369
+ return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DateConstantOperation(parseDate(value)));
370
+ }
371
+ /** Filter to rows where this date is on or after `value`. */
372
+ gte(value) {
373
+ return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DateConstantOperation(parseDate(value)));
374
+ }
375
+ /** Filter to rows where this date is on or before `value`. */
376
+ lte(value) {
377
+ return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DateConstantOperation(parseDate(value)));
378
+ }
379
+ /** Extract the four-digit calendar year. */
380
+ year() {
381
+ return new DateExtractOperation(this.cwj(), "YEAR" /* YEAR */, "Year " + this.displayName());
382
+ }
383
+ /** Extract the month number (1–12). */
384
+ month() {
385
+ return new DateExtractOperation(this.cwj(), "MONTH" /* MONTH */, "Month " + this.displayName());
386
+ }
387
+ /** Extract the day of the month (1–31). */
388
+ day() {
389
+ return new DateExtractOperation(this.cwj(), "DAY" /* DAY */, "Day " + this.displayName());
390
+ }
391
+ /** Extract the quarter (1–4). */
392
+ quarter() {
393
+ return new DateExtractOperation(this.cwj(), "QUARTER" /* QUARTER */, "Quarter " + this.displayName());
394
+ }
395
+ /** Extract the ISO week number (1–53). */
396
+ week() {
397
+ return new DateExtractOperation(this.cwj(), "WEEK" /* WEEK */, "Week " + this.displayName());
398
+ }
399
+ /** Extract the day of the week (0 = Sunday through 6 = Saturday). */
400
+ dayOfWeek() {
401
+ return new DateExtractOperation(this.cwj(), "DOW" /* DOW */, "Day Of Week " + this.displayName());
402
+ }
403
+ /** The date of the first day of the week the date falls in (a Monday). */
404
+ firstDayOfWeek() {
405
+ return new DateTruncOperation(this.cwj(), "WEEK" /* WEEK */, "First Day Of Week " + this.displayName());
406
+ }
407
+ /** The date of the first day of the month the date falls in. */
408
+ firstDayOfMonth() {
409
+ return new DateTruncOperation(this.cwj(), "MONTH" /* MONTH */, "First Day Of Month " + this.displayName());
410
+ }
411
+ /** The date of the first day of the quarter the date falls in. */
412
+ firstDayOfQuarter() {
413
+ return new DateTruncOperation(this.cwj(), "QUARTER" /* QUARTER */, "First Day Of Quarter " + this.displayName());
414
+ }
415
+ /** The date of the first day of the year the date falls in. */
416
+ firstDayOfYear() {
417
+ return new DateTruncOperation(this.cwj(), "YEAR" /* YEAR */, "First Day Of Year " + this.displayName());
418
+ }
419
+ /** Add `n` days to this date. */
420
+ addDays(n) {
421
+ return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, true, "Add Days " + this.displayName());
422
+ }
423
+ /** Add `n` months to this date. */
424
+ addMonths(n) {
425
+ return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, true, "Add Months " + this.displayName());
426
+ }
427
+ /** Add `n` years to this date. */
428
+ addYears(n) {
429
+ return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, true, "Add Years " + this.displayName());
430
+ }
431
+ /** Subtract `n` days from this date. */
432
+ subtractDays(n) {
433
+ return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, false, "Subtract Days " + this.displayName());
434
+ }
435
+ /** Subtract `n` months from this date. */
436
+ subtractMonths(n) {
437
+ return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, false, "Subtract Months " + this.displayName());
438
+ }
439
+ /** Subtract `n` years from this date. */
440
+ subtractYears(n) {
441
+ return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, false, "Subtract Years " + this.displayName());
442
+ }
443
+ /** Number of whole days between this date and `other`. */
444
+ diffDays(other) {
445
+ return new DateDiffOperation(this.cwj(), other, "DAY" /* DAY */, "Diff Days " + this.displayName());
446
+ }
447
+ /** Number of whole months between this date and `other`. */
448
+ diffMonths(other) {
449
+ return new DateDiffOperation(this.cwj(), other, "MONTH" /* MONTH */, "Diff Months " + this.displayName());
450
+ }
451
+ /** Number of whole years between this date and `other`. */
452
+ diffYears(other) {
453
+ return new DateDiffOperation(this.cwj(), other, "YEAR" /* YEAR */, "Diff Years " + this.displayName());
454
+ }
455
+ };
456
+ var DateTimeAttribute = class extends Attribute {
457
+ constructor(displayName, columnName, columnDbType, owner, parent, embedded, nullable = true, optional = false) {
458
+ super(displayName, columnName, columnDbType, owner, parent, embedded, nullable, optional);
459
+ }
460
+ toConstant(value) {
461
+ return temporalConstant(value);
462
+ }
463
+ /** Filter to rows where this timestamp equals `value`. */
464
+ eq(value) {
465
+ return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, temporalConstant(value));
466
+ }
467
+ /** Filter to rows where this timestamp does not equal `value`. */
468
+ ne(value) {
469
+ return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, temporalConstant(value));
470
+ }
471
+ /** Filter to rows where this timestamp is after `value`. */
472
+ gt(value) {
473
+ return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, temporalConstant(value));
474
+ }
475
+ /** Filter to rows where this timestamp is before `value`. */
476
+ lt(value) {
477
+ return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, temporalConstant(value));
478
+ }
479
+ /** Filter to rows where this timestamp is on or after `value`. */
480
+ gte(value) {
481
+ return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, temporalConstant(value));
482
+ }
483
+ /** Filter to rows where this timestamp is on or before `value`. */
484
+ lte(value) {
485
+ return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, temporalConstant(value));
486
+ }
487
+ /** Extract the four-digit calendar year. */
488
+ year() {
489
+ return new DateExtractOperation(this.cwj(), "YEAR" /* YEAR */, "Year " + this.displayName());
490
+ }
491
+ /** Extract the month number (1–12). */
492
+ month() {
493
+ return new DateExtractOperation(this.cwj(), "MONTH" /* MONTH */, "Month " + this.displayName());
494
+ }
495
+ /** Extract the day of the month (1–31). */
496
+ day() {
497
+ return new DateExtractOperation(this.cwj(), "DAY" /* DAY */, "Day " + this.displayName());
498
+ }
499
+ /** Extract the hour (0–23). */
500
+ hour() {
501
+ return new DateExtractOperation(this.cwj(), "HOUR" /* HOUR */, "Hour " + this.displayName());
502
+ }
503
+ /** Extract the minute (0–59). */
504
+ minute() {
505
+ return new DateExtractOperation(this.cwj(), "MINUTE" /* MINUTE */, "Minute " + this.displayName());
506
+ }
507
+ /** Extract the second (0–59). */
508
+ second() {
509
+ return new DateExtractOperation(this.cwj(), "SECOND" /* SECOND */, "Second " + this.displayName());
510
+ }
511
+ /** Extract the quarter (1–4). */
512
+ quarter() {
513
+ return new DateExtractOperation(this.cwj(), "QUARTER" /* QUARTER */, "Quarter " + this.displayName());
514
+ }
515
+ /** Extract the ISO week number (1–53). */
516
+ week() {
517
+ return new DateExtractOperation(this.cwj(), "WEEK" /* WEEK */, "Week " + this.displayName());
518
+ }
519
+ /** Extract the day of the week (0 = Sunday through 6 = Saturday). */
520
+ dayOfWeek() {
521
+ return new DateExtractOperation(this.cwj(), "DOW" /* DOW */, "Day Of Week " + this.displayName());
522
+ }
523
+ /** The date of the first day of the week the date falls in (a Monday). */
524
+ firstDayOfWeek() {
525
+ return new DateTruncOperation(this.cwj(), "WEEK" /* WEEK */, "First Day Of Week " + this.displayName());
526
+ }
527
+ /** The date of the first day of the month the date falls in. */
528
+ firstDayOfMonth() {
529
+ return new DateTruncOperation(this.cwj(), "MONTH" /* MONTH */, "First Day Of Month " + this.displayName());
530
+ }
531
+ /** The date of the first day of the quarter the date falls in. */
532
+ firstDayOfQuarter() {
533
+ return new DateTruncOperation(this.cwj(), "QUARTER" /* QUARTER */, "First Day Of Quarter " + this.displayName());
534
+ }
535
+ /** The date of the first day of the year the date falls in. */
536
+ firstDayOfYear() {
537
+ return new DateTruncOperation(this.cwj(), "YEAR" /* YEAR */, "First Day Of Year " + this.displayName());
538
+ }
539
+ /** Add `n` days to this timestamp. */
540
+ addDays(n) {
541
+ return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, true, "Add Days " + this.displayName());
542
+ }
543
+ /** Add `n` months to this timestamp. */
544
+ addMonths(n) {
545
+ return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, true, "Add Months " + this.displayName());
546
+ }
547
+ /** Add `n` years to this timestamp. */
548
+ addYears(n) {
549
+ return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, true, "Add Years " + this.displayName());
550
+ }
551
+ /** Add `n` hours to this timestamp. */
552
+ addHours(n) {
553
+ return new DateArithmeticOperation(this.cwj(), n, "HOUR" /* HOUR */, true, "Add Hours " + this.displayName());
554
+ }
555
+ /** Add `n` minutes to this timestamp. */
556
+ addMinutes(n) {
557
+ return new DateArithmeticOperation(this.cwj(), n, "MINUTE" /* MINUTE */, true, "Add Minutes " + this.displayName());
558
+ }
559
+ /** Add `n` seconds to this timestamp. */
560
+ addSeconds(n) {
561
+ return new DateArithmeticOperation(this.cwj(), n, "SECOND" /* SECOND */, true, "Add Seconds " + this.displayName());
562
+ }
563
+ /** Subtract `n` days from this timestamp. */
564
+ subtractDays(n) {
565
+ return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, false, "Subtract Days " + this.displayName());
566
+ }
567
+ /** Subtract `n` months from this timestamp. */
568
+ subtractMonths(n) {
569
+ return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, false, "Subtract Months " + this.displayName());
570
+ }
571
+ /** Subtract `n` years from this timestamp. */
572
+ subtractYears(n) {
573
+ return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, false, "Subtract Years " + this.displayName());
574
+ }
575
+ /** Subtract `n` hours from this timestamp. */
576
+ subtractHours(n) {
577
+ return new DateArithmeticOperation(this.cwj(), n, "HOUR" /* HOUR */, false, "Subtract Hours " + this.displayName());
578
+ }
579
+ /** Subtract `n` minutes from this timestamp. */
580
+ subtractMinutes(n) {
581
+ return new DateArithmeticOperation(this.cwj(), n, "MINUTE" /* MINUTE */, false, "Subtract Minutes " + this.displayName());
582
+ }
583
+ /** Subtract `n` seconds from this timestamp. */
584
+ subtractSeconds(n) {
585
+ return new DateArithmeticOperation(this.cwj(), n, "SECOND" /* SECOND */, false, "Subtract Seconds " + this.displayName());
586
+ }
587
+ /** Number of whole days between this timestamp and `other`. */
588
+ diffDays(other) {
589
+ return new DateDiffOperation(this.cwj(), other, "DAY" /* DAY */, "Diff Days " + this.displayName());
590
+ }
591
+ /** Number of whole months between this timestamp and `other`. */
592
+ diffMonths(other) {
593
+ return new DateDiffOperation(this.cwj(), other, "MONTH" /* MONTH */, "Diff Months " + this.displayName());
594
+ }
595
+ /** Number of whole years between this timestamp and `other`. */
596
+ diffYears(other) {
597
+ return new DateDiffOperation(this.cwj(), other, "YEAR" /* YEAR */, "Diff Years " + this.displayName());
598
+ }
599
+ /** Number of whole hours between this timestamp and `other`. */
600
+ diffHours(other) {
601
+ return new DateDiffOperation(this.cwj(), other, "HOUR" /* HOUR */, "Diff Hours " + this.displayName());
602
+ }
603
+ /** Number of whole minutes between this timestamp and `other`. */
604
+ diffMinutes(other) {
605
+ return new DateDiffOperation(this.cwj(), other, "MINUTE" /* MINUTE */, "Diff Minutes " + this.displayName());
606
+ }
607
+ /** Number of whole seconds between this timestamp and `other`. */
608
+ diffSeconds(other) {
609
+ return new DateDiffOperation(this.cwj(), other, "SECOND" /* SECOND */, "Diff Seconds " + this.displayName());
610
+ }
611
+ };
612
+ applyMixins(DateAttribute, [MinMax]);
613
+ applyMixins(DateTimeAttribute, [MinMax]);
614
+
615
+ export {
616
+ StringFunctionOperation,
617
+ NumericFunctionOperation,
618
+ StringAttribute,
619
+ NumericAttribute,
620
+ DoubleAttribute,
621
+ FloatAttribute,
622
+ DecimalAttribute,
623
+ IntegerAttribute,
624
+ BooleanAttribute,
625
+ DateAttribute,
626
+ DateTimeAttribute
627
+ };
628
+ //# sourceMappingURL=chunk-MGEL5RWM.js.map