@platforma-sdk/workflow-tengo 2.13.6 → 2.15.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.
Files changed (80) hide show
  1. package/README.md +17 -1
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +4 -1
  4. package/dist/index.mjs +4 -1
  5. package/dist/tengo/lib/assets.lib.tengo +28 -28
  6. package/dist/tengo/lib/assets.swinfo.lib.tengo +24 -24
  7. package/dist/tengo/lib/constants.lib.tengo +6 -3
  8. package/dist/tengo/lib/exec.R.internal.lib.tengo +2 -2
  9. package/dist/tengo/lib/exec.R.lib.tengo +41 -41
  10. package/dist/tengo/lib/exec.descriptor.lib.tengo +3 -3
  11. package/dist/tengo/lib/exec.internal.lib.tengo +41 -41
  12. package/dist/tengo/lib/exec.lib.tengo +289 -289
  13. package/dist/tengo/lib/exec.limits.lib.tengo +49 -49
  14. package/dist/tengo/lib/exec.monetization.lib.tengo +1 -1
  15. package/dist/tengo/lib/exec.monetization_internal.lib.tengo +38 -38
  16. package/dist/tengo/lib/exec.package.lib.tengo +53 -53
  17. package/dist/tengo/lib/exec.python.internal.lib.tengo +1 -1
  18. package/dist/tengo/lib/exec.python.lib.tengo +37 -37
  19. package/dist/tengo/lib/exec.runcmd.lib.tengo +138 -138
  20. package/dist/tengo/lib/exec.runenv.lib.tengo +18 -18
  21. package/dist/tengo/lib/exec.stream.lib.tengo +25 -25
  22. package/dist/tengo/lib/feats.lib.tengo +3 -3
  23. package/dist/tengo/lib/file.internal.lib.tengo +31 -31
  24. package/dist/tengo/lib/file.lib.tengo +29 -29
  25. package/dist/tengo/lib/ll.get-future-field-default.lib.tengo +137 -0
  26. package/dist/tengo/lib/ll.lib.tengo +129 -129
  27. package/dist/tengo/lib/maps.lib.tengo +38 -38
  28. package/dist/tengo/lib/objects.lib.tengo +6 -6
  29. package/dist/tengo/lib/oop.lib.tengo +11 -11
  30. package/dist/tengo/lib/path.lib.tengo +60 -60
  31. package/dist/tengo/lib/pframes.builder.lib.tengo +3 -3
  32. package/dist/tengo/lib/pframes.constants.lib.tengo +20 -20
  33. package/dist/tengo/lib/pframes.export-pcolumn.lib.tengo +5 -5
  34. package/dist/tengo/lib/pframes.lib.tengo +206 -198
  35. package/dist/tengo/lib/pframes.ll.lib.tengo +59 -59
  36. package/dist/tengo/lib/pframes.pcolumn.lib.tengo +18 -18
  37. package/dist/tengo/lib/pframes.remove-nulls.lib.tengo +36 -0
  38. package/dist/tengo/lib/pframes.spec.lib.tengo +83 -83
  39. package/dist/tengo/lib/pframes.util.lib.tengo +176 -176
  40. package/dist/tengo/lib/pframes.xsv-import-file.lib.tengo +160 -0
  41. package/dist/tengo/lib/pframes.xsv.lib.tengo +84 -167
  42. package/dist/tengo/lib/render.lib.tengo +100 -45
  43. package/dist/tengo/lib/sets.lib.tengo +44 -44
  44. package/dist/tengo/lib/slices.lib.tengo +126 -126
  45. package/dist/tengo/lib/smart.lib.tengo +654 -507
  46. package/dist/tengo/lib/test.lib.tengo +120 -120
  47. package/dist/tengo/lib/tpl.lib.tengo +206 -170
  48. package/dist/tengo/lib/tpl.state-await.lib.tengo +17 -17
  49. package/dist/tengo/lib/tpl.util.lib.tengo +5 -5
  50. package/dist/tengo/lib/units.lib.tengo +2 -2
  51. package/dist/tengo/lib/validation.lib.tengo +130 -130
  52. package/dist/tengo/lib/waiter.lib.tengo +59 -0
  53. package/dist/tengo/lib/workdir.lib.tengo +126 -126
  54. package/dist/tengo/lib/workdir.proc.lib.tengo +47 -47
  55. package/dist/tengo/lib/workdir.save.lib.tengo +53 -53
  56. package/dist/tengo/lib/workflow.bobject.lib.tengo +11 -11
  57. package/dist/tengo/lib/workflow.bquery.lib.tengo +40 -40
  58. package/dist/tengo/lib/workflow.constants.lib.tengo +1 -1
  59. package/dist/tengo/lib/workflow.context.lib.tengo +16 -16
  60. package/dist/tengo/lib/workflow.lib.tengo +76 -76
  61. package/dist/tengo/tpl/exec.R.create-renv.plj.gz +0 -0
  62. package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
  63. package/dist/tengo/tpl/exec.monetization_to_json.plj.gz +0 -0
  64. package/dist/tengo/tpl/exec.python.create-venv.plj.gz +0 -0
  65. package/dist/tengo/tpl/exec.python.install-deps.plj.gz +0 -0
  66. package/dist/tengo/tpl/ll.get-field.plj.gz +0 -0
  67. package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
  68. package/dist/tengo/tpl/pframes.export-pframe.plj.gz +0 -0
  69. package/dist/tengo/tpl/pframes.export-single-pcolumn.plj.gz +0 -0
  70. package/dist/tengo/tpl/pframes.import-dir.plj.gz +0 -0
  71. package/dist/tengo/tpl/pframes.process-pcolumn-data.plj.gz +0 -0
  72. package/dist/tengo/tpl/pframes.remove-nulls.plj.gz +0 -0
  73. package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
  74. package/dist/tengo/tpl/pframes.xsv-import-if-not-null.plj.gz +0 -0
  75. package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
  76. package/dist/tengo/tpl/waiter.waiter.plj.gz +0 -0
  77. package/dist/tengo/tpl/workdir.save.plj.gz +0 -0
  78. package/dist/tengo/tpl/workflow.build-ctx.plj.gz +0 -0
  79. package/package.json +2 -2
  80. package/dist/tengo/tpl/pframes.map-pframe.plj.gz +0 -0
@@ -5,219 +5,219 @@ slices := import("@platforma-sdk/workflow-tengo:slices")
5
5
 
6
6
  _PRE_PROCESS_STEP_SCHEMA := [`or`,
7
7
  {
8
- // Perform JS String.prototype.replace() operation
9
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
8
+
9
+
10
10
  `type`: `string,regex=regexpReplace`,
11
- // String representing ECMAScript RegEx with at least one capturing group.
12
- // If you need to reorder capturing groups - use RegExp matching the whole string
13
- // (must start with string begin anchor ^, end with string end anchor $).
14
- // Use regex playground https://regexr.com/ to test your ideas.
11
+
12
+
13
+
14
+
15
15
  `pattern`: `string`,
16
- // Replacement pattern used to construct result string from captured groups
17
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement
18
- // Empty string as result would become NA.
16
+
17
+
18
+
19
19
  `replacement`: `string`
20
20
  },
21
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
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
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
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
48
  `pattern`: `string`
49
49
  }]
50
50
 
51
51
  _SPEC_AXES_SCHEMA := {
52
- // Column label from XSV
52
+
53
53
  `column`: `string`,
54
- // Regular expression, if matched - whole row would be skipped;
55
- // Performed just after reading XSV before any other operations;
56
- // default: no filter
54
+
55
+
56
+
57
57
  `filterOutRegex,?`: `string`,
58
- // Pre-processing operations to be performed just after filtering out rows
58
+
59
59
  `preProcess,?`: [_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;
60
+
61
+
62
+
63
+
64
64
  `naRegex,?`: `string`,
65
- // Should the N/A values (or empty rows) be allowed; When set to false,
66
- // an error would be thrown on N/A value (or empty row) encountering;
67
- // default: false
65
+
66
+
67
+
68
68
  `allowNA,?`: `bool`,
69
- // Specification of the axis
69
+
70
70
  `spec`: {
71
- // Type of axis values
71
+
72
72
  `type`: `string,regex=Int|Long|Float|Double|String`,
73
- // Name of the axis to be used in spec;
74
- // default: column label
73
+
74
+
75
75
  `name,?`: `string`,
76
- // Auxiliary information to the axis name, type and parents to form a unique identifier;
77
- // default: empty
76
+
77
+
78
78
  `domain,?`: { any: `string` },
79
- // Any additional information attached to the axis that does not affect its identifier;
80
- // default: "pl7.app/label": Column label from XSV
79
+
80
+
81
81
  `annotations,?`: { any: `string` },
82
- // A list of zero-based indices of parent axes in the overall axes specification;
83
- // default: empty
82
+
83
+
84
84
  `parentAxes,?`: [`number`]
85
85
  }
86
86
  }
87
87
 
88
88
  _SPEC_COLUMN_SCHEMA := {
89
- // Column label from XSV
89
+
90
90
  `column`: `string`,
91
- // Regular expression, if matched - whole row would be skipped;
92
- // Performed just after reading XSV before any other operations;
93
- // default: no filter
91
+
92
+
93
+
94
94
  `filterOutRegex,?`: `string`,
95
- // Pre-processing operations to be performed just after filtering out rows
95
+
96
96
  `preProcess,?`: [_PRE_PROCESS_STEP_SCHEMA],
97
- // Regular expression, if matched - value is considered to be N/A;
98
- // default: Int, Long - check that the value is a valid integer number;
99
- // Float, Double - check that the value is a valid float number, not a NaN;
100
- // String - accept anything;
97
+
98
+
99
+
100
+
101
101
  `naRegex,?`: `string`,
102
- // Should the N/A values (or empty rows) be allowed; When set to false,
103
- // an error would be thrown on N/A value (or empty row) encountering;
104
- // default: true
102
+
103
+
104
+
105
105
  `allowNA,?`: `bool`,
106
- // ID of the column to be used in spec and as a saved filename;
107
- // default: column label with all special characters replaced with '_'
106
+
107
+
108
108
  `id,?`: `string`,
109
- // Specification of the column
109
+
110
110
  `spec`: {
111
- // Type of column values
111
+
112
112
  `valueType`: `string,regex=Int|Long|Float|Double|String`,
113
- // Name of the column to be used in spec;
114
- // default: column label
113
+
114
+
115
115
  `name,?`: `string`,
116
- // Auxiliary information to the column name, type and parents to form a unique identifier;
117
- // default: empty
116
+
117
+
118
118
  `domain,?`: { any: `string` },
119
- // Any additional information attached to the axis that does not affect its identifier;
120
- // default: "pl7.app/label": Column label from XSV
119
+
120
+
121
121
  `annotations,?`: { any: `string` },
122
- // A list of zero-based indices of parent axes in the overall axes specification;
123
- // default: empty
122
+
123
+
124
124
  `parentAxes,?`: [ `number` ]
125
125
  }
126
126
  }
127
127
 
128
128
  _SPEC_INDEX_SCHEMA := {
129
- // Name of the axis
129
+
130
130
  `name`: `string`,
131
- // Auxiliary information to the column name, type and parents to form a unique identifier;
132
- // default: empty
131
+
132
+
133
133
  `domain,?`: { any: `string` },
134
- // Any additional information attached to the axis that does not affect its identifier;
135
- // default: "pl7.app/label": name
134
+
135
+
136
136
  `annotations,?`: { any: `string` },
137
- // A list of zero-based indices of parent axes in the overall axes specification;
138
- // default: empty
137
+
138
+
139
139
  `parentAxes,?`: [`number`]
140
140
  }
141
141
 
142
142
  PFCONV_IMPORT_CFG_SCHEMA := {
143
- // Single ASCII character to be used as separator;
144
- // default: ',' for .csv, '\t' for .tsv
143
+
144
+
145
145
  `separator,?`: `string`,
146
- // Single ASCII character, if XSV row begins with this character - the row would be skipped;
147
- // default: error is thrown if comment lines are found in document
146
+
147
+
148
148
  `commentLinePrefix,?`: `string`,
149
- // Should empty lines be skipped;
150
- // default: false
149
+
150
+
151
151
  `skipEmptyLines,?`: `bool`,
152
- // Resolve duplicates by adding sequential suffixes to column labels;
153
- // default: true
152
+
153
+
154
154
  `allowColumnLabelDuplicates,?`: `bool`,
155
- // XSV columns to use as PColumn axes, order of axes in resulting columns
156
- // would match the order of spec entries provided here
155
+
156
+
157
157
  `axes`: [_SPEC_AXES_SCHEMA],
158
- // Axis of type Long with XSV row numbers (would be the last one);
159
- // default: do not create additional axis with indexes
158
+
159
+
160
160
  `index,?`: _SPEC_INDEX_SCHEMA,
161
- // XSV columns to use as PColumn values, each exported individually
161
+
162
162
  `columns`: [_SPEC_COLUMN_SCHEMA],
163
- // When columns spec is provided but no such column was found in XSV - create such column
164
- // filled with NA values instead of failing;
165
- // default: false
163
+
164
+
165
+
166
166
  `allowArtificialColumns,?`: `bool`,
167
- // Prefix all column names with given string;
168
- // default: names would be preserved
167
+
168
+
169
169
  `columnNamePrefix,?`: `string`,
170
- // Columns would be stored using specified format;
171
- // default: Binary
170
+
171
+
172
172
  `storageFormat,?` : `string,regex=Binary|Json`,
173
- // Partitioning key length;
174
- // default: 0
173
+
174
+
175
175
  `partitionKeyLength,?` : `number`
176
176
  }
177
177
 
178
178
  _COLUMN_FILTER_SCHEMA := {
179
- // Match any of the types listed here;
180
- // default: type is ignored during matching
179
+
180
+
181
181
  `type,?`: `string,regex=Int|Long|Float|Double|String|Bytes`,
182
- // Match any of the names listed here;
183
- // default: name is ignored during matching
182
+
183
+
184
184
  `name,?`: `string`,
185
- // Match requires all the listed domains to have provided values;
186
- // default: no domain equality checks are performed during matching
185
+
186
+
187
187
  `domainValue,?`: { any: `string` },
188
- // Match requires all the listed annotations to have provided values;
189
- // default: no annotation equality checks are performed during matching
188
+
189
+
190
190
  `annotationValue,?`: { any: `string` },
191
- // Match requires all the listed annotations to match provided regex patterns;
192
- // default: no annotation pattern matching is performed during matching
191
+
192
+
193
193
  `annotationPattern,?`: { any: `string` }
194
194
  }
195
195
 
196
196
  PFCONV_EXPORT_CFG_SCHEMA := {
197
- // String representing NA values of types Int, Long, Float, Double;
198
- // default: NaN
197
+
198
+
199
199
  `naStr,?`: `string`,
200
- // String representing NA and missing values of types String, Bytes;
201
- // default: null
200
+
201
+
202
202
  `nullStr,?`: `string`,
203
- // Toggle to export or skip axes and columns of type Bytes;
204
- // default: false
203
+
204
+
205
205
  `exportBytes,?`: `bool`,
206
- // Single ASCII character to be used as separator;
207
- // default: ',' for .csv, '\t' for .tsv
206
+
207
+
208
208
  `separator,?`: `string`,
209
- // Only columns matching the selector are exported;
210
- // default: all columns are exported
209
+
210
+
211
211
  `columnSelector,?`: [_COLUMN_FILTER_SCHEMA],
212
- // During export, columns with equal axes specifications would be joined into single table
213
- // using the join type specified;
214
- // default: Full
212
+
213
+
214
+
215
215
  `joinType,?`: `string,regex=Full|Inner`
216
216
  }
217
217
 
218
- /**
219
- * Get column id from the column spec
220
- */
218
+
219
+
220
+
221
221
  xsvColumnId := func(c) {
222
222
  id := c.id
223
223
  if is_undefined(id) {
@@ -226,9 +226,9 @@ xsvColumnId := func(c) {
226
226
  return id
227
227
  }
228
228
 
229
- /**
230
- * Removes all annotations & domain information from spec, to pass it to pfconv
231
- */
229
+
230
+
231
+
232
232
  purifySpec := func(spec) {
233
233
  newSpec := copy(spec)
234
234
 
@@ -264,31 +264,31 @@ purifySpec := func(spec) {
264
264
  return newSpec
265
265
  }
266
266
 
267
- /**
268
- * Split given pfconv config into:
269
- *
270
- * (1) purified cfg with minimal required settings to be passed to the pfconv binary,
271
- * to maximize caching retention when domains and annotations changes
272
- * (2) complete columns specs, that can be directly rendered into BObjectSpecs and
273
- * returned as workflow exports
274
- *
275
- * This method comes in handy in situations where actual csv -> pframe export is broadcasted
276
- * onto multiple objects, and then converges, so that each export operation only requires purified
277
- * config, and only data is saved for such operations, and actual specs are added somewhere
278
- * upstream.
279
- *
280
- * @param cfg full pfconv config object
281
- * @param ops additional options
282
- * {
283
- * additionalAxesSpec - array of additional axes spec to prepend to each column spec
284
- * }
285
- *
286
- * @return {
287
- * purifiedCfg - purified pfconv config
288
- * columnsSpec - map of full column specs by ids from the original cfg
289
- * }
290
- */
291
- // @TODO: rename to decomposeXsvImport to align with the naming in the rest xsv libs
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
292
  decomposePfconvImportCfg := func(cfg, ...ops) {
293
293
  ll.assert(len(ops) <= 1, "too many options for decomposePfconvImportCfg: %v", len(ops))
294
294
 
@@ -308,7 +308,7 @@ decomposePfconvImportCfg := func(cfg, ...ops) {
308
308
  ll.assert(is_undefined(columnsSpec[id]), "repeated column spec id in pfconv cfg: %v", id)
309
309
  columnsSpec[id] = column.spec
310
310
  columnsSpec[id].axesSpec = axesSpec
311
- // make sure spec contain correct kind value
311
+
312
312
  columnsSpec[id].kind = "PColumn"
313
313
  }
314
314
 
@@ -320,29 +320,29 @@ decomposePfconvImportCfg := func(cfg, ...ops) {
320
320
 
321
321
  EMPTY_JSON_KEY := "[]" // string(json.encode([]))
322
322
 
323
- /**
324
- * Calculates group indices from aggregation indices by removing aggregation indices from the full set of indices.
325
- * If no aggregation indices are provided, returns all indices.
326
- *
327
- * @param numberOfAxes: number - Total number of axes in the input
328
- * @param aggregationIndices: number[]|undefined - Indices to aggregate over. If undefined, returns all indices.
329
- *
330
- * @returns number[] - Array of remaining indices after removing aggregation indices, in ascending order.
331
- * If aggregationIndices is undefined, returns array [0..numberOfAxes-1]
332
- */
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
333
  calculateGroupAxesIndices := func(numberOfAxes, aggregationIndices) {
334
334
  groupIndices := []
335
335
  for i:=0; i<numberOfAxes; i++ {
336
336
  groupIndices = append(groupIndices, i)
337
337
  }
338
338
 
339
- // groupIndices at this point is [0, 1, 2, ... numberOfAxes-1]
339
+
340
340
 
341
341
  if is_undefined(aggregationIndices) {
342
342
  return groupIndices
343
343
  }
344
344
 
345
- // copy and sort to prevent mutation of original array
345
+
346
346
  aggregationIndices = slices.quickSort(aggregationIndices)
347
347
 
348
348
  for j:=len(aggregationIndices)-1; j>=0; j-- {
@@ -0,0 +1,160 @@
1
+ ll := import("@platforma-sdk/workflow-tengo:ll")
2
+ assets := import("@platforma-sdk/workflow-tengo:assets")
3
+ exec := import("@platforma-sdk/workflow-tengo:exec")
4
+ validation := import("@platforma-sdk/workflow-tengo:validation")
5
+ objects := import("@platforma-sdk/workflow-tengo:objects")
6
+ util := import("@platforma-sdk/workflow-tengo:pframes.util")
7
+ json := import("json")
8
+ constants := import("@platforma-sdk/workflow-tengo:pframes.constants")
9
+
10
+ transposeXsvSw := assets.importSoftware("@platforma-open/milaboratories.software-small-binaries:table-converter")
11
+ pfconvSw := assets.importSoftware("@milaboratories/software-pframes-conv:main")
12
+
13
+ renderOps := func(defaults, ...ops) {
14
+ o := { }
15
+
16
+ for k, v in defaults {
17
+ o[k] = v
18
+ }
19
+
20
+ if len(ops) > 0 {
21
+ for k, v in ops[0] {
22
+ o[k] = v
23
+ }
24
+ }
25
+ return o
26
+ }
27
+
28
+ getAxesSpec := func(spec) {
29
+ axes := []
30
+ for ax in spec.axes {
31
+ axes = append(axes, ax.spec)
32
+ }
33
+ return axes
34
+ }
35
+
36
+ getColumnSpec := func(axesSpec, col) {
37
+ spec := {
38
+ kind: constants.KIND_P_COLUMN,
39
+ axesSpec: axesSpec
40
+ }
41
+
42
+ for k, v in col.spec {
43
+ spec[k] = v
44
+ }
45
+
46
+ return objects.deleteUndefined(spec)
47
+ }
48
+
49
+
50
+
51
+
52
+ importFile := func(xsvFile, xsvType, spec, ...ops) {
53
+ ll.assert(xsvType == "csv" || xsvType == "tsv", "expected one of [tsv, csv] types, found: " + xsvType)
54
+
55
+ validation.assertType(spec, util.PFCONV_IMPORT_CFG_SCHEMA)
56
+
57
+ xsvFileName := "file." + xsvType
58
+
59
+ ops := renderOps({ dataOnly: false, splitDataAndSpec: false }, ops...)
60
+
61
+ if ops.transpose != undefined {
62
+
63
+ tops := ops.transpose
64
+
65
+ transposedFileName := "fileTransposed." + xsvType
66
+
67
+
68
+ transposeXsv := exec.builder().
69
+ software(transposeXsvSw).
70
+ printErrStreamToStdout().
71
+ inLightQueue()
72
+
73
+ if (tops.separator != undefined) {
74
+ transposeXsv = transposeXsv.arg("-input-separator").arg(tops.separator)
75
+ }
76
+ if (tops.pAxisIdx != undefined) {
77
+ transposeXsv = transposeXsv.arg("-sample-column-i").arg("" + tops.pAxisIdx) // always convert to string
78
+ }
79
+ if (tops.pAxisName != undefined) {
80
+ transposeXsv = transposeXsv.arg("-sample-column-name").arg(tops.pAxisName)
81
+ }
82
+ if (tops.pAxisSearch != undefined) {
83
+ transposeXsv = transposeXsv.arg("-sample-column-search").arg(tops.pAxisSearch)
84
+ }
85
+ if (tops.pAxisNameOverride != undefined) {
86
+ transposeXsv = transposeXsv.arg("-sample-label").arg(tops.pAxisNameOverride)
87
+ }
88
+ if (tops.sAxisSearch != undefined) {
89
+ transposeXsv = transposeXsv.arg("-metric-columns-search").arg(tops.sAxisSearch)
90
+ }
91
+ if (tops.sAxisName != undefined) {
92
+ transposeXsv = transposeXsv.arg("-metric-label").arg(tops.sAxisName)
93
+ }
94
+ if (tops.valueName != undefined) {
95
+ transposeXsv = transposeXsv.arg("-value-label").arg(tops.valueName)
96
+ }
97
+ if (tops.separatorOverride != undefined) {
98
+ transposeXsv = transposeXsv.arg("-separator").arg(tops.separatorOverride)
99
+ }
100
+
101
+ transposeXsv = transposeXsv.
102
+ arg(xsvFileName).
103
+ arg(transposedFileName).
104
+ addFile(xsvFileName, xsvFile).
105
+ saveFile(transposedFileName).
106
+ run()
107
+
108
+ xsvFile = transposeXsv.getFile(transposedFileName)
109
+ }
110
+
111
+
112
+ importDirTpl := assets.importTemplate("@platforma-sdk/workflow-tengo:pframes.import-dir")
113
+
114
+
115
+ pureSpec := util.purifySpec(spec)
116
+
117
+
118
+ pfconv := exec.builder().
119
+ software(pfconvSw).
120
+ printErrStreamToStdout().
121
+ inLightQueue().
122
+ arg("importCsv").
123
+ arg(xsvFileName).
124
+ arg("-p").arg("spec.json").
125
+ arg("-o").arg("out").
126
+ addFile(xsvFileName, xsvFile).
127
+ writeFile("spec.json", json.encode(pureSpec)).
128
+ processWorkdir("pf", importDirTpl, pureSpec).
129
+ run()
130
+
131
+
132
+ pf := pfconv.getProcessorResult("pf")
133
+ if ops.dataOnly {
134
+
135
+ return pf
136
+ }
137
+
138
+ axesSpec := getAxesSpec(spec)
139
+
140
+ result := {}
141
+ for col in spec.columns {
142
+ id := util.xsvColumnId(col)
143
+
144
+ if ops.splitDataAndSpec {
145
+ result[id] = {
146
+ data: pf.getFutureInputField(id),
147
+ spec: getColumnSpec(axesSpec, col)
148
+ }
149
+ } else {
150
+ result[id + ".data"] = pf.getFutureInputField(id)
151
+ result[id + ".spec"] = getColumnSpec(axesSpec, col)
152
+ }
153
+ }
154
+
155
+ return result
156
+ }
157
+
158
+ export ll.toStrict({
159
+ importFile: importFile
160
+ })