@platforma-sdk/workflow-tengo 2.0.1 → 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.
@@ -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.1",
3
+ "version": "2.1.0",
4
4
  "description": "Tengo SDK library",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",