@platforma-sdk/workflow-tengo 2.10.1 → 2.11.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.
- package/dist/tengo/lib/exec.R.lib.tengo +6 -6
- package/dist/tengo/lib/exec.internal.lib.tengo +2 -2
- package/dist/tengo/lib/exec.lib.tengo +6 -6
- package/dist/tengo/lib/exec.monetization.lib.tengo +6 -6
- package/dist/tengo/lib/exec.package.lib.tengo +5 -5
- package/dist/tengo/lib/exec.python.lib.tengo +5 -5
- package/dist/tengo/lib/exec.runenv.lib.tengo +3 -3
- package/dist/tengo/lib/file.internal.lib.tengo +3 -3
- package/dist/tengo/lib/file.lib.tengo +1 -1
- package/dist/tengo/lib/path.lib.tengo +8 -8
- package/dist/tengo/lib/pframes.spec.lib.tengo +3 -3
- package/dist/tengo/lib/pframes.util.lib.tengo +1 -1
- package/dist/tengo/lib/pframes.xsv.lib.tengo +1 -1
- package/dist/tengo/lib/tpl.lib.tengo +1 -1
- package/dist/tengo/lib/validation.lib.tengo +1 -1
- package/dist/tengo/lib/workdir.lib.tengo +10 -10
- package/dist/tengo/lib/workflow.lib.tengo +27 -7
- 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
|
@@ -26,7 +26,7 @@ rVenvBuilder := func() {
|
|
|
26
26
|
|
|
27
27
|
self = {
|
|
28
28
|
operationMode: func(mode) {
|
|
29
|
-
validation.
|
|
29
|
+
validation.assertType(mode, "string",
|
|
30
30
|
"exec.R.operationMode: <mode> must be string")
|
|
31
31
|
|
|
32
32
|
ll.assert(mode == "remote" || mode == "dev-local",
|
|
@@ -37,7 +37,7 @@ rVenvBuilder := func() {
|
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
useToolset: func(name) {
|
|
40
|
-
validation.
|
|
40
|
+
validation.assertType(name, "string",
|
|
41
41
|
"exec.R.useToolset: <name> must be valid name of R packaging toolset (i.e. 'renv')")
|
|
42
42
|
ll.assert(name != "", "exec.R.useToolset: toolset name must not be empty")
|
|
43
43
|
|
|
@@ -46,7 +46,7 @@ rVenvBuilder := func() {
|
|
|
46
46
|
},
|
|
47
47
|
|
|
48
48
|
runEnvDescriptor: func(descriptor) {
|
|
49
|
-
validation.
|
|
49
|
+
validation.assertType(descriptor, desc.runEnvScheme, "exec.R.runEnvDescriptor: <descriptor> must be run environment specification")
|
|
50
50
|
ll.assert(descriptor.type == "R", "exec.R.runEnvDescriptor: not a 'R' run environment: %q", descriptor.type)
|
|
51
51
|
|
|
52
52
|
rDescriptor = ll.fromStrict(descriptor)
|
|
@@ -54,14 +54,14 @@ rVenvBuilder := func() {
|
|
|
54
54
|
},
|
|
55
55
|
|
|
56
56
|
software: func(pkgRef) {
|
|
57
|
-
validation.
|
|
57
|
+
validation.assertType(pkgRef, validation.reference, "exec.R.software: <pkgRef> must be a reference to software package")
|
|
58
58
|
|
|
59
59
|
softwareRef = pkgRef
|
|
60
60
|
return self
|
|
61
61
|
},
|
|
62
62
|
|
|
63
63
|
dependencies: func(deps) {
|
|
64
|
-
validation.
|
|
64
|
+
validation.assertType(deps, { "any": "string" }, "exec.R.dependencies: <deps> must be map of reference file paths")
|
|
65
65
|
|
|
66
66
|
dependencies = deps
|
|
67
67
|
return self
|
|
@@ -150,7 +150,7 @@ rVenvBuilder := func() {
|
|
|
150
150
|
R: rPkg
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
validation.
|
|
153
|
+
validation.assertType(rVenvInputs, internal.rVenvInputSchema, "incomplete R runenv configuration")
|
|
154
154
|
|
|
155
155
|
tpl := render.create(createRenvTpl, rVenvInputs)
|
|
156
156
|
|
|
@@ -289,7 +289,7 @@ swToRunCmdOptions := func(softwareName, softwareVersion, softwareDescriptor) {
|
|
|
289
289
|
"exec.internal.swToRunCmdOptions: software name must be a string, got %v", softwareName)
|
|
290
290
|
ll.assert(is_string(softwareVersion),
|
|
291
291
|
"exec.internal.swToRunCmdOptions: software version must be a string, got %v", softwareVersion)
|
|
292
|
-
validation.
|
|
292
|
+
validation.assertType(softwareDescriptor, desc.scheme,
|
|
293
293
|
"exec.internal.swToRunCmdOptions: descriptor does not fit schema")
|
|
294
294
|
|
|
295
295
|
result := undefined
|
|
@@ -316,7 +316,7 @@ swToRunCmdOptions := func(softwareName, softwareVersion, softwareDescriptor) {
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
binaryRunOptions := func(runOptions, mnzEnvs) {
|
|
319
|
-
validation.
|
|
319
|
+
validation.assertType(mnzEnvs, {"any": validation.reference})
|
|
320
320
|
|
|
321
321
|
runCmdOpts := undefined
|
|
322
322
|
if (is_undefined(ll.fromStrict(runOptions).software)) {
|
|
@@ -179,7 +179,7 @@ builder := func() {
|
|
|
179
179
|
* @param value: string - the value of the environment variable.
|
|
180
180
|
*/
|
|
181
181
|
env: func(name, value) {
|
|
182
|
-
validation.
|
|
182
|
+
validation.assertType([name, value], ["string"])
|
|
183
183
|
envs[name] = value
|
|
184
184
|
envsTyped[name] = {
|
|
185
185
|
type: execConstants.ARG_TYPE_STRING,
|
|
@@ -195,7 +195,7 @@ builder := func() {
|
|
|
195
195
|
* @param value: string - the value of the environment variable.
|
|
196
196
|
*/
|
|
197
197
|
envWithVar: func(name, value) {
|
|
198
|
-
validation.
|
|
198
|
+
validation.assertType([name, value], ["string"])
|
|
199
199
|
|
|
200
200
|
// deprecated: remove ARG_TYPE_VAR and this check after 15 Mar 2025
|
|
201
201
|
t := feats.commandExpressions ? execConstants.ARG_TYPE_EXPRESSION : execConstants.ARG_TYPE_VAR
|
|
@@ -225,7 +225,7 @@ builder := func() {
|
|
|
225
225
|
* @param envName: string - name of environment variable to set with value of secret.
|
|
226
226
|
*/
|
|
227
227
|
secret: func(secretName, envName) {
|
|
228
|
-
validation.
|
|
228
|
+
validation.assertType([secretName, envName], ["string"])
|
|
229
229
|
secrets[envName] = "{secrets."+secretName+"}"
|
|
230
230
|
return self
|
|
231
231
|
},
|
|
@@ -366,8 +366,8 @@ builder := func() {
|
|
|
366
366
|
|
|
367
367
|
ll.assert(assets.isAssetInfo(asset),
|
|
368
368
|
"exec.builder.addAsset: <asset> parameter is not an asset info. Provide the value obtained from assets.importAsset() here")
|
|
369
|
-
validation.
|
|
370
|
-
validation.
|
|
369
|
+
validation.assertType(destinationDir, "string", "exec.builder.addAsset: <destinationDir> is not a string. It must be a path inside working directory")
|
|
370
|
+
validation.assertType(pathsInArchive, ["string"], "exec.builder.addAsset: <pathsInArchive> must contain list of strings with paths inside archive")
|
|
371
371
|
|
|
372
372
|
assetIdKey := ll.idToString(asset._id)
|
|
373
373
|
if is_undefined(assetRules[assetIdKey]) {
|
|
@@ -509,7 +509,7 @@ builder := func() {
|
|
|
509
509
|
* a resource from which data we create a file.
|
|
510
510
|
*/
|
|
511
511
|
writeFile: func(fileName, data, ...opts) {
|
|
512
|
-
validation.
|
|
512
|
+
validation.assertType(data, ["or",
|
|
513
513
|
"string",
|
|
514
514
|
"bytes",
|
|
515
515
|
validation.reference])
|
|
@@ -39,7 +39,7 @@ schema := {
|
|
|
39
39
|
"fileParams": {"any": fileParamsSchema}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/** Same as validation.
|
|
42
|
+
/** Same as validation.assertType(params, fileParamsSchema, ...),
|
|
43
43
|
* but with prettier errors for clients. */
|
|
44
44
|
_validateParams := func(params) {
|
|
45
45
|
ll.assert(ll.isMap(params), "monetization.validateParams(): mnz params must be a map")
|
|
@@ -48,7 +48,7 @@ _validateParams := func(params) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
_validateIsReady := func(mnz) {
|
|
51
|
-
validation.
|
|
51
|
+
validation.assertType(mnz, schema,
|
|
52
52
|
"monetization.assertIsReady(): monetization does not fit schema")
|
|
53
53
|
ll.assert(len(mnz.productName) > 0,
|
|
54
54
|
"monetization.assertIsReady(): product name must be set")
|
|
@@ -61,7 +61,7 @@ enable := func(mnz, productName) {
|
|
|
61
61
|
ll.assert(is_string(productName),
|
|
62
62
|
"monetization.enable(): product name must be a string, got %v", productName)
|
|
63
63
|
|
|
64
|
-
validation.
|
|
64
|
+
validation.assertType(mnz, schema,
|
|
65
65
|
"monetization.enable(): mnz object does not fit schema")
|
|
66
66
|
|
|
67
67
|
mnz.enabled = true
|
|
@@ -79,7 +79,7 @@ shouldRun := func(mnz) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
toJson := func(mnz) {
|
|
82
|
-
validation.
|
|
82
|
+
validation.assertType(mnz, schema,
|
|
83
83
|
"monetization.toJson(): monetization object does not fit json schema")
|
|
84
84
|
|
|
85
85
|
return ll.fromStrict(mnz)
|
|
@@ -87,12 +87,12 @@ toJson := func(mnz) {
|
|
|
87
87
|
|
|
88
88
|
/** Adds monetization parameters by a file. */
|
|
89
89
|
addFileParams := func(mnz, fileName, params) {
|
|
90
|
-
validation.
|
|
90
|
+
validation.assertType(mnz, schema,
|
|
91
91
|
"monetization.addFileParams(): monetization object does not fit json schema")
|
|
92
92
|
|
|
93
93
|
_validateParams(params)
|
|
94
94
|
|
|
95
|
-
validation.
|
|
95
|
+
validation.assertType(params, fileParamsSchema,
|
|
96
96
|
"monetization.addFileParams(): file params does not fit json schema")
|
|
97
97
|
|
|
98
98
|
ll.assert(mnz.enabled,
|
|
@@ -89,7 +89,7 @@ _useSettingsSchema := {
|
|
|
89
89
|
use := func(settings) {
|
|
90
90
|
res := smart.structBuilder(_RTYPE_PACKAGE_USE)
|
|
91
91
|
|
|
92
|
-
validation.
|
|
92
|
+
validation.assertType(settings, _useSettingsSchema, "package.use(<settings>): settings have invalid format")
|
|
93
93
|
settingsRes := smart.createJsonResource(settings)
|
|
94
94
|
|
|
95
95
|
res.getField(_INPUT_PACKAGE_USE_SETTINGS).set(settingsRes)
|
|
@@ -132,14 +132,14 @@ pkgFileLoader := func(pkg) {
|
|
|
132
132
|
|
|
133
133
|
self = {
|
|
134
134
|
saveFile: func(path) {
|
|
135
|
-
validation.
|
|
135
|
+
validation.assertType(path, "string", "package.pkgFileLoader.saveFile: <path> must be string")
|
|
136
136
|
filePaths = append(filePaths, path)
|
|
137
137
|
|
|
138
138
|
return self
|
|
139
139
|
},
|
|
140
140
|
|
|
141
141
|
saveFiles: func(paths) {
|
|
142
|
-
validation.
|
|
142
|
+
validation.assertType(paths, ["string"], "package.pkgFileLoader.saveFiles: <paths> must be array of strings")
|
|
143
143
|
for p in paths {
|
|
144
144
|
self.saveFile(p)
|
|
145
145
|
}
|
|
@@ -148,13 +148,13 @@ pkgFileLoader := func(pkg) {
|
|
|
148
148
|
},
|
|
149
149
|
|
|
150
150
|
saveFileContent: func(path) {
|
|
151
|
-
validation.
|
|
151
|
+
validation.assertType(path, "string", "package.pkgFileLoader.saveFileContent: <path> must be string")
|
|
152
152
|
fileContentPaths = append(fileContentPaths, path)
|
|
153
153
|
return self
|
|
154
154
|
},
|
|
155
155
|
|
|
156
156
|
saveFilesContent: func(paths) {
|
|
157
|
-
validation.
|
|
157
|
+
validation.assertType(paths, ["string"], "package.pkgFileLoader.saveFilesContent: <paths> must be array of strings")
|
|
158
158
|
for p in paths {
|
|
159
159
|
self.saveFileContent(p)
|
|
160
160
|
}
|
|
@@ -26,7 +26,7 @@ pythonVenvBuilder := func() {
|
|
|
26
26
|
|
|
27
27
|
self = {
|
|
28
28
|
useToolset: func(name) {
|
|
29
|
-
validation.
|
|
29
|
+
validation.assertType(name, "string",
|
|
30
30
|
"exec.python.useToolset: <name> must be valid name of python packaging toolset (pip, pipenv and so on)")
|
|
31
31
|
ll.assert(name != "", "exec.python.useToolset: toolset name must not be empty")
|
|
32
32
|
|
|
@@ -35,7 +35,7 @@ pythonVenvBuilder := func() {
|
|
|
35
35
|
},
|
|
36
36
|
|
|
37
37
|
runEnvDescriptor: func(descriptor) {
|
|
38
|
-
validation.
|
|
38
|
+
validation.assertType(descriptor, desc.runEnvScheme, "exec.python.runEnvDescriptor: <descriptor> must be run environment specification")
|
|
39
39
|
ll.assert(descriptor.type == "python", "exec.python.runEnvDescriptor: not a 'python' run environment: %q", descriptor.type)
|
|
40
40
|
|
|
41
41
|
pythonDescriptor = ll.fromStrict(descriptor)
|
|
@@ -43,14 +43,14 @@ pythonVenvBuilder := func() {
|
|
|
43
43
|
},
|
|
44
44
|
|
|
45
45
|
software: func(pkgRef) {
|
|
46
|
-
validation.
|
|
46
|
+
validation.assertType(pkgRef, validation.reference, "exec.python.software: <pkgRef> must be a reference to software package")
|
|
47
47
|
|
|
48
48
|
softwareRef = pkgRef
|
|
49
49
|
return self
|
|
50
50
|
},
|
|
51
51
|
|
|
52
52
|
dependencies: func(deps) {
|
|
53
|
-
validation.
|
|
53
|
+
validation.assertType(deps, { "any": "string" }, "exec.python.dependencies: <deps> must be map of reference file paths")
|
|
54
54
|
|
|
55
55
|
dependencies = deps
|
|
56
56
|
return self
|
|
@@ -140,7 +140,7 @@ pythonVenvBuilder := func() {
|
|
|
140
140
|
python: pythonPkg
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
validation.
|
|
143
|
+
validation.assertType(pyVenvInputs, internal.pythonVenvInputSchema, "incomplete python runenv configuration")
|
|
144
144
|
|
|
145
145
|
tpl := render.create(createVenvTpl, pyVenvInputs)
|
|
146
146
|
|
|
@@ -27,14 +27,14 @@ saveBuilder := func(wd) {
|
|
|
27
27
|
|
|
28
28
|
self = {
|
|
29
29
|
addPath: func(path) {
|
|
30
|
-
validation.
|
|
30
|
+
validation.assertType(path, "string", "runenv.saveBuilder.addPath: <path> must be string")
|
|
31
31
|
|
|
32
32
|
pathsToSave = append(pathsToSave, path)
|
|
33
33
|
return self
|
|
34
34
|
},
|
|
35
35
|
|
|
36
36
|
envType: func(type) {
|
|
37
|
-
validation.
|
|
37
|
+
validation.assertType(type, "string", "runenv.saveBuilder.envType: <type> must be string")
|
|
38
38
|
|
|
39
39
|
envType = type
|
|
40
40
|
return self
|
|
@@ -45,7 +45,7 @@ saveBuilder := func(wd) {
|
|
|
45
45
|
*/
|
|
46
46
|
addPackage: func(key, pkgRef) {
|
|
47
47
|
ll.assert(!maps.containsKey(packagesMap, key), "runenv.saveBuilder.addPackage: package %q was already added to SaveRunEnv builder", key)
|
|
48
|
-
validation.
|
|
48
|
+
validation.assertType(pkgRef, validation.reference, "runenv.saveBuilder.addPackage: <pkgRef> must be reference")
|
|
49
49
|
|
|
50
50
|
packagesMap[key] = pkgRef
|
|
51
51
|
return self
|
|
@@ -31,7 +31,7 @@ RTYPE_BLOB_DOWNLOAD := { Name: "BlobDownload", Version: "2" }
|
|
|
31
31
|
* 'handle' - reference to resource with 'progress' API.
|
|
32
32
|
*/
|
|
33
33
|
createBlobImportExternal := func(settings) {
|
|
34
|
-
validation.
|
|
34
|
+
validation.assertType(settings, {
|
|
35
35
|
"dataURL": "string",
|
|
36
36
|
"dataHeaders,?": [["string"]],
|
|
37
37
|
"dataVersion,?": "string"
|
|
@@ -52,7 +52,7 @@ createBlobImportExternal := func(settings) {
|
|
|
52
52
|
* 'handle' - reference to resource with 'progress' API.
|
|
53
53
|
*/
|
|
54
54
|
createBlobImportInternal := func(settings) {
|
|
55
|
-
validation.
|
|
55
|
+
validation.assertType(settings, {
|
|
56
56
|
"path": "string",
|
|
57
57
|
"storageId": "string",
|
|
58
58
|
"maxSpeedBytes,?": "number",
|
|
@@ -74,7 +74,7 @@ createBlobImportInternal := func(settings) {
|
|
|
74
74
|
* 'handle' - reference to resource with 'progress' and 'upload' APIs.
|
|
75
75
|
*/
|
|
76
76
|
createBlobUpload := func(settings) {
|
|
77
|
-
validation.
|
|
77
|
+
validation.assertType(settings, {
|
|
78
78
|
"modificationTime": "string",
|
|
79
79
|
"localPath": "string",
|
|
80
80
|
"pathSignature": "string",
|
|
@@ -9,7 +9,7 @@ validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
|
9
9
|
* @param elems: ...string - any number of elements.
|
|
10
10
|
*/
|
|
11
11
|
join := func(...elems) {
|
|
12
|
-
validation.
|
|
12
|
+
validation.assertType(elems, ["string"])
|
|
13
13
|
return ll.filepathJoin(elems...)
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@ join := func(...elems) {
|
|
|
20
20
|
* @param elems: ...string - any number of elements.
|
|
21
21
|
*/
|
|
22
22
|
regexpJoin := func(...elems) {
|
|
23
|
-
validation.
|
|
23
|
+
validation.assertType(elems, ["string"])
|
|
24
24
|
return ll.filepathRegexpJoin(elems...)
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -32,7 +32,7 @@ regexpJoin := func(...elems) {
|
|
|
32
32
|
* @param elems: ...string - any number of elements.
|
|
33
33
|
*/
|
|
34
34
|
canonize := func(...elems) {
|
|
35
|
-
validation.
|
|
35
|
+
validation.assertType(elems, ["string"])
|
|
36
36
|
return ll.filepathCanonize(elems...)
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -51,12 +51,12 @@ separator := ll.pathSeparator
|
|
|
51
51
|
* @return trimmed path: string - a path without the beginning and a path separator.
|
|
52
52
|
*/
|
|
53
53
|
trimPrefix := func(path, prefix) {
|
|
54
|
-
validation.
|
|
54
|
+
validation.assertType([path, prefix], ["string"])
|
|
55
55
|
return text.trim_prefix(path, prefix+separator)
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
_sepOrDefault := func(...sep) {
|
|
59
|
-
validation.
|
|
59
|
+
validation.assertType(sep, [["or", "string", "char", "null"]])
|
|
60
60
|
|
|
61
61
|
if slices.length(sep) == 0 {
|
|
62
62
|
return separator
|
|
@@ -89,7 +89,7 @@ split := func(path, ...sep) {
|
|
|
89
89
|
* @return components: []string - all directories and a file name at the end from their root.
|
|
90
90
|
*/
|
|
91
91
|
getBasenameDirs := func(path, ...sep) {
|
|
92
|
-
validation.
|
|
92
|
+
validation.assertType(path, "string")
|
|
93
93
|
sep = _sepOrDefault(sep...)
|
|
94
94
|
|
|
95
95
|
dirs := split(path, sep)
|
|
@@ -111,7 +111,7 @@ getBasenameDirs := func(path, ...sep) {
|
|
|
111
111
|
* @return extension: string - the extension without the leading "."
|
|
112
112
|
*/
|
|
113
113
|
getExtension := func(path, ...sep) {
|
|
114
|
-
validation.
|
|
114
|
+
validation.assertType(path, "string")
|
|
115
115
|
ext := ""
|
|
116
116
|
sep = _sepOrDefault(sep...)
|
|
117
117
|
|
|
@@ -143,7 +143,7 @@ getExtension := func(path, ...sep) {
|
|
|
143
143
|
* @param path: string - a path
|
|
144
144
|
*/
|
|
145
145
|
assertIsValid := func(path) {
|
|
146
|
-
validation.
|
|
146
|
+
validation.assertType(path, "string")
|
|
147
147
|
if text.contains(path, "/") {
|
|
148
148
|
ll.assert(
|
|
149
149
|
text.contains(path, separator),
|
|
@@ -90,7 +90,7 @@ _TRACE_SCHEMA := [_TRACE_STEP_SCHEMA]
|
|
|
90
90
|
*/
|
|
91
91
|
makeTrace := func(input, ...steps) {
|
|
92
92
|
// validating input step structure
|
|
93
|
-
validation.
|
|
93
|
+
validation.assertType(steps, _TRACE_SCHEMA)
|
|
94
94
|
|
|
95
95
|
currentTraceContent := undefined
|
|
96
96
|
if is_string(input) {
|
|
@@ -105,7 +105,7 @@ makeTrace := func(input, ...steps) {
|
|
|
105
105
|
if !is_undefined(currentTraceContent) {
|
|
106
106
|
currentTrace = json.decode(currentTraceContent)
|
|
107
107
|
// validating trace we just parsed
|
|
108
|
-
validation.
|
|
108
|
+
validation.assertType(currentTrace, _TRACE_SCHEMA)
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
currentTrace = append(currentTrace, steps...)
|
|
@@ -116,7 +116,7 @@ makeTrace := func(input, ...steps) {
|
|
|
116
116
|
valueStr: currentTraceStr,
|
|
117
117
|
/** Injects trace information into column spec */
|
|
118
118
|
inject: func(spec) {
|
|
119
|
-
validation.
|
|
119
|
+
validation.assertType(spec, P_COLUMN_SPEC_SCHEMA)
|
|
120
120
|
return maps.deepMerge(spec, {annotations: {"pl7.app/trace": currentTraceStr}})
|
|
121
121
|
}
|
|
122
122
|
})
|
|
@@ -85,7 +85,7 @@ getColumnSpec := func(axesSpec, col) {
|
|
|
85
85
|
importFile := func(xsvFile, xsvType, spec, ...ops) {
|
|
86
86
|
ll.assert(xsvType == "csv" || xsvType == "tsv", "expected one of [tsv, csv] types")
|
|
87
87
|
|
|
88
|
-
validation.
|
|
88
|
+
validation.assertType(spec, util.PFCONV_IMPORT_CFG_SCHEMA)
|
|
89
89
|
|
|
90
90
|
xsvFileName := "file." + xsvType
|
|
91
91
|
|
|
@@ -377,7 +377,7 @@ assertType := func(value, schema, ...failMsg) {
|
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
/**
|
|
380
|
-
* Alias to '
|
|
380
|
+
* Alias to 'assertType' for backward compatibility
|
|
381
381
|
*/
|
|
382
382
|
assertJsonSchema := func(js, schema, ...failMsg) {
|
|
383
383
|
assertType(js, schema, failMsg...)
|
|
@@ -126,13 +126,13 @@ _fill := func(workdir) {
|
|
|
126
126
|
* be extracted into '<destinationDir>/a/b/file.txt', NOT '<destinationDir>/file.txt',
|
|
127
127
|
*/
|
|
128
128
|
addFromZip: func(zipResource, destinationDir, pathsInArchive) {
|
|
129
|
-
validation.
|
|
130
|
-
validation.
|
|
129
|
+
validation.assertType(zipResource, validation.reference, "workdir.builder.addFromZip: <zipResource> is not smart.reference")
|
|
130
|
+
validation.assertType(destinationDir, "string", "workdir.builder.addFromZip: <destinationDir> is not a string. It must be a path inside working directory")
|
|
131
131
|
|
|
132
132
|
if (is_undefined(pathsInArchive)) {
|
|
133
133
|
pathsInArchive = []
|
|
134
134
|
}
|
|
135
|
-
validation.
|
|
135
|
+
validation.assertType(pathsInArchive, ["string"], "workdir.builder.addFromZip: <pathsInArchive> must contain list of strings with paths inside archive")
|
|
136
136
|
|
|
137
137
|
blobKey := ll.idToString(zipResource.id)
|
|
138
138
|
|
|
@@ -163,8 +163,8 @@ _fill := func(workdir) {
|
|
|
163
163
|
* @param fileResource: reference - the file to add.
|
|
164
164
|
*/
|
|
165
165
|
addFile: func(fileName, fileResource) {
|
|
166
|
-
validation.
|
|
167
|
-
validation.
|
|
166
|
+
validation.assertType(fileName, "string")
|
|
167
|
+
validation.assertType(fileResource, validation.reference)
|
|
168
168
|
|
|
169
169
|
files[fileName] = fileResource
|
|
170
170
|
blobs[fileName] = fileResource
|
|
@@ -190,7 +190,7 @@ _fill := func(workdir) {
|
|
|
190
190
|
* @param contentRef: reference|any - the content as a reference to add or the content itself.
|
|
191
191
|
*/
|
|
192
192
|
writeFile: func(fileName, contentRef) {
|
|
193
|
-
validation.
|
|
193
|
+
validation.assertType(fileName, "string")
|
|
194
194
|
values[fileName] = contentRef
|
|
195
195
|
self._addDirs(fileName)
|
|
196
196
|
|
|
@@ -291,7 +291,7 @@ save := func(workdir) {
|
|
|
291
291
|
* @param fileName: string - the name of the file.
|
|
292
292
|
*/
|
|
293
293
|
saveFile: func(fileName) {
|
|
294
|
-
validation.
|
|
294
|
+
validation.assertType(fileName, "string")
|
|
295
295
|
sets.add(files, fileName)
|
|
296
296
|
return self
|
|
297
297
|
},
|
|
@@ -302,7 +302,7 @@ save := func(workdir) {
|
|
|
302
302
|
* @param fileName: string - the name of the file.
|
|
303
303
|
*/
|
|
304
304
|
saveFileContent: func(fileName) {
|
|
305
|
-
validation.
|
|
305
|
+
validation.assertType(fileName, "string")
|
|
306
306
|
sets.add(filesContent, fileName)
|
|
307
307
|
return self
|
|
308
308
|
},
|
|
@@ -314,7 +314,7 @@ save := func(workdir) {
|
|
|
314
314
|
* @param regex: string - regex
|
|
315
315
|
*/
|
|
316
316
|
saveFileSet: func(name, regex) {
|
|
317
|
-
validation.
|
|
317
|
+
validation.assertType(regex, "string")
|
|
318
318
|
ll.assert(is_undefined(fileSets[name]), "file set with name '", name, "' is already in added")
|
|
319
319
|
fileSets[name] = regex
|
|
320
320
|
return self
|
|
@@ -327,7 +327,7 @@ save := func(workdir) {
|
|
|
327
327
|
* @param regex: string - regex
|
|
328
328
|
*/
|
|
329
329
|
saveFileSetContent: func(name, regex) {
|
|
330
|
-
validation.
|
|
330
|
+
validation.assertType(regex, "string")
|
|
331
331
|
ll.assert(is_undefined(fileSetsContent[name]), "file set content with name '", name, "' is already in added")
|
|
332
332
|
sets.add(fileSetsContent, regex)
|
|
333
333
|
return self
|
|
@@ -214,13 +214,7 @@ resolve := func(ref, ...options) {
|
|
|
214
214
|
// template for prerun
|
|
215
215
|
_preRunTpl := undefined
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
* Prepare additional resources for the workflow body. The body function of the workflow will be executed only when the references will be
|
|
219
|
-
* returned by the prepare method will ve resolved into a ready resources. The resulting resources will be passed as an input to the body function.
|
|
220
|
-
*
|
|
221
|
-
* @param cb: a callback function returning a map of references to be resolved
|
|
222
|
-
*/
|
|
223
|
-
prepare := func(cb) {
|
|
217
|
+
_prepare := func(cb) {
|
|
224
218
|
self.prepare(func(_){
|
|
225
219
|
raw := cb(args())
|
|
226
220
|
prefixed := {}
|
|
@@ -232,6 +226,32 @@ prepare := func(cb) {
|
|
|
232
226
|
})
|
|
233
227
|
}
|
|
234
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Prepare additional resources for the workflow body. The body function of the workflow will be executed only when the references will be
|
|
231
|
+
* returned by the prepare method will ve resolved into a ready resources. The resulting resources will be passed as an input to the body function.
|
|
232
|
+
*
|
|
233
|
+
* @param cb: a callback function returning a map of references to be resolved
|
|
234
|
+
*/
|
|
235
|
+
prepare := func(cb) {
|
|
236
|
+
if !_isProduction() {
|
|
237
|
+
return
|
|
238
|
+
}
|
|
239
|
+
_prepare(cb)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Prepare additional resources for the workflow body in pre-run. The body function of the workflow will be executed only when the references will be
|
|
244
|
+
* returned by the prepare method will ve resolved into a ready resources. The resulting resources will be passed as an input to the body function.
|
|
245
|
+
*
|
|
246
|
+
* @param cb: a callback function returning a map of references to be resolved
|
|
247
|
+
*/
|
|
248
|
+
preparePreRun := func(cb) {
|
|
249
|
+
if !_isStaging() {
|
|
250
|
+
return
|
|
251
|
+
}
|
|
252
|
+
_prepare(cb)
|
|
253
|
+
}
|
|
254
|
+
|
|
235
255
|
/**
|
|
236
256
|
* Defines a pre run entry point for a current workflow
|
|
237
257
|
*/
|
|
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
|