@platforma-sdk/workflow-tengo 2.9.10 → 2.10.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/exec.R.internal.lib.tengo +4 -2
- package/dist/tengo/lib/exec.descriptor.lib.tengo +1 -8
- package/dist/tengo/lib/exec.internal.lib.tengo +4 -2
- package/dist/tengo/lib/exec.lib.tengo +5 -5
- package/dist/tengo/lib/exec.monetization.lib.tengo +3 -2
- package/dist/tengo/lib/exec.runcmd.lib.tengo +3 -2
- package/dist/tengo/lib/feats.lib.tengo +15 -0
- package/dist/tengo/lib/pframes.util.lib.tengo +1 -0
- package/dist/tengo/lib/pframes.xsv.lib.tengo +10 -2
- package/dist/tengo/lib/smart.lib.tengo +4 -2
- package/dist/tengo/lib/validation.lib.tengo +42 -17
- package/dist/tengo/tpl/exec.R.create-renv.plj.gz +0 -0
- package/dist/tengo/tpl/exec.exec.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/pframes.aggregate.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-multiple-pcolumns.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.map-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-import-map.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/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
2
|
+
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
3
|
+
|
|
2
4
|
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
3
5
|
runcmd := import("@platforma-sdk/workflow-tengo:exec.runcmd")
|
|
4
6
|
path := import("@platforma-sdk/workflow-tengo:path")
|
|
@@ -16,8 +18,8 @@ rVenvInputSchema := {
|
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
runRBuilder := func(operationMode, wd, rPackage, rDescriptor) {
|
|
19
|
-
t :=
|
|
20
|
-
rule :=
|
|
21
|
+
t := feats.commandExpressions ? constants.ARG_TYPE_EXPRESSION : constants.ARG_TYPE_VAR
|
|
22
|
+
rule := feats.commandExpressions ? "R" : "{R}"
|
|
21
23
|
|
|
22
24
|
builder := runcmd.builder(wd).
|
|
23
25
|
ref("r-run-environment", rPackage).
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* The scheme is here:
|
|
3
3
|
* https://github.com/milaboratory/platforma/blob/main/tools/package-builder/src/core/renderer.ts#L161 */
|
|
4
4
|
|
|
5
|
-
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
6
5
|
|
|
7
6
|
runEnvScheme := {
|
|
8
7
|
registry: "string",
|
|
@@ -39,16 +38,10 @@ scheme := {
|
|
|
39
38
|
"local,?": localScheme
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
/** True if Platforma Backend supports expression refs. */
|
|
43
|
-
canBackendUseExpressions := func() {
|
|
44
|
-
return ll.apiVersion() >= 2
|
|
45
|
-
}
|
|
46
|
-
|
|
47
41
|
export {
|
|
48
42
|
runEnvScheme: runEnvScheme,
|
|
49
43
|
binaryScheme: binaryScheme,
|
|
50
44
|
assetScheme: assetScheme,
|
|
51
45
|
localScheme: localScheme,
|
|
52
|
-
scheme: scheme
|
|
53
|
-
canBackendUseExpressions: canBackendUseExpressions
|
|
46
|
+
scheme: scheme
|
|
54
47
|
}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
9
|
+
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
10
|
+
|
|
9
11
|
json := import("json")
|
|
10
12
|
times := import("times")
|
|
11
13
|
text := import("text")
|
|
@@ -51,7 +53,7 @@ _newArg := func(isString, value) {
|
|
|
51
53
|
if isString {
|
|
52
54
|
return _newTypedArg(constants.ARG_TYPE_STRING, value)
|
|
53
55
|
}
|
|
54
|
-
if
|
|
56
|
+
if feats.commandExpressions {
|
|
55
57
|
return _newTypedArg(constants.ARG_TYPE_EXPRESSION, value)
|
|
56
58
|
}
|
|
57
59
|
return _newTypedArg(constants.ARG_TYPE_VAR, value)
|
|
@@ -59,7 +61,7 @@ _newArg := func(isString, value) {
|
|
|
59
61
|
|
|
60
62
|
_newRefVar := func(varName, refName, reference) {
|
|
61
63
|
// deprecated, remove on 15 Mar 2025
|
|
62
|
-
if !
|
|
64
|
+
if !feats.commandExpressions {
|
|
63
65
|
return ll.toStrict({
|
|
64
66
|
varName: "{" + varName + "}",
|
|
65
67
|
refName: refName,
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
6
|
+
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
7
|
+
|
|
6
8
|
assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
7
9
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
8
10
|
times := import("times")
|
|
@@ -15,7 +17,6 @@ enum := import("enum")
|
|
|
15
17
|
oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
16
18
|
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
17
19
|
constants := import("@platforma-sdk/workflow-tengo:constants")
|
|
18
|
-
desc := import("@platforma-sdk/workflow-tengo:exec.descriptor")
|
|
19
20
|
monetization := import("@platforma-sdk/workflow-tengo:exec.monetization")
|
|
20
21
|
execConstants := import("@platforma-sdk/workflow-tengo:exec.constants")
|
|
21
22
|
|
|
@@ -161,7 +162,7 @@ builder := func() {
|
|
|
161
162
|
ll.assert(is_string(arg), "exec.argWithVar(): argument with var must be a string, got: %v", arg)
|
|
162
163
|
|
|
163
164
|
// deprecated: remove ARG_TYPE_VAR and this check after 15 Mar 2025
|
|
164
|
-
t :=
|
|
165
|
+
t := feats.commandExpressions ? execConstants.ARG_TYPE_EXPRESSION : execConstants.ARG_TYPE_VAR
|
|
165
166
|
argsTyped = append(argsTyped, {
|
|
166
167
|
type: t,
|
|
167
168
|
value: arg
|
|
@@ -197,7 +198,7 @@ builder := func() {
|
|
|
197
198
|
validation.assertJsonSchema([name, value], ["string"])
|
|
198
199
|
|
|
199
200
|
// deprecated: remove ARG_TYPE_VAR and this check after 15 Mar 2025
|
|
200
|
-
t :=
|
|
201
|
+
t := feats.commandExpressions ? execConstants.ARG_TYPE_EXPRESSION : execConstants.ARG_TYPE_VAR
|
|
201
202
|
envsTyped[name] = {
|
|
202
203
|
type: t,
|
|
203
204
|
value: value
|
|
@@ -838,6 +839,5 @@ builder := func() {
|
|
|
838
839
|
}
|
|
839
840
|
|
|
840
841
|
export ll.toStrict({
|
|
841
|
-
builder: builder
|
|
842
|
-
canBackendUseExpressions: desc.canBackendUseExpressions
|
|
842
|
+
builder: builder
|
|
843
843
|
})
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** The library provides all things to work with a monetization. */
|
|
2
2
|
|
|
3
3
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
4
|
+
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
5
|
+
|
|
4
6
|
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
5
7
|
assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
6
8
|
internal := import("@platforma-sdk/workflow-tengo:exec.internal")
|
|
@@ -9,7 +11,6 @@ text := import("text")
|
|
|
9
11
|
runcmd := import("@platforma-sdk/workflow-tengo:exec.runcmd")
|
|
10
12
|
workdir := import("@platforma-sdk/workflow-tengo:workdir")
|
|
11
13
|
render := import("@platforma-sdk/workflow-tengo:render")
|
|
12
|
-
desc := import("@platforma-sdk/workflow-tengo:exec.descriptor")
|
|
13
14
|
constants := import("@platforma-sdk/workflow-tengo:exec.constants")
|
|
14
15
|
|
|
15
16
|
_JWT_TOKEN_RESULT_ENV := "PLATFORMA_MNZ_JWT"
|
|
@@ -117,7 +118,7 @@ run := func(mnz, wd, queue) {
|
|
|
117
118
|
|
|
118
119
|
builder := runcmd.builder(wd)
|
|
119
120
|
|
|
120
|
-
exprType :=
|
|
121
|
+
exprType := feats.commandExpressions ? constants.ARG_TYPE_EXPRESSION : constants.ARG_TYPE_VAR
|
|
121
122
|
|
|
122
123
|
builder.envTyped("MI_LICENSE", exprType, "{secrets.MI_LICENSE}")
|
|
123
124
|
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
6
|
+
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
7
|
+
|
|
6
8
|
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
7
9
|
oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
8
10
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
9
11
|
json := import("json")
|
|
10
12
|
constants := import("@platforma-sdk/workflow-tengo:exec.constants")
|
|
11
13
|
slices := import("@platforma-sdk/workflow-tengo:slices")
|
|
12
|
-
desc := import("@platforma-sdk/workflow-tengo:exec.descriptor")
|
|
13
14
|
|
|
14
15
|
_RTYPE_RUN_COMMAND := { Name: "RunCommand/executor", Version: "1" }
|
|
15
16
|
_RTYPE_RUN_COMMAND_CMD := { Name: "RunCommandCmd", Version: "1" }
|
|
@@ -358,7 +359,7 @@ builder := func(workdir) {
|
|
|
358
359
|
ll.assert(!hasPatternArgs || len(substRules) != 0,
|
|
359
360
|
"found pattern argument, but no substitution rules were set: hasPatternArgs: %v, substRules: %v, cmd: %v, args: %v, envs: %v",
|
|
360
361
|
hasPatternArgs, substRules, cmd, args, envs)
|
|
361
|
-
ll.assert(!hasExpressionArgs ||
|
|
362
|
+
ll.assert(!hasExpressionArgs || feats.commandExpressions,
|
|
362
363
|
"runcmd.builder().build: expression arguments must be enabled only if platforma backend supports expressions, found: %v",
|
|
363
364
|
hasExpressionArgs)
|
|
364
365
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalogue of features available in current execution context.
|
|
3
|
+
*/
|
|
4
|
+
plapi := import("plapi")
|
|
5
|
+
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
6
|
+
|
|
7
|
+
_api := plapi.apiVersion
|
|
8
|
+
if is_undefined(_api) {
|
|
9
|
+
_api = 0
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export ll.toStrict({
|
|
13
|
+
pureFutureFields: _api >= 1,
|
|
14
|
+
commandExpressions: _api >= 2
|
|
15
|
+
})
|
|
@@ -287,6 +287,7 @@ purifySpec := func(spec) {
|
|
|
287
287
|
* columnsSpec - map of full column specs by ids from the original cfg
|
|
288
288
|
* }
|
|
289
289
|
*/
|
|
290
|
+
// @TODO: rename to decomposeXsvImport to align with the naming in the rest xsv libs
|
|
290
291
|
decomposePfconvImportCfg := func(cfg, ...ops) {
|
|
291
292
|
ll.assert(len(ops) <= 1, "too many options for decomposePfconvImportCfg: %v", len(ops))
|
|
292
293
|
|
|
@@ -164,6 +164,7 @@ importFile := func(xsvFile, xsvType, spec, ...ops) {
|
|
|
164
164
|
// p-columns data
|
|
165
165
|
pf := pfconv.getProcessorResult("pf")
|
|
166
166
|
if ops.dataOnly {
|
|
167
|
+
// @TODO discuss, as it changes the type of the return from map to object
|
|
167
168
|
return pf
|
|
168
169
|
}
|
|
169
170
|
|
|
@@ -269,10 +270,16 @@ importFileMap := func(xsvMap, xsvType, spec, ...ops) {
|
|
|
269
270
|
* @param pf: p-frame - a list of p-columns ({data, spec}) or a frame-like map of col.data col.spec entries
|
|
270
271
|
* @param xsvType: string - "csv" or "tsv"
|
|
271
272
|
* @param params: map - export params
|
|
273
|
+
* @param ops: object - additional options
|
|
274
|
+
* {
|
|
275
|
+
* partitions: {axisIdx: [keys]} - map of partitions to export; if not specified, all data is exported
|
|
276
|
+
* }
|
|
272
277
|
*/
|
|
273
|
-
exportFrame := func(pf, xsvType, params) {
|
|
278
|
+
exportFrame := func(pf, xsvType, params, ...ops) {
|
|
274
279
|
exportPfTpl := assets.importTemplate("@platforma-sdk/workflow-tengo:pframes.xsv-export-pframe")
|
|
275
280
|
|
|
281
|
+
ops := renderOps({}, ops...)
|
|
282
|
+
|
|
276
283
|
if is_array(pf) {
|
|
277
284
|
// transform into .data .spec map
|
|
278
285
|
|
|
@@ -291,7 +298,8 @@ exportFrame := func(pf, xsvType, params) {
|
|
|
291
298
|
r := render.create(exportPfTpl, {
|
|
292
299
|
pf: pf,
|
|
293
300
|
xsvType: xsvType,
|
|
294
|
-
params: params
|
|
301
|
+
params: params,
|
|
302
|
+
ops: ops
|
|
295
303
|
})
|
|
296
304
|
|
|
297
305
|
return r.output("result")
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
tx := import("tx")
|
|
6
6
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
7
|
+
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
8
|
+
|
|
7
9
|
oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
8
10
|
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
9
11
|
json := import("json")
|
|
@@ -495,7 +497,7 @@ resource = func(r) {
|
|
|
495
497
|
isEph = eph[0]
|
|
496
498
|
}
|
|
497
499
|
|
|
498
|
-
if
|
|
500
|
+
if !feats.pureFutureFields && !isEph {
|
|
499
501
|
// Dirty hack that saves from issues with buggy pure getField before v1.16.1
|
|
500
502
|
// We can safely drop it when we consider v1.16.0 old enough.
|
|
501
503
|
return self.getFutureField(name, "output", true).expectNonEphemeral()
|
|
@@ -890,7 +892,7 @@ field = func(f) {
|
|
|
890
892
|
isEph = eph[0]
|
|
891
893
|
}
|
|
892
894
|
|
|
893
|
-
if
|
|
895
|
+
if !feats.pureFutureFields && !isEph {
|
|
894
896
|
// Dirty hack that saves from issues with buggy pure getField before v1.16.1
|
|
895
897
|
// We can safely drop it when we consider v1.16.0 old enough.
|
|
896
898
|
return self.getFutureField(name, "output", true).expectNonEphemeral()
|
|
@@ -341,16 +341,32 @@ isValid := func(js, schema) {
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
/**
|
|
344
|
-
*
|
|
344
|
+
* Alias to ll.assert just for usage convenience
|
|
345
|
+
*/
|
|
346
|
+
assert := func(condition, msg, ...args) {
|
|
347
|
+
ll.assert(condition, msg, args...)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Asserts that a given variable conforms to a given schema.
|
|
352
|
+
*
|
|
353
|
+
* Schema field value examples:
|
|
354
|
+
* - for scalar type checks:
|
|
355
|
+
* "string", "number", "char", "bytes", "bool" to check presence of value of given type
|
|
356
|
+
* "null" - value must be undefined
|
|
357
|
+
* "any" - any value is accepted (even undefined)
|
|
358
|
+
* ["or", "string", "number"] - value must be string or number
|
|
359
|
+
* - for arrays: ["string"], ["number"], ... (any valid scalar type)
|
|
360
|
+
* - for maps: {"name": "string", "age": "number"} - make sure <value> is map with "name" and "age" keys with given value types.
|
|
345
361
|
*
|
|
346
|
-
* @param
|
|
347
|
-
* @param schema: any - the schema to assert against
|
|
362
|
+
* @param value: any - the value to check.
|
|
363
|
+
* @param schema: any - the schema to assert against (see comments above)
|
|
348
364
|
* @param failMsg: string - optional parameter with custom message to be printed on validation error
|
|
349
365
|
*/
|
|
350
|
-
|
|
351
|
-
r := _validateJson(
|
|
366
|
+
assertType := func(value, schema, ...failMsg) {
|
|
367
|
+
r := _validateJson(value, schema, "")
|
|
352
368
|
|
|
353
|
-
msg := "
|
|
369
|
+
msg := "type schema validation error"
|
|
354
370
|
if len(failMsg) > 0 {
|
|
355
371
|
msg = failMsg[0]
|
|
356
372
|
}
|
|
@@ -360,6 +376,13 @@ assertJsonSchema := func(js, schema, ...failMsg) {
|
|
|
360
376
|
}
|
|
361
377
|
}
|
|
362
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Alias to 'assert' for backward compatibility
|
|
381
|
+
*/
|
|
382
|
+
assertJsonSchema := func(js, schema, ...failMsg) {
|
|
383
|
+
assertType(js, schema, failMsg...)
|
|
384
|
+
}
|
|
385
|
+
|
|
363
386
|
//
|
|
364
387
|
// Domain-specific schemas and checks:
|
|
365
388
|
//
|
|
@@ -435,15 +458,17 @@ refSchema := {
|
|
|
435
458
|
}
|
|
436
459
|
|
|
437
460
|
export ll.toStrict({
|
|
438
|
-
success:
|
|
439
|
-
fail:
|
|
440
|
-
isSuccess:
|
|
441
|
-
isFail:
|
|
442
|
-
checkJson:
|
|
443
|
-
isValid:
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
461
|
+
success: success,
|
|
462
|
+
fail: fail,
|
|
463
|
+
isSuccess: isSuccess,
|
|
464
|
+
isFail: isFail,
|
|
465
|
+
checkJson: checkJson,
|
|
466
|
+
isValid: isValid,
|
|
467
|
+
assert: assert,
|
|
468
|
+
assertType: assertType,
|
|
469
|
+
assertJsonSchema: assertJsonSchema, // deprecated
|
|
470
|
+
resource: resource,
|
|
471
|
+
reference: reference,
|
|
472
|
+
resourceType: resourceType,
|
|
473
|
+
ref: refSchema
|
|
449
474
|
})
|
|
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
|