@platforma-open/milaboratories.software-ptabler.schema 1.12.0 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/aggregate.d.ts +2 -5
  2. package/dist/aggregate.d.ts.map +1 -0
  3. package/dist/basic_steps.d.ts +30 -35
  4. package/dist/basic_steps.d.ts.map +1 -0
  5. package/dist/common.d.ts +1 -0
  6. package/dist/common.d.ts.map +1 -0
  7. package/dist/concatenate.d.ts +1 -0
  8. package/dist/concatenate.d.ts.map +1 -0
  9. package/dist/expressions/base.d.ts +6 -0
  10. package/dist/expressions/base.d.ts.map +1 -0
  11. package/dist/expressions/basics.d.ts +131 -0
  12. package/dist/expressions/basics.d.ts.map +1 -0
  13. package/dist/expressions/conditional.d.ts +56 -0
  14. package/dist/expressions/conditional.d.ts.map +1 -0
  15. package/dist/expressions/fuzzy.d.ts +45 -0
  16. package/dist/expressions/fuzzy.d.ts.map +1 -0
  17. package/dist/expressions/hash.d.ts +25 -0
  18. package/dist/expressions/hash.d.ts.map +1 -0
  19. package/dist/expressions/index.d.ts +25 -0
  20. package/dist/expressions/index.d.ts.map +1 -0
  21. package/dist/expressions/pframes.d.ts +115 -0
  22. package/dist/expressions/pframes.d.ts.map +1 -0
  23. package/dist/expressions/selectors.d.ts +172 -0
  24. package/dist/expressions/selectors.d.ts.map +1 -0
  25. package/dist/expressions/string.d.ts +158 -0
  26. package/dist/expressions/string.d.ts.map +1 -0
  27. package/dist/expressions/struct.d.ts +37 -0
  28. package/dist/expressions/struct.d.ts.map +1 -0
  29. package/dist/expressions/window.d.ts +52 -0
  30. package/dist/expressions/window.d.ts.map +1 -0
  31. package/dist/index.cjs +3 -0
  32. package/dist/index.cjs.map +1 -0
  33. package/dist/index.d.ts +12 -9
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +1 -1
  36. package/dist/io.d.ts +16 -1
  37. package/dist/io.d.ts.map +1 -0
  38. package/dist/join.d.ts +1 -0
  39. package/dist/join.d.ts.map +1 -0
  40. package/dist/read_frame.d.ts +26 -0
  41. package/dist/read_frame.d.ts.map +1 -0
  42. package/dist/sort.d.ts +4 -9
  43. package/dist/sort.d.ts.map +1 -0
  44. package/dist/write_frame.d.ts +58 -0
  45. package/dist/write_frame.d.ts.map +1 -0
  46. package/package.json +11 -9
  47. package/src/aggregate.ts +0 -16
  48. package/src/basic_steps.ts +32 -37
  49. package/src/expressions/base.ts +5 -0
  50. package/src/expressions/basics.ts +163 -0
  51. package/src/expressions/conditional.ts +59 -0
  52. package/src/expressions/fuzzy.ts +51 -0
  53. package/src/expressions/hash.ts +37 -0
  54. package/src/expressions/index.ts +147 -0
  55. package/src/expressions/pframes.ts +118 -0
  56. package/src/expressions/selectors.ts +203 -0
  57. package/src/expressions/string.ts +168 -0
  58. package/src/expressions/struct.ts +37 -0
  59. package/src/expressions/window.ts +66 -0
  60. package/src/index.ts +35 -5
  61. package/src/io.ts +16 -0
  62. package/src/read_frame.ts +26 -0
  63. package/src/sort.ts +2 -9
  64. package/src/write_frame.ts +66 -0
  65. package/dist/expressions.d.ts +0 -439
  66. package/dist/index.mjs +0 -2
  67. package/dist/index.mjs.map +0 -1
  68. package/src/expressions.ts +0 -549
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Axes values are used as unique key to access the column data,
3
+ * so they cannot be floating point numbers.
4
+ */
5
+ export type AxisType = 'Int' | 'Long' | 'String';
6
+ /** PColumn values could be of any type supported by PFrames. */
7
+ export type ColumnType = 'Int' | 'Long' | 'Float' | 'Double' | 'String';
8
+ export interface AxisMapping {
9
+ /** The name of the column in the input table. */
10
+ column: string;
11
+ /**
12
+ * The type of the axis to be created.
13
+ * A cast would be performed if the type of the column in the input table is different.
14
+ * Warning: cast failure will result in an error.
15
+ */
16
+ type: AxisType;
17
+ }
18
+ export interface ColumnMapping {
19
+ /** The name of the column in the input table. */
20
+ column: string;
21
+ /**
22
+ * The value type of the PColumn to be created.
23
+ * A cast would be performed if the type of the column in the input table is different.
24
+ * Warning: cast failure will produce null values in the PColumn.
25
+ */
26
+ type: ColumnType;
27
+ }
28
+ /** Defines a step that creates a PFrame from the lazy table. */
29
+ export interface WriteFrameStep {
30
+ /** The type identifier for this step. */
31
+ type: 'write_frame';
32
+ /** The name of the table from the tablespace which will be written. */
33
+ inputTable: string;
34
+ /**
35
+ * The name of the frame to be created.
36
+ * A folder with this name will be created in the working directory.
37
+ * The folder will contain the .datainfo and .parquet files representing the frame's PColumns.
38
+ */
39
+ frameName: string;
40
+ /**
41
+ * Axes specs, the order of axes in PColumns will match the order of axes in this array.
42
+ * Each column in the input table could be used as axis or PColumn only once.
43
+ * Warning: rows with null values in axes columns of input table will be discarded.
44
+ */
45
+ axes: AxisMapping[];
46
+ /**
47
+ * PColumns specs.
48
+ * Each column in the input table could be used as axis or PColumn only once.
49
+ */
50
+ columns: ColumnMapping[];
51
+ /**
52
+ * Partition key length, specifies the number of axes to be split into metadata partition key.
53
+ * Default: 0, which means no partitioning.
54
+ * Must be strictly less than the number of axes.
55
+ */
56
+ partitionKeyLength: number;
57
+ }
58
+ //# sourceMappingURL=write_frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write_frame.d.ts","sourceRoot":"","sources":["../src/write_frame.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEjD,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAExE,MAAM,WAAW,WAAW;IAC1B,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,IAAI,EAAE,aAAa,CAAC;IAEpB,uEAAuE;IACvE,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,IAAI,EAAE,WAAW,EAAE,CAAC;IAEpB;;;OAGG;IACH,OAAO,EAAE,aAAa,EAAE,CAAC;IAEzB;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.software-ptabler.schema",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "Type definitions for PTabler",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -16,17 +16,19 @@
16
16
  "./dist/**/*",
17
17
  "./src/**/*"
18
18
  ],
19
- "dependencies": {},
19
+ "dependencies": {
20
+ "@milaboratories/pl-model-common": "1.21.6"
21
+ },
20
22
  "devDependencies": {
21
- "@platforma-sdk/eslint-config": "^1.0.3",
22
- "vite-plugin-dts": "^4.5.4",
23
- "eslint": "^9.27.0",
24
- "typescript": "~5.5.4",
25
- "vite": "^6.3.5"
23
+ "eslint": "^9.25.1",
24
+ "typescript": "~5.6.3",
25
+ "@milaboratories/ts-configs": "1.0.6",
26
+ "@milaboratories/ts-builder": "1.0.5",
27
+ "@platforma-sdk/eslint-config": "1.1.0"
26
28
  },
27
29
  "scripts": {
28
- "type-check": "tsc --noEmit --composite false",
29
- "build": "vite build",
30
+ "build": "ts-builder build --target node",
31
+ "type-check": "ts-builder types --target node",
30
32
  "lint": "eslint .",
31
33
  "do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz"
32
34
  }
package/src/aggregate.ts CHANGED
@@ -1,21 +1,5 @@
1
1
  import type { Expression, AggregationType } from './expressions';
2
2
 
3
- /**
4
- * Defines standard aggregation functions that operate on a single expression.
5
- */
6
- export type StandardAggregationType =
7
- | 'sum'
8
- | 'mean'
9
- | 'median'
10
- | 'min'
11
- | 'max'
12
- | 'std'
13
- | 'var'
14
- | 'count'
15
- | 'first'
16
- | 'last'
17
- | 'n_unique';
18
-
19
3
  /**
20
4
  * Defines aggregation functions that select a value from one expression based on the min/max of another expression.
21
5
  */
@@ -20,18 +20,7 @@ export interface AddColumnsStep {
20
20
  * An array defining the new columns to be added.
21
21
  * Each object in the array specifies the name of a new column and the expression to compute its values.
22
22
  */
23
- columns: {
24
- /**
25
- * The name of the new column.
26
- */
27
- name: string;
28
-
29
- /**
30
- * An Expression object defining how to compute the column's values.
31
- * The expression will be evaluated for each row to generate the values for the new column.
32
- */
33
- expression: Expression;
34
- }[];
23
+ columns: Expression[];
35
24
  }
36
25
 
37
26
  /**
@@ -93,19 +82,7 @@ export interface SelectStep {
93
82
  * Each object in the array specifies the name of a column in the output table
94
83
  * and the expression to compute its values.
95
84
  */
96
- columns: {
97
- /**
98
- * The name of the column in the output table.
99
- */
100
- name: string;
101
-
102
- /**
103
- * An Expression object defining how to compute the column's values.
104
- * This expression will be evaluated to generate the values for this column
105
- * in the output table.
106
- */
107
- expression: Expression;
108
- }[];
85
+ columns: Expression[];
109
86
  }
110
87
 
111
88
  /**
@@ -138,18 +115,7 @@ export interface WithColumnsStep {
138
115
  * Each object in the array specifies the name of a column and the
139
116
  * expression to compute its values.
140
117
  */
141
- columns: {
142
- /**
143
- * The name of the new or replacement column.
144
- */
145
- name: string;
146
-
147
- /**
148
- * An Expression object defining how to compute the column's values.
149
- * The expression will be evaluated for each row to generate the values for the column.
150
- */
151
- expression: Expression;
152
- }[];
118
+ columns: Expression[];
153
119
  }
154
120
 
155
121
  /**
@@ -180,3 +146,32 @@ export interface WithoutColumnsStep {
180
146
  */
181
147
  columns: string[];
182
148
  }
149
+
150
+ /**
151
+ * Defines a step that limits the number of rows in a table
152
+ * and outputs the result to a new table in the tablespace.
153
+ * This operation is similar to Polars' `limit` method.
154
+ */
155
+ export interface LimitStep {
156
+ /**
157
+ * The type identifier for this step.
158
+ * Must be 'limit'.
159
+ */
160
+ type: 'limit';
161
+
162
+ /**
163
+ * The name of the input table in the tablespace from which rows will be limited.
164
+ */
165
+ inputTable: string;
166
+
167
+ /**
168
+ * The name for the resulting table that will be added to the tablespace.
169
+ * This new table will contain only the first n rows from the input table.
170
+ */
171
+ outputTable: string;
172
+
173
+ /**
174
+ * The maximum number of rows to include in the output table.
175
+ */
176
+ n: number;
177
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Forward declaration of the Expression type.
3
+ * The real type is defined in [index.ts](./index.ts) file to avoid circular dependencies.
4
+ */
5
+ export { type Expression } from './index';
@@ -0,0 +1,163 @@
1
+ import type { AxisSpec } from '@milaboratories/pl-model-common';
2
+ import type { DataType } from '../common';
3
+ import type { Expression } from './base';
4
+
5
+ /** Represents all possible comparison operator types. */
6
+ export type ComparisonOperator = 'gt' | 'ge' | 'eq' | 'lt' | 'le' | 'neq';
7
+
8
+ /** Defines a comparison operation between two expressions. */
9
+ export interface ComparisonExpression {
10
+ /** The type of comparison (e.g., 'gt', 'eq'). */
11
+ type: ComparisonOperator;
12
+ /** The left-hand side expression. */
13
+ lhs: Expression;
14
+ /** The right-hand side expression. */
15
+ rhs: Expression;
16
+ }
17
+
18
+ /** Defines the supported binary arithmetic operators. */
19
+ export type BinaryArithmeticOperator =
20
+ | 'plus'
21
+ | 'minus'
22
+ | 'multiply'
23
+ | 'truediv'
24
+ | 'floordiv';
25
+
26
+ /** Represents a binary arithmetic operation between two expressions. */
27
+ export interface BinaryArithmeticExpression {
28
+ /** The type of arithmetic operation (e.g., 'plus', 'minus'). */
29
+ type: BinaryArithmeticOperator;
30
+ /** The left-hand side expression. */
31
+ lhs: Expression;
32
+ /** The right-hand side expression. */
33
+ rhs: Expression;
34
+ }
35
+
36
+ /** Defines the supported unary arithmetic operators. */
37
+ export type UnaryArithmeticOperator =
38
+ | 'log10'
39
+ | 'log'
40
+ | 'log2'
41
+ | 'abs'
42
+ | 'sqrt'
43
+ | 'negate'
44
+ | 'floor'
45
+ | 'round'
46
+ | 'ceil';
47
+
48
+ /** Represents a unary arithmetic operation on a single expression. */
49
+ export interface UnaryArithmeticExpression {
50
+ /** The type of unary operation (e.g., 'log10', 'abs'). */
51
+ type: UnaryArithmeticOperator;
52
+ /** The expression to operate on. */
53
+ value: Expression;
54
+ }
55
+
56
+ /**
57
+ * Represents a type casting operation that converts the result of an expression to a specified data type.
58
+ */
59
+ export interface CastExpression {
60
+ /** The type of operation, always 'cast'. */
61
+ type: 'cast';
62
+ /** The expression whose result will be cast to the target data type. */
63
+ value: Expression;
64
+ /** The target data type to cast the expression result to. */
65
+ dtype: DataType;
66
+ /**
67
+ * Whether to use strict casting mode. If true, conversion errors and overflows will throw exceptions.
68
+ * If false or undefined, uses non-strict mode where failures result in null values. Defaults to false.
69
+ */
70
+ strict?: boolean;
71
+ }
72
+
73
+ /** Defines the supported boolean list operators. */
74
+ export type BooleanListOperator = 'and' | 'or';
75
+
76
+ /** Represents a boolean logic operation (AND, OR) on a list of expressions. */
77
+ export interface BooleanLogicExpression {
78
+ /** The type of boolean operation ('and', 'or'). */
79
+ type: BooleanListOperator;
80
+ /** An array of boolean expressions as operands. */
81
+ operands: Expression[]; // Array of boolean expressions
82
+ }
83
+
84
+ /** Represents a logical NOT operation on a single boolean expression. */
85
+ export interface NotExpression {
86
+ /** The type of operation, always 'not'. */
87
+ type: 'not';
88
+ /** The boolean expression to negate. */
89
+ value: Expression;
90
+ }
91
+
92
+ /** Defines the supported null check operators. */
93
+ export type NullCheckOperator = 'is_na' | 'is_not_na';
94
+
95
+ /** Represents a null check operation (is NA, is not NA) on an expression. */
96
+ export interface NullCheckExpression {
97
+ /** The type of null check ('is_na', 'is_not_na'). */
98
+ type: NullCheckOperator;
99
+ /** The expression to check for nullity. */
100
+ value: Expression;
101
+ }
102
+
103
+ /** Represents a reference to a column by its name. */
104
+ export interface ColumnReferenceExpression {
105
+ /** The type of operation, always 'col'. */
106
+ type: 'col';
107
+ /** The name of the column to reference. */
108
+ name: string;
109
+ }
110
+
111
+ /** Represents a reference to an axis by its specification (or id). */
112
+ export interface AxisReferenceExpression {
113
+ /** The type of operation, always 'axis'. */
114
+ type: 'axis';
115
+ /** The axis to reference. */
116
+ spec: AxisSpec;
117
+ }
118
+
119
+ /** Represents a constant literal value (string, number, boolean, or null). */
120
+ export interface ConstantValueExpression {
121
+ /** The type of operation, always 'const'. */
122
+ type: 'const';
123
+ /** The constant value. */
124
+ value: string | number | boolean | null;
125
+ }
126
+
127
+ /** Defines the supported min/max operators. */
128
+ export type MinMaxOperator = 'min' | 'max';
129
+
130
+ /** Represents a min or max operation on a list of expressions. */
131
+ export interface MinMaxExpression {
132
+ /** The type of operation ('min' or 'max'). */
133
+ type: MinMaxOperator;
134
+ /** An array of expressions to find the minimum or maximum value from. */
135
+ operands: Expression[];
136
+ }
137
+
138
+ /**
139
+ * Represents an "in set" operation.
140
+ * Checks if the value of an expression is contained within a specified set of values.
141
+ * Returns true if the expression's value is found in the set, false otherwise.
142
+ */
143
+ export interface InSetExpression {
144
+ /** The type of operation, always 'in_set'. */
145
+ type: 'in_set';
146
+ /** The expression whose value will be checked for membership in the set. */
147
+ value: Expression;
148
+ /** The set of values to check membership against. */
149
+ set: (string | number | boolean | null)[];
150
+ }
151
+
152
+ /**
153
+ * Represents an alias operation.
154
+ * This operation creates a new expression with a specified alias.
155
+ */
156
+ export interface AliasExpression {
157
+ /** The type of operation, always 'alias'. */
158
+ type: 'alias';
159
+ /** The expression to alias. */
160
+ value: Expression;
161
+ /** The alias name. */
162
+ name: string;
163
+ }
@@ -0,0 +1,59 @@
1
+ import type { Expression } from './base';
2
+
3
+ /**
4
+ * Represents a single "when" condition and its corresponding "then" result expression.
5
+ * Used within the WhenThenOtherwiseExpression.
6
+ */
7
+ export interface WhenThenClause {
8
+ /** The condition expression. Should evaluate to a boolean. */
9
+ when: Expression;
10
+ /** The result expression if the 'when' condition is true. */
11
+ then: Expression;
12
+ }
13
+
14
+ /**
15
+ * Represents a conditional expression that evaluates a series of "when"
16
+ * conditions and returns the corresponding "then" expression's value.
17
+ * If no "when" condition is met, it returns the value of the "otherwise" expression.
18
+ * This mimics Polars' when/then/otherwise functionality.
19
+ */
20
+ export interface WhenThenOtherwiseExpression {
21
+ /** The type of operation, always 'when_then_otherwise'. */
22
+ type: 'when_then_otherwise';
23
+ /** An array of "when/then" clauses to be evaluated in order. */
24
+ conditions: WhenThenClause[];
25
+ /** The expression whose value is returned if none of the "when" conditions are met. */
26
+ otherwise: Expression;
27
+ }
28
+
29
+ /**
30
+ * Represents a fill null operation.
31
+ * If the 'input' expression evaluates to null, the 'fillValue' expression is used.
32
+ * Otherwise, the 'input' expression's value is used.
33
+ * This is a convenience shortcut for a common pattern often implemented with
34
+ * conditional expressions (e.g., when(is_null(input), fillValue).otherwise(input)).
35
+ */
36
+ export interface FillNullExpression {
37
+ /** The type of operation, always 'fill_null'. */
38
+ type: 'fill_null';
39
+ /** The primary expression to evaluate. */
40
+ input: Expression;
41
+ /** The expression whose value is used if 'input' is null. */
42
+ fillValue: Expression;
43
+ }
44
+
45
+ /**
46
+ * Represents a fill NaN operation.
47
+ * If the 'input' expression evaluates to NaN, the 'fillValue' expression is used.
48
+ * Otherwise, the 'input' expression's value is used.
49
+ * This is a convenience shortcut for a common pattern often implemented with
50
+ * conditional expressions (e.g., when(is_nan(input), fillValue).otherwise(input)).
51
+ */
52
+ export interface FillNaNExpression {
53
+ /** The type of operation, always 'fill_nan'. */
54
+ type: 'fill_nan';
55
+ /** The primary expression to evaluate. */
56
+ input: Expression;
57
+ /** The expression whose value is used if 'input' is NaN. */
58
+ fillValue: Expression;
59
+ }
@@ -0,0 +1,51 @@
1
+ import type { Expression } from './base';
2
+
3
+ /** Defines the supported string distance metrics. */
4
+ export type StringDistanceMetric =
5
+ | 'levenshtein'
6
+ | 'optimal_string_alignment'
7
+ | 'jaro_winkler';
8
+
9
+ /**
10
+ * Represents a string distance/similarity calculation between two expressions.
11
+ * Computes metrics like Levenshtein, Optimal String Alignment, or Jaro-Winkler.
12
+ */
13
+ export interface StringDistanceExpression {
14
+ /** The type of operation, always 'string_distance'. */
15
+ type: 'string_distance';
16
+ /** The specific distance metric to use. */
17
+ metric: StringDistanceMetric;
18
+ /** The first string expression. */
19
+ string1: Expression;
20
+ /** The second string expression to compare against. */
21
+ string2: Expression;
22
+ /**
23
+ * If true, the expression returns a similarity score (typically normalized between 0 and 1).
24
+ * If false or undefined, it returns the raw edit distance (e.g., Levenshtein, OSA).
25
+ * Jaro-Winkler inherently returns a similarity score; this flag might be ignored or influence its normalization if applicable.
26
+ */
27
+ returnSimilarity?: boolean;
28
+ }
29
+
30
+ /** Defines the supported fuzzy string filter distance metrics. */
31
+ export type FuzzyFilterDistanceMetric = 'levenshtein' | 'hamming';
32
+
33
+ /**
34
+ * Represents a fuzzy string filter operation on an expression.
35
+ * This operation compares the string value of an expression (`value`)
36
+ * against another string or string expression (`pattern`) using a specified
37
+ * distance metric (`levenshtein` or `hamming`), returning true if the distance is
38
+ * within the specified `bound`.
39
+ */
40
+ export interface FuzzyStringFilterExpression {
41
+ /** The type of operation, always 'fuzzy_string_filter'. */
42
+ type: 'fuzzy_string_filter';
43
+ /** The distance metric to use for the fuzzy comparison. */
44
+ metric: FuzzyFilterDistanceMetric;
45
+ /** The expression whose string value will be compared. */
46
+ value: Expression;
47
+ /** The expression representing the string pattern to compare against. */
48
+ pattern: Expression;
49
+ /** The maximum allowed distance for a match (inclusive). */
50
+ bound: number;
51
+ }
@@ -0,0 +1,37 @@
1
+ import type { Expression } from './base';
2
+
3
+ /** Defines the supported hash types. Includes common cryptographic and non-cryptographic algorithms. */
4
+ export type HashType =
5
+ | 'sha256' // Cryptographic
6
+ | 'sha512' // Cryptographic
7
+ | 'md5' // Cryptographic (use with caution due to vulnerabilities)
8
+ | 'blake3' // Cryptographic
9
+ | 'wyhash' // Non-cryptographic
10
+ | 'xxh3'; // Non-cryptographic
11
+
12
+ /**
13
+ * Defines the encoding for the hash output.
14
+ * - 'hex': Standard hexadecimal encoding.
15
+ * - 'base64': Standard base64 encoding.
16
+ * - 'base64_alphanumeric': Base64 encoding with non-alphanumeric characters (e.g., '+', '/') removed.
17
+ * - 'base64_alphanumeric_upper': Base64 encoding with non-alphanumeric characters removed and the result converted to uppercase.
18
+ */
19
+ export type HashEncoding =
20
+ | 'hex'
21
+ | 'base64'
22
+ | 'base64_alphanumeric'
23
+ | 'base64_alphanumeric_upper';
24
+
25
+ /** Represents a hashing operation on an expression. */
26
+ export interface HashExpression {
27
+ /** The specific type of hash algorithm to apply. */
28
+ type: 'hash';
29
+ /** The type of hash algorithm to apply. */
30
+ hashType: HashType;
31
+ /** The encoding for the output hash string. */
32
+ encoding: HashEncoding;
33
+ /** The expression whose value will be hashed. */
34
+ value: Expression;
35
+ /** Optional. Minimal number of entropy bits required. Affects encoding, truncating the result to the shortest string with the requested entropy. No error if bits exceed what the hash offers. */
36
+ bits?: number;
37
+ }
@@ -0,0 +1,147 @@
1
+ export * from './base';
2
+ export * from './basics';
3
+ export * from './selectors';
4
+ export * from './string';
5
+ export * from './fuzzy';
6
+ export * from './conditional';
7
+ export * from './window';
8
+ export * from './hash';
9
+ export * from './struct';
10
+ export * from './pframes';
11
+
12
+ import type {
13
+ ComparisonExpression,
14
+ BinaryArithmeticExpression,
15
+ UnaryArithmeticExpression,
16
+ CastExpression,
17
+ BooleanLogicExpression,
18
+ NotExpression,
19
+ NullCheckExpression,
20
+ ColumnReferenceExpression,
21
+ AxisReferenceExpression,
22
+ ConstantValueExpression,
23
+ MinMaxExpression,
24
+ InSetExpression,
25
+ AliasExpression,
26
+ } from './basics';
27
+
28
+ import type {
29
+ AllSelectorExpression,
30
+ StringSelectorExpression,
31
+ NumericSelectorExpression,
32
+ IntegerSelectorExpression,
33
+ FloatSelectorExpression,
34
+ StartsWithSelectorExpression,
35
+ EndsWithSelectorExpression,
36
+ ContainsSelectorExpression,
37
+ MatchesSelectorExpression,
38
+ ExcludeSelectorExpression,
39
+ ByNameSelectorExpression,
40
+ AxisSelectorExpression,
41
+ NestedSelectorExpression,
42
+ SelectorComplementExpression,
43
+ SelectorUnionExpression,
44
+ SelectorIntersectionExpression,
45
+ SelectorDifferenceExpression,
46
+ SelectorSymmetricDifferenceExpression,
47
+ } from './selectors';
48
+
49
+ import type {
50
+ StringJoinExpression,
51
+ ExtendedUnaryStringExpression,
52
+ SubstringExpression,
53
+ StringReplaceExpression,
54
+ StringContainsExpression,
55
+ StringStartsWithExpression,
56
+ StringEndsWithExpression,
57
+ StringContainsAnyExpression,
58
+ StringCountMatchesExpression,
59
+ StringExtractExpression,
60
+ } from './string';
61
+
62
+ import type {
63
+ StringDistanceExpression,
64
+ FuzzyStringFilterExpression,
65
+ } from './fuzzy';
66
+
67
+ import type {
68
+ WhenThenOtherwiseExpression,
69
+ FillNullExpression,
70
+ FillNaNExpression,
71
+ } from './conditional';
72
+
73
+ import type {
74
+ RankExpression,
75
+ CumsumExpression,
76
+ WindowExpression,
77
+ } from './window';
78
+
79
+ import type { HashExpression } from './hash';
80
+ import type { StructFieldExpression } from './struct';
81
+ import type {
82
+ MatchesEcmaRegexExpression,
83
+ ContainsFuzzyMatchExpression,
84
+ ReplaceEcmaRegexExpression,
85
+ ExtractEcmaRegexExpression,
86
+ } from './pframes';
87
+
88
+ /**
89
+ * Represents all possible expression types in the system.
90
+ * This is the main union type that includes all concrete expression implementations.
91
+ */
92
+ export type Expression =
93
+ | ComparisonExpression
94
+ | BinaryArithmeticExpression
95
+ | UnaryArithmeticExpression
96
+ | CastExpression
97
+ | BooleanLogicExpression
98
+ | NotExpression
99
+ | NullCheckExpression
100
+ | StringJoinExpression
101
+ | HashExpression
102
+ | ColumnReferenceExpression
103
+ | AxisReferenceExpression
104
+ | ConstantValueExpression
105
+ | RankExpression
106
+ | CumsumExpression
107
+ | ExtendedUnaryStringExpression
108
+ | StringDistanceExpression
109
+ | FuzzyStringFilterExpression
110
+ | WhenThenOtherwiseExpression
111
+ | SubstringExpression
112
+ | StringReplaceExpression
113
+ | StringContainsExpression
114
+ | StringStartsWithExpression
115
+ | StringEndsWithExpression
116
+ | StringContainsAnyExpression
117
+ | StringCountMatchesExpression
118
+ | StringExtractExpression
119
+ | MinMaxExpression
120
+ | FillNullExpression
121
+ | FillNaNExpression
122
+ | WindowExpression
123
+ | StructFieldExpression
124
+ | MatchesEcmaRegexExpression
125
+ | ContainsFuzzyMatchExpression
126
+ | ReplaceEcmaRegexExpression
127
+ | ExtractEcmaRegexExpression
128
+ | InSetExpression
129
+ | AliasExpression
130
+ | AllSelectorExpression
131
+ | StringSelectorExpression
132
+ | NumericSelectorExpression
133
+ | IntegerSelectorExpression
134
+ | FloatSelectorExpression
135
+ | StartsWithSelectorExpression
136
+ | EndsWithSelectorExpression
137
+ | ContainsSelectorExpression
138
+ | MatchesSelectorExpression
139
+ | ExcludeSelectorExpression
140
+ | ByNameSelectorExpression
141
+ | AxisSelectorExpression
142
+ | NestedSelectorExpression
143
+ | SelectorComplementExpression
144
+ | SelectorUnionExpression
145
+ | SelectorIntersectionExpression
146
+ | SelectorDifferenceExpression
147
+ | SelectorSymmetricDifferenceExpression;