@platforma-sdk/workflow-tengo 6.20.0 → 6.21.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/anonymize.impl.lib.tengo +6 -1
- package/dist/tengo/lib/feats.lib.tengo +9 -0
- package/dist/tengo/lib/ll.canonical-id.lib.tengo +194 -0
- package/dist/tengo/lib/ll.lib.tengo +2 -0
- package/dist/tengo/lib/tpl.base.lib.tengo +43 -1
- package/dist/tengo/tpl/annotations.compute.plj.gz +0 -0
- package/dist/tengo/tpl/anonymize.deanonymize.plj.gz +0 -0
- package/dist/tengo/tpl/anonymize.impl.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.create_workdir_from_storage.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.download_blob.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.run_hello_world.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.run_hello_world_py.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.upload_blob.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.upload_template.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.workdir_type_name_extractor.plj.gz +0 -0
- package/dist/tengo/tpl/exec.conda.create-env.plj.gz +0 -0
- package/dist/tengo/tpl/exec.delayed-compute-allocation.impl.plj.gz +0 -0
- package/dist/tengo/tpl/exec.exec-impl.plj.gz +0 -0
- package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
- package/dist/tengo/tpl/exec.load-software.impl.plj.gz +0 -0
- package/dist/tengo/tpl/exec.monetization_info.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/exec.python.venv-bin-path.plj.gz +0 -0
- package/dist/tengo/tpl/ll.get-field.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.build-table.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-parquet-pcolumn-chunk.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-pframe-for-ui.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.merge-resource-maps.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.parse-to-json.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.process-pcolumn-batch-split.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.process-pcolumn-batch.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.process-pcolumn-data.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.remove-nulls.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.slice-data.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-import-if-not-null.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
- package/dist/tengo/tpl/pt.import-dir.plj.gz +0 -0
- package/dist/tengo/tpl/pt.workflow-run.plj.gz +0 -0
- package/dist/tengo/tpl/v2.export-collection-for-ui.plj.gz +0 -0
- package/dist/tengo/tpl/v2.export-for-ui.plj.gz +0 -0
- package/dist/tengo/tpl/waiter.waiter.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/dist/tengo/tpl/workflow.query-anchored.plj.gz +0 -0
- package/dist/tengo/tpl/workflow.query-context-filter.plj.gz +0 -0
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
2
2
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
3
3
|
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
4
|
+
canonicalIds := import("@platforma-sdk/workflow-tengo:ll.canonical-id")
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
@@ -109,7 +110,11 @@ anonymizeFields := func(targets, ...opts) {
|
|
|
109
110
|
|
|
110
111
|
groupId := groupBy(fieldName)
|
|
111
112
|
value := field.getValue()
|
|
112
|
-
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
cid := canonicalIds.get(value)
|
|
113
118
|
|
|
114
119
|
if is_undefined(groupCIDs[groupId]) {
|
|
115
120
|
groupCIDs[groupId] = bytes(0)
|
|
@@ -100,6 +100,15 @@ export ll.toStrict({
|
|
|
100
100
|
multiStepProgress: _isEnabled("multiStepProgress"),
|
|
101
101
|
|
|
102
102
|
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
canonicalIdExposure: _isEnabled("canonicalIDExposure") ||
|
|
108
|
+
_isEnabled("supportsScratchSpaceRequests") ||
|
|
109
|
+
_isEnabled("scratchSpace"),
|
|
110
|
+
|
|
111
|
+
|
|
103
112
|
kvAsync: _isEnabled("kvAsync"),
|
|
104
113
|
|
|
105
114
|
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
30
|
+
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
31
|
+
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
32
|
+
plapi := import("plapi")
|
|
33
|
+
hex := import("hex")
|
|
34
|
+
|
|
35
|
+
_HEX_DIGITS := "0123456789abcdef"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
_CID_SIZE := 16
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
_cache := undefined
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
isSet := func(cid) {
|
|
56
|
+
if is_undefined(cid) {
|
|
57
|
+
return false
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for b in cid {
|
|
61
|
+
if b != 0 {
|
|
62
|
+
return true
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return false
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
_string8 := func(s) {
|
|
73
|
+
b := bytes(s)
|
|
74
|
+
n := len(b)
|
|
75
|
+
if n > 255 {
|
|
76
|
+
ll.panic("canonical ID: string is longer than 255 bytes: %v", s)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return hex.decode(_HEX_DIGITS[n / 16:n / 16 + 1] + _HEX_DIGITS[n % 16:n % 16 + 1]) + b
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_hash := func(rid, data) {
|
|
83
|
+
if !ll.methodExists(plapi, "sha256Encode") {
|
|
84
|
+
ll.panic("canonical ID of resource %v is not available, and this backend cannot calculate it. " +
|
|
85
|
+
"Update the Platforma backend to v1.34.0 or later", rid)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return plapi.sha256Encode(data)[0:_CID_SIZE]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get := undefined
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
_calculate := func(rid, info, inputCid) {
|
|
102
|
+
kind := info.Kind
|
|
103
|
+
buf := _string8(info.Type.Name) + _string8(info.Type.Version) + info.Data
|
|
104
|
+
|
|
105
|
+
if kind == "Value" || kind == "Singleton" {
|
|
106
|
+
return _hash(rid, buf)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if kind != "Structural" {
|
|
110
|
+
ll.panic("canonical ID: resource %v of kind %v has no canonical ID", rid, kind)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if maps.containsKey(info, "Features") && info.Features.ephemeral {
|
|
114
|
+
ll.panic("canonical ID: ephemeral resource %v has no canonical ID", rid)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if !info.InputsLocked {
|
|
118
|
+
ll.panic("canonical ID: cannot calculate the canonical ID of resource %v: its inputs are not locked", rid)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
inputs := ll.fromStrict(info.Inputs)
|
|
122
|
+
for name in maps.getKeys(inputs) {
|
|
123
|
+
f := inputs[name]
|
|
124
|
+
if f.Error != 0 {
|
|
125
|
+
ll.panic("canonical ID: cannot calculate the canonical ID of resource %v: input %v has an error", rid, name)
|
|
126
|
+
}
|
|
127
|
+
if f.Value == 0 {
|
|
128
|
+
ll.panic("canonical ID: cannot calculate the canonical ID of resource %v: input %v has no value", rid, name)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
buf += bytes(name) + inputCid(f.Value)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return _hash(rid, buf)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
get = func(r) {
|
|
149
|
+
res := smart.resource(r)
|
|
150
|
+
key := string(res.id)
|
|
151
|
+
|
|
152
|
+
if is_undefined(_cache) {
|
|
153
|
+
_cache = ll.moduleVars("ll.canonical-id")
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
cached := _cache.get(key)
|
|
157
|
+
if !is_undefined(cached) {
|
|
158
|
+
return cached
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
info := res.info()
|
|
162
|
+
cid := undefined
|
|
163
|
+
if maps.containsKey(info, "CanonicalID") {
|
|
164
|
+
cid = info.CanonicalID
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if !isSet(cid) {
|
|
168
|
+
cid = _calculate(res.id, info, get)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
_cache.set(key, cid)
|
|
172
|
+
return cid
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
calculate := func(r) {
|
|
183
|
+
res := smart.resource(r)
|
|
184
|
+
return _calculate(res.id, res.info(), get)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export ll.toStrict({
|
|
188
|
+
isSet: isSet,
|
|
189
|
+
get: get,
|
|
190
|
+
calculate: calculate,
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
_calculate: _calculate
|
|
194
|
+
})
|
|
@@ -9,6 +9,8 @@ tplutil := import("@platforma-sdk/workflow-tengo:tpl.util")
|
|
|
9
9
|
constants := import("@platforma-sdk/workflow-tengo:constants")
|
|
10
10
|
stateAwait := import("@platforma-sdk/workflow-tengo:tpl.state-await")
|
|
11
11
|
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
12
|
+
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
13
|
+
canonicalIds := import("@platforma-sdk/workflow-tengo:ll.canonical-id")
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
|
|
@@ -171,6 +173,45 @@ tpl := func(ops) {
|
|
|
171
173
|
template: func() {
|
|
172
174
|
return smart.resource(_templateId)
|
|
173
175
|
},
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
canonicalId: func() {
|
|
198
|
+
if _isEphemeral {
|
|
199
|
+
ll.panic("canonical ID is not available in ephemeral templates: renderer %v has type %v",
|
|
200
|
+
_renderer.id, _rendererType.Name)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if !feats.canonicalIdExposure {
|
|
204
|
+
return canonicalIds.get(_renderer)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
cid := _renderer.info().CanonicalID
|
|
208
|
+
if !canonicalIds.isSet(cid) {
|
|
209
|
+
ll.panic("canonical ID of renderer %v is not set yet. Read it from the template body, not during initialization",
|
|
210
|
+
_renderer.id)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return cid
|
|
214
|
+
},
|
|
174
215
|
|
|
175
216
|
_unmarshallers: copy(ops.unmarshallers),
|
|
176
217
|
|
|
@@ -762,7 +803,8 @@ tpl := func(ops) {
|
|
|
762
803
|
delegate : self.routeDelegate,
|
|
763
804
|
validateInputs : self.validateInputs,
|
|
764
805
|
body : self.body,
|
|
765
|
-
template : self.template
|
|
806
|
+
template : self.template,
|
|
807
|
+
canonicalId : self.canonicalId
|
|
766
808
|
})
|
|
767
809
|
}
|
|
768
810
|
}
|
|
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
|
|
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
|
|
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
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/workflow-tengo",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.21.0",
|
|
4
4
|
"description": "Tengo SDK library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@platforma-open/milaboratories.software-ptexter": "1.2.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@platforma-sdk/tengo-builder": "4.1.
|
|
26
|
+
"@platforma-sdk/tengo-builder": "4.1.18"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|