@platforma-sdk/workflow-tengo 4.13.0 → 4.14.1
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/anonymize.util.lib.tengo +6 -0
- package/dist/tengo/lib/pframes.lib.tengo +329 -32
- package/dist/tengo/tpl/anonymize.deanonymize.plj.gz +0 -0
- package/dist/tengo/tpl/anonymize.impl.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.create_workdir_from_storage.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.download_blob.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.run_hello_world.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.run_hello_world_py.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.upload_blob.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.upload_template.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.workdir_type_name_extractor.plj.gz +0 -0
- package/dist/tengo/tpl/exec.R.create-renv.plj.gz +0 -0
- package/dist/tengo/tpl/exec.delayed-compute-allocation.impl.plj.gz +0 -0
- package/dist/tengo/tpl/exec.exec-impl.plj.gz +0 -0
- package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
- package/dist/tengo/tpl/exec.load-software.impl.plj.gz +0 -0
- package/dist/tengo/tpl/exec.monetization_info.plj.gz +0 -0
- package/dist/tengo/tpl/exec.monetization_to_json.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/exec.python.venv-bin-path.plj.gz +0 -0
- package/dist/tengo/tpl/ll.get-field.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-pframe-for-ui.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.parse-to-json.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.process-pcolumn-data.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.remove-nulls.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.slice-data.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-import-if-not-null.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
- package/dist/tengo/tpl/waiter.waiter.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/dist/tengo/tpl/workflow.query-anchored.plj.gz +0 -0
- package/package.json +2 -2
|
@@ -44,6 +44,12 @@ decodePDataField := func(fieldName) {
|
|
|
44
44
|
ll.panic("Expected JSON array for pcolumn key, got: %v", keyArray)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
for i, component in keyArray {
|
|
48
|
+
if !is_string(component) && !is_int(component) {
|
|
49
|
+
ll.panic("Key component at index %d must be either string or integer, got: %v (%v)", i, component, keyArray)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
47
53
|
return {
|
|
48
54
|
key: keyArray,
|
|
49
55
|
suffix: suffix
|
|
@@ -20,26 +20,144 @@ pColumnData := import("@platforma-sdk/workflow-tengo:pframes.data")
|
|
|
20
20
|
llProcessTpl := assets.importTemplate("@platforma-sdk/workflow-tengo:pframes.process-pcolumn-data")
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
BASIC_TSV_COLUMN_SPEC_SCHEMA := {
|
|
24
|
+
"valueType": "string,regex=Int|Long|Float|Double|String",
|
|
25
|
+
"name,?": "string",
|
|
26
|
+
"domain,?": { "any": "string" },
|
|
27
|
+
"annotations,?": { "any": "string" }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
BASIC_TSV_COLUMN_SPEC_SCHEMA_STRING := {
|
|
32
|
+
"valueType": "string,regex=String",
|
|
33
|
+
"name,?": "string",
|
|
34
|
+
"domain,?": { "any": "string" },
|
|
35
|
+
"annotations,?": { "any": "string" }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
BASIC_COLUMN_INFO_SCHEMA := {
|
|
40
|
+
"__options__,closed": "",
|
|
41
|
+
"column": "string",
|
|
42
|
+
"id,?": "string",
|
|
43
|
+
"type": "string,regex=Int|Long|Float|Double|String"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
23
47
|
TSV_CONTENT_SETTINGS_SCHEMA := {
|
|
48
|
+
"__options__,closed": "",
|
|
24
49
|
"axes": [{
|
|
50
|
+
"__options__,closed": "",
|
|
25
51
|
"column": "string",
|
|
26
52
|
"spec": {
|
|
53
|
+
"__options__,closed": "",
|
|
27
54
|
"type": "string,regex=Int|Long|Float|Double|String",
|
|
28
55
|
"name,?": "string",
|
|
29
56
|
"domain,?": { "any": "string" },
|
|
30
57
|
"annotations,?": { "any": "string" }
|
|
31
58
|
}
|
|
32
59
|
}],
|
|
33
|
-
"columns": [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
60
|
+
"columns": [["or",
|
|
61
|
+
{
|
|
62
|
+
"__options__,closed": "",
|
|
63
|
+
"kind": "string,regex=column",
|
|
64
|
+
"column": "string",
|
|
65
|
+
"id,?": "string",
|
|
66
|
+
"spec": BASIC_TSV_COLUMN_SPEC_SCHEMA
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"__options__,closed": "",
|
|
70
|
+
"kind": "string,regex=line",
|
|
71
|
+
"id": "string",
|
|
72
|
+
"spec": BASIC_TSV_COLUMN_SPEC_SCHEMA_STRING
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"__options__,closed": "",
|
|
76
|
+
"kind": "string,regex=json-line",
|
|
77
|
+
"id": "string",
|
|
78
|
+
"spec": BASIC_TSV_COLUMN_SPEC_SCHEMA_STRING,
|
|
79
|
+
"columns": [BASIC_COLUMN_INFO_SCHEMA]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"__options__,closed": "",
|
|
83
|
+
"column": "string",
|
|
84
|
+
"id,?": "string",
|
|
85
|
+
"spec": BASIC_TSV_COLUMN_SPEC_SCHEMA
|
|
86
|
+
}
|
|
87
|
+
]]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
getTsvColumnId := func(column) {
|
|
92
|
+
kind := column.kind
|
|
93
|
+
if is_undefined(kind) {
|
|
94
|
+
kind = "column"
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if kind == "column" {
|
|
98
|
+
columnId := column.id
|
|
99
|
+
if is_undefined(columnId) {
|
|
100
|
+
columnId = column.column
|
|
41
101
|
}
|
|
42
|
-
|
|
102
|
+
return columnId
|
|
103
|
+
} else if kind == "line" || kind == "json-line" {
|
|
104
|
+
return column.id
|
|
105
|
+
} else {
|
|
106
|
+
ll.panic("Unknown column kind: %s", kind)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
transformTsvSettings := func(settings) {
|
|
112
|
+
return {
|
|
113
|
+
axes: slices.map(settings.axes, func(axis) {
|
|
114
|
+
return {
|
|
115
|
+
name: axis.column,
|
|
116
|
+
type: axis.spec.type
|
|
117
|
+
}
|
|
118
|
+
}),
|
|
119
|
+
columns: slices.map(settings.columns, func(column) {
|
|
120
|
+
|
|
121
|
+
kind := column.kind
|
|
122
|
+
if is_undefined(kind) {
|
|
123
|
+
kind = "column"
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if kind == "column" {
|
|
127
|
+
transformedColumn := {
|
|
128
|
+
kind: "column",
|
|
129
|
+
name: column.column,
|
|
130
|
+
type: column.spec.valueType
|
|
131
|
+
}
|
|
132
|
+
if !is_undefined(column.id) {
|
|
133
|
+
transformedColumn.id = column.id
|
|
134
|
+
}
|
|
135
|
+
return transformedColumn
|
|
136
|
+
} else if kind == "line" {
|
|
137
|
+
return {
|
|
138
|
+
kind: "line",
|
|
139
|
+
id: column.id
|
|
140
|
+
}
|
|
141
|
+
} else if kind == "json-line" {
|
|
142
|
+
return {
|
|
143
|
+
kind: "json-line",
|
|
144
|
+
id: column.id,
|
|
145
|
+
columns: slices.map(column.columns, func(jsonCol) {
|
|
146
|
+
transformedCol := {
|
|
147
|
+
name: jsonCol.column,
|
|
148
|
+
type: jsonCol.type
|
|
149
|
+
}
|
|
150
|
+
if !is_undefined(jsonCol.id) {
|
|
151
|
+
transformedCol.id = jsonCol.id
|
|
152
|
+
}
|
|
153
|
+
return transformedCol
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
ll.panic("Unknown column kind: %s", kind)
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
}
|
|
43
161
|
}
|
|
44
162
|
|
|
45
163
|
|
|
@@ -61,6 +179,181 @@ exportColumnData := func(data) {
|
|
|
61
179
|
|
|
62
180
|
|
|
63
181
|
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
parseToJson := func(targetContent, params) {
|
|
232
|
+
validation.assertType(params, TSV_CONTENT_SETTINGS_SCHEMA, "Invalid TsvContent settings")
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
transformedSettings := transformTsvSettings(params)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
input := undefined
|
|
239
|
+
baseAxesSpec := []
|
|
240
|
+
|
|
241
|
+
if is_string(targetContent) || smart.isReference(targetContent) {
|
|
242
|
+
|
|
243
|
+
input = targetContent
|
|
244
|
+
} else if is_map(targetContent) && !is_undefined(targetContent.data) && !is_undefined(targetContent.spec) {
|
|
245
|
+
|
|
246
|
+
input = targetContent.data
|
|
247
|
+
validation.assertType(targetContent.spec, pSpec.P_COLUMN_SPEC_SCHEMA)
|
|
248
|
+
baseAxesSpec = slices.normalize(targetContent.spec.axesSpec)
|
|
249
|
+
} else {
|
|
250
|
+
ll.panic("targetContent must be a string, resource reference, or {data: resource, spec: PColumnSpec}")
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
axesSpec := copy(baseAxesSpec)
|
|
255
|
+
for axis in params.axes {
|
|
256
|
+
axesSpec = append(axesSpec, axis.spec)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
outputSpecs := {}
|
|
261
|
+
for column in params.columns {
|
|
262
|
+
columnId := getTsvColumnId(column)
|
|
263
|
+
spec := maps.merge(column.spec, { axesSpec: axesSpec, kind: "PColumn" })
|
|
264
|
+
outputSpecs[columnId] = spec
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
parseToJsonTpl := assets.importTemplate("@platforma-sdk/workflow-tengo:pframes.parse-to-json")
|
|
269
|
+
renderResult := render.create(parseToJsonTpl, {
|
|
270
|
+
params: smart.createJsonResource(transformedSettings),
|
|
271
|
+
input: input
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
self := undefined
|
|
276
|
+
self = ll.toStrict({
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
output: func(columnId) {
|
|
284
|
+
spec := outputSpecs[columnId]
|
|
285
|
+
if is_undefined(spec) {
|
|
286
|
+
ll.panic("unknown column: " + columnId)
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
data: renderResult.resolveOutput(["result", columnId]),
|
|
290
|
+
spec: spec
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
outputData: func(columnId) {
|
|
301
|
+
if is_undefined(outputSpecs[columnId]) {
|
|
302
|
+
ll.panic("unknown column: " + columnId)
|
|
303
|
+
}
|
|
304
|
+
return renderResult.resolveOutput(["result", columnId])
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
outputSpec: func(columnId) {
|
|
314
|
+
spec := outputSpecs[columnId]
|
|
315
|
+
if is_undefined(spec) {
|
|
316
|
+
ll.panic("unknown column: " + columnId)
|
|
317
|
+
}
|
|
318
|
+
return spec
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
listOutputs: func() {
|
|
327
|
+
return maps.getKeys(outputSpecs)
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
addAllOutputsToBuilder: func(builder, ...separator) {
|
|
338
|
+
maps.forEach(outputSpecs, func(columnId, spec) {
|
|
339
|
+
builder.add(
|
|
340
|
+
columnId,
|
|
341
|
+
spec,
|
|
342
|
+
renderResult.resolveOutput(["result", columnId])
|
|
343
|
+
)
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
return builder
|
|
347
|
+
}
|
|
348
|
+
})
|
|
349
|
+
|
|
350
|
+
return self
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
64
357
|
pColumnResourceMapDataBuilder := func(keyLength) {
|
|
65
358
|
ll.panic("pframes.pColumnResourceMapDataBuilder is not supported any more; use pcolumn.resourceMapBuilder")
|
|
66
359
|
}
|
|
@@ -238,6 +531,27 @@ __primitiveValueTypes := { "Int": true, "Long": true, "Float": true, "Double": t
|
|
|
238
531
|
|
|
239
532
|
|
|
240
533
|
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
|
|
241
555
|
|
|
242
556
|
|
|
243
557
|
|
|
@@ -484,24 +798,7 @@ processColumn := func(input, bodyTpl, outputs, ...opts) {
|
|
|
484
798
|
validation.assertType(output.settings, TSV_CONTENT_SETTINGS_SCHEMA, "Invalid TsvContent settings")
|
|
485
799
|
|
|
486
800
|
|
|
487
|
-
transformedSettings :=
|
|
488
|
-
axes: slices.map(output.settings.axes, func(axis) {
|
|
489
|
-
return {
|
|
490
|
-
name: axis.column,
|
|
491
|
-
type: axis.spec.type
|
|
492
|
-
}
|
|
493
|
-
}),
|
|
494
|
-
columns: slices.map(output.settings.columns, func(column) {
|
|
495
|
-
transformedColumn := {
|
|
496
|
-
name: column.column,
|
|
497
|
-
type: column.spec.valueType
|
|
498
|
-
}
|
|
499
|
-
if !is_undefined(column.id) {
|
|
500
|
-
transformedColumn.id = column.id
|
|
501
|
-
}
|
|
502
|
-
return transformedColumn
|
|
503
|
-
})
|
|
504
|
-
}
|
|
801
|
+
transformedSettings := transformTsvSettings(output.settings)
|
|
505
802
|
|
|
506
803
|
|
|
507
804
|
columnsSpec := {}
|
|
@@ -511,10 +808,9 @@ processColumn := func(input, bodyTpl, outputs, ...opts) {
|
|
|
511
808
|
}
|
|
512
809
|
|
|
513
810
|
for column in output.settings.columns {
|
|
514
|
-
columnId := column
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}
|
|
811
|
+
columnId := getTsvColumnId(column)
|
|
812
|
+
|
|
813
|
+
|
|
518
814
|
spec := maps.merge(column.spec, { axesSpec: axesSpec, kind: "PColumn" })
|
|
519
815
|
if !is_undefined(traceInfo.trace) {
|
|
520
816
|
spec = traceInfo.trace.inject(spec, {override: traceInfo.overrideTrace})
|
|
@@ -808,5 +1104,6 @@ export ll.toStrict({
|
|
|
808
1104
|
exportColumnData: exportColumnData,
|
|
809
1105
|
pColumnResourceMapDataBuilder: pColumnResourceMapDataBuilder,
|
|
810
1106
|
tsvFileBuilder: func() { return xsvBuilder.xsvFileBuilder("tsv") },
|
|
811
|
-
csvFileBuilder: func() { return xsvBuilder.xsvFileBuilder("csv") }
|
|
1107
|
+
csvFileBuilder: func() { return xsvBuilder.xsvFileBuilder("csv") },
|
|
1108
|
+
parseToJson: parseToJson
|
|
812
1109
|
})
|
|
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
|
|
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
|
|
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": "4.
|
|
3
|
+
"version": "4.14.1",
|
|
4
4
|
"description": "Tengo SDK library",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@platforma-open/milaboratories.software-ptabler": "1.8.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@platforma-sdk/tengo-builder": "^2.1.
|
|
24
|
+
"@platforma-sdk/tengo-builder": "^2.1.13"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"type-check": "pl-tengo check",
|