@platforma-sdk/workflow-tengo 2.8.1 → 2.8.2
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 +76 -82
- package/dist/tengo/lib/constants.lib.tengo +28 -31
- package/dist/tengo/lib/exec.R.internal.lib.tengo +14 -14
- package/dist/tengo/lib/exec.R.lib.tengo +158 -167
- package/dist/tengo/lib/exec.internal.lib.tengo +222 -234
- package/dist/tengo/lib/exec.lib.tengo +647 -714
- package/dist/tengo/lib/exec.package.lib.tengo +229 -238
- package/dist/tengo/lib/exec.python.internal.lib.tengo +5 -6
- package/dist/tengo/lib/exec.python.lib.tengo +138 -146
- package/dist/tengo/lib/exec.runcmd.lib.tengo +234 -253
- package/dist/tengo/lib/exec.runenv.lib.tengo +88 -92
- package/dist/tengo/lib/exec.stream.lib.tengo +36 -40
- package/dist/tengo/lib/file.internal.lib.tengo +70 -77
- package/dist/tengo/lib/file.lib.tengo +54 -57
- package/dist/tengo/lib/ll.lib.tengo +217 -241
- package/dist/tengo/lib/maps.lib.tengo +98 -106
- package/dist/tengo/lib/objects.lib.tengo +11 -13
- package/dist/tengo/lib/oop.lib.tengo +16 -19
- package/dist/tengo/lib/path.lib.tengo +116 -125
- package/dist/tengo/lib/pframes.constants.lib.tengo +25 -28
- package/dist/tengo/lib/pframes.export-pcolumn.lib.tengo +28 -33
- package/dist/tengo/lib/pframes.lib.tengo +38 -43
- package/dist/tengo/lib/pframes.ll.lib.tengo +70 -73
- package/dist/tengo/lib/pframes.pcolumn.lib.tengo +45 -51
- package/dist/tengo/lib/pframes.spec.lib.tengo +70 -96
- package/dist/tengo/lib/pframes.util.lib.tengo +154 -289
- package/dist/tengo/lib/pframes.xsv.lib.tengo +260 -273
- package/dist/tengo/lib/render.lib.tengo +65 -76
- package/dist/tengo/lib/sets.lib.tengo +61 -68
- package/dist/tengo/lib/slices.lib.tengo +169 -180
- package/dist/tengo/lib/smart.lib.tengo +956 -1069
- package/dist/tengo/lib/test.lib.tengo +129 -161
- package/dist/tengo/lib/tpl.lib.tengo +448 -516
- package/dist/tengo/lib/tpl.state-await.lib.tengo +226 -241
- package/dist/tengo/lib/tpl.util.lib.tengo +4 -9
- package/dist/tengo/lib/validation.lib.tengo +334 -379
- package/dist/tengo/lib/workdir.lib.tengo +309 -332
- package/dist/tengo/lib/workdir.proc.lib.tengo +126 -144
- package/dist/tengo/lib/workdir.save.lib.tengo +113 -130
- package/dist/tengo/lib/workflow.bobject.lib.tengo +21 -26
- package/dist/tengo/lib/workflow.bquery.lib.tengo +140 -166
- package/dist/tengo/lib/workflow.constants.lib.tengo +1 -2
- package/dist/tengo/lib/workflow.context.lib.tengo +27 -32
- package/dist/tengo/lib/workflow.lib.tengo +167 -207
- 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 +5 -5
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
1
|
+
|
|
2
|
+
|
|
4
3
|
|
|
5
4
|
json := import("json")
|
|
6
5
|
|
|
@@ -15,359 +14,337 @@ path := import("@platforma-sdk/workflow-tengo:path")
|
|
|
15
14
|
enum := import("enum")
|
|
16
15
|
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
17
16
|
render := import("@platforma-sdk/workflow-tengo:render")
|
|
18
|
-
blobs := import("@platforma-sdk/workflow-tengo:file.internal")
|
|
19
17
|
|
|
20
18
|
create := func() {
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
wd := smart.ephemeralBuilder(constants.RTYPE_WORKDIR_CREATE).lockAndBuild()
|
|
20
|
+
return wd.getField("workdir")
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
_getFileFillRule := func(filePath, extension) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
return {
|
|
25
|
+
type: "file",
|
|
26
|
+
path: filePath,
|
|
27
|
+
permissions: 0o600,
|
|
28
|
+
pathKey: filePath,
|
|
29
|
+
blobKey: filePath,
|
|
30
|
+
copyOptional: false,
|
|
31
|
+
fileExtension: extension
|
|
32
|
+
}
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
_getArchiveFillRule := func(dstDir, whatToExtract, archiveBlobKey) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
type: "archive",
|
|
50
|
-
path: dstDir,
|
|
51
|
-
blobKey: archiveBlobKey,
|
|
52
|
-
archiveType: "zip",
|
|
53
|
-
extractRules: extractRules
|
|
54
|
-
}
|
|
36
|
+
extractRules := []
|
|
37
|
+
for f in whatToExtract {
|
|
38
|
+
extractRules = append(extractRules, {
|
|
39
|
+
srcPath: f,
|
|
40
|
+
dstPath: f,
|
|
41
|
+
filePerms: 0o600,
|
|
42
|
+
dirPerms: 0o700
|
|
43
|
+
})
|
|
55
44
|
}
|
|
56
45
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
return {
|
|
47
|
+
type: "archive",
|
|
48
|
+
path: dstDir,
|
|
49
|
+
blobKey: archiveBlobKey,
|
|
50
|
+
archiveType: "zip",
|
|
51
|
+
extractRules: extractRules
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
63
60
|
_getValueFillRule := func(filePath) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
61
|
+
return {
|
|
62
|
+
type: "value",
|
|
63
|
+
path: filePath,
|
|
64
|
+
permissions: 0o600,
|
|
65
|
+
pathKey: filePath,
|
|
66
|
+
valueKey: filePath
|
|
71
67
|
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
72
74
|
|
|
73
|
-
/**
|
|
74
|
-
* Generates a directory fill rule for a given directory.
|
|
75
|
-
*
|
|
76
|
-
* @param dir: string - the path of the directory.
|
|
77
|
-
* @return rule: map - the directory fill rule.
|
|
78
|
-
*/
|
|
79
75
|
_getDirFillRule := func(dir) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
76
|
+
return {
|
|
77
|
+
type: "dir",
|
|
78
|
+
path: dir,
|
|
79
|
+
permissions: 0o700,
|
|
80
|
+
pathKey: ""
|
|
86
81
|
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
87
|
|
|
88
|
-
/**
|
|
89
|
-
* Fills a workdir with files, values, and directories.
|
|
90
|
-
*
|
|
91
|
-
* @param workdir: reference - a reference to the workdir to fill.
|
|
92
|
-
* @return self: builder - a builder that adds files and directories to the workdir. */
|
|
93
88
|
_fill := func(workdir) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
rules = append(rules, _getValueFillRule(fileName))
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
for blobKey, directories in zipExtractions {
|
|
239
|
-
for dstDir, whatToExtract in directories {
|
|
240
|
-
rules = append(rules, _getArchiveFillRule(dstDir, whatToExtract, blobKey))
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
rulesRes := smart.createValueResource(
|
|
245
|
-
constants.RTYPE_WORKDIR_FILL_RULES,
|
|
246
|
-
json.encode(rules)
|
|
247
|
-
)
|
|
248
|
-
self.getField("rules").set(rulesRes)
|
|
249
|
-
|
|
250
|
-
self.getField("dataIn").set(smart.createBinaryMapResource(values))
|
|
251
|
-
self.getField("blobsIn").set(smart.createBlobMapResource(blobs))
|
|
252
|
-
|
|
253
|
-
return self.lockAndBuild().outputs().workdirOut
|
|
254
|
-
}
|
|
255
|
-
}))
|
|
256
|
-
|
|
257
|
-
return self
|
|
89
|
+
ll.assert(smart.isReference(workdir), "workdir must be a reference to a resource or field")
|
|
90
|
+
|
|
91
|
+
wd := smart.ephemeralBuilder(constants.RTYPE_WORKDIR_FILL)
|
|
92
|
+
wd.getField("workdirIn").set(workdir)
|
|
93
|
+
|
|
94
|
+
blobs := {}
|
|
95
|
+
files := {}
|
|
96
|
+
zipExtractions := {}
|
|
97
|
+
values := {}
|
|
98
|
+
dirs := {}
|
|
99
|
+
|
|
100
|
+
self := undefined
|
|
101
|
+
self = ll.toStrict(oop.inherit(wd, {
|
|
102
|
+
_getAllDirs: func(fileName) {
|
|
103
|
+
dirsWithFileName := path.getBasenameDirs(fileName)
|
|
104
|
+
return slices.slice(dirsWithFileName, 0, -1)
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
_addDirs: func(fileName) {
|
|
108
|
+
newDirs := self._getAllDirs(fileName)
|
|
109
|
+
sets.add(dirs, newDirs...)
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
addFromZip: func(zipResource, destinationDir, pathsInArchive) {
|
|
124
|
+
validation.assertJsonSchema(zipResource, validation.reference, "workdir.builder.addFromZip: <zipResource> is not smart.reference")
|
|
125
|
+
validation.assertJsonSchema(destinationDir, "string", "workdir.builder.addFromZip: <destinationDir> is not a string. It must be a path inside working directory")
|
|
126
|
+
|
|
127
|
+
if (is_undefined(pathsInArchive)) {
|
|
128
|
+
pathsInArchive = []
|
|
129
|
+
}
|
|
130
|
+
validation.assertJsonSchema(pathsInArchive, ["string"], "workdir.builder.addFromZip: <pathsInArchive> must contain list of strings with paths inside archive")
|
|
131
|
+
|
|
132
|
+
blobKey := ll.idToString(zipResource.id)
|
|
133
|
+
|
|
134
|
+
if is_undefined(blobs[blobKey]) {
|
|
135
|
+
blobs[blobKey] = zipResource
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if is_undefined(zipExtractions[blobKey]) {
|
|
139
|
+
zipExtractions[blobKey] = {}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if is_undefined(zipExtractions[blobKey][destinationDir]) || len(pathsInArchive) == 0 {
|
|
143
|
+
zipExtractions[blobKey][destinationDir] = pathsInArchive
|
|
144
|
+
return self
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (len(pathsInArchive) > 0) {
|
|
148
|
+
zipExtractions[blobKey][destinationDir] = append(zipExtractions[blobKey][destinationDir], pathsInArchive...)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return self
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
addFile: func(fileName, fileResource) {
|
|
160
|
+
validation.assertJsonSchema(fileName, "string")
|
|
161
|
+
validation.assertJsonSchema(fileResource, validation.reference)
|
|
162
|
+
|
|
163
|
+
files[fileName] = fileResource
|
|
164
|
+
blobs[fileName] = fileResource
|
|
165
|
+
self._addDirs(fileName)
|
|
166
|
+
|
|
167
|
+
return self
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
addFiles: func(fileMap) {
|
|
175
|
+
enum.each(fileMap, self.addFile)
|
|
176
|
+
return self
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
writeFile: func(fileName, contentRef) {
|
|
185
|
+
validation.assertJsonSchema(fileName, "string")
|
|
186
|
+
values[fileName] = contentRef
|
|
187
|
+
self._addDirs(fileName)
|
|
188
|
+
|
|
189
|
+
return self
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
writeFiles: func(contentRefMap) {
|
|
197
|
+
enum.each(contentRefMap, self.writeFile)
|
|
198
|
+
return self
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
mkDir: func(dir) {
|
|
206
|
+
sets.add(dirs, path.getBasenameDirs(dir))
|
|
207
|
+
return self
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
build: func() {
|
|
215
|
+
rules := []
|
|
216
|
+
for dir, _ in dirs {
|
|
217
|
+
rules = append(rules, _getDirFillRule(dir))
|
|
218
|
+
}
|
|
219
|
+
for fileName, _ in files {
|
|
220
|
+
rules = append(rules, _getFileFillRule(fileName, path.getExtension(fileName)))
|
|
221
|
+
}
|
|
222
|
+
for fileName, _ in values {
|
|
223
|
+
rules = append(rules, _getValueFillRule(fileName))
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
for blobKey, directories in zipExtractions {
|
|
227
|
+
for dstDir, whatToExtract in directories {
|
|
228
|
+
rules = append(rules, _getArchiveFillRule(dstDir, whatToExtract, blobKey))
|
|
229
|
+
}
|
|
258
230
|
}
|
|
259
231
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
232
|
+
rulesRes := smart.createValueResource(
|
|
233
|
+
constants.RTYPE_WORKDIR_FILL_RULES,
|
|
234
|
+
json.encode(rules)
|
|
235
|
+
)
|
|
236
|
+
self.getField("rules").set(rulesRes)
|
|
237
|
+
|
|
238
|
+
self.getField("dataIn").set(smart.createBinaryMapResource(values))
|
|
239
|
+
self.getField("blobsIn").set(smart.createBlobMapResource(blobs))
|
|
240
|
+
|
|
241
|
+
return self.lockAndBuild().outputs().workdirOut
|
|
242
|
+
}
|
|
243
|
+
}))
|
|
244
|
+
|
|
245
|
+
return self
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
265
252
|
builder := func() {
|
|
266
|
-
|
|
253
|
+
return _fill(create())
|
|
267
254
|
}
|
|
268
255
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
*/
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
275
261
|
save := func(workdir) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
fileSets : wds.output("fileSets"),
|
|
359
|
-
fileSetsContent : wds.output("fileSetsContent"),
|
|
360
|
-
workdir: wds.output("workdir"),
|
|
361
|
-
progress: wds.output("progress")
|
|
362
|
-
})
|
|
363
|
-
}
|
|
364
|
-
})
|
|
365
|
-
|
|
366
|
-
return self
|
|
262
|
+
ll.assert(smart.isReference(workdir), "workdir must be a reference to a resource or field")
|
|
263
|
+
|
|
264
|
+
files := {}
|
|
265
|
+
filesContent := {}
|
|
266
|
+
fileSets := {}
|
|
267
|
+
fileSetsContent := {}
|
|
268
|
+
|
|
269
|
+
self := undefined
|
|
270
|
+
self = ll.toStrict({
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
saveFile: func(fileName) {
|
|
276
|
+
validation.assertJsonSchema(fileName, "string")
|
|
277
|
+
sets.add(files, fileName)
|
|
278
|
+
return self
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
saveFileContent: func(fileName) {
|
|
286
|
+
validation.assertJsonSchema(fileName, "string")
|
|
287
|
+
sets.add(filesContent, fileName)
|
|
288
|
+
return self
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
saveFileSet: func(name, regex) {
|
|
297
|
+
validation.assertJsonSchema(regex, "string")
|
|
298
|
+
ll.assert(is_undefined(fileSets[name]), "file set with name '", name, "' is already in added")
|
|
299
|
+
fileSets[name] = regex
|
|
300
|
+
return self
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
saveFileSetContent: func(name, regex) {
|
|
309
|
+
validation.assertJsonSchema(regex, "string")
|
|
310
|
+
ll.assert(is_undefined(fileSetsContent[name]), "file set content with name '", name, "' is already in added")
|
|
311
|
+
sets.add(fileSetsContent, regex)
|
|
312
|
+
return self
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
build: func() {
|
|
320
|
+
|
|
321
|
+
tpl := assets.importTemplate("@platforma-sdk/workflow-tengo:workdir.save")
|
|
322
|
+
inputs := {
|
|
323
|
+
workdir: workdir,
|
|
324
|
+
files: files,
|
|
325
|
+
filesContent: filesContent,
|
|
326
|
+
fileSets: fileSets,
|
|
327
|
+
fileSetsContent: fileSetsContent
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
wds := render.createEphemeral(tpl, inputs)
|
|
331
|
+
|
|
332
|
+
return ll.toStrict({
|
|
333
|
+
files: wds.output("files"),
|
|
334
|
+
filesContent: wds.output("filesContent"),
|
|
335
|
+
fileSets : wds.output("fileSets"),
|
|
336
|
+
fileSetsContent : wds.output("fileSetsContent"),
|
|
337
|
+
workdir: wds.output("workdir"),
|
|
338
|
+
progress: wds.output("progress")
|
|
339
|
+
})
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
return self
|
|
367
344
|
}
|
|
368
345
|
|
|
369
346
|
export ll.toStrict({
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
347
|
+
builder: builder,
|
|
348
|
+
create: create,
|
|
349
|
+
save: save
|
|
373
350
|
})
|