@platforma-sdk/workflow-tengo 1.6.3 → 1.6.4

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.
@@ -64,8 +64,10 @@ getColumnSpec := func(axesSpec, col) {
64
64
  * @param ops: object - additional options
65
65
  * {
66
66
  * dataOnly: boolean - set to true to completely skip creation of specs
67
+ * splitDataAndSpec: boolean - if true, resulting map will have nested structures,
68
+ * with "spec" + "data" fields in nested maps
67
69
  * transpose: object - if specified, then the input table will be transposed
68
- * {
70
+ * {
69
71
  * separator: string - (optional) use separator instead of inferring from the file extension
70
72
  * pAxisIdx: index - (optional) the index of the primary axis (column in the input xsv); default 0
71
73
  * pAxisName: string - (optional) the name of the primary axis (column name in the input xsv); default undefined
@@ -86,7 +88,7 @@ importFile := func(xsvFile, xsvType, spec, ...ops) {
86
88
 
87
89
  xsvFileName := "file." + xsvType
88
90
 
89
- ops := renderOps({ dataOnly: false }, ops...)
91
+ ops := renderOps({ dataOnly: false, splitDataAndSpec: false }, ops...)
90
92
 
91
93
  if ops.transpose != undefined {
92
94
 
@@ -99,7 +101,7 @@ importFile := func(xsvFile, xsvType, spec, ...ops) {
99
101
  software(transposeXsvSw).
100
102
  printErrStreamToStdout().
101
103
  inLightQueue()
102
-
104
+
103
105
  if (tops.separator != undefined) {
104
106
  transposeXsv = transposeXsv.arg("-input-separator").arg(tops.separator)
105
107
  }
@@ -119,15 +121,15 @@ importFile := func(xsvFile, xsvType, spec, ...ops) {
119
121
  transposeXsv = transposeXsv.arg("-metric-columns-search").arg(tops.sAxisSearch)
120
122
  }
121
123
  if (tops.sAxisName != undefined) {
122
- transposeXsv = transposeXsv.arg("-metric-label").arg(tops.sAxisName)
124
+ transposeXsv = transposeXsv.arg("-metric-label").arg(tops.sAxisName)
123
125
  }
124
126
  if (tops.valueName != undefined) {
125
- transposeXsv = transposeXsv.arg("-value-label").arg(tops.valueName)
127
+ transposeXsv = transposeXsv.arg("-value-label").arg(tops.valueName)
126
128
  }
127
129
  if (tops.separatorOverride != undefined) {
128
- transposeXsv = transposeXsv.arg("-separator").arg(tops.separatorOverride)
130
+ transposeXsv = transposeXsv.arg("-separator").arg(tops.separatorOverride)
129
131
  }
130
-
132
+
131
133
  transposeXsv = transposeXsv.
132
134
  arg(xsvFileName).
133
135
  arg(transposedFileName).
@@ -170,8 +172,15 @@ importFile := func(xsvFile, xsvType, spec, ...ops) {
170
172
  for col in spec.columns {
171
173
  id := util.xsvColumnId(col)
172
174
 
173
- result[id + ".data"] = pf.getFutureInputField(id)
174
- result[id + ".spec"] = getColumnSpec(axesSpec, col)
175
+ if ops.splitDataAndSpec {
176
+ result[id] = {
177
+ data: pf.getFutureInputField(id),
178
+ spec: getColumnSpec(axesSpec, col)
179
+ }
180
+ } else {
181
+ result[id + ".data"] = pf.getFutureInputField(id)
182
+ result[id + ".spec"] = getColumnSpec(axesSpec, col)
183
+ }
175
184
  }
176
185
 
177
186
  return result
@@ -192,7 +201,7 @@ importFile := func(xsvFile, xsvType, spec, ...ops) {
192
201
  * additionalAxesSpec: AxisSpec[] - array of additional axes spec to prepend to
193
202
  * each column spec
194
203
  * transpose: object - if specified, then the input table will be transposed
195
- * {
204
+ * {
196
205
  * separator: string - (optional) use separator instead of inferring from the file extension
197
206
  * pAxisIdx: index - (optional) the index of the primary axis (column in the input xsv); default 0
198
207
  * pAxisName: string - (optional) the name of the primary axis (column name in the input xsv); default undefined
@@ -249,7 +258,7 @@ importFileMap := func(xsvMap, xsvType, spec, ...ops) {
249
258
  result[id + ".spec"] = columnsSpec[id]
250
259
  }
251
260
  }
252
-
261
+
253
262
  return result
254
263
  }
255
264
 
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/workflow-tengo",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
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": "^1.6.3",
19
+ "@milaboratories/software-pframes-conv": "^1.6.4",
20
20
  "@platforma-open/milaboratories.software-small-binaries": "^1.14.4"
21
21
  },
22
22
  "devDependencies": {