@platforma-sdk/model 1.53.11 → 1.53.13
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/annotations/converter.cjs +11 -11
- package/dist/annotations/converter.cjs.map +1 -1
- package/dist/annotations/converter.d.ts +1 -1
- package/dist/annotations/converter.d.ts.map +1 -1
- package/dist/annotations/converter.js +11 -11
- package/dist/annotations/converter.js.map +1 -1
- package/dist/annotations/index.d.ts +2 -2
- package/dist/annotations/types.d.ts +4 -4
- package/dist/bconfig/index.d.ts +5 -5
- package/dist/bconfig/lambdas.d.ts +7 -7
- package/dist/bconfig/lambdas.d.ts.map +1 -1
- package/dist/bconfig/normalization.cjs.map +1 -1
- package/dist/bconfig/normalization.d.ts +3 -3
- package/dist/bconfig/normalization.js.map +1 -1
- package/dist/bconfig/types.cjs.map +1 -1
- package/dist/bconfig/types.d.ts +2 -2
- package/dist/bconfig/types.d.ts.map +1 -1
- package/dist/bconfig/types.js.map +1 -1
- package/dist/bconfig/util.d.ts +4 -4
- package/dist/bconfig/v3.d.ts +3 -3
- package/dist/block_api_v1.d.ts +2 -2
- package/dist/block_api_v1.d.ts.map +1 -1
- package/dist/block_api_v2.d.ts +2 -2
- package/dist/block_api_v2.d.ts.map +1 -1
- package/dist/block_api_v3.d.ts +3 -3
- package/dist/block_migrations.cjs +10 -10
- package/dist/block_migrations.cjs.map +1 -1
- package/dist/block_migrations.d.ts.map +1 -1
- package/dist/block_migrations.js +10 -10
- package/dist/block_migrations.js.map +1 -1
- package/dist/block_model.cjs +11 -11
- package/dist/block_model.cjs.map +1 -1
- package/dist/block_model.d.ts +8 -8
- package/dist/block_model.d.ts.map +1 -1
- package/dist/block_model.js +11 -11
- package/dist/block_model.js.map +1 -1
- package/dist/block_state_patch.d.ts +2 -2
- package/dist/block_state_util.cjs +1 -1
- package/dist/block_state_util.cjs.map +1 -1
- package/dist/block_state_util.d.ts +3 -3
- package/dist/block_state_util.js +1 -1
- package/dist/block_state_util.js.map +1 -1
- package/dist/block_storage.cjs +10 -10
- package/dist/block_storage.cjs.map +1 -1
- package/dist/block_storage.d.ts +2 -2
- package/dist/block_storage.d.ts.map +1 -1
- package/dist/block_storage.js +10 -10
- package/dist/block_storage.js.map +1 -1
- package/dist/block_storage_vm.cjs +22 -22
- package/dist/block_storage_vm.cjs.map +1 -1
- package/dist/block_storage_vm.d.ts +1 -1
- package/dist/block_storage_vm.d.ts.map +1 -1
- package/dist/block_storage_vm.js +22 -22
- package/dist/block_storage_vm.js.map +1 -1
- package/dist/builder.cjs +32 -23
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.d.ts +7 -7
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +32 -23
- package/dist/builder.js.map +1 -1
- package/dist/components/PFrameForGraphs.cjs +7 -6
- package/dist/components/PFrameForGraphs.cjs.map +1 -1
- package/dist/components/PFrameForGraphs.d.ts +4 -4
- package/dist/components/PFrameForGraphs.d.ts.map +1 -1
- package/dist/components/PFrameForGraphs.js +7 -6
- package/dist/components/PFrameForGraphs.js.map +1 -1
- package/dist/components/PlAnnotations/filter.d.ts +14 -14
- package/dist/components/PlAnnotations/filter.d.ts.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.cjs +46 -46
- package/dist/components/PlAnnotations/filters_ui.cjs.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.d.ts +10 -34
- package/dist/components/PlAnnotations/filters_ui.d.ts.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.js +46 -46
- package/dist/components/PlAnnotations/filters_ui.js.map +1 -1
- package/dist/components/PlAnnotations/index.d.ts +2 -2
- package/dist/components/PlAnnotations/types.d.ts +2 -2
- package/dist/components/PlDataTable.cjs +19 -20
- package/dist/components/PlDataTable.cjs.map +1 -1
- package/dist/components/PlDataTable.d.ts +27 -27
- package/dist/components/PlDataTable.d.ts.map +1 -1
- package/dist/components/PlDataTable.js +19 -20
- package/dist/components/PlDataTable.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment.cjs +2 -2
- package/dist/components/PlMultiSequenceAlignment.cjs.map +1 -1
- package/dist/components/PlMultiSequenceAlignment.d.ts +6 -6
- package/dist/components/PlMultiSequenceAlignment.d.ts.map +1 -1
- package/dist/components/PlMultiSequenceAlignment.js +2 -2
- package/dist/components/PlMultiSequenceAlignment.js.map +1 -1
- package/dist/components/PlSelectionModel.cjs.map +1 -1
- package/dist/components/PlSelectionModel.d.ts +1 -1
- package/dist/components/PlSelectionModel.js.map +1 -1
- package/dist/components/index.d.ts +5 -5
- package/dist/config/actions.cjs +39 -39
- package/dist/config/actions.cjs.map +1 -1
- package/dist/config/actions.d.ts +9 -9
- package/dist/config/actions.d.ts.map +1 -1
- package/dist/config/actions.js +39 -39
- package/dist/config/actions.js.map +1 -1
- package/dist/config/actions_kinds.d.ts +30 -30
- package/dist/config/actions_kinds.d.ts.map +1 -1
- package/dist/config/index.d.ts +6 -6
- package/dist/config/model.d.ts +28 -28
- package/dist/config/model_meta.d.ts +1 -1
- package/dist/config/type_engine.d.ts +3 -3
- package/dist/config/type_util.d.ts +2 -2
- package/dist/env_value.cjs +1 -1
- package/dist/env_value.cjs.map +1 -1
- package/dist/env_value.js +1 -1
- package/dist/env_value.js.map +1 -1
- package/dist/filters/converter.cjs +36 -32
- package/dist/filters/converter.cjs.map +1 -1
- package/dist/filters/converter.d.ts +2 -2
- package/dist/filters/converter.d.ts.map +1 -1
- package/dist/filters/converter.js +36 -32
- package/dist/filters/converter.js.map +1 -1
- package/dist/filters/index.d.ts +2 -2
- package/dist/filters/types.d.ts +33 -33
- package/dist/filters/types.d.ts.map +1 -1
- package/dist/index.d.ts +24 -24
- package/dist/internal.cjs +7 -7
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.ts +4 -4
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +7 -7
- package/dist/internal.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/pframe.cjs +1 -1
- package/dist/pframe.cjs.map +1 -1
- package/dist/pframe.d.ts +1 -1
- package/dist/pframe.js +1 -1
- package/dist/pframe.js.map +1 -1
- package/dist/pframe_utils/columns.cjs +23 -15
- package/dist/pframe_utils/columns.cjs.map +1 -1
- package/dist/pframe_utils/columns.d.ts +3 -3
- package/dist/pframe_utils/columns.d.ts.map +1 -1
- package/dist/pframe_utils/columns.js +23 -15
- package/dist/pframe_utils/columns.js.map +1 -1
- package/dist/pframe_utils/index.cjs +25 -25
- package/dist/pframe_utils/index.cjs.map +1 -1
- package/dist/pframe_utils/index.d.ts +3 -3
- package/dist/pframe_utils/index.d.ts.map +1 -1
- package/dist/pframe_utils/index.js +25 -25
- package/dist/pframe_utils/index.js.map +1 -1
- package/dist/platforma.d.ts +7 -7
- package/dist/platforma.d.ts.map +1 -1
- package/dist/raw_globals.cjs +4 -1
- package/dist/raw_globals.cjs.map +1 -1
- package/dist/raw_globals.d.ts +2 -2
- package/dist/raw_globals.d.ts.map +1 -1
- package/dist/raw_globals.js +4 -1
- package/dist/raw_globals.js.map +1 -1
- package/dist/ref_util.cjs +4 -4
- package/dist/ref_util.cjs.map +1 -1
- package/dist/ref_util.d.ts +1 -1
- package/dist/ref_util.js +4 -4
- package/dist/ref_util.js.map +1 -1
- package/dist/render/accessor.cjs +24 -24
- package/dist/render/accessor.cjs.map +1 -1
- package/dist/render/accessor.d.ts +10 -10
- package/dist/render/accessor.d.ts.map +1 -1
- package/dist/render/accessor.js +24 -24
- package/dist/render/accessor.js.map +1 -1
- package/dist/render/api.cjs +23 -23
- package/dist/render/api.cjs.map +1 -1
- package/dist/render/api.d.ts +11 -11
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/api.js +23 -23
- package/dist/render/api.js.map +1 -1
- package/dist/render/future.cjs.map +1 -1
- package/dist/render/future.d.ts +1 -1
- package/dist/render/future.js.map +1 -1
- package/dist/render/index.d.ts +6 -6
- package/dist/render/internal.cjs +4 -4
- package/dist/render/internal.cjs.map +1 -1
- package/dist/render/internal.d.ts +7 -7
- package/dist/render/internal.d.ts.map +1 -1
- package/dist/render/internal.js +4 -4
- package/dist/render/internal.js.map +1 -1
- package/dist/render/traversal_ops.d.ts +1 -1
- package/dist/render/util/axis_filtering.cjs +48 -44
- package/dist/render/util/axis_filtering.cjs.map +1 -1
- package/dist/render/util/axis_filtering.d.ts +2 -2
- package/dist/render/util/axis_filtering.js +48 -44
- package/dist/render/util/axis_filtering.js.map +1 -1
- package/dist/render/util/column_collection.cjs +42 -35
- package/dist/render/util/column_collection.cjs.map +1 -1
- package/dist/render/util/column_collection.d.ts +4 -4
- package/dist/render/util/column_collection.d.ts.map +1 -1
- package/dist/render/util/column_collection.js +42 -35
- package/dist/render/util/column_collection.js.map +1 -1
- package/dist/render/util/index.d.ts +4 -4
- package/dist/render/util/label.cjs +15 -21
- package/dist/render/util/label.cjs.map +1 -1
- package/dist/render/util/label.d.ts +2 -2
- package/dist/render/util/label.d.ts.map +1 -1
- package/dist/render/util/label.js +15 -21
- package/dist/render/util/label.js.map +1 -1
- package/dist/render/util/pcolumn_data.cjs +56 -54
- package/dist/render/util/pcolumn_data.cjs.map +1 -1
- package/dist/render/util/pcolumn_data.d.ts +5 -5
- package/dist/render/util/pcolumn_data.d.ts.map +1 -1
- package/dist/render/util/pcolumn_data.js +56 -54
- package/dist/render/util/pcolumn_data.js.map +1 -1
- package/dist/render/util/pframe_upgraders.cjs +6 -6
- package/dist/render/util/pframe_upgraders.cjs.map +1 -1
- package/dist/render/util/pframe_upgraders.d.ts +1 -1
- package/dist/render/util/pframe_upgraders.d.ts.map +1 -1
- package/dist/render/util/pframe_upgraders.js +6 -6
- package/dist/render/util/pframe_upgraders.js.map +1 -1
- package/dist/render/util/split_selectors.d.ts +1 -1
- package/dist/render/util/split_selectors.d.ts.map +1 -1
- package/dist/sdk_info.cjs.map +1 -1
- package/dist/sdk_info.js.map +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +24 -22
- package/src/annotations/converter.test.ts +98 -101
- package/src/annotations/converter.ts +21 -17
- package/src/annotations/index.ts +2 -2
- package/src/annotations/types.ts +4 -4
- package/src/bconfig/index.ts +5 -5
- package/src/bconfig/lambdas.ts +10 -12
- package/src/bconfig/normalization.ts +5 -5
- package/src/bconfig/types.ts +3 -5
- package/src/bconfig/util.ts +3 -3
- package/src/bconfig/v3.ts +3 -3
- package/src/block_api_v1.ts +7 -3
- package/src/block_api_v2.ts +7 -3
- package/src/block_api_v3.ts +3 -3
- package/src/block_migrations.test.ts +66 -67
- package/src/block_migrations.ts +16 -16
- package/src/block_model.ts +76 -140
- package/src/block_state_patch.ts +2 -2
- package/src/block_state_util.ts +4 -4
- package/src/block_storage.test.ts +106 -99
- package/src/block_storage.ts +22 -25
- package/src/block_storage_vm.ts +41 -35
- package/src/builder.ts +107 -95
- package/src/components/PFrameForGraphs.test.ts +261 -255
- package/src/components/PFrameForGraphs.ts +35 -22
- package/src/components/PlAnnotations/filter.ts +21 -15
- package/src/components/PlAnnotations/filters_ui.test.ts +230 -73
- package/src/components/PlAnnotations/filters_ui.ts +138 -105
- package/src/components/PlAnnotations/index.ts +2 -2
- package/src/components/PlAnnotations/types.ts +2 -2
- package/src/components/PlDataTable.ts +177 -164
- package/src/components/PlMultiSequenceAlignment.ts +11 -18
- package/src/components/PlSelectionModel.ts +1 -1
- package/src/components/index.ts +5 -5
- package/src/config/actions.ts +64 -59
- package/src/config/actions_kinds.ts +38 -34
- package/src/config/index.ts +6 -6
- package/src/config/model.ts +28 -28
- package/src/config/model_meta.ts +1 -1
- package/src/config/type_engine.ts +3 -3
- package/src/config/type_util.ts +2 -2
- package/src/env_value.ts +2 -2
- package/src/filters/converter.test.ts +185 -144
- package/src/filters/converter.ts +47 -35
- package/src/filters/index.ts +2 -2
- package/src/filters/types.ts +44 -39
- package/src/global.d.ts +1 -1
- package/src/index.ts +24 -24
- package/src/internal.ts +27 -17
- package/src/pframe.ts +3 -3
- package/src/pframe_utils/columns.ts +81 -31
- package/src/pframe_utils/index.ts +65 -43
- package/src/platforma.ts +44 -21
- package/src/raw_globals.ts +13 -7
- package/src/ref_util.ts +6 -6
- package/src/render/accessor.ts +43 -44
- package/src/render/api.ts +102 -78
- package/src/render/future.ts +2 -2
- package/src/render/index.ts +6 -6
- package/src/render/internal.ts +11 -12
- package/src/render/traversal_ops.ts +1 -1
- package/src/render/util/axis_filtering.ts +67 -52
- package/src/render/util/column_collection.ts +171 -91
- package/src/render/util/index.ts +4 -4
- package/src/render/util/label.test.ts +139 -139
- package/src/render/util/label.ts +42 -33
- package/src/render/util/pcolumn_data.ts +111 -75
- package/src/render/util/pframe_upgraders.ts +24 -13
- package/src/render/util/split_selectors.ts +6 -1
- package/src/sdk_info.ts +1 -1
- package/src/typing.test.ts +56 -56
- package/src/version.ts +1 -1
package/dist/sdk_info.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk_info.cjs","sources":["../src/sdk_info.ts"],"sourcesContent":["import { PlatformaSDKVersion } from
|
|
1
|
+
{"version":3,"file":"sdk_info.cjs","sources":["../src/sdk_info.ts"],"sourcesContent":["import { PlatformaSDKVersion } from \"./version\";\n\nexport type SdkInfo = {\n readonly sdkVersion: string;\n};\n\nexport const CurrentSdkInfo: SdkInfo = {\n sdkVersion: PlatformaSDKVersion,\n};\n"],"names":["PlatformaSDKVersion"],"mappings":";;;;AAMO,MAAM,cAAc,GAAY;AACrC,IAAA,UAAU,EAAEA,2BAAmB;;;;;"}
|
package/dist/sdk_info.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk_info.js","sources":["../src/sdk_info.ts"],"sourcesContent":["import { PlatformaSDKVersion } from
|
|
1
|
+
{"version":3,"file":"sdk_info.js","sources":["../src/sdk_info.ts"],"sourcesContent":["import { PlatformaSDKVersion } from \"./version\";\n\nexport type SdkInfo = {\n readonly sdkVersion: string;\n};\n\nexport const CurrentSdkInfo: SdkInfo = {\n sdkVersion: PlatformaSDKVersion,\n};\n"],"names":[],"mappings":";;AAMO,MAAM,cAAc,GAAY;AACrC,IAAA,UAAU,EAAE,mBAAmB;;;;;"}
|
package/dist/version.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.cjs","sources":["../src/version.ts"],"sourcesContent":["import { version } from
|
|
1
|
+
{"version":3,"file":"version.cjs","sources":["../src/version.ts"],"sourcesContent":["import { version } from \"../package.json\";\nexport const PlatformaSDKVersion = version;\n"],"names":["version"],"mappings":";;;;AACO,MAAM,mBAAmB,GAAGA;;;;"}
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["import { version } from
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["import { version } from \"../package.json\";\nexport const PlatformaSDKVersion = version;\n"],"names":[],"mappings":";;AACO,MAAM,mBAAmB,GAAG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/model",
|
|
3
|
-
"version": "1.53.
|
|
3
|
+
"version": "1.53.13",
|
|
4
4
|
"description": "Platforma.bio SDK / Block Model",
|
|
5
|
+
"files": [
|
|
6
|
+
"./dist/**/*",
|
|
7
|
+
"./src/**/*",
|
|
8
|
+
"README.md"
|
|
9
|
+
],
|
|
5
10
|
"type": "module",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
11
|
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
8
13
|
"exports": {
|
|
9
14
|
".": {
|
|
10
|
-
"sources": "./src/index.ts",
|
|
11
15
|
"types": "./dist/index.d.ts",
|
|
16
|
+
"sources": "./src/index.ts",
|
|
12
17
|
"import": "./dist/index.js",
|
|
13
18
|
"require": "./dist/index.cjs"
|
|
14
19
|
}
|
|
15
20
|
},
|
|
16
|
-
"files": [
|
|
17
|
-
"./dist/**/*",
|
|
18
|
-
"./src/**/*",
|
|
19
|
-
"README.md"
|
|
20
|
-
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"fast-json-patch": "^3.1.1",
|
|
23
|
-
"utility-types": "^3.11.0",
|
|
24
22
|
"canonicalize": "~2.1.0",
|
|
25
23
|
"es-toolkit": "^1.39.10",
|
|
24
|
+
"fast-json-patch": "^3.1.1",
|
|
25
|
+
"utility-types": "^3.11.0",
|
|
26
26
|
"zod": "~3.23.8",
|
|
27
|
-
"@milaboratories/pl-
|
|
28
|
-
"@milaboratories/
|
|
29
|
-
"@milaboratories/
|
|
27
|
+
"@milaboratories/pl-error-like": "1.12.6",
|
|
28
|
+
"@milaboratories/pl-model-common": "1.24.4",
|
|
29
|
+
"@milaboratories/ptabler-expression-js": "1.1.14"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@vitest/coverage-istanbul": "^4.0.16",
|
|
32
33
|
"typescript": "~5.6.3",
|
|
33
34
|
"vitest": "^4.0.16",
|
|
34
|
-
"@
|
|
35
|
-
"@milaboratories/
|
|
36
|
-
"@milaboratories/
|
|
37
|
-
"@milaboratories/helpers": "1.13.
|
|
38
|
-
"@milaboratories/ts-builder": "1.2.4",
|
|
39
|
-
"@milaboratories/ts-configs": "1.2.0"
|
|
35
|
+
"@milaboratories/build-configs": "1.4.1",
|
|
36
|
+
"@milaboratories/ts-configs": "1.2.0",
|
|
37
|
+
"@milaboratories/ts-builder": "1.2.5",
|
|
38
|
+
"@milaboratories/helpers": "1.13.1"
|
|
40
39
|
},
|
|
41
40
|
"scripts": {
|
|
42
|
-
"type-check": "ts-builder types --target node",
|
|
43
41
|
"build": "ts-builder build --target node",
|
|
44
42
|
"watch": "ts-builder build --target node --watch",
|
|
45
|
-
"
|
|
43
|
+
"check": "ts-builder check --target node",
|
|
44
|
+
"formatter:check": "ts-builder formatter --check",
|
|
45
|
+
"linter:check": "ts-builder linter --check",
|
|
46
|
+
"types:check": "ts-builder type-check --target node",
|
|
46
47
|
"test": "vitest run --coverage",
|
|
47
|
-
"do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz"
|
|
48
|
+
"do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz",
|
|
49
|
+
"fmt": "ts-builder format"
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -1,132 +1,129 @@
|
|
|
1
|
-
import { describe, expect, test } from
|
|
2
|
-
import { convertFilterSpecsToExpressionSpecs } from
|
|
3
|
-
import { FilterSpecUi } from
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import { convertFilterSpecsToExpressionSpecs } from "./converter";
|
|
3
|
+
import { FilterSpecUi } from "./types";
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
test(
|
|
5
|
+
describe("convertFilterSpecsToExpressionSpecs", () => {
|
|
6
|
+
test("should compile an empty annotation script", () => {
|
|
7
7
|
const script = convertFilterSpecsToExpressionSpecs([]);
|
|
8
8
|
expect(script).toEqual([]);
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
test(
|
|
11
|
+
test("should compile an annotation script with steps", () => {
|
|
12
12
|
const filters: FilterSpecUi[] = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
13
|
+
{
|
|
14
|
+
label: "Step 1",
|
|
15
|
+
filter: {
|
|
16
|
+
type: "and",
|
|
17
|
+
filters: [
|
|
18
|
+
{ type: "isNA", column: "colA" } as any,
|
|
19
|
+
{ type: "patternEquals", column: "colB", value: "abc" } as any,
|
|
20
|
+
],
|
|
22
21
|
},
|
|
23
|
-
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
24
|
const expected = [
|
|
25
25
|
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
name: "Step 1",
|
|
27
|
+
type: "alias",
|
|
28
|
+
value: {
|
|
29
|
+
conditions: [
|
|
30
30
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
then: {
|
|
32
|
+
type: "const",
|
|
33
|
+
value: true,
|
|
34
34
|
},
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
when: {
|
|
36
|
+
operands: [
|
|
37
37
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
type: "is_na",
|
|
39
|
+
value: {
|
|
40
|
+
name: "colA",
|
|
41
|
+
type: "col",
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
lhs: {
|
|
46
|
+
name: "colB",
|
|
47
|
+
type: "col",
|
|
48
48
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
rhs: {
|
|
50
|
+
type: "const",
|
|
51
|
+
value: "abc",
|
|
52
52
|
},
|
|
53
|
-
|
|
53
|
+
type: "eq",
|
|
54
54
|
},
|
|
55
55
|
],
|
|
56
|
-
|
|
56
|
+
type: "and",
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
59
|
],
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
otherwise: {
|
|
61
|
+
type: "const",
|
|
62
|
+
value: false,
|
|
63
63
|
},
|
|
64
|
-
|
|
65
|
-
}
|
|
64
|
+
type: "when_then_otherwise",
|
|
65
|
+
},
|
|
66
66
|
},
|
|
67
67
|
];
|
|
68
68
|
const script = convertFilterSpecsToExpressionSpecs(filters);
|
|
69
69
|
expect(script).toEqual(expected);
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
test(
|
|
72
|
+
test("should filter out empty/unset filter conditions", () => {
|
|
73
73
|
const filters: FilterSpecUi[] = [
|
|
74
74
|
{
|
|
75
|
-
label:
|
|
75
|
+
label: "Step with various unset filters",
|
|
76
76
|
filter: {
|
|
77
|
-
type:
|
|
77
|
+
type: "and",
|
|
78
78
|
filters: [
|
|
79
79
|
{} as any,
|
|
80
80
|
{ type: undefined } as any,
|
|
81
|
-
{ type:
|
|
82
|
-
{ type:
|
|
83
|
-
{ type:
|
|
84
|
-
{ type:
|
|
85
|
-
{ type:
|
|
86
|
-
{ type:
|
|
87
|
-
{ type:
|
|
88
|
-
{ type:
|
|
89
|
-
{ type:
|
|
90
|
-
{ type:
|
|
91
|
-
{ type:
|
|
92
|
-
{ type:
|
|
93
|
-
{ type:
|
|
94
|
-
{ type:
|
|
95
|
-
{ type:
|
|
96
|
-
{ type:
|
|
97
|
-
{ type:
|
|
98
|
-
{ type:
|
|
99
|
-
{ type:
|
|
100
|
-
{ type:
|
|
101
|
-
{ type:
|
|
102
|
-
{ type:
|
|
103
|
-
{ type:
|
|
104
|
-
{ type:
|
|
105
|
-
{ type:
|
|
106
|
-
{ type: undefined, column:
|
|
81
|
+
{ type: "isNA", column: "colA" },
|
|
82
|
+
{ type: "isNA", column: undefined } as any,
|
|
83
|
+
{ type: "isNotNA", column: undefined } as any,
|
|
84
|
+
{ type: "patternEquals", column: undefined, value: "test" },
|
|
85
|
+
{ type: "patternEquals", column: "colX", value: undefined } as any,
|
|
86
|
+
{ type: "patternNotEquals", column: undefined, value: "test" } as any,
|
|
87
|
+
{ type: "patternNotEquals", column: "colX", value: undefined } as any,
|
|
88
|
+
{ type: "patternContainSubsequence", column: undefined, value: "test" } as any,
|
|
89
|
+
{ type: "patternContainSubsequence", column: "colX", value: undefined } as any,
|
|
90
|
+
{ type: "equal", column: undefined, x: 5 } as any,
|
|
91
|
+
{ type: "equal", column: "colX", x: undefined } as any,
|
|
92
|
+
{ type: "lessThan", column: undefined, x: 5 } as any,
|
|
93
|
+
{ type: "lessThan", column: "colX", x: undefined } as any,
|
|
94
|
+
{ type: "greaterThan", column: undefined, x: 5 } as any,
|
|
95
|
+
{ type: "greaterThan", column: "colX", x: undefined } as any,
|
|
96
|
+
{ type: "topN", column: undefined, n: 5 } as any,
|
|
97
|
+
{ type: "topN", column: "colX", n: undefined } as any,
|
|
98
|
+
{ type: "bottomN", column: undefined, n: 5 } as any,
|
|
99
|
+
{ type: "bottomN", column: "colX", n: undefined } as any,
|
|
100
|
+
{ type: "equalToColumn", column: undefined, rhs: "colY" } as any,
|
|
101
|
+
{ type: "equalToColumn", column: "colX", rhs: undefined } as any,
|
|
102
|
+
{ type: "greaterThanColumn", column: undefined, rhs: "colY" } as any,
|
|
103
|
+
{ type: "greaterThanColumn", column: "colX", rhs: undefined } as any,
|
|
104
|
+
{ type: "lessThanColumn", column: undefined, rhs: "colY" } as any,
|
|
105
|
+
{ type: "lessThanColumn", column: "colX", rhs: undefined } as any,
|
|
106
|
+
{ type: undefined, column: "colX", value: "someValue" } as any,
|
|
107
107
|
],
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
|
-
label:
|
|
111
|
+
label: "Step with nested unset filters",
|
|
112
112
|
filter: {
|
|
113
|
-
type:
|
|
113
|
+
type: "or",
|
|
114
114
|
filters: [
|
|
115
115
|
{
|
|
116
|
-
type:
|
|
116
|
+
type: "and",
|
|
117
117
|
filters: [
|
|
118
118
|
{ type: undefined } as any,
|
|
119
|
-
{ type:
|
|
119
|
+
{ type: "patternEquals", column: "colB", value: "test" },
|
|
120
120
|
{ type: undefined, column: undefined } as any,
|
|
121
121
|
],
|
|
122
122
|
},
|
|
123
123
|
{ type: undefined } as any,
|
|
124
124
|
{
|
|
125
|
-
type:
|
|
126
|
-
filters: [
|
|
127
|
-
{ type: undefined } as any,
|
|
128
|
-
{ type: undefined, value: undefined } as any,
|
|
129
|
-
],
|
|
125
|
+
type: "or",
|
|
126
|
+
filters: [{ type: undefined } as any, { type: undefined, value: undefined } as any],
|
|
130
127
|
} as any,
|
|
131
128
|
],
|
|
132
129
|
},
|
|
@@ -134,23 +131,23 @@ describe('convertFilterSpecsToExpressionSpecs', () => {
|
|
|
134
131
|
];
|
|
135
132
|
const expected = [
|
|
136
133
|
{
|
|
137
|
-
name:
|
|
138
|
-
type:
|
|
134
|
+
name: "Step with various unset filters",
|
|
135
|
+
type: "alias",
|
|
139
136
|
value: {
|
|
140
137
|
conditions: [
|
|
141
138
|
{
|
|
142
139
|
then: {
|
|
143
|
-
type:
|
|
140
|
+
type: "const",
|
|
144
141
|
value: true,
|
|
145
142
|
},
|
|
146
143
|
when: {
|
|
147
|
-
type:
|
|
144
|
+
type: "and",
|
|
148
145
|
operands: [
|
|
149
146
|
{
|
|
150
|
-
type:
|
|
147
|
+
type: "is_na",
|
|
151
148
|
value: {
|
|
152
|
-
name:
|
|
153
|
-
type:
|
|
149
|
+
name: "colA",
|
|
150
|
+
type: "col",
|
|
154
151
|
},
|
|
155
152
|
},
|
|
156
153
|
],
|
|
@@ -158,38 +155,38 @@ describe('convertFilterSpecsToExpressionSpecs', () => {
|
|
|
158
155
|
},
|
|
159
156
|
],
|
|
160
157
|
otherwise: {
|
|
161
|
-
type:
|
|
158
|
+
type: "const",
|
|
162
159
|
value: false,
|
|
163
160
|
},
|
|
164
|
-
type:
|
|
161
|
+
type: "when_then_otherwise",
|
|
165
162
|
},
|
|
166
163
|
},
|
|
167
164
|
{
|
|
168
|
-
name:
|
|
169
|
-
type:
|
|
165
|
+
name: "Step with nested unset filters",
|
|
166
|
+
type: "alias",
|
|
170
167
|
value: {
|
|
171
168
|
conditions: [
|
|
172
169
|
{
|
|
173
170
|
then: {
|
|
174
|
-
type:
|
|
171
|
+
type: "const",
|
|
175
172
|
value: true,
|
|
176
173
|
},
|
|
177
174
|
when: {
|
|
178
|
-
type:
|
|
175
|
+
type: "or",
|
|
179
176
|
operands: [
|
|
180
177
|
{
|
|
181
|
-
type:
|
|
178
|
+
type: "and",
|
|
182
179
|
operands: [
|
|
183
180
|
{
|
|
184
181
|
lhs: {
|
|
185
|
-
name:
|
|
186
|
-
type:
|
|
182
|
+
name: "colB",
|
|
183
|
+
type: "col",
|
|
187
184
|
},
|
|
188
185
|
rhs: {
|
|
189
|
-
type:
|
|
190
|
-
value:
|
|
186
|
+
type: "const",
|
|
187
|
+
value: "test",
|
|
191
188
|
},
|
|
192
|
-
type:
|
|
189
|
+
type: "eq",
|
|
193
190
|
},
|
|
194
191
|
],
|
|
195
192
|
},
|
|
@@ -198,10 +195,10 @@ describe('convertFilterSpecsToExpressionSpecs', () => {
|
|
|
198
195
|
},
|
|
199
196
|
],
|
|
200
197
|
otherwise: {
|
|
201
|
-
type:
|
|
198
|
+
type: "const",
|
|
202
199
|
value: false,
|
|
203
200
|
},
|
|
204
|
-
type:
|
|
201
|
+
type: "when_then_otherwise",
|
|
205
202
|
},
|
|
206
203
|
},
|
|
207
204
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { when } from
|
|
2
|
-
import type { FilterSpec } from
|
|
3
|
-
import { convertFilterUiToExpressionImpl } from
|
|
4
|
-
import type { ExpressionSpec, FilterSpecUi } from
|
|
1
|
+
import { when } from "@milaboratories/ptabler-expression-js";
|
|
2
|
+
import type { FilterSpec } from "../filters";
|
|
3
|
+
import { convertFilterUiToExpressionImpl } from "../filters/converter";
|
|
4
|
+
import type { ExpressionSpec, FilterSpecUi } from "./types";
|
|
5
5
|
|
|
6
6
|
function filterPredicate(item: FilterSpec): boolean {
|
|
7
7
|
// No need to convert empty steps
|
|
@@ -9,15 +9,15 @@ function filterPredicate(item: FilterSpec): boolean {
|
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
if (item.type ===
|
|
12
|
+
if (item.type === "or") {
|
|
13
13
|
return item.filters.length > 0;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
if (item.type ===
|
|
16
|
+
if (item.type === "and") {
|
|
17
17
|
return item.filters.length > 0;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
if (item.type ===
|
|
20
|
+
if (item.type === "not") {
|
|
21
21
|
return filterPredicate(item.filter);
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -26,10 +26,8 @@ function filterPredicate(item: FilterSpec): boolean {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function filterEmptyPeaces(item: FilterSpec): FilterSpec {
|
|
29
|
-
if (item.type ===
|
|
30
|
-
const filtered = item.filters
|
|
31
|
-
.map(filterEmptyPeaces)
|
|
32
|
-
.filter(filterPredicate);
|
|
29
|
+
if (item.type === "or" || item.type === "and") {
|
|
30
|
+
const filtered = item.filters.map(filterEmptyPeaces).filter(filterPredicate);
|
|
33
31
|
return {
|
|
34
32
|
...item,
|
|
35
33
|
filters: filtered,
|
|
@@ -39,15 +37,21 @@ function filterEmptyPeaces(item: FilterSpec): FilterSpec {
|
|
|
39
37
|
return item;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
export function convertFilterSpecsToExpressionSpecs(
|
|
40
|
+
export function convertFilterSpecsToExpressionSpecs(
|
|
41
|
+
annotationsUI: FilterSpecUi[],
|
|
42
|
+
): ExpressionSpec[] {
|
|
43
43
|
const validAnnotationsUI = annotationsUI.map((step) => ({
|
|
44
44
|
label: step.label,
|
|
45
45
|
filter: filterEmptyPeaces(step.filter),
|
|
46
46
|
}));
|
|
47
|
-
return validAnnotationsUI
|
|
48
|
-
|
|
49
|
-
type:
|
|
47
|
+
return validAnnotationsUI.map(
|
|
48
|
+
(step): ExpressionSpec => ({
|
|
49
|
+
type: "alias",
|
|
50
50
|
name: step.label.trim(),
|
|
51
|
-
value: when(convertFilterUiToExpressionImpl(step.filter))
|
|
52
|
-
|
|
51
|
+
value: when(convertFilterUiToExpressionImpl(step.filter))
|
|
52
|
+
.then(true)
|
|
53
|
+
.otherwise(false)
|
|
54
|
+
.toJSON(),
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
53
57
|
}
|
package/src/annotations/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./converter";
|
|
2
|
+
export * from "./types";
|
package/src/annotations/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Expression } from
|
|
2
|
-
import type { FilterSpec } from
|
|
1
|
+
import type { Expression } from "@milaboratories/ptabler-expression-js";
|
|
2
|
+
import type { FilterSpec } from "../filters";
|
|
3
3
|
|
|
4
4
|
export type AnnotationSpec<T extends ExpressionSpec = ExpressionSpec> = {
|
|
5
5
|
title: string;
|
|
@@ -7,7 +7,7 @@ export type AnnotationSpec<T extends ExpressionSpec = ExpressionSpec> = {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export type ExpressionSpec<T extends Expression = Expression> = {
|
|
10
|
-
type:
|
|
10
|
+
type: "alias";
|
|
11
11
|
name: string;
|
|
12
12
|
value: T;
|
|
13
13
|
}; // | OtherExpressionSpecTypesInFuture;
|
|
@@ -17,7 +17,7 @@ export type AnnotationSpecUi<T extends FilterSpecUi = FilterSpecUi> = {
|
|
|
17
17
|
steps: T[];
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export type FilterSpecUi<T extends FilterSpec = Extract<FilterSpec, { type:
|
|
20
|
+
export type FilterSpecUi<T extends FilterSpec = Extract<FilterSpec, { type: "and" | "or" }>> = {
|
|
21
21
|
label: string;
|
|
22
22
|
filter: T;
|
|
23
23
|
};
|
package/src/bconfig/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./lambdas";
|
|
2
|
+
export * from "./normalization";
|
|
3
|
+
export * from "./util";
|
|
4
|
+
export * from "./v3";
|
|
5
|
+
export * from "./types";
|
package/src/bconfig/lambdas.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ConfigResult, PlResourceEntry, TypedConfig } from
|
|
2
|
-
import type { OutputWithStatus } from
|
|
3
|
-
import type { TypedConfigOrConfigLambda } from
|
|
1
|
+
import type { ConfigResult, PlResourceEntry, TypedConfig } from "../config";
|
|
2
|
+
import type { OutputWithStatus } from "@milaboratories/pl-model-common";
|
|
3
|
+
import type { TypedConfigOrConfigLambda } from "./types";
|
|
4
4
|
|
|
5
5
|
export type StdCtxArgsOnly<Args, Data = undefined> = {
|
|
6
6
|
readonly $blockId: string;
|
|
@@ -69,16 +69,14 @@ export type InferOutputsFromConfigs<
|
|
|
69
69
|
OutputsCfg extends Record<string, TypedConfigOrConfigLambda>,
|
|
70
70
|
UiState,
|
|
71
71
|
> = {
|
|
72
|
-
[Key in keyof OutputsCfg]:
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
[Key in keyof OutputsCfg]: OutputWithStatus<InferOutputType<OutputsCfg[Key], Args, UiState>> & {
|
|
73
|
+
__unwrap: OutputsCfg[Key] extends { withStatus: true } ? false : true;
|
|
74
|
+
};
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
/** Maps lambda-only outputs configuration to inferred output types (for V3 blocks) */
|
|
78
|
-
export type InferOutputsFromLambdas<
|
|
79
|
-
OutputsCfg
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
& OutputWithStatus<ExtractFunctionHandleReturn<OutputsCfg[Key]>>
|
|
83
|
-
& { __unwrap: (OutputsCfg[Key] extends { withStatus: true } ? false : true) };
|
|
78
|
+
export type InferOutputsFromLambdas<OutputsCfg extends Record<string, ConfigRenderLambda>> = {
|
|
79
|
+
[Key in keyof OutputsCfg]: OutputWithStatus<ExtractFunctionHandleReturn<OutputsCfg[Key]>> & {
|
|
80
|
+
__unwrap: OutputsCfg[Key] extends { withStatus: true } ? false : true;
|
|
81
|
+
};
|
|
84
82
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { extractConfigGeneric, type BlockConfigContainer } from
|
|
2
|
-
import type { TypedConfigOrConfigLambda, TypedConfigOrString } from
|
|
3
|
-
import { isConfigLambda } from
|
|
4
|
-
import type { BlockConfig } from
|
|
1
|
+
import { extractConfigGeneric, type BlockConfigContainer } from "@milaboratories/pl-model-common";
|
|
2
|
+
import type { TypedConfigOrConfigLambda, TypedConfigOrString } from "./types";
|
|
3
|
+
import { isConfigLambda } from "./types";
|
|
4
|
+
import type { BlockConfig } from "./v3";
|
|
5
5
|
|
|
6
6
|
export function downgradeCfgOrLambda(data: TypedConfigOrConfigLambda): TypedConfigOrString;
|
|
7
7
|
export function downgradeCfgOrLambda(
|
|
8
|
-
data: TypedConfigOrConfigLambda | undefined
|
|
8
|
+
data: TypedConfigOrConfigLambda | undefined,
|
|
9
9
|
): TypedConfigOrString | undefined;
|
|
10
10
|
export function downgradeCfgOrLambda(
|
|
11
11
|
data: TypedConfigOrConfigLambda | undefined,
|
package/src/bconfig/types.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { TypedConfig } from
|
|
2
|
-
import type { ConfigRenderLambda } from
|
|
1
|
+
import type { TypedConfig } from "../config";
|
|
2
|
+
import type { ConfigRenderLambda } from "./lambdas";
|
|
3
3
|
|
|
4
|
-
export function isConfigLambda(
|
|
5
|
-
cfgOrFh: TypedConfigOrConfigLambda,
|
|
6
|
-
): cfgOrFh is ConfigRenderLambda {
|
|
4
|
+
export function isConfigLambda(cfgOrFh: TypedConfigOrConfigLambda): cfgOrFh is ConfigRenderLambda {
|
|
7
5
|
return (cfgOrFh as any).__renderLambda === true;
|
|
8
6
|
}
|
|
9
7
|
|
package/src/bconfig/util.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { BlockSection } from
|
|
1
|
+
import type { BlockSection } from "@milaboratories/pl-model-common";
|
|
2
2
|
|
|
3
|
-
type OnlyString<S> = S extends string ? S :
|
|
3
|
+
type OnlyString<S> = S extends string ? S : "";
|
|
4
4
|
|
|
5
5
|
export type DeriveHref<S> = S extends readonly BlockSection[]
|
|
6
|
-
? OnlyString<Extract<S[number], { type:
|
|
6
|
+
? OnlyString<Extract<S[number], { type: "link" }>["href"]>
|
|
7
7
|
: never;
|
package/src/bconfig/v3.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BlockConfigV3Generic, BlockConfigV4Generic } from
|
|
2
|
-
import type { TypedConfigOrConfigLambda } from
|
|
3
|
-
import type { ConfigRenderLambda } from
|
|
1
|
+
import type { BlockConfigV3Generic, BlockConfigV4Generic } from "@milaboratories/pl-model-common";
|
|
2
|
+
import type { TypedConfigOrConfigLambda } from "./types";
|
|
3
|
+
import type { ConfigRenderLambda } from "./lambdas";
|
|
4
4
|
|
|
5
5
|
export type BlockConfigV3<
|
|
6
6
|
Args = unknown,
|
package/src/block_api_v1.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
BlockOutputsBase,
|
|
3
|
+
BlockState,
|
|
4
|
+
NavigationState,
|
|
5
|
+
} from "@milaboratories/pl-model-common";
|
|
6
|
+
import type { BlockStatePatch } from "./block_state_patch";
|
|
3
7
|
|
|
4
8
|
/** Returned by state subscription methods to be able to cancel the subscription. */
|
|
5
9
|
export type CancelSubscription = () => void;
|
|
@@ -35,7 +39,7 @@ export interface BlockApiV1<
|
|
|
35
39
|
* @return function that cancels created subscription
|
|
36
40
|
* */
|
|
37
41
|
onStateUpdates(
|
|
38
|
-
cb: (updates: BlockStatePatch<Args, Outputs, UiState, Href>[]) => Promise<void
|
|
42
|
+
cb: (updates: BlockStatePatch<Args, Outputs, UiState, Href>[]) => Promise<void>,
|
|
39
43
|
): CancelSubscription;
|
|
40
44
|
|
|
41
45
|
/**
|