@platforma-sdk/workflow-tengo 2.8.4 → 2.8.6
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/assets.lib.tengo +6 -0
- package/dist/tengo/lib/constants.lib.tengo +3 -0
- package/dist/tengo/lib/exec.R.lib.tengo +8 -0
- package/dist/tengo/lib/exec.internal.lib.tengo +12 -0
- package/dist/tengo/lib/exec.lib.tengo +67 -0
- package/dist/tengo/lib/exec.package.lib.tengo +9 -0
- package/dist/tengo/lib/exec.python.internal.lib.tengo +1 -0
- package/dist/tengo/lib/exec.python.lib.tengo +8 -0
- package/dist/tengo/lib/exec.runcmd.lib.tengo +19 -0
- package/dist/tengo/lib/exec.runenv.lib.tengo +4 -0
- package/dist/tengo/lib/exec.stream.lib.tengo +4 -0
- package/dist/tengo/lib/file.internal.lib.tengo +7 -0
- package/dist/tengo/lib/file.lib.tengo +3 -0
- package/dist/tengo/lib/ll.lib.tengo +24 -0
- package/dist/tengo/lib/maps.lib.tengo +8 -0
- package/dist/tengo/lib/objects.lib.tengo +2 -0
- package/dist/tengo/lib/oop.lib.tengo +3 -0
- package/dist/tengo/lib/path.lib.tengo +9 -0
- package/dist/tengo/lib/pframes.constants.lib.tengo +3 -0
- package/dist/tengo/lib/pframes.export-pcolumn.lib.tengo +5 -0
- package/dist/tengo/lib/pframes.lib.tengo +5 -0
- package/dist/tengo/lib/pframes.ll.lib.tengo +2 -0
- package/dist/tengo/lib/pframes.pcolumn.lib.tengo +4 -0
- package/dist/tengo/lib/pframes.spec.lib.tengo +26 -0
- package/dist/tengo/lib/pframes.util.lib.tengo +134 -0
- package/dist/tengo/lib/pframes.xsv.lib.tengo +12 -0
- package/dist/tengo/lib/render.lib.tengo +10 -0
- package/dist/tengo/lib/sets.lib.tengo +7 -0
- package/dist/tengo/lib/slices.lib.tengo +11 -0
- package/dist/tengo/lib/smart.lib.tengo +114 -1
- package/dist/tengo/lib/test.lib.tengo +32 -0
- package/dist/tengo/lib/tpl.lib.tengo +68 -0
- package/dist/tengo/lib/tpl.state-await.lib.tengo +14 -0
- package/dist/tengo/lib/tpl.util.lib.tengo +5 -0
- package/dist/tengo/lib/validation.lib.tengo +44 -0
- package/dist/tengo/lib/workdir.lib.tengo +22 -0
- package/dist/tengo/lib/workdir.proc.lib.tengo +18 -0
- package/dist/tengo/lib/workdir.save.lib.tengo +17 -0
- package/dist/tengo/lib/workflow.bobject.lib.tengo +5 -0
- package/dist/tengo/lib/workflow.bquery.lib.tengo +25 -0
- package/dist/tengo/lib/workflow.constants.lib.tengo +1 -0
- package/dist/tengo/lib/workflow.context.lib.tengo +5 -0
- package/dist/tengo/lib/workflow.lib.tengo +39 -0
- 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.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 +3 -3
|
@@ -57,6 +57,7 @@ return self
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
60
|
+
|
|
60
61
|
cacheMillis: func(millis) {
|
|
61
62
|
ll.assert(is_int(millis) && millis > 0, "exec.python.cacheMillis: cache time must be a number of milliseconds")
|
|
62
63
|
cache = millis * times.millisecond
|
|
@@ -67,6 +68,7 @@ return self
|
|
|
67
68
|
|
|
68
69
|
|
|
69
70
|
|
|
71
|
+
|
|
70
72
|
cacheSeconds: func(seconds) {
|
|
71
73
|
ll.assert(is_int(seconds) && seconds > 0, "exec.python.cacheSeconds: cache time must be a number of seconds")
|
|
72
74
|
cache = seconds * times.second
|
|
@@ -77,6 +79,7 @@ return self
|
|
|
77
79
|
|
|
78
80
|
|
|
79
81
|
|
|
82
|
+
|
|
80
83
|
cacheMinutes: func(minutes) {
|
|
81
84
|
ll.assert(is_int(minutes) && minutes > 0, "exec.python.cacheMinutes: cache time must be a number of minutes")
|
|
82
85
|
cache = minutes * times.minute
|
|
@@ -87,6 +90,7 @@ return self
|
|
|
87
90
|
|
|
88
91
|
|
|
89
92
|
|
|
93
|
+
|
|
90
94
|
cacheHours: func(hours) {
|
|
91
95
|
ll.assert(is_int(hours) && hours > 0, "exec.python.cacheHours: cache time must be a number of hours")
|
|
92
96
|
cache = hours * times.hour
|
|
@@ -97,6 +101,7 @@ return self
|
|
|
97
101
|
|
|
98
102
|
|
|
99
103
|
|
|
104
|
+
|
|
100
105
|
cacheDays: func(days) {
|
|
101
106
|
ll.assert(is_int(days) && days > 0, "exec.python.cacheDays: cache time must be a number of days")
|
|
102
107
|
cache = days * times.hour * 24
|
|
@@ -108,6 +113,7 @@ return self
|
|
|
108
113
|
|
|
109
114
|
|
|
110
115
|
|
|
116
|
+
|
|
111
117
|
cache: func(time) {
|
|
112
118
|
ll.assert(
|
|
113
119
|
is_int(time),
|
|
@@ -126,6 +132,7 @@ pythonPkg := pkg.install(archive).package()
|
|
|
126
132
|
pyVenvInputs := {
|
|
127
133
|
toolset: toolset,
|
|
128
134
|
dependencies: depsMap,
|
|
135
|
+
|
|
129
136
|
pythonDescriptor: pythonDescriptor,
|
|
130
137
|
python: pythonPkg
|
|
131
138
|
}
|
|
@@ -140,6 +147,7 @@ self = ll.toStrict(oop.inherit(tpl, {
|
|
|
140
147
|
|
|
141
148
|
|
|
142
149
|
|
|
150
|
+
|
|
143
151
|
venv: func() {
|
|
144
152
|
return tpl.output(_OUTPUT_RUN_ENV, cache)
|
|
145
153
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
5
6
|
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
6
7
|
oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
@@ -17,6 +18,7 @@ _RTYPE_RUN_COMMAND_REFS := { Name: "RunCommandRefs", Version: "1" }
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
|
|
21
|
+
|
|
20
22
|
_createSimpleArg := func(argument) {
|
|
21
23
|
return {
|
|
22
24
|
type: "string",
|
|
@@ -27,6 +29,7 @@ value: argument
|
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
|
|
32
|
+
|
|
30
33
|
_createVariableArg := func(argTpl) {
|
|
31
34
|
return {
|
|
32
35
|
type: "variableRef",
|
|
@@ -39,6 +42,7 @@ value: argTpl
|
|
|
39
42
|
|
|
40
43
|
|
|
41
44
|
|
|
45
|
+
|
|
42
46
|
builder := func(workdir) {
|
|
43
47
|
res := smart.ephemeralBuilder(_RTYPE_RUN_COMMAND)
|
|
44
48
|
res.getField("workdirIn").set(workdir)
|
|
@@ -64,6 +68,7 @@ self = ll.toStrict(oop.inherit(res, {
|
|
|
64
68
|
|
|
65
69
|
|
|
66
70
|
|
|
71
|
+
|
|
67
72
|
cmd: func(commandName) {
|
|
68
73
|
cmd = _createSimpleArg(commandName)
|
|
69
74
|
return self
|
|
@@ -76,6 +81,7 @@ return self
|
|
|
76
81
|
|
|
77
82
|
|
|
78
83
|
|
|
84
|
+
|
|
79
85
|
cmdVar: func(commandTpl) {
|
|
80
86
|
cmd = _createVariableArg(commandTpl)
|
|
81
87
|
hasPatternArgs = true
|
|
@@ -86,6 +92,7 @@ return self
|
|
|
86
92
|
|
|
87
93
|
|
|
88
94
|
|
|
95
|
+
|
|
89
96
|
arg: func(arg) {
|
|
90
97
|
args = append(args, _createSimpleArg(arg))
|
|
91
98
|
return self
|
|
@@ -98,6 +105,7 @@ return self
|
|
|
98
105
|
|
|
99
106
|
|
|
100
107
|
|
|
108
|
+
|
|
101
109
|
argVar: func(argTpl) {
|
|
102
110
|
args = append(args, _createVariableArg(argTpl))
|
|
103
111
|
hasPatternArgs = true
|
|
@@ -120,6 +128,7 @@ return self
|
|
|
120
128
|
|
|
121
129
|
|
|
122
130
|
|
|
131
|
+
|
|
123
132
|
env: func(name, value) {
|
|
124
133
|
envs[name] = value
|
|
125
134
|
return self
|
|
@@ -131,6 +140,7 @@ return self
|
|
|
131
140
|
|
|
132
141
|
|
|
133
142
|
|
|
143
|
+
|
|
134
144
|
envVar: func(name, valueTpl) {
|
|
135
145
|
envs[name] = _createVariableArg(valueTpl)
|
|
136
146
|
hasPatternArgs = true
|
|
@@ -142,6 +152,7 @@ return self
|
|
|
142
152
|
|
|
143
153
|
|
|
144
154
|
|
|
155
|
+
|
|
145
156
|
addToPath: func(value, hasVars) {
|
|
146
157
|
if hasVars {
|
|
147
158
|
customPaths = append(customPaths, _createVariableArg(value))
|
|
@@ -158,6 +169,7 @@ return self
|
|
|
158
169
|
|
|
159
170
|
|
|
160
171
|
|
|
172
|
+
|
|
161
173
|
substitutionRule: func(varName, refKey) {
|
|
162
174
|
substRules[varName] = refKey
|
|
163
175
|
return self
|
|
@@ -167,6 +179,7 @@ return self
|
|
|
167
179
|
|
|
168
180
|
|
|
169
181
|
|
|
182
|
+
|
|
170
183
|
substitutionRules: func(rules) {
|
|
171
184
|
for k, v in rules {
|
|
172
185
|
substRules[k] = v
|
|
@@ -178,6 +191,7 @@ return self
|
|
|
178
191
|
|
|
179
192
|
|
|
180
193
|
|
|
194
|
+
|
|
181
195
|
inQueue: func(queueName) {
|
|
182
196
|
queue = queueName
|
|
183
197
|
return self
|
|
@@ -187,6 +201,7 @@ return self
|
|
|
187
201
|
|
|
188
202
|
|
|
189
203
|
|
|
204
|
+
|
|
190
205
|
stdout: func(fileName) {
|
|
191
206
|
stdout = fileName
|
|
192
207
|
return self
|
|
@@ -196,6 +211,7 @@ return self
|
|
|
196
211
|
|
|
197
212
|
|
|
198
213
|
|
|
214
|
+
|
|
199
215
|
stderr: func(fileName) {
|
|
200
216
|
stderr = fileName
|
|
201
217
|
return self
|
|
@@ -205,6 +221,7 @@ return self
|
|
|
205
221
|
|
|
206
222
|
|
|
207
223
|
|
|
224
|
+
|
|
208
225
|
nErrorLines: func(number) {
|
|
209
226
|
nErrorLines = number
|
|
210
227
|
return self
|
|
@@ -214,8 +231,10 @@ return self
|
|
|
214
231
|
|
|
215
232
|
|
|
216
233
|
|
|
234
|
+
|
|
217
235
|
build: func() {
|
|
218
236
|
|
|
237
|
+
|
|
219
238
|
ll.assert(!hasPatternArgs || len(substRules) != 0,
|
|
220
239
|
"found pattern argument, but no substitution rules were set")
|
|
221
240
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
5
6
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
6
7
|
oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
@@ -41,6 +42,7 @@ return self
|
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
|
|
45
|
+
|
|
44
46
|
addPackage: func(key, pkgRef) {
|
|
45
47
|
ll.assert(!maps.containsKey(packagesMap, key), "runenv.saveBuilder.addPackage: package %q was already added to SaveRunEnv builder", key)
|
|
46
48
|
validation.assertJsonSchema(pkgRef, validation.reference, "runenv.saveBuilder.addPackage: <pkgRef> must be reference")
|
|
@@ -71,6 +73,7 @@ return oop.inherit(envSaver.lockAndBuild(), {
|
|
|
71
73
|
|
|
72
74
|
|
|
73
75
|
|
|
76
|
+
|
|
74
77
|
runEnv: func() {
|
|
75
78
|
return envSaver.getField(_OUTPUT_RUN_ENV)
|
|
76
79
|
},
|
|
@@ -80,6 +83,7 @@ return envSaver.getField(_OUTPUT_RUN_ENV)
|
|
|
80
83
|
|
|
81
84
|
|
|
82
85
|
|
|
86
|
+
|
|
83
87
|
workdir: func() {
|
|
84
88
|
return envSaver.getField(_OUTPUT_WD_OUT)
|
|
85
89
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
5
6
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
6
7
|
oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
@@ -15,6 +16,7 @@ _RTYPE_STREAM_MANAGER := { Name: "StreamManager", Version: "2" }
|
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
|
|
19
|
+
|
|
18
20
|
_create := func(workdir, filePath) {
|
|
19
21
|
stream := smart.ephemeralBuilder(_RTYPE_CREATE_STREAM)
|
|
20
22
|
stream.getField("workdir").set(workdir)
|
|
@@ -31,6 +33,7 @@ output: stream.outputs().stream
|
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
|
|
36
|
+
|
|
34
37
|
_manager := func(stream, downloadableRef) {
|
|
35
38
|
res := smart.structBuilder(_RTYPE_STREAM_MANAGER)
|
|
36
39
|
|
|
@@ -47,6 +50,7 @@ return res.lockAndBuild()
|
|
|
47
50
|
|
|
48
51
|
|
|
49
52
|
|
|
53
|
+
|
|
50
54
|
create := func(workdirBefore, workdirAfter, filePath) {
|
|
51
55
|
stream := _create(workdirBefore, filePath)
|
|
52
56
|
fileFuture := workdirAfter.files.getFutureInputField(filePath)
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
12
13
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
13
14
|
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
@@ -15,6 +16,9 @@ validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
|
15
16
|
json := import("json")
|
|
16
17
|
|
|
17
18
|
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
18
22
|
RTYPE_BLOB_IMPORT_EXTERNAL := { Name: "BlobImportExternal", Version: "1" }
|
|
19
23
|
RTYPE_BLOB_IMPORT_INTERNAL := { Name: "BlobImportInternal", Version: "1" }
|
|
20
24
|
RTYPE_BLOB_UPLOAD := { Name: "BlobUpload", Version: "1" }
|
|
@@ -25,6 +29,7 @@ RTYPE_BLOB_DOWNLOAD := { Name: "BlobDownload", Version: "2" }
|
|
|
25
29
|
|
|
26
30
|
|
|
27
31
|
|
|
32
|
+
|
|
28
33
|
createBlobImportExternal := func(settings) {
|
|
29
34
|
validation.assertJsonSchema(settings, {
|
|
30
35
|
"dataURL": "string",
|
|
@@ -45,6 +50,7 @@ handle: importer.getField("handle")
|
|
|
45
50
|
|
|
46
51
|
|
|
47
52
|
|
|
53
|
+
|
|
48
54
|
createBlobImportInternal := func(settings) {
|
|
49
55
|
validation.assertJsonSchema(settings, {
|
|
50
56
|
"path": "string",
|
|
@@ -66,6 +72,7 @@ handle: importer.getField("handle")
|
|
|
66
72
|
|
|
67
73
|
|
|
68
74
|
|
|
75
|
+
|
|
69
76
|
createBlobUpload := func(settings) {
|
|
70
77
|
validation.assertJsonSchema(settings, {
|
|
71
78
|
"modificationTime": "string",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
|
|
13
14
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
14
15
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
15
16
|
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
@@ -29,6 +30,7 @@ json := import("json")
|
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
|
|
33
|
+
|
|
32
34
|
importFile := func(importFileHandle) {
|
|
33
35
|
validation.assertJsonSchema(
|
|
34
36
|
importFileHandle,
|
|
@@ -57,6 +59,7 @@ ll.panic("Unknown file import handle schema: ", url.Scheme)
|
|
|
57
59
|
|
|
58
60
|
|
|
59
61
|
|
|
62
|
+
|
|
60
63
|
exportFile := func(blob) {
|
|
61
64
|
builder := smart.structBuilder(blobs.RTYPE_BLOB_DOWNLOAD)
|
|
62
65
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
2
3
|
plapi := import("plapi")
|
|
3
4
|
json := import("json")
|
|
4
5
|
fmt := import("fmt")
|
|
@@ -7,12 +8,14 @@ text := import("text")
|
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
|
|
10
12
|
apiVersion := func() {
|
|
11
13
|
return 0 // stub code. Real API checker will appear here.
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
|
|
18
|
+
|
|
16
19
|
print := func(txt, ...args) {
|
|
17
20
|
plapi.print(txt, args...)
|
|
18
21
|
}
|
|
@@ -21,15 +24,18 @@ plapi.print(txt, args...)
|
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
|
|
27
|
+
|
|
24
28
|
panic := func(msg, ...args) {
|
|
25
29
|
txt := fmt.sprintf(msg, args...)
|
|
26
30
|
plapi.print(txt)
|
|
27
31
|
|
|
32
|
+
|
|
28
33
|
plapi.setTemplateError(txt)
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
|
|
32
37
|
|
|
38
|
+
|
|
33
39
|
assert := func(condition, msg, ...args) {
|
|
34
40
|
if !condition {
|
|
35
41
|
panic("assertion error: condition failed: "+msg, args...)
|
|
@@ -41,6 +47,7 @@ panic("assertion error: condition failed: "+msg, args...)
|
|
|
41
47
|
|
|
42
48
|
|
|
43
49
|
|
|
50
|
+
|
|
44
51
|
isStrict := func(obj) {
|
|
45
52
|
return plapi.isStrictMap(obj)
|
|
46
53
|
}
|
|
@@ -50,6 +57,7 @@ return plapi.isStrictMap(obj)
|
|
|
50
57
|
|
|
51
58
|
|
|
52
59
|
|
|
60
|
+
|
|
53
61
|
isMap := func(obj) {
|
|
54
62
|
return is_map(obj) || is_immutable_map(obj) || isStrict(obj)
|
|
55
63
|
}
|
|
@@ -60,6 +68,7 @@ return is_map(obj) || is_immutable_map(obj) || isStrict(obj)
|
|
|
60
68
|
|
|
61
69
|
|
|
62
70
|
|
|
71
|
+
|
|
63
72
|
fromStrict := func(r) {
|
|
64
73
|
if is_map(r) {
|
|
65
74
|
return r
|
|
@@ -79,6 +88,7 @@ return plapi.strictToMap(r)
|
|
|
79
88
|
|
|
80
89
|
|
|
81
90
|
|
|
91
|
+
|
|
82
92
|
methodExists := func(module, methodName) {
|
|
83
93
|
if isStrict(module) {
|
|
84
94
|
if !is_callable(plapi.mapHasKey) {
|
|
@@ -105,6 +115,7 @@ return is_callable(method)
|
|
|
105
115
|
|
|
106
116
|
|
|
107
117
|
|
|
118
|
+
|
|
108
119
|
ensureNonStrict := func(r) {
|
|
109
120
|
if isStrict(r) {
|
|
110
121
|
return fromStrict(r)
|
|
@@ -121,6 +132,7 @@ return r
|
|
|
121
132
|
|
|
122
133
|
|
|
123
134
|
|
|
135
|
+
|
|
124
136
|
toStrict := func(v, ...recursive) {
|
|
125
137
|
if len(recursive) > 0 && recursive[0] {
|
|
126
138
|
if isMap(v) {
|
|
@@ -152,12 +164,14 @@ return plapi.mapToStrict(v)
|
|
|
152
164
|
|
|
153
165
|
|
|
154
166
|
|
|
167
|
+
|
|
155
168
|
fieldId := func(resourceId, fieldName) {
|
|
156
169
|
return plapi.newFieldID(resourceId, fieldName)
|
|
157
170
|
}
|
|
158
171
|
|
|
159
172
|
|
|
160
173
|
|
|
174
|
+
|
|
161
175
|
isFieldId := func(val) {
|
|
162
176
|
if !isStrict(val) {
|
|
163
177
|
return false
|
|
@@ -168,6 +182,7 @@ return v["ResourceID"] != undefined && v["Name"] != undefined
|
|
|
168
182
|
|
|
169
183
|
|
|
170
184
|
|
|
185
|
+
|
|
171
186
|
idToString := func(referenceID) {
|
|
172
187
|
if isFieldId(referenceID) {
|
|
173
188
|
return fmt.sprintf("0x%X/%s", referenceID.ResourceID, referenceID.Name)
|
|
@@ -180,12 +195,14 @@ panic("ll.idToString: <referenceID> cannot be used as resource or field ID")
|
|
|
180
195
|
|
|
181
196
|
|
|
182
197
|
|
|
198
|
+
|
|
183
199
|
getCurrentTemplateRenderer := func() {
|
|
184
200
|
return plapi.getTemplate()
|
|
185
201
|
}
|
|
186
202
|
|
|
187
203
|
|
|
188
204
|
|
|
205
|
+
|
|
189
206
|
isInitializing := func() {
|
|
190
207
|
return plapi.isInit
|
|
191
208
|
}
|
|
@@ -194,6 +211,7 @@ return plapi.isInit
|
|
|
194
211
|
|
|
195
212
|
|
|
196
213
|
|
|
214
|
+
|
|
197
215
|
getExecutorsList := func() {
|
|
198
216
|
return plapi.getExecutors()
|
|
199
217
|
}
|
|
@@ -202,6 +220,7 @@ return plapi.getExecutors()
|
|
|
202
220
|
|
|
203
221
|
|
|
204
222
|
|
|
223
|
+
|
|
205
224
|
filepathJoin := func(...elems) {
|
|
206
225
|
return plapi.filepathJoin(elems...)
|
|
207
226
|
}
|
|
@@ -211,6 +230,7 @@ return plapi.filepathJoin(elems...)
|
|
|
211
230
|
|
|
212
231
|
|
|
213
232
|
|
|
233
|
+
|
|
214
234
|
filepathRegexpJoin := func(...elems) {
|
|
215
235
|
escapedSeparator := plapi.regexpQuoteMeta(plapi.osSeparator)
|
|
216
236
|
return text.join(elems, escapedSeparator)
|
|
@@ -222,6 +242,7 @@ return text.join(elems, escapedSeparator)
|
|
|
222
242
|
|
|
223
243
|
|
|
224
244
|
|
|
245
|
+
|
|
225
246
|
filepathCanonize := func(...elem) {
|
|
226
247
|
return plapi.filepathCanonize(elem...)
|
|
227
248
|
}
|
|
@@ -230,6 +251,7 @@ return plapi.filepathCanonize(elem...)
|
|
|
230
251
|
|
|
231
252
|
|
|
232
253
|
|
|
254
|
+
|
|
233
255
|
pathSeparator := plapi.osSeparator
|
|
234
256
|
|
|
235
257
|
|
|
@@ -254,6 +276,7 @@ pathSeparator := plapi.osSeparator
|
|
|
254
276
|
|
|
255
277
|
|
|
256
278
|
|
|
279
|
+
|
|
257
280
|
|
|
258
281
|
|
|
259
282
|
parseUrl := func(url) {
|
|
@@ -262,6 +285,7 @@ return plapi.urlParse(url)
|
|
|
262
285
|
|
|
263
286
|
|
|
264
287
|
|
|
288
|
+
|
|
265
289
|
getCtx := func() {
|
|
266
290
|
return plapi.getCtx()
|
|
267
291
|
}
|
|
@@ -6,6 +6,7 @@ slices := import("@platforma-sdk/workflow-tengo:slices")
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
getKeys := func(map) {
|
|
10
11
|
res := []
|
|
11
12
|
for k, _ in map {
|
|
@@ -17,6 +18,7 @@ return slices.sortByFn(res, func(elem) { return elem })
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
|
|
21
|
+
|
|
20
22
|
containsKey := func(map, key) {
|
|
21
23
|
for k, _ in map {
|
|
22
24
|
if key == k {
|
|
@@ -27,6 +29,7 @@ return true
|
|
|
27
29
|
return false
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
|
|
30
33
|
plapi := import("plapi")
|
|
31
34
|
if ll.methodExists(plapi, "mapHasKey") {
|
|
32
35
|
containsKey = func(map, key) {
|
|
@@ -40,6 +43,7 @@ return plapi.mapHasKey(map, key)
|
|
|
40
43
|
|
|
41
44
|
|
|
42
45
|
|
|
46
|
+
|
|
43
47
|
mapKeys := func(map, fnK) {
|
|
44
48
|
newM := {}
|
|
45
49
|
for k, v in map {
|
|
@@ -49,6 +53,7 @@ newM[fnK(k)] = v
|
|
|
49
53
|
return newM
|
|
50
54
|
}
|
|
51
55
|
|
|
56
|
+
|
|
52
57
|
mapValues := func(map, fnV) {
|
|
53
58
|
newM := {}
|
|
54
59
|
for k, v in map {
|
|
@@ -58,6 +63,7 @@ newM[k] = fnV(v)
|
|
|
58
63
|
return newM
|
|
59
64
|
}
|
|
60
65
|
|
|
66
|
+
|
|
61
67
|
map := func(map, fn) {
|
|
62
68
|
newM := {}
|
|
63
69
|
for k, v in map {
|
|
@@ -94,6 +100,7 @@ return filter(map, func(k, v) { return predicateFnK(k) && predicateFnV(v) })
|
|
|
94
100
|
|
|
95
101
|
|
|
96
102
|
|
|
103
|
+
|
|
97
104
|
merge := func(...maps) {
|
|
98
105
|
res := {}
|
|
99
106
|
for map in maps {
|
|
@@ -111,6 +118,7 @@ return res
|
|
|
111
118
|
|
|
112
119
|
|
|
113
120
|
|
|
121
|
+
|
|
114
122
|
deepMerge := undefined
|
|
115
123
|
deepMerge = func(...maps) {
|
|
116
124
|
res := {}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
5
6
|
|
|
6
7
|
|
|
@@ -9,9 +10,11 @@ ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
13
|
+
|
|
12
14
|
inherit := func(super, self) {
|
|
13
15
|
self["super"] = super
|
|
14
16
|
|
|
17
|
+
|
|
15
18
|
for k, v in super {
|
|
16
19
|
if self[k] == undefined {
|
|
17
20
|
self[k] = v
|
|
@@ -7,6 +7,7 @@ validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
|
|
10
11
|
join := func(...elems) {
|
|
11
12
|
validation.assertJsonSchema(elems, ["string"])
|
|
12
13
|
return ll.filepathJoin(elems...)
|
|
@@ -17,6 +18,7 @@ return ll.filepathJoin(elems...)
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
|
|
21
|
+
|
|
20
22
|
regexpJoin := func(...elems) {
|
|
21
23
|
validation.assertJsonSchema(elems, ["string"])
|
|
22
24
|
return ll.filepathRegexpJoin(elems...)
|
|
@@ -28,6 +30,7 @@ return ll.filepathRegexpJoin(elems...)
|
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
|
|
33
|
+
|
|
31
34
|
canonize := func(...elems) {
|
|
32
35
|
validation.assertJsonSchema(elems, ["string"])
|
|
33
36
|
return ll.filepathCanonize(elems...)
|
|
@@ -37,6 +40,7 @@ return ll.filepathCanonize(elems...)
|
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
|
|
43
|
+
|
|
40
44
|
separator := ll.pathSeparator
|
|
41
45
|
|
|
42
46
|
|
|
@@ -45,6 +49,7 @@ separator := ll.pathSeparator
|
|
|
45
49
|
|
|
46
50
|
|
|
47
51
|
|
|
52
|
+
|
|
48
53
|
trimPrefix := func(path, prefix) {
|
|
49
54
|
validation.assertJsonSchema([path, prefix], ["string"])
|
|
50
55
|
return text.trim_prefix(path, prefix+separator)
|
|
@@ -67,6 +72,7 @@ return sep[0]
|
|
|
67
72
|
|
|
68
73
|
|
|
69
74
|
|
|
75
|
+
|
|
70
76
|
split := func(path, ...sep) {
|
|
71
77
|
sep = _sepOrDefault(sep...)
|
|
72
78
|
|
|
@@ -81,6 +87,7 @@ return text.split(path, sep)
|
|
|
81
87
|
|
|
82
88
|
|
|
83
89
|
|
|
90
|
+
|
|
84
91
|
getBasenameDirs := func(path, ...sep) {
|
|
85
92
|
validation.assertJsonSchema(path, "string")
|
|
86
93
|
sep = _sepOrDefault(sep...)
|
|
@@ -102,6 +109,7 @@ return dirTails
|
|
|
102
109
|
|
|
103
110
|
|
|
104
111
|
|
|
112
|
+
|
|
105
113
|
getExtension := func(path, ...sep) {
|
|
106
114
|
validation.assertJsonSchema(path, "string")
|
|
107
115
|
ext := ""
|
|
@@ -133,6 +141,7 @@ return ext
|
|
|
133
141
|
|
|
134
142
|
|
|
135
143
|
|
|
144
|
+
|
|
136
145
|
assertIsValid := func(path) {
|
|
137
146
|
validation.assertJsonSchema(path, "string")
|
|
138
147
|
if text.contains(path, "/") {
|
|
@@ -5,13 +5,16 @@ file := import("@platforma-sdk/workflow-tengo:file")
|
|
|
5
5
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
6
6
|
assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
nestedTpl := assets.importTemplate("@platforma-sdk/workflow-tengo:pframes.export-single-pcolumn")
|
|
9
10
|
|
|
11
|
+
|
|
10
12
|
exportPColumnData := func(data) {
|
|
11
13
|
if data.checkResourceType(pConstants.RTYPE_P_COLUMN_DATA_RESOURCE_MAP_PARTITIONED) ||
|
|
12
14
|
data.checkResourceType(pConstants.RTYPE_P_COLUMN_DATA_JSON_SUPER_PARTITIONED) ||
|
|
13
15
|
data.checkResourceType(pConstants.RTYPE_P_COLUMN_DATA_BINARY_SUPER_PARTITIONED) {
|
|
14
16
|
|
|
17
|
+
|
|
15
18
|
newData := smart.structBuilder(data.info().Type, data.info().Data)
|
|
16
19
|
for key, partData in data.inputs() {
|
|
17
20
|
newData.createInputField(key).set(render.createEphemeral(nestedTpl, { data: partData }).output("result"))
|
|
@@ -22,6 +25,7 @@ return newData.lockAndBuild()
|
|
|
22
25
|
data.checkResourceType(pConstants.RTYPE_P_COLUMN_DATA_JSON_PARTITIONED) ||
|
|
23
26
|
data.checkResourceType(pConstants.RTYPE_P_COLUMN_DATA_BINARY_PARTITIONED) {
|
|
24
27
|
|
|
28
|
+
|
|
25
29
|
newData := smart.structBuilder(data.info().Type, data.info().Data)
|
|
26
30
|
for key, partData in data.inputs() {
|
|
27
31
|
newData.createInputField(key).set(file.exportFile(partData))
|
|
@@ -30,6 +34,7 @@ return newData.lockAndBuild()
|
|
|
30
34
|
|
|
31
35
|
} else if data.checkResourceType(pConstants.RTYPE_P_COLUMN_DATA_JSON) {
|
|
32
36
|
|
|
37
|
+
|
|
33
38
|
return data
|
|
34
39
|
|
|
35
40
|
} else {
|