@platforma-sdk/workflow-tengo 2.8.0 → 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
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
6
5
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
@@ -18,103 +17,100 @@ _OUTPUT_RUN_ENV := "runEnv"
|
|
|
18
17
|
_OUTPUT_WD_OUT := "workdirOut"
|
|
19
18
|
|
|
20
19
|
saveBuilder := func(wd) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return self
|
|
20
|
+
self := undefined
|
|
21
|
+
|
|
22
|
+
pathsToSave := []
|
|
23
|
+
envType := ""
|
|
24
|
+
|
|
25
|
+
packagesMap := {}
|
|
26
|
+
|
|
27
|
+
self = {
|
|
28
|
+
addPath: func(path) {
|
|
29
|
+
validation.assertJsonSchema(path, "string", "runenv.saveBuilder.addPath: <path> must be string")
|
|
30
|
+
|
|
31
|
+
pathsToSave = append(pathsToSave, path)
|
|
32
|
+
return self
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
envType: func(type) {
|
|
36
|
+
validation.assertJsonSchema(type, "string", "runenv.saveBuilder.envType: <type> must be string")
|
|
37
|
+
|
|
38
|
+
envType = type
|
|
39
|
+
return self
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
addPackage: func(key, pkgRef) {
|
|
45
|
+
ll.assert(!maps.containsKey(packagesMap, key), "runenv.saveBuilder.addPackage: package %q was already added to SaveRunEnv builder", key)
|
|
46
|
+
validation.assertJsonSchema(pkgRef, validation.reference, "runenv.saveBuilder.addPackage: <pkgRef> must be reference")
|
|
47
|
+
|
|
48
|
+
packagesMap[key] = pkgRef
|
|
49
|
+
return self
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
build: func() {
|
|
53
|
+
ll.assert(envType != "", "runenv.saveBuilder.build: environment type is not set")
|
|
54
|
+
|
|
55
|
+
envSaver := smart.ephemeralBuilder(_RTYPE_SAVE_RUN_ENV)
|
|
56
|
+
|
|
57
|
+
envSaver.getField(_INPUT_WD_IN).set(wd)
|
|
58
|
+
|
|
59
|
+
envSaver.getField(_INPUT_SETTINGS).
|
|
60
|
+
set(smart.createJsonResource({
|
|
61
|
+
paths: pathsToSave,
|
|
62
|
+
type: envType
|
|
63
|
+
}))
|
|
64
|
+
|
|
65
|
+
envSaver.getField(_INPUT_PACKAGES_MAP).
|
|
66
|
+
set(smart.createMapResource(packagesMap))
|
|
67
|
+
|
|
68
|
+
return oop.inherit(envSaver.lockAndBuild(), {
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
runEnv: func() {
|
|
75
|
+
return envSaver.getField(_OUTPUT_RUN_ENV)
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
workdir: func() {
|
|
84
|
+
return envSaver.getField(_OUTPUT_WD_OUT)
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return self
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
loadDependencyFiles := func(packageRef, dependencies) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
if len(dependencies) == 0 {
|
|
95
|
+
return {}
|
|
96
|
+
}
|
|
101
97
|
|
|
102
|
-
|
|
98
|
+
depsMap := {}
|
|
103
99
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
loader := pkg.pkgFileLoader(packageRef)
|
|
101
|
+
for depName, fileName in dependencies {
|
|
102
|
+
loader.saveFile(fileName)
|
|
103
|
+
}
|
|
104
|
+
deps := loader.load()
|
|
109
105
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
for depName, fileName in dependencies {
|
|
107
|
+
depsMap[depName] = deps.getFile(fileName)
|
|
108
|
+
}
|
|
113
109
|
|
|
114
|
-
|
|
110
|
+
return depsMap
|
|
115
111
|
}
|
|
116
112
|
|
|
117
113
|
export ll.toStrict({
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
saveBuilder : saveBuilder,
|
|
115
|
+
loadDependencyFiles : loadDependencyFiles
|
|
120
116
|
})
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
1
|
+
|
|
2
|
+
|
|
4
3
|
|
|
5
4
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
6
5
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
@@ -10,55 +9,52 @@ file := import("@platforma-sdk/workflow-tengo:file")
|
|
|
10
9
|
_RTYPE_CREATE_STREAM := { Name: "CreateStream", Version: "2" }
|
|
11
10
|
_RTYPE_STREAM_MANAGER := { Name: "StreamManager", Version: "2" }
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
20
18
|
_create := func(workdir, filePath) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
stream := smart.ephemeralBuilder(_RTYPE_CREATE_STREAM)
|
|
20
|
+
stream.getField("workdir").set(workdir)
|
|
21
|
+
stream.getField("filePath").setRefOrJson(filePath)
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
return ll.toStrict(oop.inherit(stream.lockAndBuild(), {
|
|
24
|
+
output: stream.outputs().stream
|
|
25
|
+
}))
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*/
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
37
34
|
_manager := func(stream, downloadableRef) {
|
|
38
|
-
|
|
35
|
+
res := smart.structBuilder(_RTYPE_STREAM_MANAGER)
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
res.getField("downloadable").set(downloadableRef)
|
|
38
|
+
res.getField("stream").set(stream.output)
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
return res.lockAndBuild()
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
54
50
|
create := func(workdirBefore, workdirAfter, filePath) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
stream := _create(workdirBefore, filePath)
|
|
52
|
+
fileFuture := workdirAfter.files.getFutureInputField(filePath)
|
|
53
|
+
downloadable := file.exportFile(fileFuture)
|
|
58
54
|
|
|
59
|
-
|
|
55
|
+
return _manager(stream, downloadable)
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
export ll.toStrict({
|
|
63
|
-
|
|
59
|
+
create: create
|
|
64
60
|
})
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
11
10
|
|
|
12
11
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
13
12
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
@@ -15,87 +14,81 @@ validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
|
15
14
|
|
|
16
15
|
json := import("json")
|
|
17
16
|
|
|
18
|
-
//
|
|
19
|
-
// Resource types:
|
|
20
|
-
//
|
|
21
17
|
|
|
22
18
|
RTYPE_BLOB_IMPORT_EXTERNAL := { Name: "BlobImportExternal", Version: "1" }
|
|
23
19
|
RTYPE_BLOB_IMPORT_INTERNAL := { Name: "BlobImportInternal", Version: "1" }
|
|
24
20
|
RTYPE_BLOB_UPLOAD := { Name: "BlobUpload", Version: "1" }
|
|
25
21
|
RTYPE_BLOB_DOWNLOAD := { Name: "BlobDownload", Version: "2" }
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*/
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
33
28
|
createBlobImportExternal := func(settings) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
validation.assertJsonSchema(settings, {
|
|
30
|
+
"dataURL": "string",
|
|
31
|
+
"dataHeaders,?": [["string"]],
|
|
32
|
+
"dataVersion,?": "string"
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
importer := smart.structBuilder(RTYPE_BLOB_IMPORT_EXTERNAL, json.encode(settings)).lockAndBuild()
|
|
36
|
+
|
|
37
|
+
return ll.toStrict({
|
|
38
|
+
file: importer.getField("blob"),
|
|
39
|
+
handle: importer.getField("handle")
|
|
40
|
+
})
|
|
46
41
|
}
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
54
48
|
createBlobImportInternal := func(settings) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
49
|
+
validation.assertJsonSchema(settings, {
|
|
50
|
+
"path": "string",
|
|
51
|
+
"storageId": "string",
|
|
52
|
+
"maxSpeedBytes,?": "number",
|
|
53
|
+
"dataVersion,?": "string"
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
importer := smart.structBuilder(RTYPE_BLOB_IMPORT_INTERNAL, json.encode(settings)).lockAndBuild()
|
|
57
|
+
|
|
58
|
+
return ll.toStrict({
|
|
59
|
+
file: importer.getField("blob"),
|
|
60
|
+
handle: importer.getField("handle")
|
|
61
|
+
})
|
|
68
62
|
}
|
|
69
63
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*/
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
76
69
|
createBlobUpload := func(settings) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
70
|
+
validation.assertJsonSchema(settings, {
|
|
71
|
+
"modificationTime": "string",
|
|
72
|
+
"localPath": "string",
|
|
73
|
+
"pathSignature": "string",
|
|
74
|
+
"sizeBytes": "string"
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
uploader := smart.structBuilder(RTYPE_BLOB_UPLOAD, json.encode(settings)).lockAndBuild()
|
|
78
|
+
|
|
79
|
+
return ll.toStrict({
|
|
80
|
+
file: uploader.getField("blob"),
|
|
81
|
+
handle: uploader.getField("handle")
|
|
82
|
+
})
|
|
90
83
|
}
|
|
91
84
|
|
|
92
85
|
export ll.toStrict({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
86
|
+
RTYPE_BLOB_IMPORT_EXTERNAL : RTYPE_BLOB_IMPORT_EXTERNAL,
|
|
87
|
+
RTYPE_BLOB_IMPORT_INTERNAL : RTYPE_BLOB_IMPORT_INTERNAL,
|
|
88
|
+
RTYPE_BLOB_UPLOAD : RTYPE_BLOB_UPLOAD,
|
|
89
|
+
RTYPE_BLOB_DOWNLOAD : RTYPE_BLOB_DOWNLOAD,
|
|
90
|
+
|
|
91
|
+
createBlobImportExternal : createBlobImportExternal,
|
|
92
|
+
createBlobImportInternal : createBlobImportInternal,
|
|
93
|
+
createBlobUpload : createBlobUpload
|
|
101
94
|
})
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
13
12
|
|
|
14
13
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
15
14
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
@@ -18,59 +17,57 @@ blobs := import("@platforma-sdk/workflow-tengo:file.internal")
|
|
|
18
17
|
|
|
19
18
|
json := import("json")
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
34
32
|
importFile := func(importFileHandle) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
33
|
+
validation.assertJsonSchema(
|
|
34
|
+
importFileHandle,
|
|
35
|
+
`string,regex=^(upload://upload/.*|index://index/.*)`
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
url := ll.parseUrl(importFileHandle)
|
|
39
|
+
path := url.Path[1:] // trim "/"
|
|
40
|
+
|
|
41
|
+
settings := json.decode(path)
|
|
42
|
+
|
|
43
|
+
if url.Scheme == "upload" {
|
|
44
|
+
ll.assert(url.Host == "upload", "wrong 'host' in import file handle. Expected: 'upload', found: '", url.Host, "'")
|
|
45
|
+
return blobs.createBlobUpload(settings)
|
|
46
|
+
} else if url.Scheme == "index" {
|
|
47
|
+
ll.assert(url.Host == "index", "wrong 'host' in import file handle. Expected 'index', found: '", url.Host, "'")
|
|
48
|
+
return blobs.createBlobImportInternal(settings)
|
|
49
|
+
} else if (url.Scheme == "download") {
|
|
50
|
+
ll.assert(url.Host == "download", "wrong 'host' in import file handle. Expected: 'download', found: '", url.Host, "'")
|
|
51
|
+
return blobs.createBlobImportExternal(settings)
|
|
52
|
+
} else {
|
|
53
|
+
ll.panic("Unknown file import handle schema: ", url.Scheme)
|
|
54
|
+
}
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
63
60
|
exportFile := func(blob) {
|
|
64
|
-
|
|
61
|
+
builder := smart.structBuilder(blobs.RTYPE_BLOB_DOWNLOAD)
|
|
65
62
|
|
|
66
|
-
|
|
63
|
+
builder.createInputField("blob").set(blob)
|
|
67
64
|
|
|
68
|
-
|
|
65
|
+
downloader := builder.lockAndBuild()
|
|
69
66
|
|
|
70
|
-
|
|
67
|
+
return downloader.getField("downloadable")
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
export ll.toStrict({
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
importFile: importFile,
|
|
72
|
+
exportFile: exportFile
|
|
76
73
|
})
|