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,751 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/datafinder/typed-attributes.ts
|
|
21
|
+
var typed_attributes_exports = {};
|
|
22
|
+
__export(typed_attributes_exports, {
|
|
23
|
+
BooleanAttribute: () => BooleanAttribute,
|
|
24
|
+
DateAttribute: () => DateAttribute,
|
|
25
|
+
DateTimeAttribute: () => DateTimeAttribute,
|
|
26
|
+
DecimalAttribute: () => DecimalAttribute,
|
|
27
|
+
DoubleAttribute: () => DoubleAttribute,
|
|
28
|
+
FloatAttribute: () => FloatAttribute,
|
|
29
|
+
IntegerAttribute: () => IntegerAttribute,
|
|
30
|
+
NumericAttribute: () => NumericAttribute,
|
|
31
|
+
StringAttribute: () => StringAttribute
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(typed_attributes_exports);
|
|
34
|
+
|
|
35
|
+
// src/model/relational.ts
|
|
36
|
+
var RelationalOperationElement = class {
|
|
37
|
+
};
|
|
38
|
+
var Operation = class extends RelationalOperationElement {
|
|
39
|
+
andOp(other) {
|
|
40
|
+
return new LogicalOperation(this, "AND" /* AND */, other);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var ConstantOperation = class extends RelationalOperationElement {
|
|
44
|
+
};
|
|
45
|
+
var IntegerConstantOperation = class extends ConstantOperation {
|
|
46
|
+
constructor(value) {
|
|
47
|
+
super();
|
|
48
|
+
this.value = value;
|
|
49
|
+
}
|
|
50
|
+
value;
|
|
51
|
+
};
|
|
52
|
+
var FloatConstantOperation = class extends ConstantOperation {
|
|
53
|
+
constructor(value) {
|
|
54
|
+
super();
|
|
55
|
+
this.value = value;
|
|
56
|
+
}
|
|
57
|
+
value;
|
|
58
|
+
};
|
|
59
|
+
var StringConstantOperation = class extends ConstantOperation {
|
|
60
|
+
constructor(value) {
|
|
61
|
+
super();
|
|
62
|
+
this.value = value;
|
|
63
|
+
}
|
|
64
|
+
value;
|
|
65
|
+
};
|
|
66
|
+
var DateConstantOperation = class extends ConstantOperation {
|
|
67
|
+
constructor(value) {
|
|
68
|
+
super();
|
|
69
|
+
this.value = value;
|
|
70
|
+
}
|
|
71
|
+
value;
|
|
72
|
+
};
|
|
73
|
+
var DateTimeConstantOperation = class extends ConstantOperation {
|
|
74
|
+
constructor(value) {
|
|
75
|
+
super();
|
|
76
|
+
this.value = value;
|
|
77
|
+
}
|
|
78
|
+
value;
|
|
79
|
+
};
|
|
80
|
+
var DecimalConstantOperation = class extends ConstantOperation {
|
|
81
|
+
constructor(value) {
|
|
82
|
+
super();
|
|
83
|
+
this.value = value;
|
|
84
|
+
}
|
|
85
|
+
value;
|
|
86
|
+
};
|
|
87
|
+
var BooleanConstantOperation = class extends ConstantOperation {
|
|
88
|
+
constructor(value) {
|
|
89
|
+
super();
|
|
90
|
+
this.value = value;
|
|
91
|
+
}
|
|
92
|
+
value;
|
|
93
|
+
};
|
|
94
|
+
var UnaryOperation = class extends Operation {
|
|
95
|
+
constructor(element) {
|
|
96
|
+
super();
|
|
97
|
+
this.element = element;
|
|
98
|
+
}
|
|
99
|
+
element;
|
|
100
|
+
};
|
|
101
|
+
var BinaryOperation = class extends Operation {
|
|
102
|
+
constructor(left, right) {
|
|
103
|
+
super();
|
|
104
|
+
this.left = left;
|
|
105
|
+
this.right = right;
|
|
106
|
+
}
|
|
107
|
+
left;
|
|
108
|
+
right;
|
|
109
|
+
};
|
|
110
|
+
var IsNullOperation = class extends UnaryOperation {
|
|
111
|
+
};
|
|
112
|
+
var IsNotNullOperation = class extends UnaryOperation {
|
|
113
|
+
};
|
|
114
|
+
var ComparisonOperation = class extends BinaryOperation {
|
|
115
|
+
constructor(left, operator, right) {
|
|
116
|
+
super(left, right);
|
|
117
|
+
this.operator = operator;
|
|
118
|
+
}
|
|
119
|
+
operator;
|
|
120
|
+
};
|
|
121
|
+
var LogicalOperation = class extends BinaryOperation {
|
|
122
|
+
constructor(left, operator, right) {
|
|
123
|
+
super(left, right);
|
|
124
|
+
this.operator = operator;
|
|
125
|
+
}
|
|
126
|
+
operator;
|
|
127
|
+
};
|
|
128
|
+
var WindowSpecification = class {
|
|
129
|
+
constructor(partitionBy = [], orderBy = []) {
|
|
130
|
+
this.partitionBy = partitionBy;
|
|
131
|
+
this.orderBy = orderBy;
|
|
132
|
+
}
|
|
133
|
+
partitionBy;
|
|
134
|
+
orderBy;
|
|
135
|
+
};
|
|
136
|
+
var AggregateOperation = class _AggregateOperation extends UnaryOperation {
|
|
137
|
+
constructor(element, operator, displayName, window) {
|
|
138
|
+
super(element);
|
|
139
|
+
this.operator = operator;
|
|
140
|
+
this.displayName = displayName;
|
|
141
|
+
this.window = window;
|
|
142
|
+
}
|
|
143
|
+
operator;
|
|
144
|
+
displayName;
|
|
145
|
+
window;
|
|
146
|
+
over(partitionBy, orderBy) {
|
|
147
|
+
return new _AggregateOperation(
|
|
148
|
+
this.element,
|
|
149
|
+
this.operator,
|
|
150
|
+
this.displayName,
|
|
151
|
+
new WindowSpecification(partitionBy ?? [], orderBy ?? [])
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
var WindowFunctionOperation = class _WindowFunctionOperation extends UnaryOperation {
|
|
156
|
+
constructor(element, func, displayName, secondArg, extraArgs = [], window) {
|
|
157
|
+
super(element);
|
|
158
|
+
this.func = func;
|
|
159
|
+
this.displayName = displayName;
|
|
160
|
+
this.secondArg = secondArg;
|
|
161
|
+
this.extraArgs = extraArgs;
|
|
162
|
+
this.window = window;
|
|
163
|
+
}
|
|
164
|
+
func;
|
|
165
|
+
displayName;
|
|
166
|
+
secondArg;
|
|
167
|
+
extraArgs;
|
|
168
|
+
window;
|
|
169
|
+
over(partitionBy, orderBy) {
|
|
170
|
+
return new _WindowFunctionOperation(
|
|
171
|
+
this.element,
|
|
172
|
+
this.func,
|
|
173
|
+
this.displayName,
|
|
174
|
+
this.secondArg,
|
|
175
|
+
[...this.extraArgs],
|
|
176
|
+
new WindowSpecification(partitionBy ?? [], orderBy ?? [])
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
var ScalarFunctionOperation = class extends UnaryOperation {
|
|
181
|
+
constructor(element, func, displayName, secondArg, extraArgs = []) {
|
|
182
|
+
super(element);
|
|
183
|
+
this.func = func;
|
|
184
|
+
this.displayName = displayName;
|
|
185
|
+
this.secondArg = secondArg;
|
|
186
|
+
this.extraArgs = extraArgs;
|
|
187
|
+
}
|
|
188
|
+
func;
|
|
189
|
+
displayName;
|
|
190
|
+
secondArg;
|
|
191
|
+
extraArgs;
|
|
192
|
+
};
|
|
193
|
+
var DateExtractOperation = class extends UnaryOperation {
|
|
194
|
+
constructor(element, part, displayName) {
|
|
195
|
+
super(element);
|
|
196
|
+
this.part = part;
|
|
197
|
+
this.displayName = displayName;
|
|
198
|
+
}
|
|
199
|
+
part;
|
|
200
|
+
displayName;
|
|
201
|
+
};
|
|
202
|
+
var DateArithmeticOperation = class extends UnaryOperation {
|
|
203
|
+
constructor(element, n, unit, isAdd = true, displayName) {
|
|
204
|
+
super(element);
|
|
205
|
+
this.n = n;
|
|
206
|
+
this.unit = unit;
|
|
207
|
+
this.isAdd = isAdd;
|
|
208
|
+
this.displayName = displayName;
|
|
209
|
+
}
|
|
210
|
+
n;
|
|
211
|
+
unit;
|
|
212
|
+
isAdd;
|
|
213
|
+
displayName;
|
|
214
|
+
};
|
|
215
|
+
var DateDiffOperation = class extends UnaryOperation {
|
|
216
|
+
constructor(element, other, unit, displayName) {
|
|
217
|
+
super(element);
|
|
218
|
+
this.other = other;
|
|
219
|
+
this.unit = unit;
|
|
220
|
+
this.displayName = displayName;
|
|
221
|
+
}
|
|
222
|
+
other;
|
|
223
|
+
unit;
|
|
224
|
+
displayName;
|
|
225
|
+
};
|
|
226
|
+
var Column = class extends RelationalOperationElement {
|
|
227
|
+
constructor(name, type, owner, primaryKey = false) {
|
|
228
|
+
super();
|
|
229
|
+
this.name = name;
|
|
230
|
+
this.type = type;
|
|
231
|
+
this.owner = owner;
|
|
232
|
+
this.primaryKey = primaryKey;
|
|
233
|
+
}
|
|
234
|
+
name;
|
|
235
|
+
type;
|
|
236
|
+
owner;
|
|
237
|
+
primaryKey;
|
|
238
|
+
table;
|
|
239
|
+
};
|
|
240
|
+
var ColumnWithJoin = class extends RelationalOperationElement {
|
|
241
|
+
constructor(column, parent) {
|
|
242
|
+
super();
|
|
243
|
+
this.column = column;
|
|
244
|
+
this.parent = parent;
|
|
245
|
+
}
|
|
246
|
+
column;
|
|
247
|
+
parent;
|
|
248
|
+
};
|
|
249
|
+
var SortOperation = class {
|
|
250
|
+
constructor(column, direction) {
|
|
251
|
+
this.column = column;
|
|
252
|
+
this.direction = direction;
|
|
253
|
+
}
|
|
254
|
+
column;
|
|
255
|
+
direction;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// src/datafinder/attribute.ts
|
|
259
|
+
var Attribute = class {
|
|
260
|
+
_displayName;
|
|
261
|
+
_column;
|
|
262
|
+
_owner;
|
|
263
|
+
_parent;
|
|
264
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
265
|
+
this._displayName = displayName;
|
|
266
|
+
this._column = new Column(columnName, columnDbType, owner);
|
|
267
|
+
this._owner = owner;
|
|
268
|
+
this._parent = parent;
|
|
269
|
+
}
|
|
270
|
+
column() {
|
|
271
|
+
return this._column;
|
|
272
|
+
}
|
|
273
|
+
owner() {
|
|
274
|
+
return this._owner;
|
|
275
|
+
}
|
|
276
|
+
parent() {
|
|
277
|
+
return this._parent;
|
|
278
|
+
}
|
|
279
|
+
displayName() {
|
|
280
|
+
return this._displayName;
|
|
281
|
+
}
|
|
282
|
+
cwj() {
|
|
283
|
+
return new ColumnWithJoin(this._column, this._parent);
|
|
284
|
+
}
|
|
285
|
+
count() {
|
|
286
|
+
return new AggregateOperation(
|
|
287
|
+
new ColumnWithJoin(this._column, this._parent),
|
|
288
|
+
"COUNT" /* COUNT */,
|
|
289
|
+
this._displayName + " Count"
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
ascending() {
|
|
293
|
+
return new SortOperation(new ColumnWithJoin(this._column, this._parent), "ASC" /* ASC */);
|
|
294
|
+
}
|
|
295
|
+
descending() {
|
|
296
|
+
return new SortOperation(new ColumnWithJoin(this._column, this._parent), "DESC" /* DESC */);
|
|
297
|
+
}
|
|
298
|
+
isNull() {
|
|
299
|
+
return new IsNullOperation(new ColumnWithJoin(this._column, this._parent));
|
|
300
|
+
}
|
|
301
|
+
isNotNull() {
|
|
302
|
+
return new IsNotNullOperation(new ColumnWithJoin(this._column, this._parent));
|
|
303
|
+
}
|
|
304
|
+
_windowSpec(partitionBy, orderBy) {
|
|
305
|
+
const pb = partitionBy === void 0 ? [] : Array.isArray(partitionBy) ? partitionBy : [partitionBy];
|
|
306
|
+
const ob = orderBy === void 0 ? [] : Array.isArray(orderBy) ? orderBy : [orderBy];
|
|
307
|
+
return new WindowSpecification(pb, ob);
|
|
308
|
+
}
|
|
309
|
+
rank(opts = {}) {
|
|
310
|
+
const { method = "min", pct = false, partitionBy, orderBy } = opts;
|
|
311
|
+
let func;
|
|
312
|
+
let name;
|
|
313
|
+
if (pct) {
|
|
314
|
+
if (method === "max") {
|
|
315
|
+
func = "CUME_DIST" /* CUME_DIST */;
|
|
316
|
+
name = "Cume Dist";
|
|
317
|
+
} else {
|
|
318
|
+
func = "PERCENT_RANK" /* PERCENT_RANK */;
|
|
319
|
+
name = "Percent Rank";
|
|
320
|
+
}
|
|
321
|
+
} else if (method === "first") {
|
|
322
|
+
func = "ROW_NUMBER" /* ROW_NUMBER */;
|
|
323
|
+
name = "Row Number";
|
|
324
|
+
} else if (method === "dense") {
|
|
325
|
+
func = "DENSE_RANK" /* DENSE_RANK */;
|
|
326
|
+
name = "Dense Rank";
|
|
327
|
+
} else {
|
|
328
|
+
func = "RANK" /* RANK */;
|
|
329
|
+
name = "Rank";
|
|
330
|
+
}
|
|
331
|
+
return new WindowFunctionOperation(null, func, name, void 0, [], this._windowSpec(partitionBy, orderBy));
|
|
332
|
+
}
|
|
333
|
+
qcut(buckets, opts = {}) {
|
|
334
|
+
return new WindowFunctionOperation(
|
|
335
|
+
null,
|
|
336
|
+
"NTILE" /* NTILE */,
|
|
337
|
+
"Quantile",
|
|
338
|
+
buckets,
|
|
339
|
+
[],
|
|
340
|
+
this._windowSpec(opts.partitionBy, opts.orderBy)
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
shift(periods = 1, opts = {}) {
|
|
344
|
+
const extraArgs = opts.fillValue !== void 0 ? [opts.fillValue] : [];
|
|
345
|
+
const func = periods >= 0 ? "LAG" /* LAG */ : "LEAD" /* LEAD */;
|
|
346
|
+
const label = periods >= 0 ? "Lag" : "Lead";
|
|
347
|
+
return new WindowFunctionOperation(
|
|
348
|
+
new ColumnWithJoin(this._column, this._parent),
|
|
349
|
+
func,
|
|
350
|
+
label + " " + this._displayName,
|
|
351
|
+
Math.abs(periods),
|
|
352
|
+
extraArgs,
|
|
353
|
+
this._windowSpec(opts.partitionBy, opts.orderBy)
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
first(opts = {}) {
|
|
357
|
+
return new WindowFunctionOperation(
|
|
358
|
+
new ColumnWithJoin(this._column, this._parent),
|
|
359
|
+
"FIRST_VALUE" /* FIRST_VALUE */,
|
|
360
|
+
"First " + this._displayName,
|
|
361
|
+
void 0,
|
|
362
|
+
[],
|
|
363
|
+
this._windowSpec(opts.partitionBy, opts.orderBy)
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
last(opts = {}) {
|
|
367
|
+
return new WindowFunctionOperation(
|
|
368
|
+
new ColumnWithJoin(this._column, this._parent),
|
|
369
|
+
"LAST_VALUE" /* LAST_VALUE */,
|
|
370
|
+
"Last " + this._displayName,
|
|
371
|
+
void 0,
|
|
372
|
+
[],
|
|
373
|
+
this._windowSpec(opts.partitionBy, opts.orderBy)
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
// src/datafinder/typed-attributes.ts
|
|
379
|
+
var StringAttribute = class extends Attribute {
|
|
380
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
381
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
382
|
+
}
|
|
383
|
+
upper() {
|
|
384
|
+
return new ScalarFunctionOperation(this.cwj(), "UPPER" /* UPPER */, "Upper " + this.displayName());
|
|
385
|
+
}
|
|
386
|
+
lower() {
|
|
387
|
+
return new ScalarFunctionOperation(this.cwj(), "LOWER" /* LOWER */, "Lower " + this.displayName());
|
|
388
|
+
}
|
|
389
|
+
strip() {
|
|
390
|
+
return new ScalarFunctionOperation(this.cwj(), "TRIM" /* TRIM */, "Strip " + this.displayName());
|
|
391
|
+
}
|
|
392
|
+
lstrip() {
|
|
393
|
+
return new ScalarFunctionOperation(this.cwj(), "LTRIM" /* LTRIM */, "LStrip " + this.displayName());
|
|
394
|
+
}
|
|
395
|
+
rstrip() {
|
|
396
|
+
return new ScalarFunctionOperation(this.cwj(), "RTRIM" /* RTRIM */, "RStrip " + this.displayName());
|
|
397
|
+
}
|
|
398
|
+
length() {
|
|
399
|
+
return new ScalarFunctionOperation(this.cwj(), "LENGTH" /* LENGTH */, "Length " + this.displayName());
|
|
400
|
+
}
|
|
401
|
+
reverse() {
|
|
402
|
+
return new ScalarFunctionOperation(this.cwj(), "REVERSE" /* REVERSE */, "Reverse " + this.displayName());
|
|
403
|
+
}
|
|
404
|
+
left(n) {
|
|
405
|
+
return new ScalarFunctionOperation(this.cwj(), "LEFT" /* LEFT */, "Left " + this.displayName(), n);
|
|
406
|
+
}
|
|
407
|
+
right(n) {
|
|
408
|
+
return new ScalarFunctionOperation(this.cwj(), "RIGHT" /* RIGHT */, "Right " + this.displayName(), n);
|
|
409
|
+
}
|
|
410
|
+
repeat(n) {
|
|
411
|
+
return new ScalarFunctionOperation(this.cwj(), "REPEAT" /* REPEAT */, "Repeat " + this.displayName(), n);
|
|
412
|
+
}
|
|
413
|
+
replace(fromStr, toStr) {
|
|
414
|
+
return new ScalarFunctionOperation(this.cwj(), "REPLACE" /* REPLACE */, "Replace " + this.displayName(), void 0, [fromStr, toStr]);
|
|
415
|
+
}
|
|
416
|
+
substring(start, length) {
|
|
417
|
+
const args = length !== void 0 ? [start + 1, length] : [start + 1];
|
|
418
|
+
return new ScalarFunctionOperation(this.cwj(), "SUBSTRING" /* SUBSTRING */, "Substring " + this.displayName(), void 0, args);
|
|
419
|
+
}
|
|
420
|
+
eq(value) {
|
|
421
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new StringConstantOperation(value));
|
|
422
|
+
}
|
|
423
|
+
ne(value) {
|
|
424
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new StringConstantOperation(value));
|
|
425
|
+
}
|
|
426
|
+
contains(value) {
|
|
427
|
+
return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`%${value}%`));
|
|
428
|
+
}
|
|
429
|
+
startsWith(prefix) {
|
|
430
|
+
return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`${prefix}%`));
|
|
431
|
+
}
|
|
432
|
+
endsWith(suffix) {
|
|
433
|
+
return new ComparisonOperation(this.cwj(), "LIKE" /* LIKE */, new StringConstantOperation(`%${suffix}`));
|
|
434
|
+
}
|
|
435
|
+
notContains(value) {
|
|
436
|
+
return new ComparisonOperation(this.cwj(), "NOT_LIKE" /* NOT_LIKE */, new StringConstantOperation(`%${value}%`));
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
var NumericAttribute = class extends Attribute {
|
|
440
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
441
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
442
|
+
}
|
|
443
|
+
sum() {
|
|
444
|
+
return new AggregateOperation(this.cwj(), "SUM" /* SUM */, this.displayName() + " Sum");
|
|
445
|
+
}
|
|
446
|
+
min() {
|
|
447
|
+
return new AggregateOperation(this.cwj(), "MIN" /* MIN */, this.displayName() + " Min");
|
|
448
|
+
}
|
|
449
|
+
max() {
|
|
450
|
+
return new AggregateOperation(this.cwj(), "MAX" /* MAX */, this.displayName() + " Max");
|
|
451
|
+
}
|
|
452
|
+
average() {
|
|
453
|
+
return new AggregateOperation(this.cwj(), "AVERAGE" /* AVERAGE */, this.displayName() + " Average");
|
|
454
|
+
}
|
|
455
|
+
abs() {
|
|
456
|
+
return new ScalarFunctionOperation(this.cwj(), "ABS" /* ABS */, "Abs " + this.displayName());
|
|
457
|
+
}
|
|
458
|
+
ceil() {
|
|
459
|
+
return new ScalarFunctionOperation(this.cwj(), "CEILING" /* CEILING */, "Ceil " + this.displayName());
|
|
460
|
+
}
|
|
461
|
+
floor() {
|
|
462
|
+
return new ScalarFunctionOperation(this.cwj(), "FLOOR" /* FLOOR */, "Floor " + this.displayName());
|
|
463
|
+
}
|
|
464
|
+
sqrt() {
|
|
465
|
+
return new ScalarFunctionOperation(this.cwj(), "SQRT" /* SQRT */, "Sqrt " + this.displayName());
|
|
466
|
+
}
|
|
467
|
+
mod(n) {
|
|
468
|
+
return new ScalarFunctionOperation(this.cwj(), "MOD" /* MOD */, "Mod " + this.displayName(), n);
|
|
469
|
+
}
|
|
470
|
+
power(n) {
|
|
471
|
+
return new ScalarFunctionOperation(this.cwj(), "POWER" /* POWER */, "Power " + this.displayName(), n);
|
|
472
|
+
}
|
|
473
|
+
round(d) {
|
|
474
|
+
return new ScalarFunctionOperation(this.cwj(), "ROUND" /* ROUND */, "Round " + this.displayName(), d);
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
var DoubleAttribute = class extends NumericAttribute {
|
|
478
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
479
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
480
|
+
}
|
|
481
|
+
eq(value) {
|
|
482
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new FloatConstantOperation(value));
|
|
483
|
+
}
|
|
484
|
+
ne(value) {
|
|
485
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new FloatConstantOperation(value));
|
|
486
|
+
}
|
|
487
|
+
gt(value) {
|
|
488
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new FloatConstantOperation(value));
|
|
489
|
+
}
|
|
490
|
+
lt(value) {
|
|
491
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new FloatConstantOperation(value));
|
|
492
|
+
}
|
|
493
|
+
gte(value) {
|
|
494
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new FloatConstantOperation(value));
|
|
495
|
+
}
|
|
496
|
+
lte(value) {
|
|
497
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new FloatConstantOperation(value));
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
var FloatAttribute = DoubleAttribute;
|
|
501
|
+
var DecimalAttribute = class extends NumericAttribute {
|
|
502
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
503
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
504
|
+
}
|
|
505
|
+
eq(value) {
|
|
506
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DecimalConstantOperation(value));
|
|
507
|
+
}
|
|
508
|
+
ne(value) {
|
|
509
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DecimalConstantOperation(value));
|
|
510
|
+
}
|
|
511
|
+
gt(value) {
|
|
512
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DecimalConstantOperation(value));
|
|
513
|
+
}
|
|
514
|
+
lt(value) {
|
|
515
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DecimalConstantOperation(value));
|
|
516
|
+
}
|
|
517
|
+
gte(value) {
|
|
518
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DecimalConstantOperation(value));
|
|
519
|
+
}
|
|
520
|
+
lte(value) {
|
|
521
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DecimalConstantOperation(value));
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
var IntegerAttribute = class extends NumericAttribute {
|
|
525
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
526
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
527
|
+
}
|
|
528
|
+
eq(value) {
|
|
529
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new IntegerConstantOperation(value));
|
|
530
|
+
}
|
|
531
|
+
ne(value) {
|
|
532
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new IntegerConstantOperation(value));
|
|
533
|
+
}
|
|
534
|
+
gt(value) {
|
|
535
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new IntegerConstantOperation(value));
|
|
536
|
+
}
|
|
537
|
+
lt(value) {
|
|
538
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new IntegerConstantOperation(value));
|
|
539
|
+
}
|
|
540
|
+
gte(value) {
|
|
541
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new IntegerConstantOperation(value));
|
|
542
|
+
}
|
|
543
|
+
lte(value) {
|
|
544
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new IntegerConstantOperation(value));
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
var BooleanAttribute = class extends Attribute {
|
|
548
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
549
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
550
|
+
}
|
|
551
|
+
eq(value) {
|
|
552
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(value));
|
|
553
|
+
}
|
|
554
|
+
isTrue() {
|
|
555
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(true));
|
|
556
|
+
}
|
|
557
|
+
isFalse() {
|
|
558
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new BooleanConstantOperation(false));
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
function parseDate(value) {
|
|
562
|
+
if (value instanceof Date) return value;
|
|
563
|
+
const d = new Date(value);
|
|
564
|
+
if (isNaN(d.getTime())) throw new Error(`Cannot parse date: ${value}`);
|
|
565
|
+
return d;
|
|
566
|
+
}
|
|
567
|
+
var DateAttribute = class extends Attribute {
|
|
568
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
569
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
570
|
+
}
|
|
571
|
+
eq(value) {
|
|
572
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DateConstantOperation(parseDate(value)));
|
|
573
|
+
}
|
|
574
|
+
ne(value) {
|
|
575
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DateConstantOperation(parseDate(value)));
|
|
576
|
+
}
|
|
577
|
+
gt(value) {
|
|
578
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DateConstantOperation(parseDate(value)));
|
|
579
|
+
}
|
|
580
|
+
lt(value) {
|
|
581
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DateConstantOperation(parseDate(value)));
|
|
582
|
+
}
|
|
583
|
+
gte(value) {
|
|
584
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DateConstantOperation(parseDate(value)));
|
|
585
|
+
}
|
|
586
|
+
lte(value) {
|
|
587
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DateConstantOperation(parseDate(value)));
|
|
588
|
+
}
|
|
589
|
+
year() {
|
|
590
|
+
return new DateExtractOperation(this.cwj(), "YEAR" /* YEAR */, "Year " + this.displayName());
|
|
591
|
+
}
|
|
592
|
+
month() {
|
|
593
|
+
return new DateExtractOperation(this.cwj(), "MONTH" /* MONTH */, "Month " + this.displayName());
|
|
594
|
+
}
|
|
595
|
+
day() {
|
|
596
|
+
return new DateExtractOperation(this.cwj(), "DAY" /* DAY */, "Day " + this.displayName());
|
|
597
|
+
}
|
|
598
|
+
quarter() {
|
|
599
|
+
return new DateExtractOperation(this.cwj(), "QUARTER" /* QUARTER */, "Quarter " + this.displayName());
|
|
600
|
+
}
|
|
601
|
+
week() {
|
|
602
|
+
return new DateExtractOperation(this.cwj(), "WEEK" /* WEEK */, "Week " + this.displayName());
|
|
603
|
+
}
|
|
604
|
+
dayOfWeek() {
|
|
605
|
+
return new DateExtractOperation(this.cwj(), "DOW" /* DOW */, "Day Of Week " + this.displayName());
|
|
606
|
+
}
|
|
607
|
+
addDays(n) {
|
|
608
|
+
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, true, "Add Days " + this.displayName());
|
|
609
|
+
}
|
|
610
|
+
addMonths(n) {
|
|
611
|
+
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, true, "Add Months " + this.displayName());
|
|
612
|
+
}
|
|
613
|
+
addYears(n) {
|
|
614
|
+
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, true, "Add Years " + this.displayName());
|
|
615
|
+
}
|
|
616
|
+
subtractDays(n) {
|
|
617
|
+
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, false, "Subtract Days " + this.displayName());
|
|
618
|
+
}
|
|
619
|
+
subtractMonths(n) {
|
|
620
|
+
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, false, "Subtract Months " + this.displayName());
|
|
621
|
+
}
|
|
622
|
+
subtractYears(n) {
|
|
623
|
+
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, false, "Subtract Years " + this.displayName());
|
|
624
|
+
}
|
|
625
|
+
diffDays(other) {
|
|
626
|
+
return new DateDiffOperation(this.cwj(), other, "DAY" /* DAY */, "Diff Days " + this.displayName());
|
|
627
|
+
}
|
|
628
|
+
diffMonths(other) {
|
|
629
|
+
return new DateDiffOperation(this.cwj(), other, "MONTH" /* MONTH */, "Diff Months " + this.displayName());
|
|
630
|
+
}
|
|
631
|
+
diffYears(other) {
|
|
632
|
+
return new DateDiffOperation(this.cwj(), other, "YEAR" /* YEAR */, "Diff Years " + this.displayName());
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
var DateTimeAttribute = class extends Attribute {
|
|
636
|
+
constructor(displayName, columnName, columnDbType, owner, parent) {
|
|
637
|
+
super(displayName, columnName, columnDbType, owner, parent);
|
|
638
|
+
}
|
|
639
|
+
eq(value) {
|
|
640
|
+
return new ComparisonOperation(this.cwj(), "EQUAL" /* EQUAL */, new DateTimeConstantOperation(parseDate(value)));
|
|
641
|
+
}
|
|
642
|
+
ne(value) {
|
|
643
|
+
return new ComparisonOperation(this.cwj(), "NOT_EQUAL" /* NOT_EQUAL */, new DateTimeConstantOperation(parseDate(value)));
|
|
644
|
+
}
|
|
645
|
+
gt(value) {
|
|
646
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN" /* GREATER_THAN */, new DateTimeConstantOperation(parseDate(value)));
|
|
647
|
+
}
|
|
648
|
+
lt(value) {
|
|
649
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN" /* LESS_THAN */, new DateTimeConstantOperation(parseDate(value)));
|
|
650
|
+
}
|
|
651
|
+
gte(value) {
|
|
652
|
+
return new ComparisonOperation(this.cwj(), "GREATER_THAN_OR_EQUAL_TO" /* GREATER_THAN_OR_EQUAL_TO */, new DateTimeConstantOperation(parseDate(value)));
|
|
653
|
+
}
|
|
654
|
+
lte(value) {
|
|
655
|
+
return new ComparisonOperation(this.cwj(), "LESS_THAN_OR_EQUAL_TO" /* LESS_THAN_OR_EQUAL_TO */, new DateTimeConstantOperation(parseDate(value)));
|
|
656
|
+
}
|
|
657
|
+
year() {
|
|
658
|
+
return new DateExtractOperation(this.cwj(), "YEAR" /* YEAR */, "Year " + this.displayName());
|
|
659
|
+
}
|
|
660
|
+
month() {
|
|
661
|
+
return new DateExtractOperation(this.cwj(), "MONTH" /* MONTH */, "Month " + this.displayName());
|
|
662
|
+
}
|
|
663
|
+
day() {
|
|
664
|
+
return new DateExtractOperation(this.cwj(), "DAY" /* DAY */, "Day " + this.displayName());
|
|
665
|
+
}
|
|
666
|
+
hour() {
|
|
667
|
+
return new DateExtractOperation(this.cwj(), "HOUR" /* HOUR */, "Hour " + this.displayName());
|
|
668
|
+
}
|
|
669
|
+
minute() {
|
|
670
|
+
return new DateExtractOperation(this.cwj(), "MINUTE" /* MINUTE */, "Minute " + this.displayName());
|
|
671
|
+
}
|
|
672
|
+
second() {
|
|
673
|
+
return new DateExtractOperation(this.cwj(), "SECOND" /* SECOND */, "Second " + this.displayName());
|
|
674
|
+
}
|
|
675
|
+
quarter() {
|
|
676
|
+
return new DateExtractOperation(this.cwj(), "QUARTER" /* QUARTER */, "Quarter " + this.displayName());
|
|
677
|
+
}
|
|
678
|
+
week() {
|
|
679
|
+
return new DateExtractOperation(this.cwj(), "WEEK" /* WEEK */, "Week " + this.displayName());
|
|
680
|
+
}
|
|
681
|
+
dayOfWeek() {
|
|
682
|
+
return new DateExtractOperation(this.cwj(), "DOW" /* DOW */, "Day Of Week " + this.displayName());
|
|
683
|
+
}
|
|
684
|
+
addDays(n) {
|
|
685
|
+
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, true, "Add Days " + this.displayName());
|
|
686
|
+
}
|
|
687
|
+
addMonths(n) {
|
|
688
|
+
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, true, "Add Months " + this.displayName());
|
|
689
|
+
}
|
|
690
|
+
addYears(n) {
|
|
691
|
+
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, true, "Add Years " + this.displayName());
|
|
692
|
+
}
|
|
693
|
+
addHours(n) {
|
|
694
|
+
return new DateArithmeticOperation(this.cwj(), n, "HOUR" /* HOUR */, true, "Add Hours " + this.displayName());
|
|
695
|
+
}
|
|
696
|
+
addMinutes(n) {
|
|
697
|
+
return new DateArithmeticOperation(this.cwj(), n, "MINUTE" /* MINUTE */, true, "Add Minutes " + this.displayName());
|
|
698
|
+
}
|
|
699
|
+
addSeconds(n) {
|
|
700
|
+
return new DateArithmeticOperation(this.cwj(), n, "SECOND" /* SECOND */, true, "Add Seconds " + this.displayName());
|
|
701
|
+
}
|
|
702
|
+
subtractDays(n) {
|
|
703
|
+
return new DateArithmeticOperation(this.cwj(), n, "DAY" /* DAY */, false, "Subtract Days " + this.displayName());
|
|
704
|
+
}
|
|
705
|
+
subtractMonths(n) {
|
|
706
|
+
return new DateArithmeticOperation(this.cwj(), n, "MONTH" /* MONTH */, false, "Subtract Months " + this.displayName());
|
|
707
|
+
}
|
|
708
|
+
subtractYears(n) {
|
|
709
|
+
return new DateArithmeticOperation(this.cwj(), n, "YEAR" /* YEAR */, false, "Subtract Years " + this.displayName());
|
|
710
|
+
}
|
|
711
|
+
subtractHours(n) {
|
|
712
|
+
return new DateArithmeticOperation(this.cwj(), n, "HOUR" /* HOUR */, false, "Subtract Hours " + this.displayName());
|
|
713
|
+
}
|
|
714
|
+
subtractMinutes(n) {
|
|
715
|
+
return new DateArithmeticOperation(this.cwj(), n, "MINUTE" /* MINUTE */, false, "Subtract Minutes " + this.displayName());
|
|
716
|
+
}
|
|
717
|
+
subtractSeconds(n) {
|
|
718
|
+
return new DateArithmeticOperation(this.cwj(), n, "SECOND" /* SECOND */, false, "Subtract Seconds " + this.displayName());
|
|
719
|
+
}
|
|
720
|
+
diffDays(other) {
|
|
721
|
+
return new DateDiffOperation(this.cwj(), other, "DAY" /* DAY */, "Diff Days " + this.displayName());
|
|
722
|
+
}
|
|
723
|
+
diffMonths(other) {
|
|
724
|
+
return new DateDiffOperation(this.cwj(), other, "MONTH" /* MONTH */, "Diff Months " + this.displayName());
|
|
725
|
+
}
|
|
726
|
+
diffYears(other) {
|
|
727
|
+
return new DateDiffOperation(this.cwj(), other, "YEAR" /* YEAR */, "Diff Years " + this.displayName());
|
|
728
|
+
}
|
|
729
|
+
diffHours(other) {
|
|
730
|
+
return new DateDiffOperation(this.cwj(), other, "HOUR" /* HOUR */, "Diff Hours " + this.displayName());
|
|
731
|
+
}
|
|
732
|
+
diffMinutes(other) {
|
|
733
|
+
return new DateDiffOperation(this.cwj(), other, "MINUTE" /* MINUTE */, "Diff Minutes " + this.displayName());
|
|
734
|
+
}
|
|
735
|
+
diffSeconds(other) {
|
|
736
|
+
return new DateDiffOperation(this.cwj(), other, "SECOND" /* SECOND */, "Diff Seconds " + this.displayName());
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
740
|
+
0 && (module.exports = {
|
|
741
|
+
BooleanAttribute,
|
|
742
|
+
DateAttribute,
|
|
743
|
+
DateTimeAttribute,
|
|
744
|
+
DecimalAttribute,
|
|
745
|
+
DoubleAttribute,
|
|
746
|
+
FloatAttribute,
|
|
747
|
+
IntegerAttribute,
|
|
748
|
+
NumericAttribute,
|
|
749
|
+
StringAttribute
|
|
750
|
+
});
|
|
751
|
+
//# sourceMappingURL=typed-attributes.cjs.map
|