@milaboratories/ptabler-expression-js 1.1.23 → 1.1.25
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/_virtual/_rolldown/runtime.js +36 -0
- package/dist/expressions.cjs +752 -835
- package/dist/expressions.cjs.map +1 -1
- package/dist/expressions.d.ts +266 -265
- package/dist/expressions.js +752 -834
- package/dist/expressions.js.map +1 -1
- package/dist/functions.cjs +101 -130
- package/dist/functions.cjs.map +1 -1
- package/dist/functions.d.ts +30 -30
- package/dist/functions.js +96 -123
- package/dist/functions.js.map +1 -1
- package/dist/index.cjs +42 -46
- package/dist/index.d.ts +12 -9
- package/dist/index.js +4 -3
- package/dist/types.d.ts +8 -1
- package/package.json +6 -6
- package/dist/expressions.d.ts.map +0 -1
- package/dist/functions.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
package/dist/functions.d.ts
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { LiteralValue } from "./expressions";
|
|
5
|
-
import { ColumnExpressionImpl, ExpressionImpl, LiteralExpressionImpl, LogicalExpressionImpl, RankExpressionImpl, WhenThenOtherwiseExpressionImpl } from "./expressions";
|
|
1
|
+
import { ColumnExpressionImpl, ExpressionImpl, LiteralExpressionImpl, LiteralValue, LogicalExpressionImpl, RankExpressionImpl, WhenThenOtherwiseExpressionImpl } from "./expressions.js";
|
|
2
|
+
|
|
3
|
+
//#region src/functions.d.ts
|
|
6
4
|
/**
|
|
7
5
|
* Create a column reference expression
|
|
8
6
|
* @param name Column name
|
|
9
7
|
*/
|
|
10
|
-
|
|
8
|
+
declare function col(name: string): ColumnExpressionImpl;
|
|
11
9
|
/**
|
|
12
10
|
* Create a literal value expression
|
|
13
11
|
* @param value Literal value (number, string, boolean, null, etc.)
|
|
14
12
|
*/
|
|
15
|
-
|
|
13
|
+
declare function lit(value: LiteralValue): LiteralExpressionImpl;
|
|
16
14
|
/**
|
|
17
15
|
* Create an AND expression with multiple operands (horizontal AND)
|
|
18
16
|
* @param expressions Array of expressions to AND together
|
|
19
17
|
*/
|
|
20
|
-
|
|
18
|
+
declare function allHorizontal(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
|
|
21
19
|
/**
|
|
22
20
|
* Create an OR expression with multiple operands (horizontal OR)
|
|
23
21
|
* @param expressions Array of expressions to OR together
|
|
24
22
|
*/
|
|
25
|
-
|
|
23
|
+
declare function anyHorizontal(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
|
|
26
24
|
/**
|
|
27
25
|
* Create an AND expression with multiple operands
|
|
28
26
|
* @param expressions Array of expressions to AND together
|
|
29
27
|
*/
|
|
30
|
-
|
|
28
|
+
declare function and(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
|
|
31
29
|
/**
|
|
32
30
|
* Create an OR expression with multiple operands
|
|
33
31
|
* @param expressions Array of expressions to OR together
|
|
34
32
|
*/
|
|
35
|
-
|
|
33
|
+
declare function or(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
|
|
36
34
|
/**
|
|
37
35
|
* Concatenate string representations with optional delimiter (Tengo: concatStr)
|
|
38
36
|
* String inputs are treated as literals.
|
|
39
37
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
declare function concatStr(expressions: Array<ExpressionImpl | string>, options?: {
|
|
39
|
+
delimiter?: string;
|
|
42
40
|
}): ExpressionImpl;
|
|
43
41
|
/**
|
|
44
42
|
* Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.
|
|
45
43
|
*/
|
|
46
|
-
|
|
44
|
+
declare function minHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl;
|
|
47
45
|
/**
|
|
48
46
|
* Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.
|
|
49
47
|
*/
|
|
50
|
-
|
|
48
|
+
declare function maxHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl;
|
|
51
49
|
/**
|
|
52
50
|
* Create a conditional when-then expression builder
|
|
53
51
|
* @param condition Boolean expression condition
|
|
54
52
|
*/
|
|
55
|
-
|
|
53
|
+
declare function when(condition: ExpressionImpl): WhenThenBuilder;
|
|
56
54
|
/**
|
|
57
55
|
* Create a rank expression
|
|
58
56
|
* @param expression Expression to rank
|
|
59
57
|
* @param options Ranking options
|
|
60
58
|
*/
|
|
61
|
-
|
|
59
|
+
declare function rank(orderBy: ExpressionImpl | string | Array<ExpressionImpl | string>, descending?: boolean): RankBuilder;
|
|
62
60
|
/**
|
|
63
61
|
* Builder class for when-then-otherwise conditional expressions
|
|
64
62
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
declare class WhenThenBuilder {
|
|
64
|
+
private readonly clauses;
|
|
65
|
+
private readonly currentWhen?;
|
|
66
|
+
private constructor();
|
|
67
|
+
static start(condition: ExpressionImpl): WhenThenBuilder;
|
|
68
|
+
when(condition: ExpressionImpl): WhenThenBuilder;
|
|
69
|
+
then(value: ExpressionImpl | LiteralValue): WhenThenBuilder;
|
|
70
|
+
otherwise(value: ExpressionImpl | LiteralValue): WhenThenOtherwiseExpressionImpl;
|
|
73
71
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
declare class RankBuilder {
|
|
73
|
+
private readonly orderBy;
|
|
74
|
+
private readonly descending;
|
|
75
|
+
constructor(orderBy: ExpressionImpl[], descending: boolean);
|
|
76
|
+
over(partitionBy: ExpressionImpl | string | Array<ExpressionImpl | string>): RankExpressionImpl;
|
|
79
77
|
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { RankBuilder, WhenThenBuilder, allHorizontal, and, anyHorizontal, col, concatStr, lit, maxHorizontal, minHorizontal, or, rank, when };
|
|
80
80
|
//# sourceMappingURL=functions.d.ts.map
|
package/dist/functions.js
CHANGED
|
@@ -1,166 +1,139 @@
|
|
|
1
|
-
import { ColumnExpressionImpl, LiteralExpressionImpl, LogicalExpressionImpl,
|
|
1
|
+
import { ColumnExpressionImpl, ExpressionImpl, LiteralExpressionImpl, LogicalExpressionImpl, MinMaxExpressionImpl, RankExpressionImpl, StringConcatExpressionImpl, WhenThenOtherwiseExpressionImpl } from "./expressions.js";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* Factory functions for creating expressions - mirrors Tengo pt library API
|
|
5
|
-
*/
|
|
6
|
-
// Internal helpers mirroring Tengo behavior
|
|
3
|
+
//#region src/functions.ts
|
|
7
4
|
function isExpression(v) {
|
|
8
|
-
|
|
5
|
+
return v instanceof ExpressionImpl;
|
|
9
6
|
}
|
|
10
7
|
function asExprFromString(value, interpretation) {
|
|
11
|
-
|
|
8
|
+
return interpretation === "col" ? col(value) : lit(value);
|
|
12
9
|
}
|
|
13
10
|
function coerceToExpressionList(items, interpretationForString) {
|
|
14
|
-
|
|
15
|
-
return arr.map((it) => typeof it === "string" ? asExprFromString(it, interpretationForString) : it);
|
|
11
|
+
return (Array.isArray(items) ? items : [items]).map((it) => typeof it === "string" ? asExprFromString(it, interpretationForString) : it);
|
|
16
12
|
}
|
|
17
13
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
* Create a column reference expression
|
|
15
|
+
* @param name Column name
|
|
16
|
+
*/
|
|
21
17
|
function col(name) {
|
|
22
|
-
|
|
18
|
+
return new ColumnExpressionImpl(name);
|
|
23
19
|
}
|
|
24
20
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
* Create a literal value expression
|
|
22
|
+
* @param value Literal value (number, string, boolean, null, etc.)
|
|
23
|
+
*/
|
|
28
24
|
function lit(value) {
|
|
29
|
-
|
|
25
|
+
return new LiteralExpressionImpl(value);
|
|
30
26
|
}
|
|
31
27
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
* Create an AND expression with multiple operands (horizontal AND)
|
|
29
|
+
* @param expressions Array of expressions to AND together
|
|
30
|
+
*/
|
|
35
31
|
function allHorizontal(...expressions) {
|
|
36
|
-
|
|
37
|
-
const processed = expressions.map((e) => (typeof e === "string" ? col(e) : e));
|
|
38
|
-
return new LogicalExpressionImpl("and", processed);
|
|
32
|
+
return new LogicalExpressionImpl("and", expressions.map((e) => typeof e === "string" ? col(e) : e));
|
|
39
33
|
}
|
|
40
34
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
* Create an OR expression with multiple operands (horizontal OR)
|
|
36
|
+
* @param expressions Array of expressions to OR together
|
|
37
|
+
*/
|
|
44
38
|
function anyHorizontal(...expressions) {
|
|
45
|
-
|
|
46
|
-
const processed = expressions.map((e) => (typeof e === "string" ? col(e) : e));
|
|
47
|
-
return new LogicalExpressionImpl("or", processed);
|
|
39
|
+
return new LogicalExpressionImpl("or", expressions.map((e) => typeof e === "string" ? col(e) : e));
|
|
48
40
|
}
|
|
49
41
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
* Create an AND expression with multiple operands
|
|
43
|
+
* @param expressions Array of expressions to AND together
|
|
44
|
+
*/
|
|
53
45
|
function and(...expressions) {
|
|
54
|
-
|
|
46
|
+
return allHorizontal(...expressions);
|
|
55
47
|
}
|
|
56
48
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
* Create an OR expression with multiple operands
|
|
50
|
+
* @param expressions Array of expressions to OR together
|
|
51
|
+
*/
|
|
60
52
|
function or(...expressions) {
|
|
61
|
-
|
|
53
|
+
return anyHorizontal(...expressions);
|
|
62
54
|
}
|
|
63
55
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
* Concatenate string representations with optional delimiter (Tengo: concatStr)
|
|
57
|
+
* String inputs are treated as literals.
|
|
58
|
+
*/
|
|
67
59
|
function concatStr(expressions, options) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
const ops = coerceToExpressionList(expressions, "lit");
|
|
72
|
-
const delimiter = options?.delimiter ?? "";
|
|
73
|
-
return new StringConcatExpressionImpl(ops, delimiter);
|
|
60
|
+
if (!Array.isArray(expressions) || expressions.length === 0) throw new Error("concatStr requires a non-empty array of expressions");
|
|
61
|
+
return new StringConcatExpressionImpl(coerceToExpressionList(expressions, "lit"), options?.delimiter ?? "");
|
|
74
62
|
}
|
|
75
63
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
* Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.
|
|
65
|
+
*/
|
|
78
66
|
function minHorizontal(expressions) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
const ops = coerceToExpressionList(expressions, "col");
|
|
83
|
-
return new MinMaxExpressionImpl("min", ops);
|
|
67
|
+
if (!Array.isArray(expressions) || expressions.length === 0) throw new Error("minHorizontal requires a non-empty array of expressions");
|
|
68
|
+
return new MinMaxExpressionImpl("min", coerceToExpressionList(expressions, "col"));
|
|
84
69
|
}
|
|
85
70
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
* Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.
|
|
72
|
+
*/
|
|
88
73
|
function maxHorizontal(expressions) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
const ops = coerceToExpressionList(expressions, "col");
|
|
93
|
-
return new MinMaxExpressionImpl("max", ops);
|
|
74
|
+
if (!Array.isArray(expressions) || expressions.length === 0) throw new Error("maxHorizontal requires a non-empty array of expressions");
|
|
75
|
+
return new MinMaxExpressionImpl("max", coerceToExpressionList(expressions, "col"));
|
|
94
76
|
}
|
|
95
77
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
78
|
+
* Create a conditional when-then expression builder
|
|
79
|
+
* @param condition Boolean expression condition
|
|
80
|
+
*/
|
|
99
81
|
function when(condition) {
|
|
100
|
-
|
|
82
|
+
return WhenThenBuilder.start(condition);
|
|
101
83
|
}
|
|
102
84
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
85
|
+
* Create a rank expression
|
|
86
|
+
* @param expression Expression to rank
|
|
87
|
+
* @param options Ranking options
|
|
88
|
+
*/
|
|
107
89
|
function rank(orderBy, descending = false) {
|
|
108
|
-
|
|
109
|
-
return new RankBuilder(orderByList, descending);
|
|
90
|
+
return new RankBuilder(coerceToExpressionList(orderBy, "col"), descending);
|
|
110
91
|
}
|
|
111
92
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
class WhenThenBuilder {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
constructor(orderBy, descending) {
|
|
156
|
-
this.orderBy = orderBy;
|
|
157
|
-
this.descending = descending;
|
|
158
|
-
}
|
|
159
|
-
over(partitionBy) {
|
|
160
|
-
const partitionByList = coerceToExpressionList(partitionBy, "col");
|
|
161
|
-
return new RankExpressionImpl(this.orderBy, partitionByList, this.descending);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
93
|
+
* Builder class for when-then-otherwise conditional expressions
|
|
94
|
+
*/
|
|
95
|
+
var WhenThenBuilder = class WhenThenBuilder {
|
|
96
|
+
constructor(clauses, currentWhen) {
|
|
97
|
+
this.clauses = clauses;
|
|
98
|
+
this.currentWhen = currentWhen;
|
|
99
|
+
}
|
|
100
|
+
static start(condition) {
|
|
101
|
+
if (!isExpression(condition)) throw new Error("when() expects an Expression");
|
|
102
|
+
return new WhenThenBuilder([], condition);
|
|
103
|
+
}
|
|
104
|
+
when(condition) {
|
|
105
|
+
if (this.currentWhen) throw new Error(".when() must follow a .then()");
|
|
106
|
+
if (!isExpression(condition)) throw new Error(".when() expects an Expression");
|
|
107
|
+
return new WhenThenBuilder(this.clauses, condition);
|
|
108
|
+
}
|
|
109
|
+
then(value) {
|
|
110
|
+
if (!this.currentWhen) throw new Error(".then() must follow a .when()");
|
|
111
|
+
const expr = isExpression(value) ? value : lit(value);
|
|
112
|
+
const nextClauses = this.clauses.slice();
|
|
113
|
+
nextClauses.push({
|
|
114
|
+
when: this.currentWhen,
|
|
115
|
+
then: expr
|
|
116
|
+
});
|
|
117
|
+
return new WhenThenBuilder(nextClauses, void 0);
|
|
118
|
+
}
|
|
119
|
+
otherwise(value) {
|
|
120
|
+
if (this.currentWhen) throw new Error(".otherwise() must follow a .then()");
|
|
121
|
+
if (this.clauses.length === 0) throw new Error("At least one .when().then() clause is required before .otherwise()");
|
|
122
|
+
const expr = isExpression(value) ? value : lit(value);
|
|
123
|
+
return new WhenThenOtherwiseExpressionImpl(this.clauses, expr);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
var RankBuilder = class {
|
|
127
|
+
constructor(orderBy, descending) {
|
|
128
|
+
this.orderBy = orderBy;
|
|
129
|
+
this.descending = descending;
|
|
130
|
+
}
|
|
131
|
+
over(partitionBy) {
|
|
132
|
+
const partitionByList = coerceToExpressionList(partitionBy, "col");
|
|
133
|
+
return new RankExpressionImpl(this.orderBy, partitionByList, this.descending);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
164
136
|
|
|
137
|
+
//#endregion
|
|
165
138
|
export { RankBuilder, WhenThenBuilder, allHorizontal, and, anyHorizontal, col, concatStr, lit, maxHorizontal, minHorizontal, or, rank, when };
|
|
166
|
-
//# sourceMappingURL=functions.js.map
|
|
139
|
+
//# sourceMappingURL=functions.js.map
|
package/dist/functions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sources":["../src/functions.ts"],"sourcesContent":["/**\n * Factory functions for creating expressions - mirrors Tengo pt library API\n */\n\nimport type { LiteralValue } from \"./expressions\";\nimport {\n ColumnExpressionImpl,\n ExpressionImpl,\n LiteralExpressionImpl,\n LogicalExpressionImpl,\n MinMaxExpressionImpl,\n RankExpressionImpl,\n StringConcatExpressionImpl,\n WhenThenOtherwiseExpressionImpl,\n} from \"./expressions\";\n\n// Internal helpers mirroring Tengo behavior\nfunction isExpression(v: unknown): v is ExpressionImpl {\n return v instanceof ExpressionImpl;\n}\n\nfunction asExprFromString(value: string, interpretation: \"col\" | \"lit\"): ExpressionImpl {\n return interpretation === \"col\" ? col(value) : lit(value);\n}\n\nfunction coerceToExpressionList(\n items: Array<ExpressionImpl | string> | ExpressionImpl | string,\n interpretationForString: \"col\" | \"lit\",\n): ExpressionImpl[] {\n const arr = Array.isArray(items) ? items : [items];\n return arr.map((it) =>\n typeof it === \"string\" ? asExprFromString(it, interpretationForString) : it,\n );\n}\n\n/**\n * Create a column reference expression\n * @param name Column name\n */\nexport function col(name: string): ColumnExpressionImpl {\n return new ColumnExpressionImpl(name);\n}\n\n/**\n * Create a literal value expression\n * @param value Literal value (number, string, boolean, null, etc.)\n */\nexport function lit(value: LiteralValue): LiteralExpressionImpl {\n return new LiteralExpressionImpl(value);\n}\n\n/**\n * Create an AND expression with multiple operands (horizontal AND)\n * @param expressions Array of expressions to AND together\n */\nexport function allHorizontal(\n ...expressions: Array<ExpressionImpl | string>\n): LogicalExpressionImpl {\n // Interpret string args as column names. We don't flatten nested ANDs to keep implementation simple.\n const processed: ExpressionImpl[] = expressions.map((e) => (typeof e === \"string\" ? col(e) : e));\n return new LogicalExpressionImpl(\"and\", processed);\n}\n\n/**\n * Create an OR expression with multiple operands (horizontal OR)\n * @param expressions Array of expressions to OR together\n */\nexport function anyHorizontal(\n ...expressions: Array<ExpressionImpl | string>\n): LogicalExpressionImpl {\n // Interpret string args as column names. We don't flatten nested ORs to keep implementation simple.\n const processed: ExpressionImpl[] = expressions.map((e) => (typeof e === \"string\" ? col(e) : e));\n return new LogicalExpressionImpl(\"or\", processed);\n}\n\n/**\n * Create an AND expression with multiple operands\n * @param expressions Array of expressions to AND together\n */\nexport function and(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n return allHorizontal(...expressions);\n}\n\n/**\n * Create an OR expression with multiple operands\n * @param expressions Array of expressions to OR together\n */\nexport function or(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n return anyHorizontal(...expressions);\n}\n\n/**\n * Concatenate string representations with optional delimiter (Tengo: concatStr)\n * String inputs are treated as literals.\n */\nexport function concatStr(\n expressions: Array<ExpressionImpl | string>,\n options?: { delimiter?: string },\n): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error(\"concatStr requires a non-empty array of expressions\");\n }\n const ops = coerceToExpressionList(expressions, \"lit\");\n const delimiter = options?.delimiter ?? \"\";\n return new StringConcatExpressionImpl(ops, delimiter);\n}\n\n/**\n * Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.\n */\nexport function minHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error(\"minHorizontal requires a non-empty array of expressions\");\n }\n\n const ops = coerceToExpressionList(expressions, \"col\");\n return new MinMaxExpressionImpl(\"min\", ops);\n}\n\n/**\n * Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.\n */\nexport function maxHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error(\"maxHorizontal requires a non-empty array of expressions\");\n }\n const ops = coerceToExpressionList(expressions, \"col\");\n return new MinMaxExpressionImpl(\"max\", ops);\n}\n\n/**\n * Create a conditional when-then expression builder\n * @param condition Boolean expression condition\n */\nexport function when(condition: ExpressionImpl): WhenThenBuilder {\n return WhenThenBuilder.start(condition);\n}\n\n/**\n * Create a rank expression\n * @param expression Expression to rank\n * @param options Ranking options\n */\nexport function rank(\n orderBy: ExpressionImpl | string | Array<ExpressionImpl | string>,\n descending = false,\n): RankBuilder {\n const orderByList = coerceToExpressionList(orderBy, \"col\");\n return new RankBuilder(orderByList, descending);\n}\n\n/**\n * Builder class for when-then-otherwise conditional expressions\n */\nexport class WhenThenBuilder {\n private constructor(\n private readonly clauses: Array<{ when: ExpressionImpl; then: ExpressionImpl }>,\n private readonly currentWhen?: ExpressionImpl,\n ) {}\n\n static start(condition: ExpressionImpl): WhenThenBuilder {\n if (!isExpression(condition)) throw new Error(\"when() expects an Expression\");\n return new WhenThenBuilder([], condition);\n }\n\n when(condition: ExpressionImpl): WhenThenBuilder {\n if (this.currentWhen) throw new Error(\".when() must follow a .then()\");\n if (!isExpression(condition)) throw new Error(\".when() expects an Expression\");\n return new WhenThenBuilder(this.clauses, condition);\n }\n\n then(value: ExpressionImpl | LiteralValue): WhenThenBuilder {\n if (!this.currentWhen) throw new Error(\".then() must follow a .when()\");\n const expr = isExpression(value) ? value : lit(value);\n const nextClauses = this.clauses.slice();\n nextClauses.push({ when: this.currentWhen, then: expr });\n return new WhenThenBuilder(nextClauses, undefined);\n }\n\n otherwise(value: ExpressionImpl | LiteralValue): WhenThenOtherwiseExpressionImpl {\n if (this.currentWhen) throw new Error(\".otherwise() must follow a .then()\");\n if (this.clauses.length === 0) {\n throw new Error(\"At least one .when().then() clause is required before .otherwise()\");\n }\n const expr = isExpression(value) ? value : lit(value);\n return new WhenThenOtherwiseExpressionImpl(this.clauses, expr);\n }\n}\n\n// Rank builder and expression\nexport class RankBuilder {\n constructor(\n private readonly orderBy: ExpressionImpl[],\n private readonly descending: boolean,\n ) {}\n\n over(partitionBy: ExpressionImpl | string | Array<ExpressionImpl | string>): RankExpressionImpl {\n const partitionByList = coerceToExpressionList(partitionBy, \"col\");\n return new RankExpressionImpl(this.orderBy, partitionByList, this.descending);\n }\n}\n"],"names":[],"mappings":";;AAAA;;AAEG;AAcH;AACA,SAAS,YAAY,CAAC,CAAU,EAAA;IAC9B,OAAO,CAAC,YAAY,cAAc;AACpC;AAEA,SAAS,gBAAgB,CAAC,KAAa,EAAE,cAA6B,EAAA;AACpE,IAAA,OAAO,cAAc,KAAK,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC;AAC3D;AAEA,SAAS,sBAAsB,CAC7B,KAA+D,EAC/D,uBAAsC,EAAA;AAEtC,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC;IAClD,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,KAChB,OAAO,EAAE,KAAK,QAAQ,GAAG,gBAAgB,CAAC,EAAE,EAAE,uBAAuB,CAAC,GAAG,EAAE,CAC5E;AACH;AAEA;;;AAGG;AACG,SAAU,GAAG,CAAC,IAAY,EAAA;AAC9B,IAAA,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC;AACvC;AAEA;;;AAGG;AACG,SAAU,GAAG,CAAC,KAAmB,EAAA;AACrC,IAAA,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC;AACzC;AAEA;;;AAGG;AACG,SAAU,aAAa,CAC3B,GAAG,WAA2C,EAAA;;AAG9C,IAAA,MAAM,SAAS,GAAqB,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAChG,IAAA,OAAO,IA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C1B;AAEH,IAAA,IAAI,CAAC,WAAqE,EAAA;QACxE,MAAM,eAAe,GAAG,sBAAsB,CAAC,WAAW,EAAE,KAAK,CAAC;AAClE,QAAA,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC;IAC/E;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"functions.js","names":[],"sources":["../src/functions.ts"],"sourcesContent":["/**\n * Factory functions for creating expressions - mirrors Tengo pt library API\n */\n\nimport type { LiteralValue } from \"./expressions\";\nimport {\n ColumnExpressionImpl,\n ExpressionImpl,\n LiteralExpressionImpl,\n LogicalExpressionImpl,\n MinMaxExpressionImpl,\n RankExpressionImpl,\n StringConcatExpressionImpl,\n WhenThenOtherwiseExpressionImpl,\n} from \"./expressions\";\n\n// Internal helpers mirroring Tengo behavior\nfunction isExpression(v: unknown): v is ExpressionImpl {\n return v instanceof ExpressionImpl;\n}\n\nfunction asExprFromString(value: string, interpretation: \"col\" | \"lit\"): ExpressionImpl {\n return interpretation === \"col\" ? col(value) : lit(value);\n}\n\nfunction coerceToExpressionList(\n items: Array<ExpressionImpl | string> | ExpressionImpl | string,\n interpretationForString: \"col\" | \"lit\",\n): ExpressionImpl[] {\n const arr = Array.isArray(items) ? items : [items];\n return arr.map((it) =>\n typeof it === \"string\" ? asExprFromString(it, interpretationForString) : it,\n );\n}\n\n/**\n * Create a column reference expression\n * @param name Column name\n */\nexport function col(name: string): ColumnExpressionImpl {\n return new ColumnExpressionImpl(name);\n}\n\n/**\n * Create a literal value expression\n * @param value Literal value (number, string, boolean, null, etc.)\n */\nexport function lit(value: LiteralValue): LiteralExpressionImpl {\n return new LiteralExpressionImpl(value);\n}\n\n/**\n * Create an AND expression with multiple operands (horizontal AND)\n * @param expressions Array of expressions to AND together\n */\nexport function allHorizontal(\n ...expressions: Array<ExpressionImpl | string>\n): LogicalExpressionImpl {\n // Interpret string args as column names. We don't flatten nested ANDs to keep implementation simple.\n const processed: ExpressionImpl[] = expressions.map((e) => (typeof e === \"string\" ? col(e) : e));\n return new LogicalExpressionImpl(\"and\", processed);\n}\n\n/**\n * Create an OR expression with multiple operands (horizontal OR)\n * @param expressions Array of expressions to OR together\n */\nexport function anyHorizontal(\n ...expressions: Array<ExpressionImpl | string>\n): LogicalExpressionImpl {\n // Interpret string args as column names. We don't flatten nested ORs to keep implementation simple.\n const processed: ExpressionImpl[] = expressions.map((e) => (typeof e === \"string\" ? col(e) : e));\n return new LogicalExpressionImpl(\"or\", processed);\n}\n\n/**\n * Create an AND expression with multiple operands\n * @param expressions Array of expressions to AND together\n */\nexport function and(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n return allHorizontal(...expressions);\n}\n\n/**\n * Create an OR expression with multiple operands\n * @param expressions Array of expressions to OR together\n */\nexport function or(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl {\n return anyHorizontal(...expressions);\n}\n\n/**\n * Concatenate string representations with optional delimiter (Tengo: concatStr)\n * String inputs are treated as literals.\n */\nexport function concatStr(\n expressions: Array<ExpressionImpl | string>,\n options?: { delimiter?: string },\n): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error(\"concatStr requires a non-empty array of expressions\");\n }\n const ops = coerceToExpressionList(expressions, \"lit\");\n const delimiter = options?.delimiter ?? \"\";\n return new StringConcatExpressionImpl(ops, delimiter);\n}\n\n/**\n * Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.\n */\nexport function minHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error(\"minHorizontal requires a non-empty array of expressions\");\n }\n\n const ops = coerceToExpressionList(expressions, \"col\");\n return new MinMaxExpressionImpl(\"min\", ops);\n}\n\n/**\n * Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.\n */\nexport function maxHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl {\n if (!Array.isArray(expressions) || expressions.length === 0) {\n throw new Error(\"maxHorizontal requires a non-empty array of expressions\");\n }\n const ops = coerceToExpressionList(expressions, \"col\");\n return new MinMaxExpressionImpl(\"max\", ops);\n}\n\n/**\n * Create a conditional when-then expression builder\n * @param condition Boolean expression condition\n */\nexport function when(condition: ExpressionImpl): WhenThenBuilder {\n return WhenThenBuilder.start(condition);\n}\n\n/**\n * Create a rank expression\n * @param expression Expression to rank\n * @param options Ranking options\n */\nexport function rank(\n orderBy: ExpressionImpl | string | Array<ExpressionImpl | string>,\n descending = false,\n): RankBuilder {\n const orderByList = coerceToExpressionList(orderBy, \"col\");\n return new RankBuilder(orderByList, descending);\n}\n\n/**\n * Builder class for when-then-otherwise conditional expressions\n */\nexport class WhenThenBuilder {\n private constructor(\n private readonly clauses: Array<{ when: ExpressionImpl; then: ExpressionImpl }>,\n private readonly currentWhen?: ExpressionImpl,\n ) {}\n\n static start(condition: ExpressionImpl): WhenThenBuilder {\n if (!isExpression(condition)) throw new Error(\"when() expects an Expression\");\n return new WhenThenBuilder([], condition);\n }\n\n when(condition: ExpressionImpl): WhenThenBuilder {\n if (this.currentWhen) throw new Error(\".when() must follow a .then()\");\n if (!isExpression(condition)) throw new Error(\".when() expects an Expression\");\n return new WhenThenBuilder(this.clauses, condition);\n }\n\n then(value: ExpressionImpl | LiteralValue): WhenThenBuilder {\n if (!this.currentWhen) throw new Error(\".then() must follow a .when()\");\n const expr = isExpression(value) ? value : lit(value);\n const nextClauses = this.clauses.slice();\n nextClauses.push({ when: this.currentWhen, then: expr });\n return new WhenThenBuilder(nextClauses, undefined);\n }\n\n otherwise(value: ExpressionImpl | LiteralValue): WhenThenOtherwiseExpressionImpl {\n if (this.currentWhen) throw new Error(\".otherwise() must follow a .then()\");\n if (this.clauses.length === 0) {\n throw new Error(\"At least one .when().then() clause is required before .otherwise()\");\n }\n const expr = isExpression(value) ? value : lit(value);\n return new WhenThenOtherwiseExpressionImpl(this.clauses, expr);\n }\n}\n\n// Rank builder and expression\nexport class RankBuilder {\n constructor(\n private readonly orderBy: ExpressionImpl[],\n private readonly descending: boolean,\n ) {}\n\n over(partitionBy: ExpressionImpl | string | Array<ExpressionImpl | string>): RankExpressionImpl {\n const partitionByList = coerceToExpressionList(partitionBy, \"col\");\n return new RankExpressionImpl(this.orderBy, partitionByList, this.descending);\n }\n}\n"],"mappings":";;;AAiBA,SAAS,aAAa,GAAiC;AACrD,QAAO,aAAa;;AAGtB,SAAS,iBAAiB,OAAe,gBAA+C;AACtF,QAAO,mBAAmB,QAAQ,IAAI,MAAM,GAAG,IAAI,MAAM;;AAG3D,SAAS,uBACP,OACA,yBACkB;AAElB,SADY,MAAM,QAAQ,MAAM,GAAG,QAAQ,CAAC,MAAM,EACvC,KAAK,OACd,OAAO,OAAO,WAAW,iBAAiB,IAAI,wBAAwB,GAAG,GAC1E;;;;;;AAOH,SAAgB,IAAI,MAAoC;AACtD,QAAO,IAAI,qBAAqB,KAAK;;;;;;AAOvC,SAAgB,IAAI,OAA4C;AAC9D,QAAO,IAAI,sBAAsB,MAAM;;;;;;AAOzC,SAAgB,cACd,GAAG,aACoB;AAGvB,QAAO,IAAI,sBAAsB,OADG,YAAY,KAAK,MAAO,OAAO,MAAM,WAAW,IAAI,EAAE,GAAG,EAAG,CAC9C;;;;;;AAOpD,SAAgB,cACd,GAAG,aACoB;AAGvB,QAAO,IAAI,sBAAsB,MADG,YAAY,KAAK,MAAO,OAAO,MAAM,WAAW,IAAI,EAAE,GAAG,EAAG,CAC/C;;;;;;AAOnD,SAAgB,IAAI,GAAG,aAAoE;AACzF,QAAO,cAAc,GAAG,YAAY;;;;;;AAOtC,SAAgB,GAAG,GAAG,aAAoE;AACxF,QAAO,cAAc,GAAG,YAAY;;;;;;AAOtC,SAAgB,UACd,aACA,SACgB;AAChB,KAAI,CAAC,MAAM,QAAQ,YAAY,IAAI,YAAY,WAAW,EACxD,OAAM,IAAI,MAAM,sDAAsD;AAIxE,QAAO,IAAI,2BAFC,uBAAuB,aAAa,MA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AU;;CAGpD,UAAU,OAAuE;AAC/E,MAAI,KAAK,YAAa,OAAM,IAAI,MAAM,qCAAqC;AAC3E,MAAI,KAAK,QAAQ,WAAW,EAC1B,OAAM,IAAI,MAAM,qEAAqE;EAEvF,MAAM,OAAO,aAAa,MAAM,GAAG,QAAQ,IAAI,MAAM;AACrD,SAAO,IAAI,gCAAgC,KAAK,SAAS,KAAK;;;AAKlE,IAAa,cAAb,MAAyB;CACvB,YACE,AAAiB,SACjB,AAAiB,YACjB;EAFiB;EACA;;CAGnB,KAAK,aAA2F;EAC9F,MAAM,kBAAkB,uBAAuB,aAAa,MAAM;AAClE,SAAO,IAAI,mBAAmB,KAAK,SAAS,iBAAiB,KAAK,WAAW"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,47 +1,43 @@
|
|
|
1
|
-
'
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_expressions = require('./expressions.cjs');
|
|
3
|
+
const require_functions = require('./functions.cjs');
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.coerceToExpression =
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.maxHorizontal = functions.maxHorizontal;
|
|
43
|
-
exports.minHorizontal = functions.minHorizontal;
|
|
44
|
-
exports.or = functions.or;
|
|
45
|
-
exports.rank = functions.rank;
|
|
46
|
-
exports.when = functions.when;
|
|
47
|
-
//# sourceMappingURL=index.cjs.map
|
|
5
|
+
exports.AggregationExpressionImpl = require_expressions.AggregationExpressionImpl;
|
|
6
|
+
exports.ArithmeticExpressionImpl = require_expressions.ArithmeticExpressionImpl;
|
|
7
|
+
exports.ColumnExpressionImpl = require_expressions.ColumnExpressionImpl;
|
|
8
|
+
exports.ComparisonExpressionImpl = require_expressions.ComparisonExpressionImpl;
|
|
9
|
+
exports.CumsumExpressionImpl = require_expressions.CumsumExpressionImpl;
|
|
10
|
+
exports.ExpressionImpl = require_expressions.ExpressionImpl;
|
|
11
|
+
exports.FillNaNExpressionImpl = require_expressions.FillNaNExpressionImpl;
|
|
12
|
+
exports.FillNullExpressionImpl = require_expressions.FillNullExpressionImpl;
|
|
13
|
+
exports.FuzzyStringFilterExpressionImpl = require_expressions.FuzzyStringFilterExpressionImpl;
|
|
14
|
+
exports.LiteralExpressionImpl = require_expressions.LiteralExpressionImpl;
|
|
15
|
+
exports.LogicalExpressionImpl = require_expressions.LogicalExpressionImpl;
|
|
16
|
+
exports.MinMaxExpressionImpl = require_expressions.MinMaxExpressionImpl;
|
|
17
|
+
exports.NullCheckExpressionImpl = require_expressions.NullCheckExpressionImpl;
|
|
18
|
+
exports.RankBuilder = require_functions.RankBuilder;
|
|
19
|
+
exports.RankExpressionImpl = require_expressions.RankExpressionImpl;
|
|
20
|
+
exports.StringCaseExpressionImpl = require_expressions.StringCaseExpressionImpl;
|
|
21
|
+
exports.StringConcatExpressionImpl = require_expressions.StringConcatExpressionImpl;
|
|
22
|
+
exports.StringContainsExpressionImpl = require_expressions.StringContainsExpressionImpl;
|
|
23
|
+
exports.StringDistanceExpressionImpl = require_expressions.StringDistanceExpressionImpl;
|
|
24
|
+
exports.StringEndsWithExpressionImpl = require_expressions.StringEndsWithExpressionImpl;
|
|
25
|
+
exports.StringReplaceExpressionImpl = require_expressions.StringReplaceExpressionImpl;
|
|
26
|
+
exports.StringStartsWithExpressionImpl = require_expressions.StringStartsWithExpressionImpl;
|
|
27
|
+
exports.SubstringExpressionImpl = require_expressions.SubstringExpressionImpl;
|
|
28
|
+
exports.UnaryArithmeticExpressionImpl = require_expressions.UnaryArithmeticExpressionImpl;
|
|
29
|
+
exports.WhenThenBuilder = require_functions.WhenThenBuilder;
|
|
30
|
+
exports.WhenThenOtherwiseExpressionImpl = require_expressions.WhenThenOtherwiseExpressionImpl;
|
|
31
|
+
exports.WindowExpressionImpl = require_expressions.WindowExpressionImpl;
|
|
32
|
+
exports.allHorizontal = require_functions.allHorizontal;
|
|
33
|
+
exports.and = require_functions.and;
|
|
34
|
+
exports.anyHorizontal = require_functions.anyHorizontal;
|
|
35
|
+
exports.coerceToExpression = require_expressions.coerceToExpression;
|
|
36
|
+
exports.col = require_functions.col;
|
|
37
|
+
exports.concatStr = require_functions.concatStr;
|
|
38
|
+
exports.lit = require_functions.lit;
|
|
39
|
+
exports.maxHorizontal = require_functions.maxHorizontal;
|
|
40
|
+
exports.minHorizontal = require_functions.minHorizontal;
|
|
41
|
+
exports.or = require_functions.or;
|
|
42
|
+
exports.rank = require_functions.rank;
|
|
43
|
+
exports.when = require_functions.when;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
1
|
+
import { __exportAll, __reExport } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { types_d_exports } from "./types.js";
|
|
3
|
+
import { AggregationExpressionImpl, ArithmeticExpressionImpl, ColumnExpressionImpl, ComparisonExpressionImpl, CumsumExpressionImpl, ExpressionImpl, FillNaNExpressionImpl, FillNullExpressionImpl, FuzzyStringFilterExpressionImpl, LiteralExpressionImpl, LiteralValue, LogicalExpressionImpl, MinMaxExpressionImpl, NullCheckExpressionImpl, RankExpressionImpl, StringCaseExpressionImpl, StringConcatExpressionImpl, StringContainsExpressionImpl, StringDistanceExpressionImpl, StringEndsWithExpressionImpl, StringReplaceExpressionImpl, StringStartsWithExpressionImpl, SubstringExpressionImpl, UnaryArithmeticExpressionImpl, WhenThenOtherwiseExpressionImpl, WindowExpressionImpl, coerceToExpression } from "./expressions.js";
|
|
4
|
+
import { RankBuilder, WhenThenBuilder, allHorizontal, and, anyHorizontal, col, concatStr, lit, maxHorizontal, minHorizontal, or, rank, when } from "./functions.js";
|
|
5
|
+
export * from "@platforma-open/milaboratories.software-ptabler.schema";
|
|
6
|
+
|
|
7
|
+
//#region src/index.d.ts
|
|
8
|
+
declare namespace index_d_exports {
|
|
9
|
+
export { AggregationExpressionImpl, ArithmeticExpressionImpl, ColumnExpressionImpl, ComparisonExpressionImpl, CumsumExpressionImpl, ExpressionImpl, FillNaNExpressionImpl, FillNullExpressionImpl, FuzzyStringFilterExpressionImpl, LiteralExpressionImpl, LiteralValue, LogicalExpressionImpl, MinMaxExpressionImpl, NullCheckExpressionImpl, RankBuilder, RankExpressionImpl, StringCaseExpressionImpl, StringConcatExpressionImpl, StringContainsExpressionImpl, StringDistanceExpressionImpl, StringEndsWithExpressionImpl, StringReplaceExpressionImpl, StringStartsWithExpressionImpl, SubstringExpressionImpl, UnaryArithmeticExpressionImpl, WhenThenBuilder, WhenThenOtherwiseExpressionImpl, WindowExpressionImpl, allHorizontal, and, anyHorizontal, coerceToExpression, col, concatStr, lit, maxHorizontal, minHorizontal, or, rank, when };
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { AggregationExpressionImpl, ArithmeticExpressionImpl, ColumnExpressionImpl, ComparisonExpressionImpl, CumsumExpressionImpl, ExpressionImpl, FillNaNExpressionImpl, FillNullExpressionImpl, FuzzyStringFilterExpressionImpl, LiteralExpressionImpl, LiteralValue, LogicalExpressionImpl, MinMaxExpressionImpl, NullCheckExpressionImpl, RankBuilder, RankExpressionImpl, StringCaseExpressionImpl, StringConcatExpressionImpl, StringContainsExpressionImpl, StringDistanceExpressionImpl, StringEndsWithExpressionImpl, StringReplaceExpressionImpl, StringStartsWithExpressionImpl, SubstringExpressionImpl, UnaryArithmeticExpressionImpl, WhenThenBuilder, WhenThenOtherwiseExpressionImpl, WindowExpressionImpl, allHorizontal, and, anyHorizontal, coerceToExpression, col, concatStr, lit, maxHorizontal, minHorizontal, or, rank, when };
|
|
10
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { AggregationExpressionImpl, ArithmeticExpressionImpl, ColumnExpressionImpl, ComparisonExpressionImpl, CumsumExpressionImpl, ExpressionImpl, FillNaNExpressionImpl, FillNullExpressionImpl, FuzzyStringFilterExpressionImpl, LiteralExpressionImpl, LogicalExpressionImpl, MinMaxExpressionImpl, NullCheckExpressionImpl, RankExpressionImpl, StringCaseExpressionImpl, StringConcatExpressionImpl, StringContainsExpressionImpl, StringDistanceExpressionImpl, StringEndsWithExpressionImpl, StringReplaceExpressionImpl, StringStartsWithExpressionImpl, SubstringExpressionImpl, UnaryArithmeticExpressionImpl, WhenThenOtherwiseExpressionImpl, WindowExpressionImpl, coerceToExpression } from "./expressions.js";
|
|
2
|
+
import { RankBuilder, WhenThenBuilder, allHorizontal, and, anyHorizontal, col, concatStr, lit, maxHorizontal, minHorizontal, or, rank, when } from "./functions.js";
|
|
3
|
+
|
|
4
|
+
export { AggregationExpressionImpl, ArithmeticExpressionImpl, ColumnExpressionImpl, ComparisonExpressionImpl, CumsumExpressionImpl, ExpressionImpl, FillNaNExpressionImpl, FillNullExpressionImpl, FuzzyStringFilterExpressionImpl, LiteralExpressionImpl, LogicalExpressionImpl, MinMaxExpressionImpl, NullCheckExpressionImpl, RankBuilder, RankExpressionImpl, StringCaseExpressionImpl, StringConcatExpressionImpl, StringContainsExpressionImpl, StringDistanceExpressionImpl, StringEndsWithExpressionImpl, StringReplaceExpressionImpl, StringStartsWithExpressionImpl, SubstringExpressionImpl, UnaryArithmeticExpressionImpl, WhenThenBuilder, WhenThenOtherwiseExpressionImpl, WindowExpressionImpl, allHorizontal, and, anyHorizontal, coerceToExpression, col, concatStr, lit, maxHorizontal, minHorizontal, or, rank, when };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { __exportAll, __reExport } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
export * from "@platforma-open/milaboratories.software-ptabler.schema";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
|
|
6
|
+
import * as import__platforma_open_milaboratories_software_ptabler_schema from "@platforma-open/milaboratories.software-ptabler.schema";
|
|
7
|
+
//#endregion
|
|
8
|
+
export { import__platforma_open_milaboratories_software_ptabler_schema as types_d_exports };
|
|
2
9
|
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/ptabler-expression-js",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.25",
|
|
4
4
|
"description": "JavaScript/TypeScript implementation of PTabler expression system",
|
|
5
5
|
"files": [
|
|
6
6
|
"./dist/**/*",
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@platforma-open/milaboratories.software-ptabler.schema": "1.13.
|
|
20
|
+
"@platforma-open/milaboratories.software-ptabler.schema": "1.13.18"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "~24.5.2",
|
|
24
24
|
"@vitest/coverage-istanbul": "^4.0.18",
|
|
25
|
-
"typescript": "~5.
|
|
25
|
+
"typescript": "~5.9.3",
|
|
26
26
|
"vitest": "^4.0.18",
|
|
27
|
-
"@milaboratories/
|
|
28
|
-
"@milaboratories/
|
|
29
|
-
"@milaboratories/ts-
|
|
27
|
+
"@milaboratories/build-configs": "1.5.2",
|
|
28
|
+
"@milaboratories/ts-builder": "1.3.0",
|
|
29
|
+
"@milaboratories/ts-configs": "1.2.2"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "ts-builder build --target node",
|