@platforma-sdk/workflow-tengo 5.3.3 → 5.3.4

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.
Files changed (52) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +2 -2
  4. package/dist/tengo/lib/exec.lib.tengo +4 -0
  5. package/dist/tengo/lib/exec.monetization_internal.lib.tengo +8 -0
  6. package/dist/tengo/lib/pframes.spec.lib.tengo +6 -0
  7. package/dist/tengo/lib/pframes.util.lib.tengo +404 -1
  8. package/dist/tengo/lib/pframes.xsv.lib.tengo +117 -65
  9. package/dist/tengo/lib/pt.expression.lib.tengo +828 -268
  10. package/dist/tengo/lib/pt.lib.tengo +567 -216
  11. package/dist/tengo/lib/pt.util.lib.tengo +231 -15
  12. package/dist/tengo/lib/slices.lib.tengo +20 -1
  13. package/dist/tengo/lib/smart.lib.tengo +0 -1
  14. package/dist/tengo/tpl/anonymize.deanonymize.plj.gz +0 -0
  15. package/dist/tengo/tpl/anonymize.impl.plj.gz +0 -0
  16. package/dist/tengo/tpl/check_network.create_workdir_from_storage.plj.gz +0 -0
  17. package/dist/tengo/tpl/check_network.download_blob.plj.gz +0 -0
  18. package/dist/tengo/tpl/check_network.run_hello_world.plj.gz +0 -0
  19. package/dist/tengo/tpl/check_network.run_hello_world_py.plj.gz +0 -0
  20. package/dist/tengo/tpl/check_network.upload_blob.plj.gz +0 -0
  21. package/dist/tengo/tpl/check_network.upload_template.plj.gz +0 -0
  22. package/dist/tengo/tpl/check_network.workdir_type_name_extractor.plj.gz +0 -0
  23. package/dist/tengo/tpl/exec.R.create-renv.plj.gz +0 -0
  24. package/dist/tengo/tpl/exec.delayed-compute-allocation.impl.plj.gz +0 -0
  25. package/dist/tengo/tpl/exec.exec-impl.plj.gz +0 -0
  26. package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
  27. package/dist/tengo/tpl/exec.load-software.impl.plj.gz +0 -0
  28. package/dist/tengo/tpl/exec.monetization_info.plj.gz +0 -0
  29. package/dist/tengo/tpl/exec.monetization_to_json.plj.gz +0 -0
  30. package/dist/tengo/tpl/exec.python.create-venv.plj.gz +0 -0
  31. package/dist/tengo/tpl/exec.python.install-deps.plj.gz +0 -0
  32. package/dist/tengo/tpl/exec.python.venv-bin-path.plj.gz +0 -0
  33. package/dist/tengo/tpl/ll.get-field.plj.gz +0 -0
  34. package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
  35. package/dist/tengo/tpl/pframes.export-pframe-for-ui.plj.gz +0 -0
  36. package/dist/tengo/tpl/pframes.export-pframe.plj.gz +0 -0
  37. package/dist/tengo/tpl/pframes.export-single-pcolumn.plj.gz +0 -0
  38. package/dist/tengo/tpl/pframes.import-dir.plj.gz +0 -0
  39. package/dist/tengo/tpl/pframes.parse-to-json.plj.gz +0 -0
  40. package/dist/tengo/tpl/pframes.process-pcolumn-data.plj.gz +0 -0
  41. package/dist/tengo/tpl/pframes.remove-nulls.plj.gz +0 -0
  42. package/dist/tengo/tpl/pframes.slice-data.plj.gz +0 -0
  43. package/dist/tengo/tpl/pframes.xsv-import-if-not-null.plj.gz +0 -0
  44. package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
  45. package/dist/tengo/tpl/pt.import-dir.plj.gz +0 -0
  46. package/dist/tengo/tpl/pt.workflow-run.plj.gz +0 -0
  47. package/dist/tengo/tpl/waiter.waiter.plj.gz +0 -0
  48. package/dist/tengo/tpl/workdir.save.plj.gz +0 -0
  49. package/dist/tengo/tpl/workflow.build-ctx.plj.gz +0 -0
  50. package/dist/tengo/tpl/workflow.query-anchored.plj.gz +0 -0
  51. package/package.json +3 -3
  52. package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
@@ -95,18 +95,6 @@ validateParamsForFrameFromColumnBundle := func(params) {
95
95
  ll.assert(len(params.columns) > 0, "At least one column is required")
96
96
  }
97
97
 
98
- unique := func(list) {
99
- uniqueMap := {}
100
- for _, item in list {
101
- uniqueMap[item] = item
102
- }
103
- uniqueList := []
104
- for _, item in uniqueMap {
105
- uniqueList = append(uniqueList, item)
106
- }
107
- return uniqueList
108
- }
109
-
110
98
  makeFrameSpecs := func(params) {
111
99
  axes := []
112
100
  for entry in params.axes {
@@ -121,7 +109,7 @@ makeFrameSpecs := func(params) {
121
109
  spec.annotations = entry.spec.annotations
122
110
  }
123
111
  if !is_undefined(entry.spec.parentAxes) && len(entry.spec.parentAxes) > 0 {
124
- spec.parentAxes = unique(entry.spec.parentAxes)
112
+ spec.parentAxes = slices.sortUnique(entry.spec.parentAxes)
125
113
  }
126
114
  axes = append(axes, spec)
127
115
  }
@@ -140,7 +128,7 @@ makeFrameSpecs := func(params) {
140
128
  spec.annotations = entry.spec.annotations
141
129
  }
142
130
  if !is_undefined(entry.spec.parentAxes) && len(entry.spec.parentAxes) > 0 {
143
- spec.parentAxes = unique(entry.spec.parentAxes)
131
+ spec.parentAxes = slices.sortUnique(entry.spec.parentAxes)
144
132
  }
145
133
  columns[entry.column] = spec
146
134
  }
@@ -183,10 +171,238 @@ makeFrameColumnRef := func(frameName, columnId) {
183
171
  })
184
172
  }
185
173
 
174
+ _AXIS_FILTER_SCHEMA := {
175
+
176
+ `axisIndex`: `number`,
177
+
178
+ `constant`: [`or`, `number`, `string`]
179
+ }
180
+
181
+ validateAxisFilters := func(axisFilter) {
182
+ validation.assertType(axisFilter, [_AXIS_FILTER_SCHEMA])
183
+ }
184
+
185
+
186
+ _JOIN_ENTRY_SCHEMA := undefined
187
+
188
+ _JOIN_LEAF_SCHEMA := func(js, _, _) {
189
+ return validation.checkJson(js, _JOIN_ENTRY_SCHEMA)
190
+ }
191
+ _JOIN_SUBTREE_SCHEMA := func(js, _, _) {
192
+ return validation.checkJson(js, [_JOIN_ENTRY_SCHEMA])
193
+ }
194
+
195
+ _JOIN_ENTRY_SCHEMA = [`or`,
196
+ {
197
+
198
+ `type`: `string,regex=column`,
199
+
200
+ `columnId`: `string`
201
+ },
202
+ {
203
+
204
+ `type`: `string,regex=slicedColumn`,
205
+
206
+ `columnId`: `string`,
207
+
208
+ `newId`: `string`,
209
+
210
+ `axisFilters`: [_AXIS_FILTER_SCHEMA]
211
+ },
212
+ {
213
+
214
+ `type`: `string,regex=artificialColumn`,
215
+
216
+ `columnId`: `string`,
217
+
218
+ `newId`: `string`,
219
+
220
+ `axesIndices`: [`number`]
221
+ },
222
+ {
223
+
224
+ `type`: `string,regex=inlineColumn`,
225
+
226
+ `newId`: `string`,
227
+
228
+ `spec`: spec.P_COLUMN_STRICT_SPEC_SCHEMA,
229
+
230
+ `dataInfo`: {
231
+
232
+ `type`: `string,regex=Json`,
233
+
234
+ `keyLength`: `number`,
235
+
236
+ `data`: {
237
+ any: [`or`, `null`, `number`, `string`]
238
+ }
239
+ }
240
+ },
241
+ {
242
+
243
+ `type`: `string,regex=inner`,
244
+
245
+ `entries`: _JOIN_SUBTREE_SCHEMA
246
+ },
247
+ {
248
+
249
+ `type`: `string,regex=full`,
250
+
251
+ `entries`: _JOIN_SUBTREE_SCHEMA
252
+ },
253
+ {
254
+
255
+ `type`: `string,regex=outer`,
256
+
257
+ `primary`: _JOIN_LEAF_SCHEMA,
258
+
259
+
260
+ `secondary`: _JOIN_SUBTREE_SCHEMA
261
+ }]
262
+
263
+
264
+ _PREDICATE_SCHEMA := undefined
265
+
266
+ _PREDICATE_LEAF_SCHEMA := func(js, _, _) {
267
+ return validation.checkJson(js, _PREDICATE_SCHEMA)
268
+ }
269
+ _PREDICATE_SUBTREE_SCHEMA := func(js, _, _) {
270
+ return validation.checkJson(js, [_PREDICATE_SCHEMA])
271
+ }
272
+ _PREDICATE_SCHEMA = [`or`,
273
+ {
274
+
275
+ `operator`: `string,regex=IsNA`
276
+ },
277
+ {
278
+
279
+ `operator`: `string,regex=Equal|Less|LessOrEqual|Greater|GreaterOrEqual`,
280
+
281
+ `reference`: [`or`, `number`, `string`]
282
+ },
283
+ {
284
+
285
+ `operator`: `string,regex=InSet`,
286
+
287
+ `values`: [`or`, [`number`], [`string`]]
288
+ },
289
+ {
290
+
291
+ `operator`: `string,regex=IEqual`,
292
+
293
+ `reference`: `string`
294
+ },
295
+ {
296
+
297
+ `operator`: `string,regex=StringContains|StringIContains`,
298
+
299
+ `substring`: `string`
300
+ },
301
+ {
302
+
303
+ `operator`: `string,regex=Matches`,
304
+
305
+ `regex`: `string`
306
+ },
307
+ {
308
+
309
+ `operator`: `string,regex=StringContainsFuzzy|StringIContainsFuzzy`,
310
+
311
+ `reference`: `string`,
312
+
313
+ `maxEdits`: `number`,
314
+
315
+ `wildcard,?`: `string`,
316
+
317
+ `substitutionsOnly,?`: `bool`
318
+ },
319
+ {
320
+
321
+ `operator`: `string,regex=Not`,
322
+
323
+ `operand`: _PREDICATE_LEAF_SCHEMA
324
+ },
325
+ {
326
+
327
+ `operator`: `string,regex=And|Or`,
328
+
329
+ `operands`: [_PREDICATE_SUBTREE_SCHEMA]
330
+ }]
331
+
332
+ _P_TABLE_COLUMN_ID_SCHEMA := [`or`,
333
+ {
334
+
335
+ `type`: `string,regex=column`,
336
+
337
+ `id`: `string`
338
+ },
339
+ {
340
+
341
+ `type`: `string,regex=axis`,
342
+
343
+ `axisId`: {
344
+ `name`: `string`,
345
+ `type`: `string,regex=Int|Long|String`,
346
+ `domain,?`: { any: `string` }
347
+ }
348
+ }]
349
+
350
+ _FILTER_SCHEMA := {
351
+
352
+ `column`: _P_TABLE_COLUMN_ID_SCHEMA,
353
+
354
+ `predicate`: _PREDICATE_SCHEMA
355
+ }
356
+
357
+
358
+ _JOIN_REQUEST_SCHEMA := {
359
+ `__options__,closed`: true,
360
+
361
+ `src`: _JOIN_ENTRY_SCHEMA,
362
+
363
+ `filters`: [_FILTER_SCHEMA]
364
+ }
365
+
366
+ _renameJoinEntry := func(entry, rename) {
367
+ if entry.type == "column" || entry.type == "slicedColumn" || entry.type == "artificialColumn" {
368
+ entry.columnId = rename[entry.columnId]
369
+ } else if entry.type == "inner" || entry.type == "full" {
370
+ entry.entries = slices.map(entry.entries, func(entry) {
371
+ return _renameJoinEntry(entry, rename)
372
+ })
373
+ } else if entry.type == "outer" {
374
+ entry.primary = _renameJoinEntry(entry.primary, rename)
375
+ entry.secondary = slices.map(entry.secondary, func(entry) {
376
+ return _renameJoinEntry(entry, rename)
377
+ })
378
+ }
379
+ return entry
380
+ }
381
+
382
+ _renameJoinFilter := func(filter, rename) {
383
+ if filter.column.type == "column" {
384
+ filter.column.id = rename[filter.column.id]
385
+ }
386
+ return filter
387
+ }
388
+
389
+ renameJoinColumns := func(request, rename) {
390
+ validation.assertType(request, _JOIN_REQUEST_SCHEMA)
391
+ validation.assertType(rename, {any: `string`})
392
+ return {
393
+ src: _renameJoinEntry(request.src, rename),
394
+ filters: slices.map(request.filters, func(filter) {
395
+ return _renameJoinFilter(filter, rename)
396
+ })
397
+ }
398
+ }
399
+
186
400
  export ll.toStrict({
187
401
  validateParamsForSaveFrameDirect: validateParamsForSaveFrameDirect,
188
402
  validateParamsForFrameFromColumnBundle: validateParamsForFrameFromColumnBundle,
189
403
  makeFrameSpecs: makeFrameSpecs,
190
404
  makeWriteFrameStep: makeWriteFrameStep,
191
- makeFrameColumnRef: makeFrameColumnRef
405
+ makeFrameColumnRef: makeFrameColumnRef,
406
+ renameJoinColumns: renameJoinColumns,
407
+ validateAxisFilters: validateAxisFilters
192
408
  })
@@ -349,6 +349,24 @@ normalize := func(s) {
349
349
  return copy(s)
350
350
  }
351
351
 
352
+
353
+
354
+
355
+
356
+
357
+
358
+ sortUnique := func(list) {
359
+ uniqueMap := {}
360
+ for _, item in list {
361
+ uniqueMap[item] = item
362
+ }
363
+ uniqueList := []
364
+ for _, item in uniqueMap {
365
+ uniqueList = append(uniqueList, item)
366
+ }
367
+ return quickSortInPlace(uniqueList)
368
+ }
369
+
352
370
  export ll.toStrict({
353
371
  length: length,
354
372
  safeAppend: safeAppend,
@@ -367,5 +385,6 @@ export ll.toStrict({
367
385
  sortByFn: sortByFn,
368
386
  fromSet: fromSet,
369
387
  slice: slice,
370
- normalize: normalize
388
+ normalize: normalize,
389
+ sortUnique: sortUnique
371
390
  })
@@ -522,7 +522,6 @@ resource = func(r) {
522
522
 
523
523
 
524
524
 
525
-
526
525
  metaInputs: func() {
527
526
  if self._metaInputs == undefined {
528
527
  info := self.info()
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": "5.3.3",
3
+ "version": "5.3.4",
4
4
  "description": "Tengo SDK library",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -18,11 +18,11 @@
18
18
  "dependencies": {
19
19
  "@milaboratories/software-pframes-conv": "2.2.7",
20
20
  "@platforma-open/milaboratories.software-small-binaries": "^1.15.23",
21
- "@platforma-open/milaboratories.software-ptabler": "1.12.4",
21
+ "@platforma-open/milaboratories.software-ptabler": "1.12.5",
22
22
  "@platforma-open/milaboratories.software-ptexter": "1.1.1"
23
23
  },
24
24
  "devDependencies": {
25
- "@platforma-sdk/tengo-builder": "2.3.0"
25
+ "@platforma-sdk/tengo-builder": "2.3.1"
26
26
  },
27
27
  "scripts": {
28
28
  "type-check": "pl-tengo check",