@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.
@@ -1,80 +1,80 @@
1
- /**
2
- * Factory functions for creating expressions - mirrors Tengo pt library API
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
- export declare function col(name: string): ColumnExpressionImpl;
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
- export declare function lit(value: LiteralValue): LiteralExpressionImpl;
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
- export declare function allHorizontal(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
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
- export declare function anyHorizontal(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
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
- export declare function and(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
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
- export declare function or(...expressions: Array<ExpressionImpl | string>): LogicalExpressionImpl;
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
- export declare function concatStr(expressions: Array<ExpressionImpl | string>, options?: {
41
- delimiter?: string;
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
- export declare function minHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl;
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
- export declare function maxHorizontal(expressions: Array<ExpressionImpl | string>): ExpressionImpl;
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
- export declare function when(condition: ExpressionImpl): WhenThenBuilder;
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
- export declare function rank(orderBy: ExpressionImpl | string | Array<ExpressionImpl | string>, descending?: boolean): RankBuilder;
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
- export declare class WhenThenBuilder {
66
- private readonly clauses;
67
- private readonly currentWhen?;
68
- private constructor();
69
- static start(condition: ExpressionImpl): WhenThenBuilder;
70
- when(condition: ExpressionImpl): WhenThenBuilder;
71
- then(value: ExpressionImpl | LiteralValue): WhenThenBuilder;
72
- otherwise(value: ExpressionImpl | LiteralValue): WhenThenOtherwiseExpressionImpl;
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
- export declare class RankBuilder {
75
- private readonly orderBy;
76
- private readonly descending;
77
- constructor(orderBy: ExpressionImpl[], descending: boolean);
78
- over(partitionBy: ExpressionImpl | string | Array<ExpressionImpl | string>): RankExpressionImpl;
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, StringConcatExpressionImpl, MinMaxExpressionImpl, WhenThenOtherwiseExpressionImpl, RankExpressionImpl, ExpressionImpl } from './expressions.js';
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
- return v instanceof ExpressionImpl;
5
+ return v instanceof ExpressionImpl;
9
6
  }
10
7
  function asExprFromString(value, interpretation) {
11
- return interpretation === "col" ? col(value) : lit(value);
8
+ return interpretation === "col" ? col(value) : lit(value);
12
9
  }
13
10
  function coerceToExpressionList(items, interpretationForString) {
14
- const arr = Array.isArray(items) ? items : [items];
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
- * Create a column reference expression
19
- * @param name Column name
20
- */
14
+ * Create a column reference expression
15
+ * @param name Column name
16
+ */
21
17
  function col(name) {
22
- return new ColumnExpressionImpl(name);
18
+ return new ColumnExpressionImpl(name);
23
19
  }
24
20
  /**
25
- * Create a literal value expression
26
- * @param value Literal value (number, string, boolean, null, etc.)
27
- */
21
+ * Create a literal value expression
22
+ * @param value Literal value (number, string, boolean, null, etc.)
23
+ */
28
24
  function lit(value) {
29
- return new LiteralExpressionImpl(value);
25
+ return new LiteralExpressionImpl(value);
30
26
  }
31
27
  /**
32
- * Create an AND expression with multiple operands (horizontal AND)
33
- * @param expressions Array of expressions to AND together
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
- // Interpret string args as column names. We don't flatten nested ANDs to keep implementation simple.
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
- * Create an OR expression with multiple operands (horizontal OR)
42
- * @param expressions Array of expressions to OR together
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
- // Interpret string args as column names. We don't flatten nested ORs to keep implementation simple.
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
- * Create an AND expression with multiple operands
51
- * @param expressions Array of expressions to AND together
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
- return allHorizontal(...expressions);
46
+ return allHorizontal(...expressions);
55
47
  }
56
48
  /**
57
- * Create an OR expression with multiple operands
58
- * @param expressions Array of expressions to OR together
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
- return anyHorizontal(...expressions);
53
+ return anyHorizontal(...expressions);
62
54
  }
63
55
  /**
64
- * Concatenate string representations with optional delimiter (Tengo: concatStr)
65
- * String inputs are treated as literals.
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
- if (!Array.isArray(expressions) || expressions.length === 0) {
69
- throw new Error("concatStr requires a non-empty array of expressions");
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
- * Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.
77
- */
64
+ * Element-wise min across expressions (Tengo: minHorizontal). Strings -> columns.
65
+ */
78
66
  function minHorizontal(expressions) {
79
- if (!Array.isArray(expressions) || expressions.length === 0) {
80
- throw new Error("minHorizontal requires a non-empty array of expressions");
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
- * Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.
87
- */
71
+ * Element-wise max across expressions (Tengo: maxHorizontal). Strings -> columns.
72
+ */
88
73
  function maxHorizontal(expressions) {
89
- if (!Array.isArray(expressions) || expressions.length === 0) {
90
- throw new Error("maxHorizontal requires a non-empty array of expressions");
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
- * Create a conditional when-then expression builder
97
- * @param condition Boolean expression condition
98
- */
78
+ * Create a conditional when-then expression builder
79
+ * @param condition Boolean expression condition
80
+ */
99
81
  function when(condition) {
100
- return WhenThenBuilder.start(condition);
82
+ return WhenThenBuilder.start(condition);
101
83
  }
102
84
  /**
103
- * Create a rank expression
104
- * @param expression Expression to rank
105
- * @param options Ranking options
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
- const orderByList = coerceToExpressionList(orderBy, "col");
109
- return new RankBuilder(orderByList, descending);
90
+ return new RankBuilder(coerceToExpressionList(orderBy, "col"), descending);
110
91
  }
111
92
  /**
112
- * Builder class for when-then-otherwise conditional expressions
113
- */
114
- class WhenThenBuilder {
115
- clauses;
116
- currentWhen;
117
- constructor(clauses, currentWhen) {
118
- this.clauses = clauses;
119
- this.currentWhen = currentWhen;
120
- }
121
- static start(condition) {
122
- if (!isExpression(condition))
123
- throw new Error("when() expects an Expression");
124
- return new WhenThenBuilder([], condition);
125
- }
126
- when(condition) {
127
- if (this.currentWhen)
128
- throw new Error(".when() must follow a .then()");
129
- if (!isExpression(condition))
130
- throw new Error(".when() expects an Expression");
131
- return new WhenThenBuilder(this.clauses, condition);
132
- }
133
- then(value) {
134
- if (!this.currentWhen)
135
- throw new Error(".then() must follow a .when()");
136
- const expr = isExpression(value) ? value : lit(value);
137
- const nextClauses = this.clauses.slice();
138
- nextClauses.push({ when: this.currentWhen, then: expr });
139
- return new WhenThenBuilder(nextClauses, undefined);
140
- }
141
- otherwise(value) {
142
- if (this.currentWhen)
143
- throw new Error(".otherwise() must follow a .then()");
144
- if (this.clauses.length === 0) {
145
- throw new Error("At least one .when().then() clause is required before .otherwise()");
146
- }
147
- const expr = isExpression(value) ? value : lit(value);
148
- return new WhenThenOtherwiseExpressionImpl(this.clauses, expr);
149
- }
150
- }
151
- // Rank builder and expression
152
- class RankBuilder {
153
- orderBy;
154
- descending;
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
@@ -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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AI,KAAK,CAAC,oEAAoE,CAAC;QACvF;AACA,QAAA,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;QACrD,OAAO,IAAI,+BAA+B,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;IAChE;AACD;AAED;MACa,WAAW,CAAA;AAEH,IAAA,OAAA;AACA,IAAA,UAAA;IAFnB,WAAA,CACmB,OAAyB,EACzB,UAAmB,EAAA;QADnB,IAAA,CAAA,OAAO,GAAP,OAAO;QACP,IAAA,CAAA,UAAU,GAAV,UAAU;IAC1B;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,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gC;AACtE,MAAI,CAAC,aAAa,UAAU,CAAE,OAAM,IAAI,MAAM,gCAAgC;AAC9E,SAAO,IAAI,gBAAgB,KAAK,SAAS,UAAU;;CAGrD,KAAK,OAAuD;AAC1D,MAAI,CAAC,KAAK,YAAa,OAAM,IAAI,MAAM,gCAAgC;EACvE,MAAM,OAAO,aAAa,MAAM,GAAG,QAAQ,IAAI,MAAM;EACrD,MAAM,cAAc,KAAK,QAAQ,OAAO;AACxC,cAAY,KAAK;GAAE,MAAM,KAAK;GAAa,MAAM;GAAM,CAAC;AACxD,SAAO,IAAI,gBAAgB,aAAa,OAAU;;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
- 'use strict';
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
- var expressions = require('./expressions.cjs');
4
- var functions = require('./functions.cjs');
5
-
6
-
7
-
8
- exports.AggregationExpressionImpl = expressions.AggregationExpressionImpl;
9
- exports.ArithmeticExpressionImpl = expressions.ArithmeticExpressionImpl;
10
- exports.ColumnExpressionImpl = expressions.ColumnExpressionImpl;
11
- exports.ComparisonExpressionImpl = expressions.ComparisonExpressionImpl;
12
- exports.CumsumExpressionImpl = expressions.CumsumExpressionImpl;
13
- exports.ExpressionImpl = expressions.ExpressionImpl;
14
- exports.FillNaNExpressionImpl = expressions.FillNaNExpressionImpl;
15
- exports.FillNullExpressionImpl = expressions.FillNullExpressionImpl;
16
- exports.FuzzyStringFilterExpressionImpl = expressions.FuzzyStringFilterExpressionImpl;
17
- exports.LiteralExpressionImpl = expressions.LiteralExpressionImpl;
18
- exports.LogicalExpressionImpl = expressions.LogicalExpressionImpl;
19
- exports.MinMaxExpressionImpl = expressions.MinMaxExpressionImpl;
20
- exports.NullCheckExpressionImpl = expressions.NullCheckExpressionImpl;
21
- exports.RankExpressionImpl = expressions.RankExpressionImpl;
22
- exports.StringCaseExpressionImpl = expressions.StringCaseExpressionImpl;
23
- exports.StringConcatExpressionImpl = expressions.StringConcatExpressionImpl;
24
- exports.StringContainsExpressionImpl = expressions.StringContainsExpressionImpl;
25
- exports.StringDistanceExpressionImpl = expressions.StringDistanceExpressionImpl;
26
- exports.StringEndsWithExpressionImpl = expressions.StringEndsWithExpressionImpl;
27
- exports.StringReplaceExpressionImpl = expressions.StringReplaceExpressionImpl;
28
- exports.StringStartsWithExpressionImpl = expressions.StringStartsWithExpressionImpl;
29
- exports.SubstringExpressionImpl = expressions.SubstringExpressionImpl;
30
- exports.UnaryArithmeticExpressionImpl = expressions.UnaryArithmeticExpressionImpl;
31
- exports.WhenThenOtherwiseExpressionImpl = expressions.WhenThenOtherwiseExpressionImpl;
32
- exports.WindowExpressionImpl = expressions.WindowExpressionImpl;
33
- exports.coerceToExpression = expressions.coerceToExpression;
34
- exports.RankBuilder = functions.RankBuilder;
35
- exports.WhenThenBuilder = functions.WhenThenBuilder;
36
- exports.allHorizontal = functions.allHorizontal;
37
- exports.and = functions.and;
38
- exports.anyHorizontal = functions.anyHorizontal;
39
- exports.col = functions.col;
40
- exports.concatStr = functions.concatStr;
41
- exports.lit = functions.lit;
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
- * PTabler JavaScript Expression System
3
- *
4
- * Provides JavaScript/TypeScript implementation of PTabler expression API
5
- * with identical JSON output to Tengo implementation.
6
- */
7
- export * from "./expressions";
8
- export * from "./functions";
9
- export * from "./types";
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
- export { 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
- export { RankBuilder, WhenThenBuilder, allHorizontal, and, anyHorizontal, col, concatStr, lit, maxHorizontal, minHorizontal, or, rank, when } from './functions.js';
3
- //# sourceMappingURL=index.js.map
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
- export type * from "@platforma-open/milaboratories.software-ptabler.schema";
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.23",
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.16"
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.6.3",
25
+ "typescript": "~5.9.3",
26
26
  "vitest": "^4.0.18",
27
- "@milaboratories/ts-configs": "1.2.1",
28
- "@milaboratories/build-configs": "1.5.0",
29
- "@milaboratories/ts-builder": "1.2.11"
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",