@platforma-sdk/workflow-tengo 2.8.6 → 2.8.8

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
2
- declare type TplName = "pframes.aggregate" | "pframes.export-single-pcolumn" | "pframes.import-dir" | "pframes.map-pframe" | "workdir.save" | "workflow.build-ctx" | "exec.R.create-renv" | "exec.python.install-deps" | "pframes.export-multiple-pcolumns" | "pframes.export-pframe" | "exec.python.create-venv" | "exec.exec" | "pframes.xsv-export-pframe" | "pframes.xsv-import-map";
2
+ declare type TplName = "exec.monetization_to_json" | "pframes.aggregate" | "pframes.export-single-pcolumn" | "pframes.import-dir" | "pframes.map-pframe" | "workdir.save" | "workflow.build-ctx" | "exec.R.create-renv" | "exec.python.install-deps" | "pframes.export-multiple-pcolumns" | "pframes.export-pframe" | "exec.python.create-venv" | "exec.exec" | "pframes.xsv-export-pframe" | "pframes.xsv-import-map";
3
3
  declare const Templates: Record<TplName, TemplateFromFile>;
4
4
  export { Templates };
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  module.exports = { Templates: {
2
+ 'exec.monetization_to_json': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.monetization_to_json.plj.gz') },
2
3
  'pframes.aggregate': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.aggregate.plj.gz') },
3
4
  'pframes.export-single-pcolumn': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.export-single-pcolumn.plj.gz') },
4
5
  'pframes.import-dir': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.import-dir.plj.gz') },
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { resolve } from 'node:path';
2
2
  export const Templates = {
3
+ 'exec.monetization_to_json': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.monetization_to_json.plj.gz') },
3
4
  'pframes.aggregate': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.aggregate.plj.gz') },
4
5
  'pframes.export-single-pcolumn': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.export-single-pcolumn.plj.gz') },
5
6
  'pframes.import-dir': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.import-dir.plj.gz') },
@@ -16,6 +16,7 @@ pkg := import("@platforma-sdk/workflow-tengo:exec.package")
16
16
  runcmd := import("@platforma-sdk/workflow-tengo:exec.runcmd")
17
17
  python := import("@platforma-sdk/workflow-tengo:exec.python")
18
18
  R := import("@platforma-sdk/workflow-tengo:exec.R")
19
+ validation := import("@platforma-sdk/workflow-tengo:validation")
19
20
 
20
21
 
21
22
  _ARG_VAR_PKG := "{pkg}" // abs path to software package
@@ -23,6 +24,7 @@ _ARG_VAR_JAVA := "{java}" // abs path to 'java' run environment
23
24
  _ARG_VAR_PYTHON := "{python}" // abs path to 'python' run environment
24
25
  _ARG_VAR_R := "{R}" // abs path to 'R' run environment runtime
25
26
  _ARG_VAR_R_VENV := "{rVenv}" // abs path to 'R' portable virtual environment
27
+ _ARG_VAR_MNZ := "{monetization}" // monetization env value
26
28
 
27
29
 
28
30
 
@@ -45,29 +47,20 @@ reference: reference
45
47
  }
46
48
 
47
49
  _installSoftware := func(registry, pkgName) {
50
+ ll.assert(is_string(registry), "exec.internal._installSoftware(): registry is not a string, got: %v", registry, pkgName)
51
+ ll.assert(is_string(pkgName), "exec.internal._installSoftware(): pkgName is not a string, got: %v", pkgName, registry)
52
+
48
53
  archive := pkg.get(registry, pkgName).archive()
49
54
  return pkg.install(archive).package()
50
55
  }
51
56
 
52
57
  _directCallOptions := func(runOptions) {
53
- cmd := _newArg(false, runOptions.cmd)
54
- args := []
55
- envs := {}
56
-
57
- for name, arg in runOptions.args {
58
- args = append(args, _newArg(false, arg))
59
- }
60
-
61
- for name, val in runOptions.envs {
62
- envs[name] = _newArg(false, val)
63
- }
64
-
65
- return oop.inherit(runOptions, {
58
+ return ll.toStrict({
66
59
  variables: [],
67
60
  customPaths: [],
68
- cmd: cmd,
69
- args: args,
70
- envs: envs
61
+ cmd: _newArg(false, runOptions.cmd),
62
+ args: [],
63
+ envs: {}
71
64
  })
72
65
  }
73
66
 
@@ -176,7 +169,7 @@ ll.panic("run environment type %q is not currently supported by workflow-sdk", d
176
169
 
177
170
 
178
171
 
179
- _binPackageCallOptions := func(operationMode, runOptions, variables, descriptor, softPackage) {
172
+ _binPackageCallOptions := func(operationMode, softwareName, variables, descriptor, softPackage) {
180
173
  customPaths := []
181
174
  envs := ll.toStrict({})
182
175
  args := []
@@ -185,7 +178,7 @@ runEnvType := "binary"
185
178
 
186
179
 
187
180
  if (maps.containsKey(descriptor, "runEnv")) {
188
- runEnvInfo := _loadRunEnvironment(operationMode, descriptor, runOptions.software.name, softPackage)
181
+ runEnvInfo := _loadRunEnvironment(operationMode, descriptor, softwareName, softPackage)
189
182
 
190
183
  runEnvType = runEnvInfo.runEnvType
191
184
  if len(runEnvInfo.variables) > 0 {
@@ -208,15 +201,8 @@ cmd := _newArg(true, descriptor.cmd[0])
208
201
  for arg in splice(descriptor.cmd, 1) {
209
202
  args = append(args, _newArg(true, arg))
210
203
  }
211
- for arg in runOptions.args {
212
- args = append(args, _newArg(false, arg))
213
- }
214
-
215
- for name, val in runOptions.envs {
216
- envs[name] = _newArg(false, val)
217
- }
218
204
 
219
- return oop.inherit(runOptions, {
205
+ return ll.toStrict({
220
206
  runEnvType: runEnvType,
221
207
  variables: variables,
222
208
  customPaths: customPaths,
@@ -226,56 +212,101 @@ envs: envs
226
212
  })
227
213
  }
228
214
 
229
- _devLocalPackageCallOptions := func(runOptions) {
230
- software := runOptions.software
231
- localDescriptor := software.descriptor.local
232
-
215
+ _devLocalPackageCallOptions := func(softwareName, localDescriptor) {
233
216
  softPackage := pkg.use({
234
217
  hash: localDescriptor.hash,
235
218
  path: localDescriptor.path,
236
- descriptor: json.encode(ll.fromStrict(software.descriptor)),
219
+ descriptor: json.encode(ll.fromStrict(localDescriptor)),
237
220
  origin: {
238
221
  registry: "dev-local",
239
222
  url: "file://" + localDescriptor.path,
240
- packageName: software.descriptor.name
223
+ packageName: softwareName
241
224
  }
242
225
  }).package()
243
226
 
244
- variables := [ _newRefVar(_ARG_VAR_PKG, software.name, softPackage) ]
227
+ variables := [ _newRefVar(_ARG_VAR_PKG, softwareName, softPackage) ]
245
228
 
246
- return _binPackageCallOptions("dev-local", runOptions, variables, localDescriptor, softPackage)
229
+ return _binPackageCallOptions("dev-local", softwareName, variables, localDescriptor, softPackage)
247
230
  }
248
231
 
249
- _remotePackageCallOptions := func(runOptions) {
250
- software := runOptions.software
251
- binaryDescriptor := software.descriptor.binary
232
+ _remotePackageCallOptions := func(softwareName, binaryDescriptor) {
252
233
  softPackage := _installSoftware(binaryDescriptor.registry, binaryDescriptor.package)
253
234
 
254
- variables := [ _newRefVar(_ARG_VAR_PKG, software.name, softPackage) ]
235
+ variables := [ _newRefVar(_ARG_VAR_PKG, softwareName, softPackage) ]
255
236
 
256
- return _binPackageCallOptions("remote", runOptions, variables, binaryDescriptor, softPackage)
237
+ return _binPackageCallOptions("remote", softwareName, variables, binaryDescriptor, softPackage)
257
238
  }
258
239
 
259
- binaryRunOptions := func(runOptions) {
260
- if (is_undefined(ll.fromStrict(runOptions).software)) {
261
240
 
262
241
 
263
242
 
264
- return _directCallOptions(runOptions)
243
+
244
+ swToRunCmdOptions := func(softwareName, softwareVersion, softwareDescriptor) {
245
+ ll.assert(is_string(softwareName),
246
+ "exec.internal.swToRunCmdOptions: software name must be a string, got %v", softwareName)
247
+ ll.assert(is_string(softwareVersion),
248
+ "exec.internal.swToRunCmdOptions: software version must be a string, got %v", softwareVersion)
249
+ validation.assertJsonSchema(softwareDescriptor, pkg.descriptorScheme,
250
+ "exec.internal.swToRunCmdOptions: descriptor does not fit schema")
251
+
252
+ result := undefined
253
+ if maps.containsKey(softwareDescriptor, "local") {
254
+ result = _devLocalPackageCallOptions(softwareName, softwareDescriptor.local)
255
+ } else if maps.containsKey(softwareDescriptor, "binary") {
256
+ result = _remotePackageCallOptions(softwareName, softwareDescriptor.binary)
257
+ } else {
258
+ ll.panic(
259
+ "Unable to run software %s v%s: 'binary' execution mode is not enabled in software descriptor",
260
+ softwareName, softwareVersion)
261
+ }
262
+
263
+
264
+
265
+ return ll.toStrict({
266
+ runEnvType: result.runEnvType,
267
+ variables: result.variables,
268
+ customPaths: result.customPaths,
269
+ cmd: result.cmd,
270
+ args: result.args,
271
+ envs: result.envs
272
+ })
265
273
  }
266
274
 
275
+ binaryRunOptions := func(runOptions, mnzEnvs) {
276
+ validation.assertJsonSchema(mnzEnvs, {"any": validation.reference})
277
+
278
+ runCmdOpts := undefined
279
+ if (is_undefined(ll.fromStrict(runOptions).software)) {
280
+
281
+
282
+
283
+ runCmdOpts = _directCallOptions(runOptions)
284
+ } else {
267
285
  software := runOptions.software
268
286
  descriptor := software.descriptor
269
287
 
270
- if (maps.containsKey(descriptor, "local")) {
271
- return _devLocalPackageCallOptions(runOptions)
288
+ runCmdOpts = swToRunCmdOptions(software.name, software.version, descriptor)
289
+ }
290
+
291
+
292
+ for arg in runOptions.args {
293
+ runCmdOpts.args = append(runCmdOpts.args, _newArg(false, arg))
272
294
  }
295
+ for name, val in runOptions.envs {
296
+ runCmdOpts.envs[name] = _newArg(false, val)
297
+ }
298
+
299
+ for name, val in mnzEnvs { // can be empty
273
300
 
274
- if (maps.containsKey(descriptor, "binary")) {
275
- return _remotePackageCallOptions(runOptions)
301
+
302
+ runCmdOpts.envs[name] = _newArg(true, _ARG_VAR_MNZ)
303
+
304
+ runCmdOpts.variables = append(runCmdOpts.variables,
305
+ _newRefVar(_ARG_VAR_MNZ, "monetization", val))
276
306
  }
277
307
 
278
- ll.panic("Unable to run software %s v%s: 'binary' execution mode is not enabled in software descriptor", software.name, software.version)
308
+
309
+ return oop.inherit(runOptions, ll.fromStrict(runCmdOpts))
279
310
  }
280
311
 
281
312
  prepareCommandRun := func(wd, opts) {
@@ -328,6 +359,7 @@ return wd
328
359
  }
329
360
 
330
361
  export {
362
+ swToRunCmdOptions : swToRunCmdOptions,
331
363
  binaryRunOptions : binaryRunOptions,
332
364
 
333
365
  prepareWDForRunEnvironment : prepareWDForRunEnvironment,
@@ -15,6 +15,7 @@ enum := import("enum")
15
15
  oop := import("@platforma-sdk/workflow-tengo:oop")
16
16
  validation := import("@platforma-sdk/workflow-tengo:validation")
17
17
  constants := import("@platforma-sdk/workflow-tengo:constants")
18
+ monetization := import("@platforma-sdk/workflow-tengo:exec.monetization")
18
19
 
19
20
  _HEAVY_QUEUE := "heavy"
20
21
  _MEDIUM_QUEUE := "medium"
@@ -71,6 +72,27 @@ assetDescriptors := {}
71
72
  assetRules := {}
72
73
  assetCache := {}
73
74
 
75
+ mnz := monetization.init()
76
+
77
+
78
+ _getMnzOption := func(...opts) {
79
+ if slices.length(opts) < 1 {
80
+ return undefined
81
+ }
82
+ opt := opts[0]["mnz"]
83
+
84
+
85
+ return is_undefined(opt) ? undefined : opt
86
+ }
87
+
88
+
89
+ _addMnzOption := func(fileName, ...opts) {
90
+ opt := _getMnzOption(opts...)
91
+ if !is_undefined(opt) {
92
+ monetization.addFileParams(mnz, fileName, opt)
93
+ }
94
+ }
95
+
74
96
  stdout := "stdout.txt"
75
97
  stderr := "stderr.txt"
76
98
 
@@ -392,15 +414,24 @@ assetCache[assetIdKey] = days * 24 * times.hour
392
414
  return self
393
415
  },
394
416
 
417
+ enableMnz: func(productName) {
418
+ monetization.enable(mnz, productName)
419
+ return self
420
+ },
421
+
395
422
 
396
423
 
397
424
 
398
425
 
399
426
 
400
427
 
401
- addFile: func(fileName, file) {
428
+ addFile: func(fileName, file, ...opts) {
429
+ ll.assert(is_string(fileName), "exec.builder().addFile: fileName must be a string")
430
+ ll.assert(smart.isReference(file), "exec.builder().addFile: file must be a reference")
431
+
402
432
  fileName = path.canonize(fileName)
403
433
  filesToAdd[fileName] = file
434
+ _addMnzOption(fileName, opts...)
404
435
  return self
405
436
  },
406
437
 
@@ -409,8 +440,11 @@ return self
409
440
 
410
441
 
411
442
 
412
- addFiles: func(filesMap) {
413
- enum.each(filesMap, self.addFile)
443
+ addFiles: func(filesMap, ...opts) {
444
+ ll.assert(ll.isMap(filesMap), "exec.builder().addFiles: filesMap must be map of file names to file resources")
445
+ for fileName, file in filesMap {
446
+ self.addFile(fileName, file, opts...)
447
+ }
414
448
  return self
415
449
  },
416
450
 
@@ -421,7 +455,7 @@ return self
421
455
 
422
456
 
423
457
 
424
- writeFile: func(fileName, data) {
458
+ writeFile: func(fileName, data, ...opts) {
425
459
  validation.assertJsonSchema(data, ["or",
426
460
  "string",
427
461
  "bytes",
@@ -430,6 +464,7 @@ validation.reference])
430
464
  fileName = path.canonize(fileName)
431
465
 
432
466
  filesToWrite[fileName] = data
467
+ _addMnzOption(fileName, opts...)
433
468
 
434
469
  return self
435
470
  },
@@ -585,11 +620,7 @@ return smart.createValueResource(constants.RTYPE_BINARY_VALUE, v)
585
620
  ll.assert(entrypointSet,
586
621
  "incomplete command: cmd() or software() must be provided to exec.builder")
587
622
 
588
- execInputs := {
589
- filesToAdd: smart.createMapResource(filesToAdd),
590
- filesToWrite: smart.createMapResource(filesToWriteRefs),
591
- dirsToCreate: slices.fromSet(dirsToCreate),
592
- runOptions: {
623
+ runOptions := {
593
624
  cmd: cmd,
594
625
  args: args,
595
626
  envs: envs,
@@ -598,7 +629,13 @@ queue: queue,
598
629
  stdout: stdout,
599
630
  stderr: stderr,
600
631
  nErrorLines: nErrorLines
601
- },
632
+ }
633
+
634
+ execInputs := {
635
+ filesToAdd: smart.createMapResource(filesToAdd),
636
+ filesToWrite: smart.createMapResource(filesToWriteRefs),
637
+ dirsToCreate: slices.fromSet(dirsToCreate),
638
+ runOptions: runOptions,
602
639
  filesToSave: slices.fromSet(filesToSave),
603
640
  filesContentToSave: slices.fromSet(filesContentToSave),
604
641
  fileSetsToSave: fileSetsToSave,
@@ -611,6 +648,13 @@ assetRules: assetRules,
611
648
  assetCache: assetCache
612
649
  }
613
650
 
651
+
652
+
653
+
654
+ if monetization.shouldRun(mnz) {
655
+ execInputs.runOptions.monetization = monetization.toJson(mnz)
656
+ }
657
+
614
658
  if !is_undefined(soft) {
615
659
  execInputs.softwareInfo = soft.resource
616
660
  execInputs.runOptions.software = {
@@ -0,0 +1,173 @@
1
+
2
+
3
+ ll := import("@platforma-sdk/workflow-tengo:ll")
4
+ validation := import("@platforma-sdk/workflow-tengo:validation")
5
+ assets := import("@platforma-sdk/workflow-tengo:assets")
6
+ internal := import("@platforma-sdk/workflow-tengo:exec.internal")
7
+ fmt := import("fmt")
8
+ text := import("text")
9
+ runcmd := import("@platforma-sdk/workflow-tengo:exec.runcmd")
10
+ workdir := import("@platforma-sdk/workflow-tengo:workdir")
11
+ render := import("@platforma-sdk/workflow-tengo:render")
12
+
13
+ _JWT_TOKEN_RESULT_ENV := "PLATFORMA_MNZ_JWT"
14
+
15
+
16
+ init := func() {
17
+ return ll.toStrict({
18
+ enabled: false,
19
+
20
+
21
+ productName: "",
22
+
23
+
24
+ fileParams: {}
25
+ })
26
+ }
27
+
28
+ fileParamsSchema := {
29
+ "arg": "string",
30
+ "collect": [`string,regex=size|lines|sha256`]
31
+ }
32
+
33
+ schema := {
34
+ "enabled": "bool",
35
+ "productName": "string",
36
+ "fileParams": {"any": fileParamsSchema}
37
+ }
38
+
39
+ _assertIsReady := func(mnz) {
40
+ validation.assertJsonSchema(mnz, schema,
41
+ "monetization.assertIsReady(): monetization does not fit schema")
42
+ ll.assert(len(mnz.productName) > 0,
43
+ "monetization.assertIsReady(): product name must be set")
44
+ ll.assert(len(mnz.fileParams) > 0,
45
+ "monetization.assertIsReady(): at least 1 file param must be set")
46
+ }
47
+
48
+
49
+ enable := func(mnz, productName) {
50
+ ll.assert(is_string(productName),
51
+ "monetization.enable(): product name must be a string, got %v", productName)
52
+
53
+ validation.assertJsonSchema(mnz, schema,
54
+ "monetization.enable(): mnz object does not fit schema")
55
+
56
+ mnz.enabled = true
57
+ mnz.productName = productName
58
+ }
59
+
60
+
61
+ shouldRun := func(mnz) {
62
+ if mnz.enabled {
63
+ _assertIsReady(mnz)
64
+ return true
65
+ }
66
+
67
+ return false
68
+ }
69
+
70
+ toJson := func(mnz) {
71
+ validation.assertJsonSchema(mnz, schema,
72
+ "monetization.toJson(): monetization object does not fit json schema")
73
+
74
+ return ll.fromStrict(mnz)
75
+ }
76
+
77
+
78
+ addFileParams := func(mnz, fileName, params) {
79
+ validation.assertJsonSchema(mnz, schema,
80
+ "monetization.addFileParams(): monetization object does not fit json schema")
81
+
82
+ validation.assertJsonSchema(params, fileParamsSchema,
83
+ "monetization.addFileParams(): file params does not fit json schema")
84
+
85
+ ll.assert(mnz.enabled,
86
+ "monetization.addFileParams(): monetization must be explicitly enabled by enableMnz(productName) function")
87
+
88
+ ll.assert(is_string(fileName),
89
+ "monetization.addFileParams(): file name must be a string.")
90
+
91
+ mnz.fileParams[fileName] = params
92
+ }
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+ run := func(mnz, wd, queue) {
102
+ _assertIsReady(mnz)
103
+
104
+ mnzSw := assets.importSoftware("@platforma-open/milaboratories.software-small-binaries:mnz-client")
105
+
106
+ builder := runcmd.builder(wd)
107
+ builder.envVar("MI_LICENSE", "{secrets.MI_LICENSE}")
108
+
109
+ opts := internal.swToRunCmdOptions(mnzSw.name, mnzSw.version, mnzSw.descriptor)
110
+
111
+ for _, varInfo in opts.variables {
112
+ builder.ref(varInfo.refName, varInfo.reference)
113
+ builder.substitutionRule(varInfo.varName, varInfo.refName)
114
+ }
115
+
116
+ builder.cmdVar(opts.cmd.value)
117
+ for _, arg in opts.args {
118
+
119
+ builder.argVar(arg)
120
+ }
121
+ builder.arg("-productName").arg(mnz.productName)
122
+
123
+
124
+ for fileName, param in mnz.fileParams {
125
+
126
+ toCollect := text.join(param.collect, ",")
127
+ arg := fmt.sprintf("%s:file:%s:%s", param.arg, fileName, toCollect)
128
+ builder.arg(arg)
129
+ }
130
+
131
+ builder.inQueue(queue)
132
+ stdout := "mnz_stdout.txt"
133
+ builder.stdout(stdout)
134
+ run := builder.build()
135
+
136
+
137
+ savedWd := workdir.save(run.workdir).
138
+ saveFileContent(stdout).
139
+ build()
140
+
141
+ jwtResultAsBytes := savedWd.filesContent.getFutureInputField(stdout)
142
+
143
+
144
+
145
+
146
+ jwtResultAsString := render.create(
147
+ assets.importTemplate("@platforma-sdk/workflow-tengo:exec.monetization_to_json"),
148
+ { resource: jwtResultAsBytes }
149
+ ).output("jsonedData")
150
+
151
+ return ll.toStrict({
152
+
153
+
154
+
155
+ wdAfter: savedWd.workdir,
156
+
157
+
158
+
159
+
160
+ jwtEnvName: _JWT_TOKEN_RESULT_ENV,
161
+ jwtEnvValue: jwtResultAsString
162
+ })
163
+ }
164
+
165
+ export ll.toStrict({
166
+ init: init,
167
+ schema: schema,
168
+ enable: enable,
169
+ shouldRun: shouldRun,
170
+ toJson: toJson,
171
+ addFileParams: addFileParams,
172
+ run: run
173
+ })
@@ -21,7 +21,7 @@ binaryDescriptorScheme := {
21
21
  registry: "string",
22
22
  package: "string",
23
23
  cmd: ["string"],
24
- runEnv: runEnvDescriptorScheme
24
+ "runEnv,?": runEnvDescriptorScheme
25
25
  }
26
26
 
27
27
  assetDescriptorScheme := {
@@ -1,7 +1,6 @@
1
1
 
2
2
 
3
3
  plapi := import("plapi")
4
- json := import("json")
5
4
  fmt := import("fmt")
6
5
  log := import("log")
7
6
  text := import("text")
@@ -101,6 +101,49 @@ return filter(map, func(k, v) { return predicateFnK(k) && predicateFnV(v) })
101
101
 
102
102
 
103
103
 
104
+
105
+
106
+
107
+
108
+
109
+
110
+ clone := func(obj, ...ops) {
111
+ removeUndefs := false
112
+ if len(ops) == 1 {
113
+ removeUndefs = ops[0].removeUndefs
114
+ }
115
+
116
+ if is_map(obj) || ll.isStrict(obj) {
117
+ res := {}
118
+ strict := ll.isStrict(obj)
119
+ if strict {
120
+ obj = ll.fromStrict(obj)
121
+ }
122
+ for k, v in obj {
123
+ if !removeUndefs || !is_undefined(v) {
124
+ res[k] = clone(v, ops...)
125
+ }
126
+ }
127
+ if strict {
128
+ return ll.toStrict(res)
129
+ } else {
130
+ return res
131
+ }
132
+ } else if is_array(obj) {
133
+ res := []
134
+ for v in obj {
135
+ res = append(res, clone(v, ops...))
136
+ }
137
+ return res
138
+ }
139
+
140
+ return obj
141
+ }
142
+
143
+
144
+
145
+
146
+
104
147
  merge := func(...maps) {
105
148
  res := {}
106
149
  for map in maps {
@@ -140,6 +183,7 @@ export ll.toStrict({
140
183
  map : map,
141
184
  merge: merge,
142
185
  deepMerge: deepMerge,
186
+ clone: clone,
143
187
  mapKeys : mapKeys,
144
188
  mapValues : mapValues,
145
189
  filter : filter,
@@ -1131,6 +1131,7 @@ ll.assert(!ll.isStrict(value), "can't encode strict map: ", value)
1131
1131
 
1132
1132
 
1133
1133
  encoded := json.encode(value)
1134
+
1134
1135
  return createValueResource(constants.RTYPE_JSON, encoded)
1135
1136
  }
1136
1137
 
@@ -28,7 +28,6 @@ ll.assert(smart.isResource(resource), "expected resource, found ", resource)
28
28
 
29
29
  self := func(resource) { return _unmarshal(resource, preprocessors) }
30
30
 
31
-
32
31
  for preproc in preprocessors {
33
32
  if preproc.canParse(resource) {
34
33
  return preproc.parse(resource, self)
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/workflow-tengo",
3
- "version": "2.8.6",
3
+ "version": "2.8.8",
4
4
  "description": "Tengo SDK library",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@milaboratories/software-pframes-conv": "2.1.2",
20
- "@platforma-open/milaboratories.software-small-binaries": "^1.15.4"
20
+ "@platforma-open/milaboratories.software-small-binaries": "^1.15.6"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@platforma-sdk/tengo-builder": "^1.17.5"