@platforma-sdk/workflow-tengo 2.10.0 → 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/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
|
@@ -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
|