@platforma-sdk/workflow-tengo 2.0.0 → 2.1.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.
@@ -225,9 +225,10 @@ purifySpec := func(spec) {
225
225
  for ax in spec.axes {
226
226
  newAxes = append(newAxes, objects.deleteUndefined({
227
227
  column: ax.column,
228
+ filterOutRegex: ax.filterOutRegex,
228
229
  preProcess: ax.preProcess,
230
+ naRegex: ax.naRegex,
229
231
  allowNA: ax.allowNA,
230
- parseErrorToNA: ax.parseErrorToNA,
231
232
  spec: { type: ax.spec.type }
232
233
  }))
233
234
  }
@@ -237,10 +238,11 @@ purifySpec := func(spec) {
237
238
  for col in spec.columns {
238
239
  newCols = append(newCols, objects.deleteUndefined({
239
240
  column: col.column,
241
+ filterOutRegex: col.filterOutRegex,
240
242
  preProcess: col.preProcess,
241
- id: col.id,
243
+ naRegex: col.naRegex,
242
244
  allowNA: col.allowNA,
243
- parseErrorToNA: col.parseErrorToNA,
245
+ id: col.id,
244
246
  spec: { valueType: col.spec.valueType }
245
247
  }))
246
248
  }
@@ -267,12 +267,27 @@ importFileMap := func(xsvMap, xsvType, spec, ...ops) {
267
267
  /**
268
268
  * Export p-frame into xsv file
269
269
  *
270
- * @param pf: p-frame - a collection of p-columns
270
+ * @param pf: p-frame - a list of p-columns ({data, spec}) or a frame-like map of col.data col.spec entries
271
271
  * @param xsvType: string - "csv" or "tsv"
272
272
  * @param params: map - export params
273
273
  */
274
274
  exportFrame := func(pf, xsvType, params) {
275
275
  exportPfTpl := assets.importTemplate("@platforma-sdk/workflow-tengo:pframes.xsv-export-pframe")
276
+
277
+ if is_array(pf) {
278
+ // transform into .data .spec map
279
+
280
+ pfm := {}
281
+ i := 0
282
+ for col in pf {
283
+ ll.assert(!is_undefined(col.spec), "expected array of {spec, data} maps as a list of columns, but spec is undefined for: ", col)
284
+ ll.assert(!is_undefined(col.data), "expected array of {spec, data} maps as a list of columns, but data is undefined for: ", col)
285
+ pfm["" + i + ".spec"] = col.spec
286
+ pfm["" + i + ".data"] = col.data
287
+ i = i + 1
288
+ }
289
+ pf = pfm
290
+ }
276
291
 
277
292
  r := render.create(exportPfTpl, {
278
293
  pf: pf,
@@ -59,7 +59,6 @@ create := func(spec, ctx, ...options) {
59
59
  setErrorIfMissing: ops.errIfMissing
60
60
  })
61
61
 
62
-
63
62
  builder := undefined
64
63
  if ops.first {
65
64
  builder = smart.ephemeralBuilder(constants.RTYPE_BRESOLVE_FIRST, query)
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/workflow-tengo",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Tengo SDK library",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",