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
|
@@ -238,13 +238,19 @@ var Column = class extends RelationalOperationElement {
|
|
|
238
238
|
table;
|
|
239
239
|
};
|
|
240
240
|
var ColumnWithJoin = class extends RelationalOperationElement {
|
|
241
|
-
|
|
241
|
+
/**
|
|
242
|
+
* `embedded` is an alternate reference to a flat (denormalized) column on the owning table that
|
|
243
|
+
* holds the same value without the join; the SQL generator uses it when the join can be elided.
|
|
244
|
+
*/
|
|
245
|
+
constructor(column, parent, embedded) {
|
|
242
246
|
super();
|
|
243
247
|
this.column = column;
|
|
244
248
|
this.parent = parent;
|
|
249
|
+
this.embedded = embedded;
|
|
245
250
|
}
|
|
246
251
|
column;
|
|
247
252
|
parent;
|
|
253
|
+
embedded;
|
|
248
254
|
};
|
|
249
255
|
var SortOperation = class {
|
|
250
256
|
constructor(column, direction) {
|
|
@@ -256,16 +262,18 @@ var SortOperation = class {
|
|
|
256
262
|
};
|
|
257
263
|
|
|
258
264
|
// src/datafinder/attribute.ts
|
|
259
|
-
var Attribute = class {
|
|
265
|
+
var Attribute = class _Attribute {
|
|
260
266
|
_displayName;
|
|
261
267
|
_column;
|
|
262
268
|
_owner;
|
|
263
269
|
_parent;
|
|
264
|
-
|
|
270
|
+
_embedded;
|
|
271
|
+
constructor(displayName, columnName, columnDbType, owner, parent, embedded) {
|
|
265
272
|
this._displayName = displayName;
|
|
266
273
|
this._column = new Column(columnName, columnDbType, owner);
|
|
267
274
|
this._owner = owner;
|
|
268
275
|
this._parent = parent;
|
|
276
|
+
this._embedded = embedded;
|
|
269
277
|
}
|
|
270
278
|
column() {
|
|
271
279
|
return this._column;
|
|
@@ -279,33 +287,58 @@ var Attribute = class {
|
|
|
279
287
|
displayName() {
|
|
280
288
|
return this._displayName;
|
|
281
289
|
}
|
|
290
|
+
/** Alternate attribute on a flat column of the owning table, used in place of this one when its join is elided. */
|
|
291
|
+
embedded() {
|
|
292
|
+
return this._embedded;
|
|
293
|
+
}
|
|
282
294
|
cwj() {
|
|
283
|
-
return new ColumnWithJoin(this._column, this._parent);
|
|
295
|
+
return new ColumnWithJoin(this._column, this._parent, this._embedded?.cwj());
|
|
284
296
|
}
|
|
297
|
+
/** Count the number of non-null values. Use in a projection with `groupByOp` to aggregate per group. */
|
|
285
298
|
count() {
|
|
286
299
|
return new AggregateOperation(
|
|
287
|
-
|
|
300
|
+
this.cwj(),
|
|
288
301
|
"COUNT" /* COUNT */,
|
|
289
302
|
this._displayName + " Count"
|
|
290
303
|
);
|
|
291
304
|
}
|
|
305
|
+
/** Sort this attribute in ascending order. Pass to `orderByOp` or a window function's `orderBy`. */
|
|
292
306
|
ascending() {
|
|
293
|
-
return new SortOperation(
|
|
307
|
+
return new SortOperation(this.cwj(), "ASC" /* ASC */);
|
|
294
308
|
}
|
|
309
|
+
/** Sort this attribute in descending order. Pass to `orderByOp` or a window function's `orderBy`. */
|
|
295
310
|
descending() {
|
|
296
|
-
return new SortOperation(
|
|
311
|
+
return new SortOperation(this.cwj(), "DESC" /* DESC */);
|
|
297
312
|
}
|
|
313
|
+
/** Filter to rows where this attribute has no value. */
|
|
298
314
|
isNull() {
|
|
299
|
-
return new IsNullOperation(
|
|
315
|
+
return new IsNullOperation(this.cwj());
|
|
300
316
|
}
|
|
317
|
+
/** Filter to rows where this attribute has a value. */
|
|
301
318
|
isNotNull() {
|
|
302
|
-
return new IsNotNullOperation(
|
|
319
|
+
return new IsNotNullOperation(this.cwj());
|
|
303
320
|
}
|
|
304
321
|
_windowSpec(partitionBy, orderBy) {
|
|
305
|
-
const
|
|
322
|
+
const pbArr = partitionBy === void 0 ? [] : Array.isArray(partitionBy) ? partitionBy : [partitionBy];
|
|
323
|
+
const pb = pbArr.map((x) => x instanceof _Attribute ? x.cwj() : x);
|
|
306
324
|
const ob = orderBy === void 0 ? [] : Array.isArray(orderBy) ? orderBy : [orderBy];
|
|
307
325
|
return new WindowSpecification(pb, ob);
|
|
308
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Assign a rank to each row within the ordered window, following pandas `Series.rank` conventions.
|
|
329
|
+
*
|
|
330
|
+
* `method` controls tie-breaking (default `'min'`):
|
|
331
|
+
* - `'min'` — tied rows share the lowest rank; the next rank skips.
|
|
332
|
+
* - `'dense'` — like `'min'` but ranks are contiguous (no gaps).
|
|
333
|
+
* - `'first'` — each row gets a unique sequential integer (no ties).
|
|
334
|
+
* - `'max'` — only meaningful with `pct: true` (see below).
|
|
335
|
+
*
|
|
336
|
+
* When `pct: true` the result is a relative rank between 0 and 1:
|
|
337
|
+
* - `method: 'min'` (default) → fraction of values strictly below this row (PERCENT_RANK).
|
|
338
|
+
* - `method: 'max'` → fraction of values at or below this row (cumulative distribution).
|
|
339
|
+
*
|
|
340
|
+
* `partitionBy` restarts the ranking within each group of distinct values.
|
|
341
|
+
*/
|
|
309
342
|
rank(opts = {}) {
|
|
310
343
|
const { method = "min", pct = false, partitionBy, orderBy } = opts;
|
|
311
344
|
let func;
|
|
@@ -330,6 +363,11 @@ var Attribute = class {
|
|
|
330
363
|
}
|
|
331
364
|
return new WindowFunctionOperation(null, func, name, void 0, [], this._windowSpec(partitionBy, orderBy));
|
|
332
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Split rows into `buckets` equal-sized quantile bins ordered by `orderBy`.
|
|
368
|
+
* Each row receives a bucket number from 1 (lowest) to `buckets` (highest).
|
|
369
|
+
* Named after `pandas.qcut`.
|
|
370
|
+
*/
|
|
333
371
|
qcut(buckets, opts = {}) {
|
|
334
372
|
return new WindowFunctionOperation(
|
|
335
373
|
null,
|
|
@@ -340,12 +378,17 @@ var Attribute = class {
|
|
|
340
378
|
this._windowSpec(opts.partitionBy, opts.orderBy)
|
|
341
379
|
);
|
|
342
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* Return the value of this attribute from `periods` rows earlier (positive) or later (negative)
|
|
383
|
+
* within the ordered window, following `pandas.Series.shift`.
|
|
384
|
+
* Rows with no neighbour at the given offset return `null` (or `fillValue` if provided).
|
|
385
|
+
*/
|
|
343
386
|
shift(periods = 1, opts = {}) {
|
|
344
387
|
const extraArgs = opts.fillValue !== void 0 ? [opts.fillValue] : [];
|
|
345
388
|
const func = periods >= 0 ? "LAG" /* LAG */ : "LEAD" /* LEAD */;
|
|
346
389
|
const label = periods >= 0 ? "Lag" : "Lead";
|
|
347
390
|
return new WindowFunctionOperation(
|
|
348
|
-
|
|
391
|
+
this.cwj(),
|
|
349
392
|
func,
|
|
350
393
|
label + " " + this._displayName,
|
|
351
394
|
Math.abs(periods),
|
|
@@ -353,9 +396,13 @@ var Attribute = class {
|
|
|
353
396
|
this._windowSpec(opts.partitionBy, opts.orderBy)
|
|
354
397
|
);
|
|
355
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* Return the first value of this attribute in the window frame.
|
|
401
|
+
* Use `partitionBy` to restart the frame for each group.
|
|
402
|
+
*/
|
|
356
403
|
first(opts = {}) {
|
|
357
404
|
return new WindowFunctionOperation(
|
|
358
|
-
|
|
405
|
+
this.cwj(),
|
|
359
406
|
"FIRST_VALUE" /* FIRST_VALUE */,
|
|
360
407
|
"First " + this._displayName,
|
|
361
408
|
void 0,
|
|
@@ -363,9 +410,13 @@ var Attribute = class {
|
|
|
363
410
|
this._windowSpec(opts.partitionBy, opts.orderBy)
|
|
364
411
|
);
|
|
365
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* Return the last value of this attribute in the window frame.
|
|
415
|
+
* Use `partitionBy` to restart the frame for each group.
|
|
416
|
+
*/
|
|
366
417
|
last(opts = {}) {
|
|
367
418
|
return new WindowFunctionOperation(
|
|
368
|
-
|
|
419
|
+
this.cwj(),
|
|
369
420
|
"LAST_VALUE" /* LAST_VALUE */,
|
|
370
421
|
"Last " + this._displayName,
|
|
371
422
|
void 0,
|
|
@@ -377,183 +428,236 @@ var Attribute = class {
|
|
|
377
428
|
|
|
378
429
|
// src/datafinder/typed-attributes.ts
|
|
379
430
|
var StringAttribute = class extends Attribute {
|
|
380
|
-
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
381
|
-
super(displayName, columnName, columnDbType, owner, parent);
|
|
431
|
+
constructor(displayName, columnName, columnDbType, owner, parent, embedded) {
|
|
432
|
+
super(displayName, columnName, columnDbType, owner, parent, embedded);
|
|
382
433
|
}
|
|
383
|
-
|
|
434
|
+
/** Convert every character to uppercase. */
|
|
435
|
+
toUpperCase() {
|
|
384
436
|
return new ScalarFunctionOperation(this.cwj(), "UPPER" /* UPPER */, "Upper " + this.displayName());
|
|
385
437
|
}
|
|
386
|
-
|
|
438
|
+
/** Convert every character to lowercase. */
|
|
439
|
+
toLowerCase() {
|
|
387
440
|
return new ScalarFunctionOperation(this.cwj(), "LOWER" /* LOWER */, "Lower " + this.displayName());
|
|
388
441
|
}
|
|
389
|
-
|
|
390
|
-
|
|
442
|
+
/** Remove leading and trailing whitespace. */
|
|
443
|
+
trim() {
|
|
444
|
+
return new ScalarFunctionOperation(this.cwj(), "TRIM" /* TRIM */, "Trim " + this.displayName());
|
|
391
445
|
}
|
|
392
|
-
|
|
393
|
-
|
|
446
|
+
/** Remove leading whitespace. */
|
|
447
|
+
trimStart() {
|
|
448
|
+
return new ScalarFunctionOperation(this.cwj(), "LTRIM" /* LTRIM */, "Trim Start " + this.displayName());
|
|
394
449
|
}
|
|
395
|
-
|
|
396
|
-
|
|
450
|
+
/** Remove trailing whitespace. */
|
|
451
|
+
trimEnd() {
|
|
452
|
+
return new ScalarFunctionOperation(this.cwj(), "RTRIM" /* RTRIM */, "Trim End " + this.displayName());
|
|
397
453
|
}
|
|
454
|
+
/** Return the number of characters in the string. */
|
|
398
455
|
length() {
|
|
399
456
|
return new ScalarFunctionOperation(this.cwj(), "LENGTH" /* LENGTH */, "Length " + this.displayName());
|
|
400
457
|
}
|
|
458
|
+
/** Return the string with characters in reverse order. */
|
|
401
459
|
reverse() {
|
|
402
460
|
return new ScalarFunctionOperation(this.cwj(), "REVERSE" /* REVERSE */, "Reverse " + this.displayName());
|
|
403
461
|
}
|
|
462
|
+
/** Return the first `n` characters. */
|
|
404
463
|
left(n) {
|
|
405
464
|
return new ScalarFunctionOperation(this.cwj(), "LEFT" /* LEFT */, "Left " + this.displayName(), n);
|
|
406
465
|
}
|
|
466
|
+
/** Return the last `n` characters. */
|
|
407
467
|
right(n) {
|
|
408
468
|
return new ScalarFunctionOperation(this.cwj(), "RIGHT" /* RIGHT */, "Right " + this.displayName(), n);
|
|
409
469
|
}
|
|
470
|
+
/** Return the string repeated `n` times. */
|
|
410
471
|
repeat(n) {
|
|
411
472
|
return new ScalarFunctionOperation(this.cwj(), "REPEAT" /* REPEAT */, "Repeat " + this.displayName(), n);
|
|
412
473
|
}
|
|
474
|
+
/** Replace all occurrences of `fromStr` with `toStr`. */
|
|
413
475
|
replace(fromStr, toStr) {
|
|
414
476
|
return new ScalarFunctionOperation(this.cwj(), "REPLACE" /* REPLACE */, "Replace " + this.displayName(), void 0, [fromStr, toStr]);
|
|
415
477
|
}
|
|
478
|
+
/**
|
|
479
|
+
* Extract a portion of the string.
|
|
480
|
+
* `start` is zero-based (following Python convention); `length` is optional.
|
|
481
|
+
*/
|
|
416
482
|
substring(start, length) {
|
|
417
483
|
const args = length !== void 0 ? [start + 1, length] : [start + 1];
|
|
418
484
|
return new ScalarFunctionOperation(this.cwj(), "SUBSTRING" /* SUBSTRING */, "Substring " + this.displayName(), void 0, args);
|
|
419
485
|
}
|
|
486
|
+
/** Filter to rows where this attribute equals `value`. */
|
|
420
487
|
eq(value) {
|
|
421
488
|
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new StringConstantOperation(value));
|
|
422
489
|
}
|
|
490
|
+
/** Filter to rows where this attribute does not equal `value`. */
|
|
423
491
|
ne(value) {
|
|
424
492
|
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new StringConstantOperation(value));
|
|
425
493
|
}
|
|
494
|
+
/** Filter to rows where this attribute contains `value` as a substring. */
|
|
426
495
|
contains(value) {
|
|
427
496
|
return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`%${value}%`));
|
|
428
497
|
}
|
|
498
|
+
/** Filter to rows where this attribute begins with `prefix`. */
|
|
429
499
|
startsWith(prefix) {
|
|
430
500
|
return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`${prefix}%`));
|
|
431
501
|
}
|
|
502
|
+
/** Filter to rows where this attribute ends with `suffix`. */
|
|
432
503
|
endsWith(suffix) {
|
|
433
504
|
return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`%${suffix}`));
|
|
434
505
|
}
|
|
506
|
+
/** Filter to rows where this attribute does not contain `value` as a substring. */
|
|
435
507
|
notContains(value) {
|
|
436
508
|
return new ComparisonOperation(this.cwj(), "NOT_LIKE" /* NOT_LIKE */, new StringConstantOperation(`%${value}%`));
|
|
437
509
|
}
|
|
438
510
|
};
|
|
439
511
|
var NumericAttribute = class extends Attribute {
|
|
440
|
-
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
441
|
-
super(displayName, columnName, columnDbType, owner, parent);
|
|
512
|
+
constructor(displayName, columnName, columnDbType, owner, parent, embedded) {
|
|
513
|
+
super(displayName, columnName, columnDbType, owner, parent, embedded);
|
|
442
514
|
}
|
|
515
|
+
/** Sum of all values in the group. */
|
|
443
516
|
sum() {
|
|
444
|
-
return new AggregateOperation(this.cwj(), "SUM" /* SUM */, this.displayName()
|
|
517
|
+
return new AggregateOperation(this.cwj(), "SUM" /* SUM */, "Sum " + this.displayName());
|
|
445
518
|
}
|
|
519
|
+
/** Smallest value in the group. */
|
|
446
520
|
min() {
|
|
447
|
-
return new AggregateOperation(this.cwj(), "MIN" /* MIN */, this.displayName()
|
|
521
|
+
return new AggregateOperation(this.cwj(), "MIN" /* MIN */, "Min " + this.displayName());
|
|
448
522
|
}
|
|
523
|
+
/** Largest value in the group. */
|
|
449
524
|
max() {
|
|
450
|
-
return new AggregateOperation(this.cwj(), "MAX" /* MAX */, this.displayName()
|
|
525
|
+
return new AggregateOperation(this.cwj(), "MAX" /* MAX */, "Max " + this.displayName());
|
|
451
526
|
}
|
|
527
|
+
/** Arithmetic mean of all values in the group. */
|
|
452
528
|
average() {
|
|
453
|
-
return new AggregateOperation(this.cwj(), "AVERAGE" /* AVERAGE */, this.displayName()
|
|
529
|
+
return new AggregateOperation(this.cwj(), "AVERAGE" /* AVERAGE */, "Average " + this.displayName());
|
|
454
530
|
}
|
|
531
|
+
/** Absolute value (distance from zero, always non-negative). */
|
|
455
532
|
abs() {
|
|
456
533
|
return new ScalarFunctionOperation(this.cwj(), "ABS" /* ABS */, "Abs " + this.displayName());
|
|
457
534
|
}
|
|
535
|
+
/** Round up to the nearest integer. */
|
|
458
536
|
ceil() {
|
|
459
537
|
return new ScalarFunctionOperation(this.cwj(), "CEILING" /* CEILING */, "Ceil " + this.displayName());
|
|
460
538
|
}
|
|
539
|
+
/** Round down to the nearest integer. */
|
|
461
540
|
floor() {
|
|
462
541
|
return new ScalarFunctionOperation(this.cwj(), "FLOOR" /* FLOOR */, "Floor " + this.displayName());
|
|
463
542
|
}
|
|
543
|
+
/** Square root. */
|
|
464
544
|
sqrt() {
|
|
465
545
|
return new ScalarFunctionOperation(this.cwj(), "SQRT" /* SQRT */, "Sqrt " + this.displayName());
|
|
466
546
|
}
|
|
547
|
+
/** Remainder after dividing by `n`. */
|
|
467
548
|
mod(n) {
|
|
468
549
|
return new ScalarFunctionOperation(this.cwj(), "MOD" /* MOD */, "Mod " + this.displayName(), n);
|
|
469
550
|
}
|
|
551
|
+
/** Raise to the power of `n`. */
|
|
470
552
|
power(n) {
|
|
471
553
|
return new ScalarFunctionOperation(this.cwj(), "POWER" /* POWER */, "Power " + this.displayName(), n);
|
|
472
554
|
}
|
|
555
|
+
/** Round to `d` decimal places, or to the nearest integer when `d` is omitted. */
|
|
473
556
|
round(d) {
|
|
474
557
|
return new ScalarFunctionOperation(this.cwj(), "ROUND" /* ROUND */, "Round " + this.displayName(), d);
|
|
475
558
|
}
|
|
476
559
|
};
|
|
477
560
|
var DoubleAttribute = class extends NumericAttribute {
|
|
478
|
-
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
479
|
-
super(displayName, columnName, columnDbType, owner, parent);
|
|
561
|
+
constructor(displayName, columnName, columnDbType, owner, parent, embedded) {
|
|
562
|
+
super(displayName, columnName, columnDbType, owner, parent, embedded);
|
|
480
563
|
}
|
|
564
|
+
/** Filter to rows where this attribute equals `value`. */
|
|
481
565
|
eq(value) {
|
|
482
566
|
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new FloatConstantOperation(value));
|
|
483
567
|
}
|
|
568
|
+
/** Filter to rows where this attribute does not equal `value`. */
|
|
484
569
|
ne(value) {
|
|
485
570
|
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new FloatConstantOperation(value));
|
|
486
571
|
}
|
|
572
|
+
/** Filter to rows where this attribute is greater than `value`. */
|
|
487
573
|
gt(value) {
|
|
488
574
|
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new FloatConstantOperation(value));
|
|
489
575
|
}
|
|
576
|
+
/** Filter to rows where this attribute is less than `value`. */
|
|
490
577
|
lt(value) {
|
|
491
578
|
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new FloatConstantOperation(value));
|
|
492
579
|
}
|
|
580
|
+
/** Filter to rows where this attribute is greater than or equal to `value`. */
|
|
493
581
|
gte(value) {
|
|
494
582
|
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new FloatConstantOperation(value));
|
|
495
583
|
}
|
|
584
|
+
/** Filter to rows where this attribute is less than or equal to `value`. */
|
|
496
585
|
lte(value) {
|
|
497
586
|
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new FloatConstantOperation(value));
|
|
498
587
|
}
|
|
499
588
|
};
|
|
500
589
|
var FloatAttribute = DoubleAttribute;
|
|
501
590
|
var DecimalAttribute = class extends NumericAttribute {
|
|
502
|
-
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
503
|
-
super(displayName, columnName, columnDbType, owner, parent);
|
|
591
|
+
constructor(displayName, columnName, columnDbType, owner, parent, embedded) {
|
|
592
|
+
super(displayName, columnName, columnDbType, owner, parent, embedded);
|
|
504
593
|
}
|
|
594
|
+
/** Filter to rows where this attribute equals `value`. */
|
|
505
595
|
eq(value) {
|
|
506
596
|
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DecimalConstantOperation(value));
|
|
507
597
|
}
|
|
598
|
+
/** Filter to rows where this attribute does not equal `value`. */
|
|
508
599
|
ne(value) {
|
|
509
600
|
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DecimalConstantOperation(value));
|
|
510
601
|
}
|
|
602
|
+
/** Filter to rows where this attribute is greater than `value`. */
|
|
511
603
|
gt(value) {
|
|
512
604
|
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DecimalConstantOperation(value));
|
|
513
605
|
}
|
|
606
|
+
/** Filter to rows where this attribute is less than `value`. */
|
|
514
607
|
lt(value) {
|
|
515
608
|
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DecimalConstantOperation(value));
|
|
516
609
|
}
|
|
610
|
+
/** Filter to rows where this attribute is greater than or equal to `value`. */
|
|
517
611
|
gte(value) {
|
|
518
612
|
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DecimalConstantOperation(value));
|
|
519
613
|
}
|
|
614
|
+
/** Filter to rows where this attribute is less than or equal to `value`. */
|
|
520
615
|
lte(value) {
|
|
521
616
|
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DecimalConstantOperation(value));
|
|
522
617
|
}
|
|
523
618
|
};
|
|
524
619
|
var IntegerAttribute = class extends NumericAttribute {
|
|
525
|
-
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
526
|
-
super(displayName, columnName, columnDbType, owner, parent);
|
|
620
|
+
constructor(displayName, columnName, columnDbType, owner, parent, embedded) {
|
|
621
|
+
super(displayName, columnName, columnDbType, owner, parent, embedded);
|
|
527
622
|
}
|
|
623
|
+
/** Filter to rows where this attribute equals `value`. */
|
|
528
624
|
eq(value) {
|
|
529
625
|
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new IntegerConstantOperation(value));
|
|
530
626
|
}
|
|
627
|
+
/** Filter to rows where this attribute does not equal `value`. */
|
|
531
628
|
ne(value) {
|
|
532
629
|
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new IntegerConstantOperation(value));
|
|
533
630
|
}
|
|
631
|
+
/** Filter to rows where this attribute is greater than `value`. */
|
|
534
632
|
gt(value) {
|
|
535
633
|
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new IntegerConstantOperation(value));
|
|
536
634
|
}
|
|
635
|
+
/** Filter to rows where this attribute is less than `value`. */
|
|
537
636
|
lt(value) {
|
|
538
637
|
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new IntegerConstantOperation(value));
|
|
539
638
|
}
|
|
639
|
+
/** Filter to rows where this attribute is greater than or equal to `value`. */
|
|
540
640
|
gte(value) {
|
|
541
641
|
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new IntegerConstantOperation(value));
|
|
542
642
|
}
|
|
643
|
+
/** Filter to rows where this attribute is less than or equal to `value`. */
|
|
543
644
|
lte(value) {
|
|
544
645
|
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new IntegerConstantOperation(value));
|
|
545
646
|
}
|
|
546
647
|
};
|
|
547
648
|
var BooleanAttribute = class extends Attribute {
|
|
548
|
-
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
549
|
-
super(displayName, columnName, columnDbType, owner, parent);
|
|
649
|
+
constructor(displayName, columnName, columnDbType, owner, parent, embedded) {
|
|
650
|
+
super(displayName, columnName, columnDbType, owner, parent, embedded);
|
|
550
651
|
}
|
|
652
|
+
/** Filter to rows where this attribute equals `value`. */
|
|
551
653
|
eq(value) {
|
|
552
654
|
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(value));
|
|
553
655
|
}
|
|
656
|
+
/** Filter to rows where this attribute is true. */
|
|
554
657
|
isTrue() {
|
|
555
658
|
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(true));
|
|
556
659
|
}
|
|
660
|
+
/** Filter to rows where this attribute is false. */
|
|
557
661
|
isFalse() {
|
|
558
662
|
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(false));
|
|
559
663
|
}
|
|
@@ -565,173 +669,227 @@ function parseDate(value) {
|
|
|
565
669
|
return d;
|
|
566
670
|
}
|
|
567
671
|
var DateAttribute = class extends Attribute {
|
|
568
|
-
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
569
|
-
super(displayName, columnName, columnDbType, owner, parent);
|
|
672
|
+
constructor(displayName, columnName, columnDbType, owner, parent, embedded) {
|
|
673
|
+
super(displayName, columnName, columnDbType, owner, parent, embedded);
|
|
570
674
|
}
|
|
675
|
+
/** Filter to rows where this date equals `value`. */
|
|
571
676
|
eq(value) {
|
|
572
677
|
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DateConstantOperation(parseDate(value)));
|
|
573
678
|
}
|
|
679
|
+
/** Filter to rows where this date does not equal `value`. */
|
|
574
680
|
ne(value) {
|
|
575
681
|
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DateConstantOperation(parseDate(value)));
|
|
576
682
|
}
|
|
683
|
+
/** Filter to rows where this date is after `value`. */
|
|
577
684
|
gt(value) {
|
|
578
685
|
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DateConstantOperation(parseDate(value)));
|
|
579
686
|
}
|
|
687
|
+
/** Filter to rows where this date is before `value`. */
|
|
580
688
|
lt(value) {
|
|
581
689
|
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DateConstantOperation(parseDate(value)));
|
|
582
690
|
}
|
|
691
|
+
/** Filter to rows where this date is on or after `value`. */
|
|
583
692
|
gte(value) {
|
|
584
693
|
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DateConstantOperation(parseDate(value)));
|
|
585
694
|
}
|
|
695
|
+
/** Filter to rows where this date is on or before `value`. */
|
|
586
696
|
lte(value) {
|
|
587
697
|
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DateConstantOperation(parseDate(value)));
|
|
588
698
|
}
|
|
699
|
+
/** Extract the four-digit calendar year. */
|
|
589
700
|
year() {
|
|
590
701
|
return new DateExtractOperation(this.cwj(), "YEAR" /* YEAR */, "Year " + this.displayName());
|
|
591
702
|
}
|
|
703
|
+
/** Extract the month number (1–12). */
|
|
592
704
|
month() {
|
|
593
705
|
return new DateExtractOperation(this.cwj(), "MONTH" /* MONTH */, "Month " + this.displayName());
|
|
594
706
|
}
|
|
707
|
+
/** Extract the day of the month (1–31). */
|
|
595
708
|
day() {
|
|
596
709
|
return new DateExtractOperation(this.cwj(), "DAY" /* DAY */, "Day " + this.displayName());
|
|
597
710
|
}
|
|
711
|
+
/** Extract the quarter (1–4). */
|
|
598
712
|
quarter() {
|
|
599
713
|
return new DateExtractOperation(this.cwj(), "QUARTER" /* QUARTER */, "Quarter " + this.displayName());
|
|
600
714
|
}
|
|
715
|
+
/** Extract the ISO week number (1–53). */
|
|
601
716
|
week() {
|
|
602
717
|
return new DateExtractOperation(this.cwj(), "WEEK" /* WEEK */, "Week " + this.displayName());
|
|
603
718
|
}
|
|
719
|
+
/** Extract the day of the week (0 = Sunday through 6 = Saturday). */
|
|
604
720
|
dayOfWeek() {
|
|
605
721
|
return new DateExtractOperation(this.cwj(), "DOW" /* DOW */, "Day Of Week " + this.displayName());
|
|
606
722
|
}
|
|
723
|
+
/** Add `n` days to this date. */
|
|
607
724
|
addDays(n) {
|
|
608
725
|
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, true, "Add Days " + this.displayName());
|
|
609
726
|
}
|
|
727
|
+
/** Add `n` months to this date. */
|
|
610
728
|
addMonths(n) {
|
|
611
729
|
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, true, "Add Months " + this.displayName());
|
|
612
730
|
}
|
|
731
|
+
/** Add `n` years to this date. */
|
|
613
732
|
addYears(n) {
|
|
614
733
|
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, true, "Add Years " + this.displayName());
|
|
615
734
|
}
|
|
735
|
+
/** Subtract `n` days from this date. */
|
|
616
736
|
subtractDays(n) {
|
|
617
737
|
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, false, "Subtract Days " + this.displayName());
|
|
618
738
|
}
|
|
739
|
+
/** Subtract `n` months from this date. */
|
|
619
740
|
subtractMonths(n) {
|
|
620
741
|
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, false, "Subtract Months " + this.displayName());
|
|
621
742
|
}
|
|
743
|
+
/** Subtract `n` years from this date. */
|
|
622
744
|
subtractYears(n) {
|
|
623
745
|
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, false, "Subtract Years " + this.displayName());
|
|
624
746
|
}
|
|
747
|
+
/** Number of whole days between this date and `other`. */
|
|
625
748
|
diffDays(other) {
|
|
626
749
|
return new DateDiffOperation(this.cwj(), other, "DAY" /* DAY */, "Diff Days " + this.displayName());
|
|
627
750
|
}
|
|
751
|
+
/** Number of whole months between this date and `other`. */
|
|
628
752
|
diffMonths(other) {
|
|
629
753
|
return new DateDiffOperation(this.cwj(), other, "MONTH" /* MONTH */, "Diff Months " + this.displayName());
|
|
630
754
|
}
|
|
755
|
+
/** Number of whole years between this date and `other`. */
|
|
631
756
|
diffYears(other) {
|
|
632
757
|
return new DateDiffOperation(this.cwj(), other, "YEAR" /* YEAR */, "Diff Years " + this.displayName());
|
|
633
758
|
}
|
|
634
759
|
};
|
|
635
760
|
var DateTimeAttribute = class extends Attribute {
|
|
636
|
-
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
637
|
-
super(displayName, columnName, columnDbType, owner, parent);
|
|
761
|
+
constructor(displayName, columnName, columnDbType, owner, parent, embedded) {
|
|
762
|
+
super(displayName, columnName, columnDbType, owner, parent, embedded);
|
|
638
763
|
}
|
|
764
|
+
/** Filter to rows where this timestamp equals `value`. */
|
|
639
765
|
eq(value) {
|
|
640
766
|
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DateTimeConstantOperation(parseDate(value)));
|
|
641
767
|
}
|
|
768
|
+
/** Filter to rows where this timestamp does not equal `value`. */
|
|
642
769
|
ne(value) {
|
|
643
770
|
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DateTimeConstantOperation(parseDate(value)));
|
|
644
771
|
}
|
|
772
|
+
/** Filter to rows where this timestamp is after `value`. */
|
|
645
773
|
gt(value) {
|
|
646
774
|
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DateTimeConstantOperation(parseDate(value)));
|
|
647
775
|
}
|
|
776
|
+
/** Filter to rows where this timestamp is before `value`. */
|
|
648
777
|
lt(value) {
|
|
649
778
|
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DateTimeConstantOperation(parseDate(value)));
|
|
650
779
|
}
|
|
780
|
+
/** Filter to rows where this timestamp is on or after `value`. */
|
|
651
781
|
gte(value) {
|
|
652
782
|
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DateTimeConstantOperation(parseDate(value)));
|
|
653
783
|
}
|
|
784
|
+
/** Filter to rows where this timestamp is on or before `value`. */
|
|
654
785
|
lte(value) {
|
|
655
786
|
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DateTimeConstantOperation(parseDate(value)));
|
|
656
787
|
}
|
|
788
|
+
/** Extract the four-digit calendar year. */
|
|
657
789
|
year() {
|
|
658
790
|
return new DateExtractOperation(this.cwj(), "YEAR" /* YEAR */, "Year " + this.displayName());
|
|
659
791
|
}
|
|
792
|
+
/** Extract the month number (1–12). */
|
|
660
793
|
month() {
|
|
661
794
|
return new DateExtractOperation(this.cwj(), "MONTH" /* MONTH */, "Month " + this.displayName());
|
|
662
795
|
}
|
|
796
|
+
/** Extract the day of the month (1–31). */
|
|
663
797
|
day() {
|
|
664
798
|
return new DateExtractOperation(this.cwj(), "DAY" /* DAY */, "Day " + this.displayName());
|
|
665
799
|
}
|
|
800
|
+
/** Extract the hour (0–23). */
|
|
666
801
|
hour() {
|
|
667
802
|
return new DateExtractOperation(this.cwj(), "HOUR" /* HOUR */, "Hour " + this.displayName());
|
|
668
803
|
}
|
|
804
|
+
/** Extract the minute (0–59). */
|
|
669
805
|
minute() {
|
|
670
806
|
return new DateExtractOperation(this.cwj(), "MINUTE" /* MINUTE */, "Minute " + this.displayName());
|
|
671
807
|
}
|
|
808
|
+
/** Extract the second (0–59). */
|
|
672
809
|
second() {
|
|
673
810
|
return new DateExtractOperation(this.cwj(), "SECOND" /* SECOND */, "Second " + this.displayName());
|
|
674
811
|
}
|
|
812
|
+
/** Extract the quarter (1–4). */
|
|
675
813
|
quarter() {
|
|
676
814
|
return new DateExtractOperation(this.cwj(), "QUARTER" /* QUARTER */, "Quarter " + this.displayName());
|
|
677
815
|
}
|
|
816
|
+
/** Extract the ISO week number (1–53). */
|
|
678
817
|
week() {
|
|
679
818
|
return new DateExtractOperation(this.cwj(), "WEEK" /* WEEK */, "Week " + this.displayName());
|
|
680
819
|
}
|
|
820
|
+
/** Extract the day of the week (0 = Sunday through 6 = Saturday). */
|
|
681
821
|
dayOfWeek() {
|
|
682
822
|
return new DateExtractOperation(this.cwj(), "DOW" /* DOW */, "Day Of Week " + this.displayName());
|
|
683
823
|
}
|
|
824
|
+
/** Add `n` days to this timestamp. */
|
|
684
825
|
addDays(n) {
|
|
685
826
|
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, true, "Add Days " + this.displayName());
|
|
686
827
|
}
|
|
828
|
+
/** Add `n` months to this timestamp. */
|
|
687
829
|
addMonths(n) {
|
|
688
830
|
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, true, "Add Months " + this.displayName());
|
|
689
831
|
}
|
|
832
|
+
/** Add `n` years to this timestamp. */
|
|
690
833
|
addYears(n) {
|
|
691
834
|
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, true, "Add Years " + this.displayName());
|
|
692
835
|
}
|
|
836
|
+
/** Add `n` hours to this timestamp. */
|
|
693
837
|
addHours(n) {
|
|
694
838
|
return new DateArithmeticOperation(this.cwj(), n, "HOUR" /* HOUR */, true, "Add Hours " + this.displayName());
|
|
695
839
|
}
|
|
840
|
+
/** Add `n` minutes to this timestamp. */
|
|
696
841
|
addMinutes(n) {
|
|
697
842
|
return new DateArithmeticOperation(this.cwj(), n, "MINUTE" /* MINUTE */, true, "Add Minutes " + this.displayName());
|
|
698
843
|
}
|
|
844
|
+
/** Add `n` seconds to this timestamp. */
|
|
699
845
|
addSeconds(n) {
|
|
700
846
|
return new DateArithmeticOperation(this.cwj(), n, "SECOND" /* SECOND */, true, "Add Seconds " + this.displayName());
|
|
701
847
|
}
|
|
848
|
+
/** Subtract `n` days from this timestamp. */
|
|
702
849
|
subtractDays(n) {
|
|
703
850
|
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, false, "Subtract Days " + this.displayName());
|
|
704
851
|
}
|
|
852
|
+
/** Subtract `n` months from this timestamp. */
|
|
705
853
|
subtractMonths(n) {
|
|
706
854
|
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, false, "Subtract Months " + this.displayName());
|
|
707
855
|
}
|
|
856
|
+
/** Subtract `n` years from this timestamp. */
|
|
708
857
|
subtractYears(n) {
|
|
709
858
|
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, false, "Subtract Years " + this.displayName());
|
|
710
859
|
}
|
|
860
|
+
/** Subtract `n` hours from this timestamp. */
|
|
711
861
|
subtractHours(n) {
|
|
712
862
|
return new DateArithmeticOperation(this.cwj(), n, "HOUR" /* HOUR */, false, "Subtract Hours " + this.displayName());
|
|
713
863
|
}
|
|
864
|
+
/** Subtract `n` minutes from this timestamp. */
|
|
714
865
|
subtractMinutes(n) {
|
|
715
866
|
return new DateArithmeticOperation(this.cwj(), n, "MINUTE" /* MINUTE */, false, "Subtract Minutes " + this.displayName());
|
|
716
867
|
}
|
|
868
|
+
/** Subtract `n` seconds from this timestamp. */
|
|
717
869
|
subtractSeconds(n) {
|
|
718
870
|
return new DateArithmeticOperation(this.cwj(), n, "SECOND" /* SECOND */, false, "Subtract Seconds " + this.displayName());
|
|
719
871
|
}
|
|
872
|
+
/** Number of whole days between this timestamp and `other`. */
|
|
720
873
|
diffDays(other) {
|
|
721
874
|
return new DateDiffOperation(this.cwj(), other, "DAY" /* DAY */, "Diff Days " + this.displayName());
|
|
722
875
|
}
|
|
876
|
+
/** Number of whole months between this timestamp and `other`. */
|
|
723
877
|
diffMonths(other) {
|
|
724
878
|
return new DateDiffOperation(this.cwj(), other, "MONTH" /* MONTH */, "Diff Months " + this.displayName());
|
|
725
879
|
}
|
|
880
|
+
/** Number of whole years between this timestamp and `other`. */
|
|
726
881
|
diffYears(other) {
|
|
727
882
|
return new DateDiffOperation(this.cwj(), other, "YEAR" /* YEAR */, "Diff Years " + this.displayName());
|
|
728
883
|
}
|
|
884
|
+
/** Number of whole hours between this timestamp and `other`. */
|
|
729
885
|
diffHours(other) {
|
|
730
886
|
return new DateDiffOperation(this.cwj(), other, "HOUR" /* HOUR */, "Diff Hours " + this.displayName());
|
|
731
887
|
}
|
|
888
|
+
/** Number of whole minutes between this timestamp and `other`. */
|
|
732
889
|
diffMinutes(other) {
|
|
733
890
|
return new DateDiffOperation(this.cwj(), other, "MINUTE" /* MINUTE */, "Diff Minutes " + this.displayName());
|
|
734
891
|
}
|
|
892
|
+
/** Number of whole seconds between this timestamp and `other`. */
|
|
735
893
|
diffSeconds(other) {
|
|
736
894
|
return new DateDiffOperation(this.cwj(), other, "SECOND" /* SECOND */, "Diff Seconds " + this.displayName());
|
|
737
895
|
}
|