@platforma-open/milaboratories.software-ptabler.schema 1.11.4 → 1.11.5
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.
|
@@ -16,10 +16,10 @@ import type { WhenThenOtherwiseExpression, FillNullExpression, FillNaNExpression
|
|
|
16
16
|
import type { RankExpression, CumsumExpression, WindowExpression } from './window';
|
|
17
17
|
import type { HashExpression } from './hash';
|
|
18
18
|
import type { StructFieldExpression } from './struct';
|
|
19
|
-
import type { MatchesEcmaRegexExpression, ContainsFuzzyMatchExpression } from './pframes';
|
|
19
|
+
import type { MatchesEcmaRegexExpression, ContainsFuzzyMatchExpression, ReplaceEcmaRegexExpression, ExtractEcmaRegexExpression } from './pframes';
|
|
20
20
|
/**
|
|
21
21
|
* Represents all possible expression types in the system.
|
|
22
22
|
* This is the main union type that includes all concrete expression implementations.
|
|
23
23
|
*/
|
|
24
|
-
export type Expression = ComparisonExpression | BinaryArithmeticExpression | UnaryArithmeticExpression | CastExpression | BooleanLogicExpression | NotExpression | NullCheckExpression | StringJoinExpression | HashExpression | ColumnReferenceExpression | AxisReferenceExpression | ConstantValueExpression | RankExpression | CumsumExpression | ExtendedUnaryStringExpression | StringDistanceExpression | FuzzyStringFilterExpression | WhenThenOtherwiseExpression | SubstringExpression | StringReplaceExpression | StringContainsExpression | StringStartsWithExpression | StringEndsWithExpression | StringContainsAnyExpression | StringCountMatchesExpression | StringExtractExpression | MinMaxExpression | FillNullExpression | FillNaNExpression | WindowExpression | StructFieldExpression | MatchesEcmaRegexExpression | ContainsFuzzyMatchExpression | InSetExpression | AliasExpression | AllSelectorExpression | StringSelectorExpression | NumericSelectorExpression | IntegerSelectorExpression | FloatSelectorExpression | StartsWithSelectorExpression | EndsWithSelectorExpression | ContainsSelectorExpression | MatchesSelectorExpression | ExcludeSelectorExpression | ByNameSelectorExpression | AxisSelectorExpression | NestedSelectorExpression | SelectorComplementExpression | SelectorUnionExpression | SelectorIntersectionExpression | SelectorDifferenceExpression | SelectorSymmetricDifferenceExpression;
|
|
24
|
+
export type Expression = ComparisonExpression | BinaryArithmeticExpression | UnaryArithmeticExpression | CastExpression | BooleanLogicExpression | NotExpression | NullCheckExpression | StringJoinExpression | HashExpression | ColumnReferenceExpression | AxisReferenceExpression | ConstantValueExpression | RankExpression | CumsumExpression | ExtendedUnaryStringExpression | StringDistanceExpression | FuzzyStringFilterExpression | WhenThenOtherwiseExpression | SubstringExpression | StringReplaceExpression | StringContainsExpression | StringStartsWithExpression | StringEndsWithExpression | StringContainsAnyExpression | StringCountMatchesExpression | StringExtractExpression | MinMaxExpression | FillNullExpression | FillNaNExpression | WindowExpression | StructFieldExpression | MatchesEcmaRegexExpression | ContainsFuzzyMatchExpression | ReplaceEcmaRegexExpression | ExtractEcmaRegexExpression | InSetExpression | AliasExpression | AllSelectorExpression | StringSelectorExpression | NumericSelectorExpression | IntegerSelectorExpression | FloatSelectorExpression | StartsWithSelectorExpression | EndsWithSelectorExpression | ContainsSelectorExpression | MatchesSelectorExpression | ExcludeSelectorExpression | ByNameSelectorExpression | AxisSelectorExpression | NestedSelectorExpression | SelectorComplementExpression | SelectorUnionExpression | SelectorIntersectionExpression | SelectorDifferenceExpression | SelectorSymmetricDifferenceExpression;
|
|
25
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expressions/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAE1B,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,8BAA8B,EAC9B,4BAA4B,EAC5B,qCAAqC,EACtC,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EACV,oBAAoB,EACpB,6BAA6B,EAC7B,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EACV,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EACV,2BAA2B,EAC3B,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expressions/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc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0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,WAAW,CAAC;AAEnB;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,oBAAoB,GACpB,0BAA0B,GAC1B,yBAAyB,GACzB,cAAc,GACd,sBAAsB,GACtB,aAAa,GACb,mBAAmB,GACnB,oBAAoB,GACpB,cAAc,GACd,yBAAyB,GACzB,uBAAuB,GACvB,uBAAuB,GACvB,cAAc,GACd,gBAAgB,GAChB,6BAA6B,GAC7B,wBAAwB,GACxB,2BAA2B,GAC3B,2BAA2B,GAC3B,mBAAmB,GACnB,uBAAuB,GACvB,wBAAwB,GACxB,0BAA0B,GAC1B,wBAAwB,GACxB,2BAA2B,GAC3B,4BAA4B,GAC5B,uBAAuB,GACvB,gBAAgB,GAChB,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,qBAAqB,GACrB,0BAA0B,GAC1B,4BAA4B,GAC5B,0BAA0B,GAC1B,0BAA0B,GAC1B,eAAe,GACf,eAAe,GACf,qBAAqB,GACrB,wBAAwB,GACxB,yBAAyB,GACzB,yBAAyB,GACzB,uBAAuB,GACvB,4BAA4B,GAC5B,0BAA0B,GAC1B,0BAA0B,GAC1B,yBAAyB,GACzB,yBAAyB,GACzB,wBAAwB,GACxB,sBAAsB,GACtB,wBAAwB,GACxB,4BAA4B,GAC5B,uBAAuB,GACvB,8BAA8B,GAC9B,4BAA4B,GAC5B,qCAAqC,CAAC"}
|
|
@@ -31,4 +31,85 @@ export interface ContainsFuzzyMatchExpression {
|
|
|
31
31
|
/** If true, only substitutions are allowed (deletions and insertions are also allowed by default). */
|
|
32
32
|
substitutions_only?: boolean;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Represents a regex replacement operation using ECMAScript regular expressions.
|
|
36
|
+
* Performs JavaScript String.prototype.replace() operation.
|
|
37
|
+
*
|
|
38
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* Input: "result.POIS_P001_W104_PBMC_2.clns"
|
|
42
|
+
* Pattern: "^.*(P\\d+)_(W\\d+).*$"
|
|
43
|
+
* Replacement: "$2-$1"
|
|
44
|
+
* Result: "W104-P001"
|
|
45
|
+
*/
|
|
46
|
+
export interface ReplaceEcmaRegexExpression {
|
|
47
|
+
/** The type of operation, always 'replace_ecma_regex'. */
|
|
48
|
+
type: 'replace_ecma_regex';
|
|
49
|
+
/** The string expression whose value will be replaced. */
|
|
50
|
+
value: Expression;
|
|
51
|
+
/**
|
|
52
|
+
* String representing ECMAScript RegEx with at least one capturing group.
|
|
53
|
+
* If you need to reorder capturing groups - use RegExp matching the whole string
|
|
54
|
+
* (must start with string begin anchor ^, end with string end anchor $).
|
|
55
|
+
* Use regex playground https://regexr.com/ to test your ideas.
|
|
56
|
+
*/
|
|
57
|
+
ecma_regex: string;
|
|
58
|
+
/**
|
|
59
|
+
* Replacement pattern used to construct result string from captured groups.
|
|
60
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement
|
|
61
|
+
* Empty string as result would become NA.
|
|
62
|
+
*/
|
|
63
|
+
replacement: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Represents a regex extraction operation using ECMAScript regular expressions.
|
|
67
|
+
* Simplified 'regexpReplace' with replacement set to $1.
|
|
68
|
+
* This means that string is replaced with first capture group value.
|
|
69
|
+
*
|
|
70
|
+
* RegEx must match the entire string, this would be enforced even when ^ and $ are skipped.
|
|
71
|
+
* If there are no matches - value would be replaced with empty string.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // Example 1:
|
|
75
|
+
* Input: "123___abc.xlsx"
|
|
76
|
+
* Pattern: "\\d+___([a-z]+).xlsx"
|
|
77
|
+
* Result: "abc"
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* // Example 2:
|
|
81
|
+
* Input: "123___abc.xlsx"
|
|
82
|
+
* Pattern: "(\\d+)___([a-z]+).xlsx"
|
|
83
|
+
* Result: "123"
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* // Example 3:
|
|
87
|
+
* Input: "123___abc.xlsx"
|
|
88
|
+
* Pattern: "((\\d+)___([a-z]+)).xlsx"
|
|
89
|
+
* Result: "123___abc"
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* // Wrong example (pattern doesn't match entire string):
|
|
93
|
+
* Input: "123___abc.xlsx"
|
|
94
|
+
* Pattern: "(\\d+___[a-z]+)"
|
|
95
|
+
* Result: "" (empty string, as .xlsx part is missing in pattern, so pattern was not matched)
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* // Correct example:
|
|
99
|
+
* Input: "123___abc.xlsx"
|
|
100
|
+
* Pattern: "(\\d+___[a-z]+).xlsx"
|
|
101
|
+
* Result: "123___abc"
|
|
102
|
+
*/
|
|
103
|
+
export interface ExtractEcmaRegexExpression {
|
|
104
|
+
/** The type of operation, always 'extract_ecma_regex'. */
|
|
105
|
+
type: 'extract_ecma_regex';
|
|
106
|
+
/** The string expression whose value will be extracted. */
|
|
107
|
+
value: Expression;
|
|
108
|
+
/**
|
|
109
|
+
* String representing ECMAScript RegEx with at least one capturing group.
|
|
110
|
+
* RegEx must match the entire string, this would be enforced even when ^ and $ are skipped.
|
|
111
|
+
* If there are no matches - value would be replaced with empty string.
|
|
112
|
+
*/
|
|
113
|
+
ecma_regex: string;
|
|
114
|
+
}
|
|
34
115
|
//# sourceMappingURL=pframes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pframes.d.ts","sourceRoot":"","sources":["../../src/expressions/pframes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,0DAA0D;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C;IAC3B,0DAA0D;IAC1D,KAAK,EAAE,UAAU,CAAC;IAClB;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,WAAW,0BAA0B;IACzC,0DAA0D;IAC1D,IAAI,EAAE,oBAAoB,CAAC;IAC3B,2DAA2D;IAC3D,KAAK,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-open/milaboratories.software-ptabler.schema",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.5",
|
|
4
4
|
"description": "Type definitions for PTabler",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"eslint": "^9.25.1",
|
|
24
24
|
"typescript": "~5.6.3",
|
|
25
|
-
"@milaboratories/ts-configs": "1.0.6",
|
|
26
25
|
"@milaboratories/ts-builder": "1.0.5",
|
|
26
|
+
"@milaboratories/ts-configs": "1.0.6",
|
|
27
27
|
"@platforma-sdk/eslint-config": "1.1.0"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
package/src/expressions/index.ts
CHANGED
|
@@ -81,6 +81,8 @@ import type { StructFieldExpression } from './struct';
|
|
|
81
81
|
import type {
|
|
82
82
|
MatchesEcmaRegexExpression,
|
|
83
83
|
ContainsFuzzyMatchExpression,
|
|
84
|
+
ReplaceEcmaRegexExpression,
|
|
85
|
+
ExtractEcmaRegexExpression,
|
|
84
86
|
} from './pframes';
|
|
85
87
|
|
|
86
88
|
/**
|
|
@@ -121,6 +123,8 @@ export type Expression =
|
|
|
121
123
|
| StructFieldExpression
|
|
122
124
|
| MatchesEcmaRegexExpression
|
|
123
125
|
| ContainsFuzzyMatchExpression
|
|
126
|
+
| ReplaceEcmaRegexExpression
|
|
127
|
+
| ExtractEcmaRegexExpression
|
|
124
128
|
| InSetExpression
|
|
125
129
|
| AliasExpression
|
|
126
130
|
| AllSelectorExpression
|
|
@@ -33,3 +33,86 @@ export interface ContainsFuzzyMatchExpression {
|
|
|
33
33
|
/** If true, only substitutions are allowed (deletions and insertions are also allowed by default). */
|
|
34
34
|
substitutions_only?: boolean;
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Represents a regex replacement operation using ECMAScript regular expressions.
|
|
39
|
+
* Performs JavaScript String.prototype.replace() operation.
|
|
40
|
+
*
|
|
41
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* Input: "result.POIS_P001_W104_PBMC_2.clns"
|
|
45
|
+
* Pattern: "^.*(P\\d+)_(W\\d+).*$"
|
|
46
|
+
* Replacement: "$2-$1"
|
|
47
|
+
* Result: "W104-P001"
|
|
48
|
+
*/
|
|
49
|
+
export interface ReplaceEcmaRegexExpression {
|
|
50
|
+
/** The type of operation, always 'replace_ecma_regex'. */
|
|
51
|
+
type: 'replace_ecma_regex';
|
|
52
|
+
/** The string expression whose value will be replaced. */
|
|
53
|
+
value: Expression;
|
|
54
|
+
/**
|
|
55
|
+
* String representing ECMAScript RegEx with at least one capturing group.
|
|
56
|
+
* If you need to reorder capturing groups - use RegExp matching the whole string
|
|
57
|
+
* (must start with string begin anchor ^, end with string end anchor $).
|
|
58
|
+
* Use regex playground https://regexr.com/ to test your ideas.
|
|
59
|
+
*/
|
|
60
|
+
ecma_regex: string;
|
|
61
|
+
/**
|
|
62
|
+
* Replacement pattern used to construct result string from captured groups.
|
|
63
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement
|
|
64
|
+
* Empty string as result would become NA.
|
|
65
|
+
*/
|
|
66
|
+
replacement: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Represents a regex extraction operation using ECMAScript regular expressions.
|
|
71
|
+
* Simplified 'regexpReplace' with replacement set to $1.
|
|
72
|
+
* This means that string is replaced with first capture group value.
|
|
73
|
+
*
|
|
74
|
+
* RegEx must match the entire string, this would be enforced even when ^ and $ are skipped.
|
|
75
|
+
* If there are no matches - value would be replaced with empty string.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // Example 1:
|
|
79
|
+
* Input: "123___abc.xlsx"
|
|
80
|
+
* Pattern: "\\d+___([a-z]+).xlsx"
|
|
81
|
+
* Result: "abc"
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* // Example 2:
|
|
85
|
+
* Input: "123___abc.xlsx"
|
|
86
|
+
* Pattern: "(\\d+)___([a-z]+).xlsx"
|
|
87
|
+
* Result: "123"
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* // Example 3:
|
|
91
|
+
* Input: "123___abc.xlsx"
|
|
92
|
+
* Pattern: "((\\d+)___([a-z]+)).xlsx"
|
|
93
|
+
* Result: "123___abc"
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* // Wrong example (pattern doesn't match entire string):
|
|
97
|
+
* Input: "123___abc.xlsx"
|
|
98
|
+
* Pattern: "(\\d+___[a-z]+)"
|
|
99
|
+
* Result: "" (empty string, as .xlsx part is missing in pattern, so pattern was not matched)
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* // Correct example:
|
|
103
|
+
* Input: "123___abc.xlsx"
|
|
104
|
+
* Pattern: "(\\d+___[a-z]+).xlsx"
|
|
105
|
+
* Result: "123___abc"
|
|
106
|
+
*/
|
|
107
|
+
export interface ExtractEcmaRegexExpression {
|
|
108
|
+
/** The type of operation, always 'extract_ecma_regex'. */
|
|
109
|
+
type: 'extract_ecma_regex';
|
|
110
|
+
/** The string expression whose value will be extracted. */
|
|
111
|
+
value: Expression;
|
|
112
|
+
/**
|
|
113
|
+
* String representing ECMAScript RegEx with at least one capturing group.
|
|
114
|
+
* RegEx must match the entire string, this would be enforced even when ^ and $ are skipped.
|
|
115
|
+
* If there are no matches - value would be replaced with empty string.
|
|
116
|
+
*/
|
|
117
|
+
ecma_regex: string;
|
|
118
|
+
}
|