@platforma-sdk/workflow-tengo 1.8.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tengo/lib/pframes.util.lib.tengo +76 -54
- package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
- package/dist/tengo/tpl/exec.python.create-venv.plj.gz +0 -0
- package/dist/tengo/tpl/exec.python.install-deps.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.aggregate.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-single-pcolumn.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.import-dir.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.map-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
- package/dist/tengo/tpl/workdir.save.plj.gz +0 -0
- package/dist/tengo/tpl/workflow.build-ctx.plj.gz +0 -0
- package/package.json +2 -2
|
@@ -4,14 +4,6 @@ constants := import("@platforma-sdk/workflow-tengo:pframes.constants")
|
|
|
4
4
|
objects := import("@platforma-sdk/workflow-tengo:objects")
|
|
5
5
|
|
|
6
6
|
_PRE_PROCESS_STEP_SCHEMA := [`or`,
|
|
7
|
-
{
|
|
8
|
-
// Replace cell value with the first full RegEx match
|
|
9
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match
|
|
10
|
-
`type`: `string,regex=regexpExtract`,
|
|
11
|
-
// String representing ECMAScript RegEx
|
|
12
|
-
// If there are no or more than one matches - result would become NA
|
|
13
|
-
`pattern`: `string`
|
|
14
|
-
},
|
|
15
7
|
{
|
|
16
8
|
// Perform JS String.prototype.replace() operation
|
|
17
9
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
|
|
@@ -25,23 +17,58 @@ _PRE_PROCESS_STEP_SCHEMA := [`or`,
|
|
|
25
17
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement
|
|
26
18
|
// Empty string as result would become NA.
|
|
27
19
|
`replacement`: `string`
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
// Simplified 'regexpReplace' with replacement set to $1.
|
|
23
|
+
// This means that string is replaced with first capture group value.
|
|
24
|
+
// Example 1:
|
|
25
|
+
// - input: 123___abc.xlsx
|
|
26
|
+
// - pattern: \d+___([a-z]+).xlsx
|
|
27
|
+
// - result: abc
|
|
28
|
+
// Example 2:
|
|
29
|
+
// - input: 123___abc.xlsx
|
|
30
|
+
// - pattern: (\d+)___([a-z]+).xlsx
|
|
31
|
+
// - result: 123
|
|
32
|
+
// Example 3:
|
|
33
|
+
// - input: 123___abc.xlsx
|
|
34
|
+
// - pattern: ((\d+)___([a-z]+)).xlsx
|
|
35
|
+
// - result: 123___abc
|
|
36
|
+
`type`: `string,regex=regexpExtract`,
|
|
37
|
+
// String representing ECMAScript RegEx with at least one capturing group.
|
|
38
|
+
// RegEx must match the entire string, this would be enforced even when ^ and $ are skipped.
|
|
39
|
+
// If there are no matches - value would be replaced with empty string.
|
|
40
|
+
// Wrong example:
|
|
41
|
+
// - input: 123___abc.xlsx
|
|
42
|
+
// - pattern: (\d+___[a-z]+)
|
|
43
|
+
// - result: empty string, as .xlsx part is missing in pattern, so pattern was not matched
|
|
44
|
+
// Correct example:
|
|
45
|
+
// - input: 123___abc.xlsx
|
|
46
|
+
// - pattern: (\d+___[a-z]+).xlsx
|
|
47
|
+
// - result: 123___abc
|
|
48
|
+
`pattern`: `string`
|
|
28
49
|
}]
|
|
29
50
|
|
|
30
51
|
_SPEC_AXES_SCHEMA := {
|
|
31
52
|
// Column label from XSV
|
|
32
53
|
`column`: `string`,
|
|
33
|
-
//
|
|
54
|
+
// Regular expression, if matched - whole row would be skipped;
|
|
55
|
+
// Performed just after reading XSV before any other operations;
|
|
56
|
+
// default: no filter
|
|
57
|
+
`filterOutRegex,omitempty`: `string`,
|
|
58
|
+
// Pre-processing operations to be performed just after filtering out rows
|
|
34
59
|
`preProcess,omitempty`: [_PRE_PROCESS_STEP_SCHEMA],
|
|
60
|
+
// Regular expression, if matched - value is considered to be N/A;
|
|
61
|
+
// default: Int, Long - check that the value is a valid integer number;
|
|
62
|
+
// Float, Double - check that the value is a valid float number, not a NaN;
|
|
63
|
+
// String - accept anything;
|
|
64
|
+
`naRegex,omitempty`: `string`,
|
|
35
65
|
// Should the N/A values (or empty rows) be allowed;
|
|
36
66
|
// default: false
|
|
37
67
|
`allowNA,omitempty`: `bool`,
|
|
38
|
-
// Should the parsing error be interpreted as N/A;
|
|
39
|
-
// default: false
|
|
40
|
-
`parseErrorToNA,omitempty`: `bool`,
|
|
41
68
|
// Specification of the axis
|
|
42
69
|
`spec`: {
|
|
43
|
-
// Type of
|
|
44
|
-
`type`: `string,regex=Int|Long|Float|Double|String
|
|
70
|
+
// Type of axis values
|
|
71
|
+
`type`: `string,regex=Int|Long|Float|Double|String`,
|
|
45
72
|
// Name of the axis to be used in spec;
|
|
46
73
|
// default: column label
|
|
47
74
|
`name,omitempty`: `string`,
|
|
@@ -60,23 +87,27 @@ _SPEC_AXES_SCHEMA := {
|
|
|
60
87
|
_SPEC_COLUMN_SCHEMA := {
|
|
61
88
|
// Column label from XSV
|
|
62
89
|
`column`: `string`,
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
//
|
|
90
|
+
// Regular expression, if matched - whole row would be skipped;
|
|
91
|
+
// Performed just after reading XSV before any other operations;
|
|
92
|
+
// default: no filter
|
|
93
|
+
`filterOutRegex,omitempty`: `string`,
|
|
94
|
+
// Pre-processing operations to be performed just after filtering out rows
|
|
68
95
|
`preProcess,omitempty`: [_PRE_PROCESS_STEP_SCHEMA],
|
|
96
|
+
// Regular expression, if matched - value is considered to be N/A;
|
|
97
|
+
// default: Int, Long - check that the value is a valid integer number;
|
|
98
|
+
// Float, Double - check that the value is a valid float number, not a NaN;
|
|
99
|
+
// String - accept anything;
|
|
100
|
+
`naRegex,omitempty`: `string`,
|
|
69
101
|
// Should the N/A values (or empty rows) be allowed;
|
|
70
102
|
// default: true
|
|
71
103
|
`allowNA,omitempty`: `bool`,
|
|
72
|
-
//
|
|
73
|
-
// default:
|
|
74
|
-
`
|
|
104
|
+
// ID of the column to be used in spec and as a saved filename;
|
|
105
|
+
// default: column label with all special characters replaced with '_'
|
|
106
|
+
`id,omitempty`: `string`,
|
|
75
107
|
// Specification of the column
|
|
76
|
-
`spec
|
|
77
|
-
// Type of column values
|
|
78
|
-
|
|
79
|
-
`type,omitempty`: `string,regex=Int|Long|Float|Double|String|Bytes`,
|
|
108
|
+
`spec`: {
|
|
109
|
+
// Type of column values
|
|
110
|
+
`valueType`: `string,regex=Int|Long|Float|Double|String`,
|
|
80
111
|
// Name of the column to be used in spec;
|
|
81
112
|
// default: column label
|
|
82
113
|
`name,omitempty`: `string`,
|
|
@@ -107,42 +138,33 @@ _SPEC_INDEX_SCHEMA := {
|
|
|
107
138
|
}
|
|
108
139
|
|
|
109
140
|
PFCONV_IMPORT_CFG_SCHEMA := {
|
|
110
|
-
// Columns would be stored using specified format;
|
|
111
|
-
// default: Binary
|
|
112
|
-
`storageFormat,omitempty` : `string,regex=Binary|Json`,
|
|
113
|
-
// Partitioning key length;
|
|
114
|
-
// default: 0
|
|
115
|
-
`partitionKeyLength,omitempty` : `number`,
|
|
116
|
-
// XSV columns to use as PColumn axes, order of axes in resulting columns
|
|
117
|
-
// would match the order of spec entries provided here
|
|
118
|
-
`axes`: [_SPEC_AXES_SCHEMA],
|
|
119
|
-
// XSV columns to use as PColumn values, each exported individually
|
|
120
|
-
`columns`: [_SPEC_COLUMN_SCHEMA],
|
|
121
|
-
// Axis of type Int with XSV row numbers (would be the last one);
|
|
122
|
-
// default: do not create additional axis with indexes
|
|
123
|
-
`index,omitempty`: _SPEC_INDEX_SCHEMA,
|
|
124
|
-
// String representing NA values of types Int, Long, Float, Double;
|
|
125
|
-
// default: NaN
|
|
126
|
-
`naStr,omitempty`: `string`,
|
|
127
|
-
// String representing NA values of types String, Bytes;
|
|
128
|
-
// default: null
|
|
129
|
-
`nullStr,omitempty`: `string`,
|
|
130
141
|
// Single ASCII character to be used as separator;
|
|
131
142
|
// default: ',' for .csv, '\t' for .tsv
|
|
132
143
|
`separator,omitempty`: `string`,
|
|
133
|
-
// Interpret empty string as NA value;
|
|
134
|
-
// default: true
|
|
135
|
-
`emptyStrAsNA,omitempty`: `bool`,
|
|
136
|
-
// Prefix all column names with given string;
|
|
137
|
-
// default: names would be preserved
|
|
138
|
-
`columnNamePrefix,omitempty`: `string`,
|
|
139
144
|
// Resolve duplicates by adding sequential suffixes to column labels;
|
|
140
145
|
// default: true
|
|
141
146
|
`allowColumnLabelDuplicates,omitempty`: `bool`,
|
|
147
|
+
// XSV columns to use as PColumn axes, order of axes in resulting columns
|
|
148
|
+
// would match the order of spec entries provided here
|
|
149
|
+
`axes`: [_SPEC_AXES_SCHEMA],
|
|
150
|
+
// Axis of type Long with XSV row numbers (would be the last one);
|
|
151
|
+
// default: do not create additional axis with indexes
|
|
152
|
+
`index,omitempty`: _SPEC_INDEX_SCHEMA,
|
|
153
|
+
// XSV columns to use as PColumn values, each exported individually
|
|
154
|
+
`columns`: [_SPEC_COLUMN_SCHEMA],
|
|
142
155
|
// When columns spec is provided but no such column was found in XSV - create such column
|
|
143
156
|
// filled with NA values instead of failing;
|
|
144
157
|
// default: false
|
|
145
|
-
`allowArtificialColumns,omitempty`: `bool
|
|
158
|
+
`allowArtificialColumns,omitempty`: `bool`,
|
|
159
|
+
// Prefix all column names with given string;
|
|
160
|
+
// default: names would be preserved
|
|
161
|
+
`columnNamePrefix,omitempty`: `string`,
|
|
162
|
+
// Columns would be stored using specified format;
|
|
163
|
+
// default: Binary
|
|
164
|
+
`storageFormat,omitempty` : `string,regex=Binary|Json`,
|
|
165
|
+
// Partitioning key length;
|
|
166
|
+
// default: 0
|
|
167
|
+
`partitionKeyLength,omitempty` : `number`
|
|
146
168
|
}
|
|
147
169
|
|
|
148
170
|
_COLUMN_FILTER_SCHEMA := {
|
|
@@ -179,7 +201,7 @@ PFCONV_EXPORT_CFG_SCHEMA := {
|
|
|
179
201
|
// During export, columns with equal axes specifications would be joined into single table
|
|
180
202
|
// using the join type specified;
|
|
181
203
|
// default: Full
|
|
182
|
-
`joinType,omitempty
|
|
204
|
+
`joinType,omitempty`: `string,regex=Full|Inner`
|
|
183
205
|
}
|
|
184
206
|
|
|
185
207
|
/**
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/workflow-tengo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Tengo SDK library",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"./dist/**/*"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@milaboratories/software-pframes-conv": "
|
|
19
|
+
"@milaboratories/software-pframes-conv": "2.0.1",
|
|
20
20
|
"@platforma-open/milaboratories.software-small-binaries": "^1.14.5"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|