@milaboratories/uikit 2.3.23 → 2.3.25

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.
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @milaboratories/uikit@2.3.23 build /home/runner/_work/platforma/platforma/lib/ui/uikit
3
+ > @milaboratories/uikit@2.3.25 build /home/runner/_work/platforma/platforma/lib/ui/uikit
4
4
  > vite build
5
5
 
6
6
  vite v6.3.5 building for production...
@@ -14,8 +14,8 @@ computing gzip size...
14
14
  dist/_virtual/stringify2.js  0.09 kB │ gzip: 0.11 kB │ map: 0.10 kB
15
15
  dist/node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/number.js  0.09 kB │ gzip: 0.11 kB │ map: 0.33 kB
16
16
  dist/components/PlTabs/Tab.vue2.js  0.09 kB │ gzip: 0.11 kB │ map: 0.09 kB
17
- dist/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/identity.js  0.09 kB │ gzip: 0.11 kB │ map: 0.33 kB
18
17
  dist/node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/identity.js  0.09 kB │ gzip: 0.11 kB │ map: 0.32 kB
18
+ dist/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/identity.js  0.09 kB │ gzip: 0.11 kB │ map: 0.33 kB
19
19
  dist/node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/identity.js  0.09 kB │ gzip: 0.11 kB │ map: 0.32 kB
20
20
  dist/components/PlTooltip/global.js  0.10 kB │ gzip: 0.11 kB │ map: 0.22 kB
21
21
  dist/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/array.js  0.10 kB │ gzip: 0.11 kB │ map: 0.36 kB
@@ -46,10 +46,10 @@ computing gzip size...
46
46
  dist/components/PlLogView/PlLogView.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
47
47
  dist/components/Scrollable.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
48
48
  dist/components/PlBtnGroup/PlBtnGroup.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
49
- dist/components/PlBtnGhost/PlBtnGhost.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
50
49
  dist/components/PlBtnSplit/PlBtnSplit.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
51
- dist/components/PlDropdown/PlDropdown.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
52
50
  dist/components/PlCheckbox/PlCheckbox.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
51
+ dist/components/PlBtnGhost/PlBtnGhost.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
52
+ dist/components/PlDropdown/PlDropdown.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
53
53
  dist/components/PlTextArea/PlTextArea.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
54
54
  dist/components/InputRange.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
55
55
  dist/utils/DoubleContour.vue2.js  0.11 kB │ gzip: 0.12 kB │ map: 0.43 kB
@@ -57,13 +57,13 @@ computing gzip size...
57
57
  dist/components/PlDropdown/OptionList.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
58
58
  dist/components/SliderRange.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
59
59
  dist/components/PlAccordion/PlAccordion.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
60
- dist/layout/PlBlockPage/PlBlockPage.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
61
60
  dist/layout/PlContainer/PlContainer.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
61
+ dist/layout/PlBlockPage/PlBlockPage.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
62
62
  dist/components/PlBtnAccent/PlBtnAccent.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
63
63
  dist/components/PlBtnDanger/PlBtnDanger.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
64
- dist/components/PlStatusTag/PlStatusTag.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
65
64
  dist/components/PlFileInput/PlFileInput.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
66
65
  dist/components/PlTextField/PlTextField.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
66
+ dist/components/PlStatusTag/PlStatusTag.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
67
67
  dist/components/DataTable/ColumnCaret.vue2.js  0.11 kB │ gzip: 0.11 kB │ map: 0.10 kB
68
68
  dist/node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sparse.js  0.11 kB │ gzip: 0.12 kB │ map: 0.39 kB
69
69
  dist/components/PlBtnPrimary/PlBtnPrimary.vue2.js  0.11 kB │ gzip: 0.12 kB │ map: 0.10 kB
@@ -71,31 +71,31 @@ computing gzip size...
71
71
  dist/utils/InnerBorder.vue2.js  0.11 kB │ gzip: 0.12 kB │ map: 0.34 kB
72
72
  dist/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/number.js  0.11 kB │ gzip: 0.12 kB │ map: 0.78 kB
73
73
  dist/components/ThemeSwitcher.vue2.js  0.11 kB │ gzip: 0.12 kB │ map: 0.10 kB
74
- dist/components/PlDialogModal/PlDialogModal.vue2.js  0.11 kB │ gzip: 0.12 kB │ map: 0.10 kB
75
74
  dist/components/PlDropdownRef/PlDropdownRef.vue2.js  0.11 kB │ gzip: 0.12 kB │ map: 0.10 kB
75
+ dist/components/PlDialogModal/PlDialogModal.vue2.js  0.11 kB │ gzip: 0.12 kB │ map: 0.10 kB
76
76
  dist/components/PlNumberField/PlNumberField.vue2.js  0.11 kB │ gzip: 0.12 kB │ map: 0.10 kB
77
77
  dist/components/PlProgressBar/PlProgressBar.vue2.js  0.11 kB │ gzip: 0.12 kB │ map: 0.10 kB
78
78
  dist/components/DataTable/TableComponent.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.10 kB
79
79
  dist/components/PlAutocomplete/PlAutocomplete.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.10 kB
80
- dist/components/PlDropdownLine/PlDropdownLine.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.10 kB
81
80
  dist/components/PlBtnSecondary/PlBtnSecondary.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.10 kB
82
- dist/components/PlProgressCell/PlProgressCell.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.10 kB
81
+ dist/components/PlDropdownLine/PlDropdownLine.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.10 kB
83
82
  dist/components/PlToggleSwitch/PlToggleSwitch.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.10 kB
83
+ dist/components/PlProgressCell/PlProgressCell.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.10 kB
84
84
  dist/components/PlCheckbox/PlCheckboxBase.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.10 kB
85
85
  dist/components/PlDropdownLine/ResizableInput.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.10 kB
86
86
  dist/components/ContextProvider.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
87
87
  dist/components/PlErrorBoundary/PlErrorBoundary.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
88
88
  dist/components/PlCheckboxGroup/PlCheckboxGroup.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
89
- dist/components/PlDropdownMulti/PlDropdownMulti.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
90
89
  dist/components/PlEditableTitle/PlEditableTitle.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
91
- dist/helpers/math.js  0.12 kB │ gzip: 0.13 kB │ map: 0.33 kB
90
+ dist/components/PlDropdownMulti/PlDropdownMulti.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
92
91
  dist/components/PlConfirmDialog.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
92
+ dist/helpers/math.js  0.12 kB │ gzip: 0.13 kB │ map: 0.33 kB
93
93
  dist/utils/DropdownOverlay/DropdownOverlay.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
94
94
  dist/components/DataTable/RowsCommandMenu.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
95
95
  dist/components/DropdownListItem.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
96
96
  dist/components/PlDropdownLegacy/PlDropdownLegacy.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
97
- dist/components/PlLoaderCircular/PlLoaderCircular.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
98
97
  dist/components/PlSlideModal/PlPureSlideModal.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
98
+ dist/components/PlLoaderCircular/PlLoaderCircular.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
99
99
  dist/components/SliderRangeTriple.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
100
100
  dist/components/DataTable/BaseCellComponent.vue2.js  0.12 kB │ gzip: 0.12 kB │ map: 0.11 kB
101
101
  dist/node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/constant.js  0.12 kB │ gzip: 0.12 kB │ map: 0.39 kB
@@ -172,8 +172,8 @@ computing gzip size...
172
172
  dist/assets/icons/icon-assets-min/24_arrow-down.svg.js  0.27 kB │ gzip: 0.24 kB │ map: 0.44 kB
173
173
  dist/assets/icons/icon-assets-min/16_add.svg.js  0.27 kB │ gzip: 0.23 kB │ map: 0.44 kB
174
174
  dist/components/PlRadio/PlRadio.vue.js  0.27 kB │ gzip: 0.21 kB │ map: 0.10 kB
175
- dist/components/PlChartStackedBar/Legends.vue.js  0.27 kB │ gzip: 0.21 kB │ map: 0.10 kB
176
175
  dist/assets/icons/icon-assets-min/24_linetype-longdash.svg.js  0.27 kB │ gzip: 0.23 kB │ map: 0.47 kB
176
+ dist/components/PlChartStackedBar/Legends.vue.js  0.27 kB │ gzip: 0.21 kB │ map: 0.10 kB
177
177
  dist/assets/icons/icon-assets-min/16_chevron-first.svg.js  0.28 kB │ gzip: 0.23 kB │ map: 0.45 kB
178
178
  dist/components/PlIcon16/PlIcon16.vue.js  0.28 kB │ gzip: 0.22 kB │ map: 0.10 kB
179
179
  dist/components/PlIcon24/PlIcon24.vue.js  0.28 kB │ gzip: 0.22 kB │ map: 0.10 kB
@@ -230,10 +230,10 @@ computing gzip size...
230
230
  dist/assets/icons/icon-assets-min/16_checkmark.svg.js  0.30 kB │ gzip: 0.25 kB │ map: 0.48 kB
231
231
  dist/components/PlChartStackedBar/PlChartStackedBar.vue.js  0.30 kB │ gzip: 0.22 kB │ map: 0.11 kB
232
232
  dist/components/PlElementList/PlElementListItem.vue.js  0.30 kB │ gzip: 0.22 kB │ map: 0.11 kB
233
- dist/components/PlChartStackedBar/StackedRowCompact.vue.js  0.30 kB │ gzip: 0.22 kB │ map: 0.11 kB
233
+ dist/_virtual/canonicalize.js  0.30 kB │ gzip: 0.22 kB │ map: 0.10 kB
234
234
  dist/assets/icons/icon-assets-min/16_arrow-up.svg.js  0.30 kB │ gzip: 0.25 kB │ map: 0.48 kB
235
235
  dist/assets/icons/icon-assets-min/24_linetype-twodash.svg.js  0.30 kB │ gzip: 0.25 kB │ map: 0.50 kB
236
- dist/_virtual/canonicalize.js  0.30 kB │ gzip: 0.22 kB │ map: 0.10 kB
236
+ dist/components/PlChartStackedBar/StackedRowCompact.vue.js  0.30 kB │ gzip: 0.22 kB │ map: 0.11 kB
237
237
  dist/assets/icons/icon-assets-min/24_checkmark.svg.js  0.31 kB │ gzip: 0.25 kB │ map: 0.49 kB
238
238
  dist/assets/icons/icon-assets-min/16_arrow-down.svg.js  0.31 kB │ gzip: 0.25 kB │ map: 0.49 kB
239
239
  dist/assets/icons/icon-assets-min/16_arrow-left.svg.js  0.31 kB │ gzip: 0.24 kB │ map: 0.49 kB
@@ -355,8 +355,8 @@ computing gzip size...
355
355
  dist/assets/icons/icon-assets-min/16_y-axis.svg.js  0.45 kB │ gzip: 0.30 kB │ map: 0.65 kB
356
356
  dist/assets/icons/icon-assets-min/24_delete-circle.svg.js  0.45 kB │ gzip: 0.31 kB │ map: 0.65 kB
357
357
  dist/assets/icons/icon-assets-min/24_zoom-in.svg.js  0.45 kB │ gzip: 0.30 kB │ map: 0.65 kB
358
- dist/assets/images/24_checkbox-light-enabled-checked.svg.js  0.45 kB │ gzip: 0.33 kB │ map: 0.71 kB
359
358
  dist/components/PlChartStackedBar/PlChartStackedBarCompact.vue3.js  0.45 kB │ gzip: 0.32 kB │ map: 0.12 kB
359
+ dist/assets/images/24_checkbox-light-enabled-checked.svg.js  0.45 kB │ gzip: 0.33 kB │ map: 0.71 kB
360
360
  dist/assets/icons/icon-assets-min/24_frame-type-all.svg.js  0.46 kB │ gzip: 0.31 kB │ map: 0.65 kB
361
361
  dist/assets/icons/icon-assets-min/16_delete-bin.svg.js  0.46 kB │ gzip: 0.32 kB │ map: 0.64 kB
362
362
  dist/assets/icons/icon-assets-min/24_frame-type-left-bottom.svg.js  0.46 kB │ gzip: 0.30 kB │ map: 0.67 kB
@@ -547,8 +547,8 @@ computing gzip size...
547
547
  dist/assets/icons/icon-assets-min/24_view-show.svg.js  0.93 kB │ gzip: 0.55 kB │ map: 1.11 kB
548
548
  dist/assets/icons/icon-assets-min/24_theme-dark.svg.js  0.94 kB │ gzip: 0.48 kB │ map: 1.12 kB
549
549
  dist/layout/PlRow/PlRow.vue.js  0.94 kB │ gzip: 0.56 kB │ map: 0.61 kB
550
- dist/components/PlIcon24/PlIcon24.vue2.js  0.95 kB │ gzip: 0.51 kB │ map: 2.26 kB
551
550
  dist/components/PlIcon16/PlIcon16.vue2.js  0.95 kB │ gzip: 0.51 kB │ map: 1.55 kB
551
+ dist/components/PlIcon24/PlIcon24.vue2.js  0.95 kB │ gzip: 0.51 kB │ map: 2.26 kB
552
552
  dist/assets/icons/icon-assets-min/24_dendrogram-X-line.svg.js  0.95 kB │ gzip: 0.39 kB │ map: 1.24 kB
553
553
  dist/components/PlAccordion/PlAccordionSection.vue3.js  0.95 kB │ gzip: 0.53 kB │ map: 0.11 kB
554
554
  dist/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisector.js  0.96 kB │ gzip: 0.40 kB │ map: 3.13 kB
@@ -721,7 +721,7 @@ computing gzip size...
721
721
  dist/components/PlFileInput/PlFileInput.vue.js  10.74 kB │ gzip: 3.37 kB │ map: 8.41 kB
722
722
  dist/demo-site-data/all-css-variables.js  11.00 kB │ gzip: 1.76 kB │ map: 18.21 kB
723
723
  dist/components/PlDropdownLine/PlDropdownLine.vue.js  14.66 kB │ gzip: 3.91 kB │ map: 13.27 kB
724
- dist/lib/model/common/dist/index.js  15.38 kB │ gzip: 4.26 kB │ map: 89.05 kB
724
+ dist/lib/model/common/dist/index.js  15.38 kB │ gzip: 4.26 kB │ map: 89.14 kB
725
725
  dist/components/PlDropdown/PlDropdown.vue.js  16.29 kB │ gzip: 4.79 kB │ map: 15.21 kB
726
726
  dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js  17.36 kB │ gzip: 4.83 kB │ map: 14.94 kB
727
727
  dist/components/PlAutocomplete/PlAutocomplete.vue.js  17.72 kB │ gzip: 5.14 kB │ map: 17.60 kB
@@ -734,6 +734,6 @@ computing gzip size...
734
734
  dist/index.js 501.87 kB │ gzip: 192.38 kB │ map: 5.70 kB
735
735
  dist/components/PlSlideModal/PlPureSlideModal.vue.js 601.01 kB │ gzip: 204.66 kB │ map: 2.24 kB
736
736
  dist/components/DataTable/TableComponent.vue.js 602.90 kB │ gzip: 205.50 kB │ map: 4.86 kB
737
- [vite:dts] Declaration files built in 6224ms.
737
+ [vite:dts] Declaration files built in 16844ms.
738
738
 
739
- ✓ built in 11.05s
739
+ ✓ built in 21.41s
@@ -1,5 +1,5 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @milaboratories/uikit@2.3.23 type-check /home/runner/_work/platforma/platforma/lib/ui/uikit
3
+ > @milaboratories/uikit@2.3.25 type-check /home/runner/_work/platforma/platforma/lib/ui/uikit
4
4
  > vue-tsc --project ./tsconfig.lib.json
5
5
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @milaboratories/uikit
2
2
 
3
+ ## 2.3.25
4
+
5
+ ### Patch Changes
6
+
7
+ - @platforma-sdk/model@1.42.1
8
+
9
+ ## 2.3.24
10
+
11
+ ### Patch Changes
12
+
13
+ - @platforma-sdk/model@1.42.0
14
+
3
15
  ## 2.3.23
4
16
 
5
17
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".pl-file-input{--contour-color: var(--txt-01);--label-color: var(--txt-01);--text-color: var(--txt-01);--contour-border-width: 1px;--contour-box-shadow: none;--label-offset-left-x: 8px;--label-offset-right-x: 8px;--prefix-color: var(--color-placeholder);--contour-offset: 2px;--icon-color: #000;position:relative;z-index:0;width:100%;height:var(--control-height, 40px);border-radius:var(--border-radius-control);display:flex;flex-direction:row;align-items:center;outline:none;padding:0 8px;gap:8px;cursor:pointer}.pl-file-input__envelope{font-family:var(--font-family-base);display:flex;flex-direction:column;min-width:160px}.pl-file-input .mask-24{display:block;min-width:24px}.pl-file-input .mask-close{cursor:pointer}.pl-file-input__progress{position:absolute;z-index:-1;top:0;bottom:0;left:0;right:0;background:linear-gradient(90deg,#fff,#d8fac8);pointer-events:none;width:0}.pl-file-input__clear{--icon-color: var(--ic-02)}.pl-file-input__filename{width:100%;border:none;font-size:inherit;background-color:transparent;color:var(--text-color);caret-color:var(--border-color-focus);z-index:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:18px}.pl-file-input__filename:empty:before{color:var(--color-placeholder);content:attr(data-placeholder);color:var(--txt-03);font-size:14px;font-weight:500;line-height:20px}.pl-file-input__stats{white-space:nowrap;z-index:1;font-size:11px;font-weight:600;letter-spacing:.44px;text-transform:uppercase;color:var(--txt-03)}.pl-file-input label{display:flex;align-items:center;gap:4px;position:absolute;top:0;transform:translateY(-60%);left:var(--label-offset-left-x);padding:0 4px;max-width:calc(100% - 16px);overflow:hidden;white-space:pre;text-overflow:ellipsis;cursor:inherit;color:var(--label-color);font-size:12px;font-weight:500;border-bottom-right-radius:4px;border-bottom-left-radius:4px;background:var(--bg-elevated-01)}.pl-file-input label>span{overflow:hidden;white-space:pre;text-overflow:ellipsis}.pl-file-input__contour{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:var(--border-radius-control);border-width:var(--contour-border-width);border-color:var(--contour-color);border-style:solid;box-shadow:var(--contour-box-shadow);z-index:0;pointer-events:none}.pl-file-input__prefix{padding-left:12px;white-space:nowrap;margin-right:-12px;color:var(--prefix-color)}.pl-file-input__helper{font-size:12px;color:var(--txt-03);padding:2px 0 0;white-space:pre-wrap;text-overflow:ellipsis;font-weight:500;line-height:16px;margin-top:6px}.pl-file-input__error{font-size:12px;color:var(--txt-error);padding:2px 0 0;white-space:pre-wrap;text-overflow:ellipsis;font-weight:500;line-height:16px;margin-top:6px}.pl-file-input:hover{--contour-color: var(--control-hover-color)}.pl-file-input:focus-within:not(.error){--label-color: var(--txt-focus);--contour-color: var(--border-color-focus);--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--border-color-focus-shadow)}.pl-file-input:focus-within.error{--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--color-error-shadow)}.pl-file-input.dashed .pl-file-input__contour{border-style:dashed}.pl-file-input.nonEmpty{--prefix-color: var(--txt-01)}.pl-file-input.error{--contour-color: var(--txt-error);--label-color: var(--txt-error);--text-color: var(--txt-error);--icon-color: var(--txt-error)}.pl-file-input.error .pl-file-input__progress{display:none}.pl-file-input.disabled{--contour-color: var(--color-dis-01);cursor:not-allowed}.pl-file-input__cell-style{--border-radius-control: 0px;--input-active-color: var(--bg-base-light);--border-color: var(--border-color-div-grey);background-color:var(--input-active-color);padding:4px;height:100%;position:relative}.pl-file-input__cell-style .mask-paper-clip{display:none}.pl-file-input__cell-style .pl-file-input{height:100%!important;position:unset}.pl-file-input__cell-style .pl-file-input .double-contour{top:2px;right:2px;bottom:2px;left:2px}.pl-file-input__cell-style .pl-file-input__contour{border-width:1px;box-shadow:unset!important;border-color:var(--border-color);border-style:dashed}.pl-file-input__cell-style .pl-file-input__filename{text-align:center!important}.pl-file-input__cell-style .pl-file-input__error{margin-top:0;margin-right:8px}.pl-file-input__cell-style:hover{--border-color: var(--border-color-focus);background-color:#d9f8ca}.pl-file-input__cell-style:hover .pl-file-input__filename:before{color:#110529!important}.pl-file-input__cell-style.has-file:hover{background-color:var(--input-active-color)}.pl-file-input__cell-style.has-file{padding-left:0;padding-right:0}.pl-file-input__cell-style.has-file .pl-file-input__contour{border:unset}.pl-file-input__cell-style.has-file .pl-file-input__filename{text-align:left!important}.pl-file-input__cell-style.has-file .mask-paper-clip{display:block}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- import { defineComponent as q, reactive as K, useSlots as R, computed as s, watch as U, ref as $, createElementBlock as n, openBlock as l, Fragment as D, createElementVNode as c, createVNode as O, normalizeClass as B, createCommentVNode as p, withModifiers as F, withKeys as z, createBlock as i, normalizeStyle as H, toDisplayString as u, unref as r, withCtx as L, renderSlot as j, createTextVNode as A } from "vue";
2
+ import { defineComponent as q, reactive as K, useSlots as R, computed as s, watch as U, ref as $, createElementBlock as n, openBlock as l, Fragment as D, createElementVNode as c, createVNode as B, normalizeClass as O, createCommentVNode as p, withModifiers as F, withKeys as z, createBlock as i, normalizeStyle as H, toDisplayString as u, unref as r, withCtx as L, renderSlot as j, createTextVNode as A } from "vue";
3
3
  import { prettyBytes as y } from "../../lib/util/helpers/dist/index.js";
4
4
  import "../../sdk/model/dist/index.js";
5
5
  import G from "../../generated/components/svg/images/SvgRequired.vue2.js";
@@ -73,12 +73,12 @@ const ee = {
73
73
  const S = $();
74
74
  return o.cellStyle || W(S), (e, t) => (l(), n(D, null, [
75
75
  c("div", {
76
- class: B([{ "pl-file-input__cell-style": !!e.cellStyle, "has-file": !!k.value }, "pl-file-input__envelope"])
76
+ class: O([{ "pl-file-input__cell-style": !!e.cellStyle, "has-file": !!k.value }, "pl-file-input__envelope"])
77
77
  }, [
78
78
  c("div", {
79
79
  ref_key: "rootRef",
80
80
  ref: S,
81
- class: B([{ dashed: e.dashed, error: m.value }, "pl-file-input"]),
81
+ class: O([{ dashed: e.dashed, error: m.value }, "pl-file-input"]),
82
82
  tabindex: "0",
83
83
  onKeyup: z(C, ["enter"]),
84
84
  onClick: F(C, ["stop"])
@@ -127,11 +127,11 @@ const ee = {
127
127
  name: "close",
128
128
  onClick: F(I, ["stop"])
129
129
  })) : p("", !0),
130
- O(Q, { class: "pl-file-input__contour" })
130
+ B(Q, { class: "pl-file-input__contour" })
131
131
  ], 34),
132
132
  m.value ? (l(), n("div", te, u(V.value), 1)) : e.helper ? (l(), n("div", re, u(e.helper), 1)) : p("", !0)
133
133
  ], 2),
134
- O(r(X), {
134
+ B(r(X), {
135
135
  modelValue: a.fileDialogOpen,
136
136
  "onUpdate:modelValue": t[0] || (t[0] = (d) => a.fileDialogOpen = d),
137
137
  "close-on-outside-click": e.fileDialogCloseOnOutsideClick,
@@ -14,11 +14,11 @@ const P = "upload://upload/", k = "index://index/";
14
14
  function I(e) {
15
15
  return e.startsWith(P);
16
16
  }
17
- function S(e) {
17
+ function J(e) {
18
18
  return e.startsWith(k);
19
19
  }
20
- function j(e) {
21
- if (S(e)) {
20
+ function S(e) {
21
+ if (J(e)) {
22
22
  const t = e.slice(k.length);
23
23
  return JSON.parse(decodeURIComponent(t)).path;
24
24
  } else if (I(e)) {
@@ -27,11 +27,11 @@ function j(e) {
27
27
  }
28
28
  g(e);
29
29
  }
30
- function J(e) {
30
+ function j(e) {
31
31
  return e.replace(/^.*[\\/]/, "");
32
32
  }
33
33
  function M(e) {
34
- return J(j(e));
34
+ return j(S(e));
35
35
  }
36
36
  function U(e) {
37
37
  if (!e || typeof e != "object")
@@ -167,7 +167,7 @@ function d(e) {
167
167
  function C(e) {
168
168
  return e.map(d);
169
169
  }
170
- function z(e) {
170
+ function W(e) {
171
171
  return y(d(e));
172
172
  }
173
173
  function L(e, t) {
@@ -180,7 +180,7 @@ function L(e, t) {
180
180
  function $(e, t) {
181
181
  return e.name === t.name && L(e.domain, t.domain);
182
182
  }
183
- function W(e, t) {
183
+ function z(e, t) {
184
184
  return { ...e, src: p(e.src, t) };
185
185
  }
186
186
  function p(e, t) {
@@ -224,7 +224,7 @@ function x(e) {
224
224
  function b(e, t) {
225
225
  return JSON.stringify([e, t]);
226
226
  }
227
- class G {
227
+ class Q {
228
228
  /**
229
229
  * Creates a new anchor context from a set of anchor column specifications
230
230
  * @param anchors Record of anchor column specifications indexed by anchor ID
@@ -314,7 +314,7 @@ class G {
314
314
  return N(this.derive(t, n));
315
315
  }
316
316
  }
317
- function X(e, t, n) {
317
+ function Y(e, t, n) {
318
318
  const r = { ...t }, o = (n == null ? void 0 : n.ignoreMissingDomains) ?? !1;
319
319
  if (r.domainAnchor !== void 0) {
320
320
  const i = e[r.domainAnchor];
@@ -344,7 +344,7 @@ function X(e, t, n) {
344
344
  return r.axes && (r.axes = r.axes.map((i) => K(e, i))), r;
345
345
  }
346
346
  function K(e, t) {
347
- if (!F(t))
347
+ if (!D(t))
348
348
  return t;
349
349
  const n = t.anchor, r = e[n];
350
350
  if (!r)
@@ -370,20 +370,20 @@ function K(e, t) {
370
370
  }
371
371
  throw new Error("Unsupported axis reference type");
372
372
  }
373
- function F(e) {
373
+ function D(e) {
374
374
  return typeof e == "object" && "anchor" in e;
375
375
  }
376
376
  function h(e) {
377
377
  return e.kind === "PColumn";
378
378
  }
379
- function T(e) {
379
+ function B(e) {
380
380
  return h(e.spec);
381
381
  }
382
- function Q(e) {
383
- if (!T(e)) throw new Error(`not a PColumn (kind = ${e.spec.kind})`);
382
+ function G(e) {
383
+ if (!B(e)) throw new Error(`not a PColumn (kind = ${e.spec.kind})`);
384
384
  return e;
385
385
  }
386
- function Y(e, t) {
386
+ function X(e, t) {
387
387
  return e === void 0 ? void 0 : {
388
388
  ...e,
389
389
  data: t(e.data)
@@ -513,38 +513,38 @@ function re(e, t = !0) {
513
513
  function oe(e, t) {
514
514
  return e.ok ? { ok: !0, value: t(e.value) } : e;
515
515
  }
516
- const B = 24;
517
- u.string().length(B).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
516
+ const F = 24;
517
+ u.string().length(F).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
518
518
  export {
519
- G as AnchoredIdDeriver,
520
- B as PlIdLength,
521
- z as canonicalizeAxisId,
519
+ Q as AnchoredIdDeriver,
520
+ F as PlIdLength,
521
+ W as canonicalizeAxisId,
522
522
  q as dataInfoToEntries,
523
523
  te as deriveNativeId,
524
- Q as ensurePColumn,
524
+ G as ensurePColumn,
525
525
  V as entriesToDataInfo,
526
526
  Z as extractAllColumns,
527
527
  C as getAxesId,
528
528
  d as getAxisId,
529
529
  M as getFileNameFromHandle,
530
- j as getFilePathFromHandle,
530
+ S as getFilePathFromHandle,
531
531
  U as isDataInfo,
532
532
  E as isDataInfoEntries,
533
- S as isImportFileHandleIndex,
533
+ J as isImportFileHandleIndex,
534
534
  I as isImportFileHandleUpload,
535
- T as isPColumn,
535
+ B as isPColumn,
536
536
  h as isPColumnSpec,
537
537
  H as isPartitionedDataInfoEntries,
538
538
  ne as isPlRef,
539
539
  _ as mapDataInfo,
540
540
  p as mapJoinEntry,
541
- Y as mapPObjectData,
542
- W as mapPTableDef,
541
+ X as mapPObjectData,
542
+ z as mapPTableDef,
543
543
  oe as mapValueInVOE,
544
544
  v as matchAxis,
545
545
  $ as matchAxisId,
546
546
  w as matchPColumn,
547
- X as resolveAnchors,
547
+ Y as resolveAnchors,
548
548
  ee as selectorsToPredicate,
549
549
  N as stringifyColumnId,
550
550
  re as withEnrichments
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../../model/common/src/drivers/blob.ts","../../../../../../../model/common/src/util.ts","../../../../../../../model/common/src/drivers/ls.ts","../../../../../../../model/common/src/drivers/pframe/data_info.ts","../../../../../../../model/common/src/drivers/pframe/spec/spec.ts","../../../../../../../model/common/src/drivers/pframe/table_calculate.ts","../../../../../../../model/common/src/drivers/pframe/spec/ids.ts","../../../../../../../model/common/src/drivers/pframe/spec/anchored.ts","../../../../../../../model/common/src/pool/spec.ts","../../../../../../../model/common/src/drivers/pframe/spec/selectors.ts","../../../../../../../model/common/src/drivers/pframe/spec/native_id.ts","../../../../../../../model/common/src/ref.ts","../../../../../../../model/common/src/value_or_error.ts","../../../../../../../model/common/src/plid.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport { z } from 'zod';\n\n/** Handle of locally downloaded blob. This handle is issued only after the\n * blob's content is downloaded locally, and ready for quick access. */\nexport type LocalBlobHandle = Branded<string, 'LocalBlobHandle'>;\n\n/** Handle of remote blob. This handle is issued as soon as the data becomes\n * available on the remote server. */\nexport type RemoteBlobHandle = Branded<string, 'RemoteBlobHandle'>;\n\n/** Being configured inside the output structure provides information about\n * blob's content and means to retrieve it when needed. */\nexport interface BlobHandleAndSize<\n H extends LocalBlobHandle | RemoteBlobHandle = | LocalBlobHandle\n | RemoteBlobHandle,\n> {\n /** Handle to retrieve block content using {@link BlobDriver.getContent()} */\n readonly handle: H;\n\n /** Blob size in bytes. */\n readonly size: number;\n}\n\n/** Range in bytes, from should be less or equal than to. */\nexport const RangeBytes = z.object({\n /** Included left border. */\n from: z.number(),\n /** Excluded right border. */\n to: z.number(),\n});\n\nexport type RangeBytes = z.infer<typeof RangeBytes>;\n\nexport function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined {\n if (from == undefined || to == undefined) {\n return undefined;\n }\n\n return { from, to };\n}\n\nexport function validateRangeBytes(range: RangeBytes, errMsg: string) {\n if (range.from < 0 || range.to < 0 || range.from >= range.to) {\n throw new Error(`${errMsg}: invalid bytes range: ${range}`);\n }\n}\n\n/** Being configured inside the output structure provides information about\n * locally downloaded blob and means to retrieve it's content when needed. This\n * structure is created only after the blob's content is downloaded locally, and\n * ready for quick access. */\nexport type LocalBlobHandleAndSize = BlobHandleAndSize<LocalBlobHandle>;\n\n/** Being configured inside the output structure provides information about\n * remote blob and means to retrieve it's content when needed. This structure\n * is created as soon as remote blob becomes available. */\nexport type RemoteBlobHandleAndSize = BlobHandleAndSize<RemoteBlobHandle>;\n\n/** Defines API of blob driver as it is seen from the block UI code. */\nexport interface BlobDriver {\n /** Given the blob handle returns its content. Depending on the handle type,\n * content will be served from locally downloaded file, or directly from\n * remote platforma storage. */\n getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;\n}\n","export function assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x); // This is ok, because this is a possible runtime error\n}\n","import { assertNever } from '../util';\nimport type { Branded } from '../branding';\nimport type { TableRange } from './pframe';\nimport type { FileLike } from './interfaces';\n\nconst uploadPrefix = 'upload://upload/';\nconst indexPrefix = 'index://index/';\n\nexport type ImportFileHandleUpload = `upload://upload/${string}`;\nexport type ImportFileHandleIndex = `index://index/${string}`;\n\nexport type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;\n\nexport type LocalImportFileHandle = Branded<ImportFileHandle, 'Local'>;\n\nexport function isImportFileHandleUpload(\n handle: ImportFileHandle,\n): handle is ImportFileHandleUpload {\n return handle.startsWith(uploadPrefix);\n}\n\nexport function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex {\n return handle.startsWith(indexPrefix);\n}\n\n/** Results in upload */\nexport type StorageHandleLocal = `local://${string}`;\n\n/** Results in index */\nexport type StorageHandleRemote = `remote://${string}`;\n\nexport type StorageHandle = StorageHandleLocal | StorageHandleRemote;\n\nexport type StorageEntry = {\n name: string;\n handle: StorageHandle;\n initialFullPath: string;\n\n // TODO\n // pathStartsWithDisk\n};\n\nexport type ListFilesResult = {\n parent?: string;\n entries: LsEntry[];\n};\n\nexport type LsEntry =\n | {\n type: 'dir';\n name: string;\n fullPath: string;\n }\n | {\n type: 'file';\n name: string;\n fullPath: string;\n\n /** This handle should be set to args... */\n handle: ImportFileHandle;\n };\n\nexport type OpenDialogFilter = {\n /** Human-readable file type name */\n readonly name: string;\n /** File extensions */\n readonly extensions: string[];\n};\n\nexport type OpenDialogOps = {\n /** Open dialog window title */\n readonly title?: string;\n /** Custom label for the confirmation button, when left empty the default label will be used. */\n readonly buttonLabel?: string;\n /** Limits of file types user can select */\n readonly filters?: OpenDialogFilter[];\n};\n\nexport type OpenSingleFileResponse = {\n /** Contains local file handle, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly file?: LocalImportFileHandle;\n};\n\nexport type OpenMultipleFilesResponse = {\n /** Contains local file handles, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly files?: LocalImportFileHandle[];\n};\n\n/** Can be used to limit request for local file content to a certain bytes range */\nexport type FileRange = {\n /** From byte index (inclusive) */\n readonly from: number;\n /** To byte index (exclusive) */\n readonly to: number;\n};\n\nexport interface LsDriver {\n /** remote and local storages */\n getStorageList(): Promise<StorageEntry[]>;\n\n listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;\n\n /** Opens system file open dialog allowing to select single file and awaits user action */\n showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;\n\n /** Opens system file open dialog allowing to multiple files and awaits user action */\n showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;\n\n /** Given a handle to a local file, allows to get file size */\n getLocalFileSize(file: LocalImportFileHandle): Promise<number>;\n\n /** Given a handle to a local file, allows to get its content */\n getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;\n\n /**\n * Resolves browser's File object into platforma's import file handle.\n *\n * This method is useful among other things for implementation of UI\n * components, that handle file Drag&Drop.\n * */\n fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;\n}\n\n/** Gets a file path from an import handle. */\nexport function getFilePathFromHandle(handle: ImportFileHandle): string {\n if (isImportFileHandleIndex(handle)) {\n const trimmed = handle.slice(indexPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { path: string };\n return data.path;\n } else if (isImportFileHandleUpload(handle)) {\n const trimmed = handle.slice(uploadPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { localPath: string };\n return data.localPath;\n }\n\n assertNever(handle);\n}\n\nfunction extractFileName(filePath: string) {\n return filePath.replace(/^.*[\\\\/]/, '');\n}\n\n/** Gets a file name from an import handle. */\nexport function getFileNameFromHandle(handle: ImportFileHandle): string {\n return extractFileName(getFilePathFromHandle(handle));\n}\n","/**\n * Represents a JavaScript representation of a value in a PColumn. Can be null, a number, or a string.\n * These are the primitive types that can be stored directly in PColumns.\n *\n * Note: Actual columns can hold more value types, which are converted to these JavaScript types\n * once they enter the JavaScript runtime.\n */\nexport type PColumnValue = null | number | string;\n\n/**\n * Represents a key for a PColumn value.\n * Can be an array of strings or numbers.\n */\nexport type PColumnKey = (number | string)[];\n\n/**\n * Represents a single entry in a PColumn's data structure.\n * Contains a key and a value.\n */\nexport type PColumnDataEntry<T> = {\n /** Key for the value */\n key: PColumnKey;\n\n /** Value / blob at the given key */\n value: T;\n};\n\n/**\n * Represents column data stored as a simple JSON structure.\n * Used for small datasets that can be efficiently stored directly in memory.\n */\nexport type JsonDataInfo = {\n /** Identifier for this data format ('Json') */\n type: 'Json';\n\n /** Number of axes that make up the complete key (tuple length) */\n keyLength: number;\n\n /**\n * Key-value pairs where keys are stringified tuples of axis values\n * and values are the column values for those coordinates\n */\n data: Record<string, PColumnValue>;\n};\n\n/**\n * Represents column data partitioned across multiple JSON blobs.\n * Used for larger datasets that need to be split into manageable chunks.\n */\nexport type JsonPartitionedDataInfo<Blob> = {\n /** Identifier for this data format ('JsonPartitioned') */\n type: 'JsonPartitioned';\n\n /** Number of leading axes used for partitioning */\n partitionKeyLength: number;\n\n /** Map of stringified partition keys to blob references */\n parts: Record<string, Blob>;\n};\n\n/**\n * Represents a binary format chunk containing index and values as separate blobs.\n * Used for efficient storage and retrieval of column data in binary format.\n */\nexport type BinaryChunk<Blob> = {\n /** Binary blob containing structured index information */\n index: Blob;\n\n /** Binary blob containing the actual values */\n values: Blob;\n};\n\n/**\n * Represents column data partitioned across multiple binary chunks.\n * Optimized for efficient storage and retrieval of large datasets.\n */\nexport type BinaryPartitionedDataInfo<Blob> = {\n /** Identifier for this data format ('BinaryPartitioned') */\n type: 'BinaryPartitioned';\n\n /** Number of leading axes used for partitioning */\n partitionKeyLength: number;\n\n /** Map of stringified partition keys to binary chunks */\n parts: Record<string, BinaryChunk<Blob>>;\n};\n\n/**\n * Union type representing all possible data storage formats for PColumn data.\n * The specific format used depends on data size, access patterns, and performance requirements.\n *\n * @template Blob - Type parameter representing the storage reference type (could be ResourceInfo, PFrameBlobId, etc.)\n */\nexport type DataInfo<Blob> =\n | JsonDataInfo\n | JsonPartitionedDataInfo<Blob>\n | BinaryPartitionedDataInfo<Blob>;\n\n/**\n * Type guard function that checks if the given value is a valid DataInfo.\n *\n * @param value - The value to check\n * @returns True if the value is a valid DataInfo, false otherwise\n */\nexport function isDataInfo<Blob>(value: unknown): value is DataInfo<Blob> {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n const data = value as Record<string, unknown>;\n if (!('type' in data)) {\n return false;\n }\n\n switch (data.type) {\n case 'Json':\n return (\n typeof data.keyLength === 'number'\n && data.data !== undefined\n && typeof data.data === 'object'\n );\n case 'JsonPartitioned':\n return (\n typeof data.partitionKeyLength === 'number'\n && data.parts !== undefined\n && typeof data.parts === 'object'\n );\n case 'BinaryPartitioned':\n return (\n typeof data.partitionKeyLength === 'number'\n && data.parts !== undefined\n && typeof data.parts === 'object'\n );\n default:\n return false;\n }\n}\n\n/**\n * Maps blob references in a DataInfo object from one type to another using a mapping function.\n *\n * @template B1 - Source blob type\n * @template B2 - Target blob type\n * @param dataInfo - The source DataInfo object\n * @param mapFn - Function to transform blobs from type B1 to type B2\n * @returns A new DataInfo object with transformed blob references\n */\nexport function mapDataInfo<B1, B2>(\n dataInfo: DataInfo<B1>,\n mapFn: (blob: B1) => B2,\n): DataInfo<B2>;\nexport function mapDataInfo<B1, B2>(\n dataInfo: DataInfo<B1> | undefined,\n mapFn: (blob: B1) => B2,\n): DataInfo<B2> | undefined {\n if (dataInfo === undefined) {\n return undefined;\n }\n\n switch (dataInfo.type) {\n case 'Json':\n // Json type doesn't contain blobs, so return as is\n return dataInfo;\n case 'JsonPartitioned': {\n // Map each blob in parts\n const newParts: Record<string, B2> = {};\n for (const [key, blob] of Object.entries(dataInfo.parts)) {\n newParts[key] = mapFn(blob);\n }\n return {\n ...dataInfo,\n parts: newParts,\n };\n }\n case 'BinaryPartitioned': {\n // Map each index and values blob in parts\n const newParts: Record<string, BinaryChunk<B2>> = {};\n for (const [key, chunk] of Object.entries(dataInfo.parts)) {\n newParts[key] = {\n index: mapFn(chunk.index),\n values: mapFn(chunk.values),\n };\n }\n return {\n ...dataInfo,\n parts: newParts,\n };\n }\n }\n}\n\n/**\n * @param dataInfo - The source DataInfo object\n * @param cb - Callback, function that have access to every blob to visit them all\n * @returns Nothing\n */\nexport function visitDataInfo<B>(\n dataInfo: DataInfo<B>,\n cb: (blob: B) => void,\n): void {\n switch (dataInfo.type) {\n case 'Json':\n // Json type doesn't contain blobs, so return as is\n break;\n case 'JsonPartitioned': {\n // Visit each blob in parts\n for (const [_, blob] of Object.entries(dataInfo.parts)) {\n cb(blob);\n }\n break;\n }\n case 'BinaryPartitioned': {\n // Visit each index and values blob in parts\n for (const [_, chunk] of Object.entries(dataInfo.parts)) {\n cb(chunk.index);\n cb(chunk.values);\n }\n break;\n }\n }\n}\n\n//\n// Lightway representation for ExplicitJsonData\n//\n\n/**\n * Represents a single key-value entry in a column's explicit data structure.\n * Used when directly instantiating PColumns with explicit data.\n */\nexport type PColumnValuesEntry = {\n key: PColumnKey;\n val: PColumnValue;\n};\n\n/**\n * Array of key-value entries representing explicit column data.\n * Used for lightweight explicit instantiation of PColumns.\n */\nexport type PColumnValues = PColumnValuesEntry[];\n\n/**\n * Entry-based representation of JsonDataInfo\n */\nexport interface JsonDataInfoEntries {\n type: 'Json';\n keyLength: number;\n data: PColumnDataEntry<PColumnValue>[];\n}\n\n/**\n * Entry-based representation of JsonPartitionedDataInfo\n */\nexport interface JsonPartitionedDataInfoEntries<Blob> {\n type: 'JsonPartitioned';\n partitionKeyLength: number;\n parts: PColumnDataEntry<Blob>[];\n}\n\n/**\n * Entry-based representation of BinaryPartitionedDataInfo\n */\nexport interface BinaryPartitionedDataInfoEntries<Blob> {\n type: 'BinaryPartitioned';\n partitionKeyLength: number;\n parts: PColumnDataEntry<BinaryChunk<Blob>>[];\n}\n\n/**\n * Union type representing all possible entry-based partitioned data storage formats\n */\nexport type PartitionedDataInfoEntries<Blob> =\n | JsonPartitionedDataInfoEntries<Blob>\n | BinaryPartitionedDataInfoEntries<Blob>;\n\n/**\n * Union type representing all possible entry-based data storage formats\n */\nexport type DataInfoEntries<Blob> =\n | JsonDataInfoEntries\n | PartitionedDataInfoEntries<Blob>;\n\n/**\n * Type guard function that checks if the given value is a valid DataInfoEntries.\n *\n * @param value - The value to check\n * @returns True if the value is a valid DataInfoEntries, false otherwise\n */\nexport function isDataInfoEntries<Blob>(value: unknown): value is DataInfoEntries<Blob> {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n const data = value as Record<string, unknown>;\n if (!('type' in data)) {\n return false;\n }\n\n switch (data.type) {\n case 'Json':\n return (\n typeof data.keyLength === 'number'\n && Array.isArray(data.data)\n );\n case 'JsonPartitioned':\n return (\n typeof data.partitionKeyLength === 'number'\n && Array.isArray(data.parts)\n );\n case 'BinaryPartitioned':\n return (\n typeof data.partitionKeyLength === 'number'\n && Array.isArray(data.parts)\n );\n default:\n return false;\n }\n}\n\n/**\n * Type guard function that checks if the given value is a valid PartitionedDataInfoEntries.\n *\n * @template Blob - Type parameter representing the storage reference type\n * @param value - The value to check\n * @returns True if the value is a valid PartitionedDataInfoEntries, false otherwise\n */\nexport function isPartitionedDataInfoEntries<Blob>(value: unknown): value is PartitionedDataInfoEntries<Blob> {\n if (!isDataInfoEntries(value)) return false;\n return value.type === 'JsonPartitioned' || value.type === 'BinaryPartitioned';\n}\n\n/**\n * Converts DataInfo to DataInfoEntries\n *\n * @param dataInfo - The record-based DataInfo object\n * @returns The equivalent entry-based DataInfoEntries object\n */\nexport function dataInfoToEntries<Blob>(dataInfo: DataInfo<Blob>): DataInfoEntries<Blob> {\n switch (dataInfo.type) {\n case 'Json': {\n const entries: PColumnDataEntry<PColumnValue>[] = Object.entries(dataInfo.data).map(([keyStr, value]) => {\n const key = JSON.parse(keyStr) as PColumnKey;\n return { key, value };\n });\n\n return {\n type: 'Json',\n keyLength: dataInfo.keyLength,\n data: entries,\n };\n }\n case 'JsonPartitioned': {\n const parts: PColumnDataEntry<Blob>[] = Object.entries(dataInfo.parts).map(([keyStr, blob]) => {\n const key = JSON.parse(keyStr) as PColumnKey;\n return { key, value: blob };\n });\n\n return {\n type: 'JsonPartitioned',\n partitionKeyLength: dataInfo.partitionKeyLength,\n parts,\n };\n }\n case 'BinaryPartitioned': {\n const parts: PColumnDataEntry<BinaryChunk<Blob>>[] = Object.entries(dataInfo.parts).map(([keyStr, chunk]) => {\n const key = JSON.parse(keyStr) as PColumnKey;\n return { key, value: chunk };\n });\n\n return {\n type: 'BinaryPartitioned',\n partitionKeyLength: dataInfo.partitionKeyLength,\n parts,\n };\n }\n }\n}\n\n/**\n * Converts DataInfoEntries to DataInfo\n *\n * @param dataInfoEntries - The entry-based DataInfoEntries object\n * @returns The equivalent record-based DataInfo object\n */\nexport function entriesToDataInfo<Blob>(dataInfoEntries: DataInfoEntries<Blob>): DataInfo<Blob> {\n switch (dataInfoEntries.type) {\n case 'Json': {\n const data: Record<string, PColumnValue> = {};\n for (const entry of dataInfoEntries.data) {\n data[JSON.stringify(entry.key)] = entry.value;\n }\n\n return {\n type: 'Json',\n keyLength: dataInfoEntries.keyLength,\n data,\n };\n }\n case 'JsonPartitioned': {\n const parts: Record<string, Blob> = {};\n for (const entry of dataInfoEntries.parts) {\n parts[JSON.stringify(entry.key)] = entry.value;\n }\n\n return {\n type: 'JsonPartitioned',\n partitionKeyLength: dataInfoEntries.partitionKeyLength,\n parts,\n };\n }\n case 'BinaryPartitioned': {\n const parts: Record<string, BinaryChunk<Blob>> = {};\n for (const entry of dataInfoEntries.parts) {\n parts[JSON.stringify(entry.key)] = entry.value;\n }\n\n return {\n type: 'BinaryPartitioned',\n partitionKeyLength: dataInfoEntries.partitionKeyLength,\n parts,\n };\n }\n }\n}\n\n/**\n * Maps blob references in a DataInfoEntries object from one type to another using a mapping function.\n *\n * @template B1 - Source blob type\n * @template B2 - Target blob type\n * @param dataInfoEntries - The source DataInfoEntries object\n * @param mapFn - Function to transform blobs from type B1 to type B2\n * @returns A new DataInfoEntries object with transformed blob references\n */\nexport function mapDataInfoEntries<B1, B2>(\n dataInfoEntries: DataInfoEntries<B1>,\n mapFn: (blob: B1) => B2,\n): DataInfoEntries<B2>;\nexport function mapDataInfoEntries<B1, B2>(\n dataInfoEntries: DataInfoEntries<B1> | undefined,\n mapFn: (blob: B1) => B2,\n): DataInfoEntries<B2> | undefined {\n if (dataInfoEntries === undefined) {\n return undefined;\n }\n\n switch (dataInfoEntries.type) {\n case 'Json':\n // Json type doesn't contain blobs, so return as is\n return dataInfoEntries;\n case 'JsonPartitioned': {\n // Map each blob in parts\n const newParts = dataInfoEntries.parts.map((entry) => ({\n key: entry.key,\n value: mapFn(entry.value),\n }));\n\n return {\n ...dataInfoEntries,\n parts: newParts,\n };\n }\n case 'BinaryPartitioned': {\n // Map each index and values blob in parts\n const newParts = dataInfoEntries.parts.map((entry) => ({\n key: entry.key,\n value: {\n index: mapFn(entry.value.index),\n values: mapFn(entry.value.values),\n },\n }));\n\n return {\n ...dataInfoEntries,\n parts: newParts,\n };\n }\n }\n}\n","import type { PObject, PObjectId, PObjectSpec } from '../../../pool';\nimport canonicalize from 'canonicalize';\n\n/** PFrame columns and axes within them may store one of these types. */\nexport type ValueType = 'Int' | 'Long' | 'Float' | 'Double' | 'String' | 'Bytes';\n\n/**\n * Specification of an individual axis.\n *\n * Each axis is a part of a composite key that addresses data inside the PColumn.\n *\n * Each record inside a PColumn is addressed by a unique tuple of values set for\n * all the axes specified in the column spec.\n * */\nexport interface AxisSpec {\n /** Type of the axis value. Should not use non-key types like float or double. */\n readonly type: ValueType;\n\n /** Name of the axis */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Any additional information attached to the axis that does not affect its\n * identifier */\n readonly annotations?: Record<string, string>;\n\n /**\n * Parent axes provide contextual grouping for the axis in question, establishing\n * a hierarchy where the current axis is dependent on one or more axes for its\n * full definition and meaning. For instance, in a data structure where each\n * \"container\" axis may contain multiple \"item\" axes, the `item` axis would\n * list the index of the `container` axis in this field to denote its dependency.\n *\n * This means that the identity or significance of the `item` axis is only\n * interpretable when combined with its parent `container` axis. An `item` axis\n * index by itself may be non-unique and only gains uniqueness within the context\n * of its parent `container`. Therefore, the `parentAxes` field is essential for\n * mapping these relationships and ensuring data coherence across nested or\n * multi-level data models.\n *\n * A list of zero-based indices of parent axes in the overall axes specification\n * from the column spec. Each index corresponds to the position of a parent axis\n * in the list that defines the structure of the data model.\n */\n readonly parentAxes?: number[];\n}\n\n/** Common type representing spec for all the axes in a column */\nexport type AxesSpec = AxisSpec[];\n\n/**\n * Full column specification including all axes specs and specs of the column\n * itself.\n *\n * A PColumn in its essence represents a mapping from a fixed size, explicitly\n * typed tuple to an explicitly typed value.\n *\n * (axis1Value1, axis2Value1, ...) -> columnValue\n *\n * Each element in tuple correspond to the axis having the same index in axesSpec.\n * */\nexport interface PUniversalColumnSpec extends PObjectSpec {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: 'PColumn';\n\n /** Type of column values */\n readonly valueType: string;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Any additional information attached to the column that does not affect its\n * identifier */\n readonly annotations?: Record<string, string>;\n\n /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */\n readonly parentAxes?: number[];\n\n /** Axes specifications */\n readonly axesSpec: AxesSpec;\n}\n\n/**\n * Specification of a data column.\n *\n * Data column is a specialized type of PColumn that stores only simple values (strings and numbers)\n * addressed by multiple keys. This is in contrast to other PColumn variants that can store more complex\n * values like files or other abstract data types. Data columns are optimized for storing and processing\n * basic tabular data.\n */\nexport interface PDataColumnSpec extends PUniversalColumnSpec {\n /** Type of column values */\n readonly valueType: ValueType;\n}\n\n// @todo: change this to PUniversalColumnSpec\nexport type PColumnSpec = PDataColumnSpec;\n\n/** Unique PColumnSpec identifier */\nexport type PColumnSpecId = {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: 'PColumn';\n\n /** Type of column values */\n readonly valueType: ValueType;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */\n readonly parentAxes?: number[];\n\n /** Axes id */\n readonly axesId: AxesId;\n};\n\nexport function getPColumnSpecId(spec: PColumnSpec): PColumnSpecId {\n return {\n kind: spec.kind,\n valueType: spec.valueType,\n name: spec.name,\n domain: spec.domain,\n parentAxes: spec.parentAxes,\n axesId: getAxesId(spec.axesSpec),\n };\n}\n\nexport interface PColumn<Data> extends PObject<Data> {\n /** PColumn spec, allowing it to be found among other PObjects */\n readonly spec: PColumnSpec;\n}\n\n/** Columns in a PFrame also have internal identifier, this object represents\n * combination of specs and such id */\nexport interface PColumnIdAndSpec {\n /** Internal column id within the PFrame */\n readonly columnId: PObjectId;\n\n /** Column spec */\n readonly spec: PColumnSpec;\n}\n\n/** Get column id and spec from a column */\nexport function getColumnIdAndSpec<Data>(column: PColumn<Data>): PColumnIdAndSpec {\n return {\n columnId: column.id,\n spec: column.spec,\n };\n}\n\n/** Information returned by {@link PFrame.listColumns} method */\nexport interface PColumnInfo extends PColumnIdAndSpec {\n /** True if data was associated with this PColumn */\n readonly hasData: boolean;\n}\n\nexport interface AxisId {\n /** Type of the axis or column value. For an axis should not use non-key\n * types like float or double. */\n readonly type: ValueType;\n\n /** Name of the axis or column */\n readonly name: string;\n\n /** Adds auxiliary information to the axis or column name and type to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n}\n\n/** Array of axis ids */\nexport type AxesId = AxisId[];\n\n/** Extracts axis ids from axis spec */\nexport function getAxisId(spec: AxisSpec): AxisId {\n const { type, name, domain } = spec;\n const result = { type, name };\n if (domain && Object.entries(domain).length > 0) {\n Object.assign(result, { domain });\n }\n return result;\n}\n\n/** Extracts axes ids from axes spec array from column spec */\nexport function getAxesId(spec: AxesSpec): AxesId {\n return spec.map(getAxisId);\n}\n\n/**\n * Canonicalizes axis id\n * @deprecated Use {@link canonicalizeJson} instead to preserve type\n */\nexport function canonicalizeAxisId(id: AxisId): string {\n return canonicalize(getAxisId(id))!;\n}\n\n/** Returns true if all domains from query are found in target */\nfunction matchDomain(query?: Record<string, string>, target?: Record<string, string>) {\n if (query === undefined) return target === undefined;\n if (target === undefined) return true;\n for (const k in target) {\n if (query[k] !== target[k]) return false;\n }\n return true;\n}\n\n/** Returns whether \"match\" axis id is compatible with the \"query\" */\nexport function matchAxisId(query: AxisId, target: AxisId): boolean {\n return query.name === target.name && matchDomain(query.domain, target.domain);\n}\n","import type { PTableColumnId, PTableColumnSpec } from './table_common';\nimport type { PTableVector } from './data_types';\nimport type { PObjectId } from '../../pool';\nimport { assertNever } from '../../util';\nimport type { PColumn } from './spec/spec';\nimport type { PColumnValues } from './data_info';\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'column';\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Axis filter slicing target axis from column axes.\n * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).\n * */\nexport interface ConstantAxisFilter {\n /** Filter type discriminator */\n readonly type: 'constant';\n\n /** Index of axis to slice (zero-based) */\n readonly axisIndex: number;\n\n /** Equality filter reference value, see {@link SingleValueEqualPredicate} */\n readonly constant: string | number;\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface SlicedColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'slicedColumn';\n\n /** Local column */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Non-empty list of axis filters */\n readonly axisFilters: ConstantAxisFilter[];\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface InlineColumnJoinEntry {\n /** Node type discriminator */\n readonly type: 'inlineColumn';\n\n /** Column definition */\n readonly column: PColumn<PColumnValues>;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: 'inner';\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: 'full';\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: 'outer';\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | SlicedColumnJoinEntry<Col>\n | InlineColumnJoinEntry\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: 'IsNA';\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: 'Equal';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueInSetPredicate {\n /** Comparison operator */\n readonly operator: 'InSet';\n\n /** Reference values, NA values will not match */\n readonly references: (string | number)[];\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'IEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: 'Less';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'LessOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: 'Greater';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'GreaterOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: 'StringContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: 'Matches';\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: 'StringContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueInSetPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: 'bySingleColumnV2';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Partition filters */\n readonly partitionFilters: PTableRecordFilter[];\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n};\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(\n def: PTableDef<C1>,\n cb: (c: C1) => C2,\n): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(\n entry: JoinEntry<C1>,\n cb: (c: C1) => C2,\n): JoinEntry<C2> {\n switch (entry.type) {\n case 'column':\n return {\n type: 'column',\n column: cb(entry.column),\n };\n case 'slicedColumn':\n return {\n type: 'slicedColumn',\n column: cb(entry.column),\n newId: entry.newId,\n axisFilters: entry.axisFilters,\n };\n case 'inlineColumn':\n return entry;\n case 'inner':\n case 'full':\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb)),\n };\n case 'outer':\n return {\n type: 'outer',\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb)),\n };\n default:\n assertNever(entry);\n }\n}\n","import type { Branded } from '../../../branding';\nimport type { AnchoredPColumnId } from './selectors';\nimport type { FilteredPColumnId } from './filtered_column';\nimport canonicalize from 'canonicalize';\nimport type { PObjectId } from '../../../pool';\n/**\n * Universal column identifier optionally anchored and optionally filtered.\n */\nexport type UniversalPColumnId = AnchoredPColumnId | FilteredPColumnId;\n\n/**\n * Canonically serialized {@link UniversalPColumnId}.\n */\nexport type SUniversalPColumnId = Branded<PObjectId, 'SUniversalPColumnId', '__pl_model_brand_2__'>;\n\n/**\n * Canonically serializes a {@link UniversalPColumnId} to a string.\n * @param id - The column identifier to serialize\n * @returns The canonically serialized string\n */\nexport function stringifyColumnId(id: UniversalPColumnId): SUniversalPColumnId {\n return canonicalize(id)! as SUniversalPColumnId;\n}\n\n/**\n * Parses a canonically serialized {@link UniversalPColumnId} from a string.\n * @param str - The string to parse\n * @returns The parsed column identifier\n */\nexport function parseColumnId(str: SUniversalPColumnId): UniversalPColumnId {\n return JSON.parse(str) as UniversalPColumnId;\n}\n","import canonicalize from 'canonicalize';\nimport type { PValue } from '../data_types';\nimport type { AxisFilter } from './filtered_column';\nimport type { SUniversalPColumnId, UniversalPColumnId } from './ids';\nimport { stringifyColumnId } from './ids';\nimport type { AAxisSelector, AnchorAxisRef, AnchorAxisRefByIdx, AnchoredPColumnId, AnchoredPColumnSelector, AxisSelector, PColumnSelector } from './selectors';\nimport type { AxisId, PColumnSpec } from './spec';\nimport { getAxisId, matchAxisId } from './spec';\n\n//\n// Helper functions\n//\n\nfunction axisKey(axis: AxisId): string {\n return canonicalize(getAxisId(axis))!;\n}\n\nfunction domainKey(key: string, value: string): string {\n return JSON.stringify([key, value]);\n}\n\n/**\n * Context for resolving and generating anchored references to columns and axes\n * Maintains maps of known domain values and axes that can be referenced by anchors\n */\nexport class AnchoredIdDeriver {\n private readonly domains = new Map<string, string>();\n private readonly axes = new Map<string, AnchorAxisRefByIdx>();\n /**\n * Domain packs are used to group domain keys that can be anchored to the same anchor\n * This is used to optimize the lookup of domain anchors\n */\n private readonly domainPacks: string[][] = [];\n /**\n * Maps domain packs to anchors\n */\n private readonly domainPackToAnchor = new Map<string, string>();\n\n /**\n * Creates a new anchor context from a set of anchor column specifications\n * @param anchors Record of anchor column specifications indexed by anchor ID\n */\n constructor(public readonly anchors: Record<string, PColumnSpec>) {\n const anchorEntries = Object.entries(anchors);\n anchorEntries.sort((a, b) => a[0].localeCompare(b[0]));\n for (const [anchorId, spec] of anchorEntries) {\n for (let axisIdx = 0; axisIdx < spec.axesSpec.length; axisIdx++) {\n const axis = spec.axesSpec[axisIdx];\n const key = axisKey(axis);\n this.axes.set(key, { anchor: anchorId, idx: axisIdx });\n }\n if (spec.domain !== undefined) {\n const domainEntries = Object.entries(spec.domain);\n domainEntries.sort((a, b) => a[0].localeCompare(b[0]));\n\n this.domainPackToAnchor.set(JSON.stringify(domainEntries), anchorId);\n this.domainPacks.push(domainEntries.map(([dKey]) => dKey));\n\n for (const [dKey, dValue] of domainEntries) {\n const key = domainKey(dKey, dValue);\n this.domains.set(key, anchorId);\n }\n }\n }\n }\n\n /**\n * Derives an anchored column identifier from a column specification\n * @param spec Column specification to anchor\n * @returns An anchored column identifier that can be used to identify columns similar to the input specification\n */\n derive(spec: PColumnSpec): AnchoredPColumnId;\n\n /**\n * Derives an anchored column identifier from a column specification\n * @param spec Column specification to anchor\n * @param axisFilters Axis filters to apply to the column\n * @returns An anchored and sliced column identifier that can be used to identify columns similar to the input specification\n */\n derive(spec: PColumnSpec, axisFilters?: AxisFilter[]): UniversalPColumnId;\n\n /**\n * Implementation of derive method\n */\n derive(spec: PColumnSpec, axisFilters?: AxisFilter[]): UniversalPColumnId {\n const result: AnchoredPColumnId = {\n name: spec.name,\n axes: [],\n };\n\n let skipDomains: Set<string> | undefined = undefined;\n if (spec.domain !== undefined) {\n outer:\n for (const domainPack of this.domainPacks) {\n const dAnchor: string[][] = [];\n for (const domainKey of domainPack) {\n const dValue = spec.domain[domainKey];\n if (dValue !== undefined)\n dAnchor.push([domainKey, dValue]);\n else\n break outer;\n }\n const domainAnchor = this.domainPackToAnchor.get(JSON.stringify(dAnchor));\n if (domainAnchor !== undefined) {\n result.domainAnchor = domainAnchor;\n skipDomains = new Set(domainPack);\n break;\n }\n }\n }\n\n for (const [dKey, dValue] of Object.entries(spec.domain ?? {})) {\n if (skipDomains !== undefined && skipDomains.has(dKey))\n continue;\n const key = domainKey(dKey, dValue);\n const anchorId = this.domains.get(key);\n result.domain ??= {};\n result.domain[dKey] = anchorId ? { anchor: anchorId } : dValue;\n }\n\n result.axes = spec.axesSpec.map((axis) => {\n const key = axisKey(axis);\n const anchorAxisRef = this.axes.get(key);\n if (anchorAxisRef === undefined) return getAxisId(axis);\n else return anchorAxisRef;\n });\n\n // If no axis filters are provided, return the anchored ID as is\n if (!axisFilters || axisFilters.length === 0) {\n return result;\n }\n\n // Process axis filters and create a sliced column ID\n const resolvedFilters: [number, PValue][] = [];\n\n for (const filter of axisFilters) {\n const [axisIdOrIndex, value] = filter;\n\n // If it's already a numeric index, validate it\n if (typeof axisIdOrIndex === 'number') {\n if (axisIdOrIndex < 0 || axisIdOrIndex >= spec.axesSpec.length) {\n throw new Error(`Axis index ${axisIdOrIndex} is out of bounds (0-${spec.axesSpec.length - 1})`);\n }\n resolvedFilters.push([axisIdOrIndex, value]);\n } else {\n // If it's a string (axis name), resolve it to an index\n const axisIndex = spec.axesSpec.findIndex((axis) => axis.name === axisIdOrIndex);\n if (axisIndex === -1) {\n throw new Error(`Axis with name \"${axisIdOrIndex}\" not found in the column specification`);\n }\n resolvedFilters.push([axisIndex, value]);\n }\n }\n\n // Sort filters by axis index to ensure consistency\n resolvedFilters.sort((a, b) => a[0] - b[0]);\n\n return {\n source: result,\n axisFilters: resolvedFilters,\n };\n }\n\n /**\n * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column\n * @param spec Column specification to anchor\n * @param axisFilters Optional axis filters to apply to the column\n * @returns A canonicalized string representation of the anchored column identifier\n */\n deriveS(spec: PColumnSpec, axisFilters?: AxisFilter[]): SUniversalPColumnId {\n return stringifyColumnId(this.derive(spec, axisFilters));\n }\n}\n\n/**\n * Options for the resolveAnchors function\n */\nexport type ResolveAnchorsOptions = {\n /**\n * If true, missing domain keys in anchors will be ignored.\n * If false (default), an error will be thrown.\n */\n ignoreMissingDomains?: boolean;\n};\n\n/**\n * Resolves anchored references in a column matcher to create a non-anchored matcher.\n * Doing an opposite operation to {@link AnchorIdDeriver.derive()}.\n *\n * @param anchors - Record of anchor column specifications indexed by anchor id\n * @param matcher - An anchored column matcher (or id, which is subtype of it) containing references that need to be resolved\n * @param options - Options for resolving anchors\n * @returns A non-anchored column matcher with all references resolved to actual values\n */\nexport function resolveAnchors(anchors: Record<string, PColumnSpec>, matcher: AnchoredPColumnSelector, options?: ResolveAnchorsOptions): PColumnSelector {\n const result = { ...matcher };\n const ignoreMissingDomains = options?.ignoreMissingDomains ?? false;\n\n if (result.domainAnchor !== undefined) {\n const anchorSpec = anchors[result.domainAnchor];\n if (!anchorSpec)\n throw new Error(`Anchor \"${result.domainAnchor}\" not found`);\n\n const anchorDomains = anchorSpec.domain || {};\n result.domain = { ...anchorDomains, ...result.domain };\n delete result.domainAnchor;\n }\n\n if (result.domain) {\n const resolvedDomain: Record<string, string> = {};\n for (const [key, value] of Object.entries(result.domain)) {\n if (typeof value === 'string') {\n resolvedDomain[key] = value;\n } else {\n // It's an AnchorDomainRef\n const anchorSpec = anchors[value.anchor];\n if (!anchorSpec)\n throw new Error(`Anchor \"${value.anchor}\" not found for domain key \"${key}\"`);\n\n if (!anchorSpec.domain || anchorSpec.domain[key] === undefined) {\n if (!ignoreMissingDomains)\n throw new Error(`Domain key \"${key}\" not found in anchor \"${value.anchor}\"`);\n continue;\n }\n\n resolvedDomain[key] = anchorSpec.domain[key];\n }\n }\n result.domain = resolvedDomain;\n }\n\n if (result.axes)\n result.axes = result.axes.map((axis) => resolveAxisReference(anchors, axis));\n\n return result as PColumnSelector;\n}\n\n/**\n * Resolves an anchored axis reference to a concrete AxisId\n */\nfunction resolveAxisReference(anchors: Record<string, PColumnSpec>, axisRef: AAxisSelector): AxisSelector {\n if (!isAnchorAxisRef(axisRef))\n return axisRef;\n\n // It's an anchored reference\n const anchorId = axisRef.anchor;\n const anchorSpec = anchors[anchorId];\n if (!anchorSpec)\n throw new Error(`Anchor \"${anchorId}\" not found for axis reference`);\n\n if ('idx' in axisRef) {\n // AnchorAxisRefByIdx\n if (axisRef.idx < 0 || axisRef.idx >= anchorSpec.axesSpec.length)\n throw new Error(`Axis index ${axisRef.idx} out of bounds for anchor \"${anchorId}\"`);\n return anchorSpec.axesSpec[axisRef.idx];\n } else if ('name' in axisRef) {\n // AnchorAxisRefByName\n const matches = anchorSpec.axesSpec.filter((axis) => axis.name === axisRef.name);\n if (matches.length > 1)\n throw new Error(`Multiple axes with name \"${axisRef.name}\" found in anchor \"${anchorId}\"`);\n if (matches.length === 0)\n throw new Error(`Axis with name \"${axisRef.name}\" not found in anchor \"${anchorId}\"`);\n return matches[0];\n } else if ('id' in axisRef) {\n // AnchorAxisRefByMatcher\n const matches = anchorSpec.axesSpec.filter((axis) => matchAxisId(axisRef.id, getAxisId(axis)));\n if (matches.length > 1)\n throw new Error(`Multiple matching axes found for matcher in anchor \"${anchorId}\"`);\n if (matches.length === 0)\n throw new Error(`No matching axis found for matcher in anchor \"${anchorId}\"`);\n return matches[0];\n }\n\n throw new Error(`Unsupported axis reference type`);\n}\n\n/**\n * Type guard to check if a value is an anchored axis reference\n */\nfunction isAnchorAxisRef(value: AAxisSelector): value is AnchorAxisRef {\n return typeof value === 'object' && 'anchor' in value;\n}\n","import type { Branded } from '../branding';\nimport type { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\nimport type { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport interface PObjectSpec {\n /** PObject kind discriminator */\n readonly kind: string;\n\n /** Name is common part of PObject identity */\n readonly name: string;\n\n /** Domain is a set of key-value pairs that can be used to identify the object */\n readonly domain?: Record<string, string>;\n\n /** Additional information attached to the object */\n readonly annotations?: Record<string, string>;\n}\n\n/** Stable PObject id */\nexport type PObjectId = Branded<string, 'PColumnId'>;\n\n/**\n * Full PObject representation.\n *\n * @template Data type of the object referencing or describing the \"data\" part of the PObject\n * */\nexport interface PObject<Data> {\n /** Fully rendered PObjects are assigned a stable identifier. */\n readonly id: PObjectId;\n\n /** PObject spec, allowing it to be found among other PObjects */\n readonly spec: PObjectSpec;\n\n /** A handle to data object */\n readonly data: Data;\n}\n\nexport function isPColumnSpec(spec: PObjectSpec): spec is PColumnSpec {\n return spec.kind === 'PColumn';\n}\n\nexport function isPColumn<T>(obj: PObject<T>): obj is PColumn<T> {\n return isPColumnSpec(obj.spec);\n}\n\nexport function isPColumnSpecResult(\n r: ResultPoolEntry<PObjectSpec>,\n): r is ResultPoolEntry<PColumnSpec> {\n return isPColumnSpec(r.obj);\n}\n\nexport function isPColumnResult<T>(\n r: ResultPoolEntry<PObject<T>>,\n): r is ResultPoolEntry<PColumn<T>> {\n return isPColumnSpec(r.obj.spec);\n}\n\nexport function ensurePColumn<T>(obj: PObject<T>): PColumn<T> {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n}\n\nexport function mapPObjectData<D1, D2>(pObj: PColumn<D1>, cb: (d: D1) => D2): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | undefined,\n cb: (d: D1) => D2\n): PColumn<D2> | undefined;\nexport function mapPObjectData<D1, D2>(pObj: PObject<D1>, cb: (d: D1) => D2): PObject<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2\n): PObject<D2> | undefined;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined {\n return pObj === undefined\n ? undefined\n : {\n ...pObj,\n data: cb(pObj.data),\n };\n}\n\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case 'column':\n columns.set(entry.column.id, entry.column);\n return;\n case 'slicedColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'inlineColumn':\n return;\n case 'full':\n case 'inner':\n for (const e of entry.entries) addAllColumns(e);\n return;\n case 'outer':\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n","import { isPColumnSpec, type PObjectSpec } from '../../../pool';\nimport type { AxisId, PColumnSpec, ValueType } from './spec';\nimport { getAxisId } from './spec';\n\n/**\n * Defines a pattern for matching axes within the PFrame data model.\n *\n * AxisSelector provides a flexible way to identify axes based on their\n * properties. All fields are optional, allowing for partial matching.\n * When multiple properties are specified, all must match for an axis\n * to be selected (logical AND).\n *\n * This interface is used in various selection and matching operations\n * throughout the PFrame system, such as column queries and axis lookups.\n */\nexport interface AxisSelector {\n /**\n * Optional value type to match against.\n * When specified, only axes with this exact type will match.\n * Can be a single type or an array of types to match against any of them.\n * Valid types include: 'Int', 'Long', 'Float', 'Double', 'String', 'Bytes'.\n */\n type?: ValueType | ValueType[];\n\n /**\n * Optional name to match against.\n * When specified, only axes with this exact name will match.\n */\n name?: string;\n\n /**\n * Optional domain key-value pairs to match against.\n * Domains provide additional context to uniquely identify an axis beyond its name and type.\n * When specified, an axis will match only if it contains all the key-value pairs defined here.\n * An axis with additional domain entries not present in this selector will still match.\n */\n domain?: Record<string, string>;\n}\n\n/**\n * Reference to an axis by its numerical index within the anchor column's axes array\n * Format: [anchorId, axisIndex]\n */\nexport type AnchorAxisRefByIdx = { anchor: string; idx: number };\n\n/**\n * Reference to an axis by its name within the anchor column\n * Format: [anchorId, axisName]\n */\nexport type AnchorAxisRefByName = { anchor: string; name: string };\n\n/**\n * Reference to an axis using an AxisId matcher within the anchor\n * Format: [anchorId, axisMatcher]\n */\nexport type AnchorAxisRefByMatcher = { anchor: string; id: AxisId };\n\n/**\n * Basic anchor axis reference that can be either by index or a direct AxisId\n */\nexport type AnchorAxisIdOrRefBasic = AnchorAxisRefByIdx | AxisId;\n\n/** Union of all possible ways to reference an axis in an anchored context */\nexport type AnchorAxisRef = AnchorAxisRefByIdx | AnchorAxisRefByName | AnchorAxisRefByMatcher;\n\n/** Reference to a domain value through an anchor */\nexport type AnchorDomainRef = { anchor: string };\n\n/**\n * Domain value that can be either a direct string value or a reference to a domain through an anchor\n * Used to establish domain context that can be resolved relative to other anchored columns\n */\nexport type ADomain = string | AnchorDomainRef;\n/**\n * Axis identifier that can be either a direct AxisId or a reference to an axis through an anchor\n * Allows referring to axes in a way that can be resolved in different contexts\n */\nexport type AAxisSelector = AxisSelector | AnchorAxisRef;\n\n/**\n * Match resolution strategy for PColumns\n * Specifies how to handle when multiple columns match the criteria\n * (default is \"expectSingle\")\n */\nexport type AnchoredColumnMatchStrategy = 'expectSingle' | 'expectMultiple' | 'takeFirst';\n\n/**\n * Matcher for PColumns in an anchored context\n * Supports partial matching on axes, allowing for flexible column discovery\n */\nexport interface AnchoredPColumnSelector {\n /** Optional name of the column to match; can't be used together with namePattern */\n name?: string;\n /** Optional regexp pattern for column name matching; can't be used together with name */\n namePattern?: string;\n /** Optional value type to match. If an array is provided, matches if the column's type is any of the specified types */\n type?: ValueType | ValueType[];\n /** If specified, the domain values must be anchored to this anchor */\n domainAnchor?: string;\n /** Optional domain values to match, can include anchored references, if domainAnchor is specified,\n * interpreted as additional domains to domain from the anchor */\n domain?: Record<string, ADomain>;\n /** Optional axes to match, can include anchored references */\n axes?: AAxisSelector[];\n /** When true, allows matching if only a subset of axes match */\n partialAxesMatch?: boolean;\n /** Optional annotations to match with exact values */\n annotations?: Record<string, string>;\n /** Optional annotation patterns to match with regex patterns */\n annotationPatterns?: Record<string, string>;\n /** Match resolution strategy, default is \"expectSingle\" */\n matchStrategy?: AnchoredColumnMatchStrategy;\n}\n\n/**\n * Matcher for PColumns in a non-anchored context\n */\nexport interface PColumnSelector extends AnchoredPColumnSelector {\n domainAnchor?: never;\n domain?: Record<string, string>;\n axes?: AxisSelector[];\n}\n\n/**\n * Strict identifier for PColumns in an anchored context\n * Unlike APColumnMatcher, this requires exact matches on domain and axes\n */\nexport interface AnchoredPColumnId extends AnchoredPColumnSelector {\n /** Name is required for exact column identification */\n name: string;\n /** No namePattern in ID */\n namePattern?: never;\n /** Type is not used in exact column identification */\n type?: never;\n /** Full axes specification using only basic references */\n axes: AnchorAxisIdOrRefBasic[];\n /** Partial axes matching is not allowed for exact identification */\n partialAxesMatch?: never;\n /** Annotations are not used in exact column identification */\n annotations?: never;\n /** Annotation patterns are not used in exact column identification */\n annotationPatterns?: never;\n /** \"Id\" implies single match strategy */\n matchStrategy?: never;\n}\n\n/**\n * Determines if an axis ID matches an axis selector.\n *\n * @param selector - The selector with criteria to match against\n * @param axis - The AxisId to check against the selector\n * @returns true if the AxisId matches all specified criteria in the selector, false otherwise\n */\nexport function matchAxis(selector: AxisSelector, axis: AxisId): boolean {\n // Match name if specified\n if (selector.name !== undefined && selector.name !== axis.name)\n return false;\n\n // Match type if specified\n if (selector.type !== undefined) {\n if (Array.isArray(selector.type)) {\n if (!selector.type.includes(axis.type))\n return false;\n } else if (selector.type !== axis.type) {\n return false;\n }\n }\n\n // Match domain if specified - using existing logic from matchAxisId\n if (selector.domain !== undefined) {\n const axisDomain = axis.domain || {};\n for (const [key, value] of Object.entries(selector.domain))\n if (axisDomain[key] !== value)\n return false;\n }\n\n return true;\n}\n\n/**\n * Determines if a given PColumnSpec matches a selector.\n *\n * @param pcolumn - The PColumnSpec to check against the selector\n * @param selector - The selector criteria to match against\n * @returns true if the PColumnSpec matches all criteria in the selector, false otherwise\n */\nexport function matchPColumn(pcolumn: PColumnSpec, selector: PColumnSelector): boolean {\n // Match name if specified\n if (selector.name !== undefined && pcolumn.name !== selector.name)\n return false;\n\n // Match name pattern if specified\n if (selector.namePattern !== undefined && !new RegExp(selector.namePattern).test(pcolumn.name))\n return false;\n\n // Match type if specified\n if (selector.type !== undefined) {\n if (Array.isArray(selector.type)) {\n if (!selector.type.includes(pcolumn.valueType))\n return false;\n } else if (selector.type !== pcolumn.valueType) {\n return false;\n }\n }\n\n // Match domain if specified\n if (selector.domain !== undefined) {\n const columnDomain = pcolumn.domain || {};\n for (const [key, value] of Object.entries(selector.domain))\n if (columnDomain[key] !== value)\n return false;\n }\n\n // Match axes if specified\n if (selector.axes !== undefined) {\n const pcolumnAxes = pcolumn.axesSpec.map(getAxisId);\n\n if (selector.partialAxesMatch) {\n // For partial matching, all selector axes must match at least one column axis\n for (const selectorAxis of selector.axes)\n if (!pcolumnAxes.some((columnAxis) => matchAxis(selectorAxis, columnAxis)))\n return false;\n } else {\n // For exact matching, column must have the same number of axes and all must match\n if (pcolumnAxes.length !== selector.axes.length)\n return false;\n\n // Each selector axis must match a corresponding column axis\n for (let i = 0; i < selector.axes.length; i++)\n if (!matchAxis(selector.axes[i], pcolumnAxes[i]))\n return false;\n }\n }\n\n // Match annotations if specified\n if (selector.annotations !== undefined) {\n const columnAnnotations = pcolumn.annotations || {};\n for (const [key, value] of Object.entries(selector.annotations))\n if (columnAnnotations[key] !== value)\n return false;\n }\n\n // Match annotation patterns if specified\n if (selector.annotationPatterns !== undefined) {\n const columnAnnotations = pcolumn.annotations || {};\n for (const [key, pattern] of Object.entries(selector.annotationPatterns)) {\n const value = columnAnnotations[key];\n if (value === undefined || !new RegExp(pattern).test(value))\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Convert a predicate or array of selectors to a single predicate function\n * @param predicateOrSelectors - Either a function that takes a PColumnSpec and returns a boolean,\n * or an array of PColumnSelectors, or a single PColumnSelector\n * @returns A function that takes a PColumnSpec and returns a boolean\n */\nexport function selectorsToPredicate(predicateOrSelectors: PColumnSelector | PColumnSelector[]): ((spec: PObjectSpec) => boolean) {\n if (Array.isArray(predicateOrSelectors))\n return (spec) => predicateOrSelectors.some((selector) => isPColumnSpec(spec) && matchPColumn(spec, selector));\n else\n return (spec) => isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);\n}\n","import type { Branded } from '../../../branding';\nimport { isPColumnSpec, type PObjectSpec } from '../../../pool';\nimport { getAxesId } from './spec';\nimport canonicalize from 'canonicalize';\nexport type NativePObjectId = Branded<string, 'NativePObjectId'>;\n\nexport function deriveNativeId(spec: PObjectSpec): NativePObjectId {\n const result: Record<string, unknown> = {\n kind: spec.kind,\n name: spec.name,\n };\n if (spec.domain !== undefined)\n result.domain = spec.domain;\n if (isPColumnSpec(spec))\n result.axesSpec = getAxesId(spec.axesSpec);\n return canonicalize(result) as NativePObjectId;\n}\n","import { z } from 'zod';\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe('Crucial marker for the block dependency tree reconstruction'),\n blockId: z.string()\n .describe('Upstream block id'),\n name: z.string()\n .describe('Name of the output provided to the upstream block\\'s output context'),\n requireEnrichments: z.literal(true).optional()\n .describe('True if current block that stores this reference in its args, may need enrichments '\n + 'for the references value originating from the blocks in between current and referenced block'),\n })\n .describe(\n 'Universal reference type, allowing to set block connections. It is crucial that '\n + '{@link __isRef} is present and equal to true, internal logic relies on this marker '\n + 'to build block dependency trees.',\n )\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/**\n * Type guard to check if a value is a PlRef.\n *\n * @param value - The value to check.\n * @returns True if the value is a PlRef, false otherwise.\n */\nexport function isPlRef(value: unknown): value is PlRef {\n return (\n typeof value === 'object'\n && value !== null\n && '__isRef' in value\n && (value as { __isRef: unknown }).__isRef === true\n && 'blockId' in value\n && 'name' in value\n );\n}\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/**\n * Creates a PlRef with the given blockId and name.\n *\n * @param blockId - The blockId of the reference.\n * @param name - The name of the reference.\n * @param requireEnrichments - Whether the reference requires enrichments.\n */\nexport function createPlRef(blockId: string, name: string, requireEnrichments: boolean = false) {\n if (requireEnrichments)\n return {\n __isRef: true,\n blockId,\n name,\n requireEnrichments: true,\n };\n else\n return {\n __isRef: true,\n blockId,\n name,\n };\n}\n\n/**\n * Creates a new PlRef based on an existing one, explicitly setting (default) or removing the\n * requireEnrichments property.\n *\n * @param ref - The original PlRef object.\n * @param requireEnrichments - If true, the `requireEnrichments: true` property is added\n * to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.\n * @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.\n */\nexport function withEnrichments(ref: PlRef, requireEnrichments: boolean = true): PlRef {\n if (requireEnrichments)\n return {\n ...ref,\n requireEnrichments: true,\n };\n else {\n const { requireEnrichments: _, ...rest } = ref;\n return rest;\n }\n}\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef, ignoreEnrichments: boolean = false) {\n return ref1.blockId === ref2.blockId && ref1.name === ref2.name && (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments);\n}\n","export type ValueOrError<V, E> =\n | {\n ok: true;\n value: V;\n }\n | {\n ok: false;\n error: E;\n };\n\nexport function mapValueInVOE<V1, V2, E>(\n voe: ValueOrError<V1, E>,\n cb: (value: V1) => V2,\n): ValueOrError<V2, E> {\n return voe.ok ? { ok: true, value: cb(voe.value) } : voe;\n}\n","import { z } from 'zod';\nimport { base32Encode } from './base32_encode';\n\n/** Number of raw bytes in the PlId. */\nexport const PlIdBytes = 15;\n/** Characters in string representation */\nexport const PlIdLength = 24; // = 15 bytes * 8 bits / 5 bits per char in base32\n\nexport const PlId = z\n .string()\n .length(PlIdLength)\n .regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/) // RFC4648\n .brand('PlId');\nexport type PlId = z.infer<typeof PlId>;\n\nexport function uniquePlId(): PlId {\n const data = new Uint8Array(PlIdBytes);\n crypto.getRandomValues(data);\n return PlId.parse(base32Encode(data, 'RFC4648'));\n}\n\nexport function plId(bytes: Uint8Array): PlId {\n if (bytes.length !== PlIdBytes) throw new Error(`Wrong number of bytes: ${bytes.length}`);\n return PlId.parse(base32Encode(bytes, 'RFC4648'));\n}\n\nexport async function digestPlId(data: string): Promise<PlId> {\n const encoder = new TextEncoder();\n const bytes = await crypto.subtle.digest('SHA-256', encoder.encode(data));\n return plId(new Uint8Array(bytes.slice(0, 15)));\n}\n"],"names":["z","assertNever","x","uploadPrefix","indexPrefix","isImportFileHandleUpload","handle","isImportFileHandleIndex","getFilePathFromHandle","trimmed","extractFileName","filePath","getFileNameFromHandle","isDataInfo","value","data","mapDataInfo","dataInfo","mapFn","newParts","key","blob","chunk","isDataInfoEntries","isPartitionedDataInfoEntries","dataInfoToEntries","entries","keyStr","parts","entriesToDataInfo","dataInfoEntries","entry","getAxisId","spec","type","name","domain","result","getAxesId","canonicalizeAxisId","id","canonicalize","matchDomain","query","target","k","matchAxisId","mapPTableDef","def","cb","mapJoinEntry","col","stringifyColumnId","axisKey","axis","domainKey","AnchoredIdDeriver","anchors","__publicField","anchorEntries","a","b","anchorId","axisIdx","domainEntries","dKey","dValue","axisFilters","skipDomains","outer","domainPack","dAnchor","domainAnchor","anchorAxisRef","resolvedFilters","filter","axisIdOrIndex","axisIndex","resolveAnchors","matcher","options","ignoreMissingDomains","anchorSpec","anchorDomains","resolvedDomain","resolveAxisReference","axisRef","isAnchorAxisRef","matches","isPColumnSpec","isPColumn","obj","ensurePColumn","mapPObjectData","pObj","extractAllColumns","columns","addAllColumns","e","matchAxis","selector","axisDomain","matchPColumn","pcolumn","columnDomain","pcolumnAxes","selectorAxis","columnAxis","i","columnAnnotations","pattern","selectorsToPredicate","predicateOrSelectors","deriveNativeId","isPlRef","withEnrichments","ref","requireEnrichments","_","rest","mapValueInVOE","voe","PlIdLength"],"mappings":";;;AAyB0BA,EAAE,OAAO;AAAA;AAAA,EAEjC,MAAMA,EAAE,OAAO;AAAA;AAAA,EAEf,IAAIA,EAAE,OAAO;AACf,CAAC;AC9BM,SAASC,EAAYC,GAAiB;AACrC,QAAA,IAAI,MAAM,wBAAwBA,CAAC;AAC3C;ACGA,MAAMC,IAAe,oBACfC,IAAc;AASb,SAASC,EACdC,GACkC;AAC3BA,SAAAA,EAAO,WAAWH,CAAY;AACvC;AAEO,SAASI,EAAwBD,GAA2D;AAC1FA,SAAAA,EAAO,WAAWF,CAAW;AACtC;AAuGO,SAASI,EAAsBF,GAAkC;AAClEC,MAAAA,EAAwBD,CAAM,GAAG;AACnC,UAAMG,IAAUH,EAAO,MAAMF,EAAY,MAAM;AAE/C,WADa,KAAK,MAAM,mBAAmBK,CAAO,CAAC,EACvC;AAAA,EAAA,WACHJ,EAAyBC,CAAM,GAAG;AAC3C,UAAMG,IAAUH,EAAO,MAAMH,EAAa,MAAM;AAEhD,WADa,KAAK,MAAM,mBAAmBM,CAAO,CAAC,EACvC;AAAA,EAAA;AAGdR,EAAAA,EAAYK,CAAM;AACpB;AAEA,SAASI,EAAgBC,GAAkB;AAClCA,SAAAA,EAAS,QAAQ,YAAY,EAAE;AACxC;AAGO,SAASC,EAAsBN,GAAkC;AAC/DI,SAAAA,EAAgBF,EAAsBF,CAAM,CAAC;AACtD;AC3CO,SAASO,EAAiBC,GAAyC;AACpE,MAAA,CAACA,KAAS,OAAOA,KAAU;AACtB,WAAA;AAGT,QAAMC,IAAOD;AACT,MAAA,EAAE,UAAUC;AACP,WAAA;AAGT,UAAQA,EAAK,MAAM;AAAA,IACjB,KAAK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GACqB;AACdwE,SAAAA,EAAI,KAAK,EAAE,IAAI,IAAM,OAAOxE,EAAGwE,EAAI,KAAK,EAAA,IAAMA;AACvD;ACXO,MAEMC,IAAa;AAEN1H,EACjB,OAAA,EACA,OAAO0H,CAAU,EACjB,MAAM,oCAAoC,EAC1C,MAAM,MAAM;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../../model/common/src/drivers/blob.ts","../../../../../../../model/common/src/util.ts","../../../../../../../model/common/src/drivers/ls.ts","../../../../../../../model/common/src/drivers/pframe/data_info.ts","../../../../../../../model/common/src/drivers/pframe/spec/spec.ts","../../../../../../../model/common/src/drivers/pframe/table_calculate.ts","../../../../../../../model/common/src/drivers/pframe/spec/ids.ts","../../../../../../../model/common/src/drivers/pframe/spec/anchored.ts","../../../../../../../model/common/src/pool/spec.ts","../../../../../../../model/common/src/drivers/pframe/spec/selectors.ts","../../../../../../../model/common/src/drivers/pframe/spec/native_id.ts","../../../../../../../model/common/src/ref.ts","../../../../../../../model/common/src/value_or_error.ts","../../../../../../../model/common/src/plid.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport { z } from 'zod';\n\n/** Handle of locally downloaded blob. This handle is issued only after the\n * blob's content is downloaded locally, and ready for quick access. */\nexport type LocalBlobHandle = Branded<string, 'LocalBlobHandle'>;\n\n/** Handle of remote blob. This handle is issued as soon as the data becomes\n * available on the remote server. */\nexport type RemoteBlobHandle = Branded<string, 'RemoteBlobHandle'>;\n\n/** Being configured inside the output structure provides information about\n * blob's content and means to retrieve it when needed. */\nexport interface BlobHandleAndSize<\n H extends LocalBlobHandle | RemoteBlobHandle = | LocalBlobHandle\n | RemoteBlobHandle,\n> {\n /** Handle to retrieve block content using {@link BlobDriver.getContent()} */\n readonly handle: H;\n\n /** Blob size in bytes. */\n readonly size: number;\n}\n\n/** Range in bytes, from should be less or equal than to. */\nexport const RangeBytes = z.object({\n /** Included left border. */\n from: z.number(),\n /** Excluded right border. */\n to: z.number(),\n});\n\nexport type RangeBytes = z.infer<typeof RangeBytes>;\n\nexport function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined {\n if (from == undefined || to == undefined) {\n return undefined;\n }\n\n return { from, to };\n}\n\nexport function validateRangeBytes(range: RangeBytes, errMsg: string) {\n if (range.from < 0 || range.to < 0 || range.from >= range.to) {\n throw new Error(`${errMsg}: invalid bytes range: ${range}`);\n }\n}\n\n/** Being configured inside the output structure provides information about\n * locally downloaded blob and means to retrieve it's content when needed. This\n * structure is created only after the blob's content is downloaded locally, and\n * ready for quick access. */\nexport type LocalBlobHandleAndSize = BlobHandleAndSize<LocalBlobHandle>;\n\n/** Being configured inside the output structure provides information about\n * remote blob and means to retrieve it's content when needed. This structure\n * is created as soon as remote blob becomes available. */\nexport type RemoteBlobHandleAndSize = BlobHandleAndSize<RemoteBlobHandle>;\n\n/** Defines API of blob driver as it is seen from the block UI code. */\nexport interface BlobDriver {\n /** Given the blob handle returns its content. Depending on the handle type,\n * content will be served from locally downloaded file, or directly from\n * remote platforma storage. */\n getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;\n}\n","export function assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x); // This is ok, because this is a possible runtime error\n}\n","import { assertNever } from '../util';\nimport type { Branded } from '../branding';\nimport type { TableRange } from './pframe';\nimport type { FileLike } from './interfaces';\n\nconst uploadPrefix = 'upload://upload/';\nconst indexPrefix = 'index://index/';\n\nexport type ImportFileHandleUpload = `upload://upload/${string}`;\nexport type ImportFileHandleIndex = `index://index/${string}`;\n\nexport type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;\n\nexport type LocalImportFileHandle = Branded<ImportFileHandle, 'Local'>;\n\nexport function isImportFileHandleUpload(\n handle: ImportFileHandle,\n): handle is ImportFileHandleUpload {\n return handle.startsWith(uploadPrefix);\n}\n\nexport function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex {\n return handle.startsWith(indexPrefix);\n}\n\n/** Results in upload */\nexport type StorageHandleLocal = `local://${string}`;\n\n/** Results in index */\nexport type StorageHandleRemote = `remote://${string}`;\n\nexport type StorageHandle = StorageHandleLocal | StorageHandleRemote;\n\nexport type StorageEntry = {\n name: string;\n handle: StorageHandle;\n initialFullPath: string;\n\n // TODO\n // pathStartsWithDisk\n};\n\nexport type ListFilesResult = {\n parent?: string;\n entries: LsEntry[];\n};\n\nexport type LsEntry =\n | {\n type: 'dir';\n name: string;\n fullPath: string;\n }\n | {\n type: 'file';\n name: string;\n fullPath: string;\n\n /** This handle should be set to args... */\n handle: ImportFileHandle;\n };\n\nexport type OpenDialogFilter = {\n /** Human-readable file type name */\n readonly name: string;\n /** File extensions */\n readonly extensions: string[];\n};\n\nexport type OpenDialogOps = {\n /** Open dialog window title */\n readonly title?: string;\n /** Custom label for the confirmation button, when left empty the default label will be used. */\n readonly buttonLabel?: string;\n /** Limits of file types user can select */\n readonly filters?: OpenDialogFilter[];\n};\n\nexport type OpenSingleFileResponse = {\n /** Contains local file handle, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly file?: LocalImportFileHandle;\n};\n\nexport type OpenMultipleFilesResponse = {\n /** Contains local file handles, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly files?: LocalImportFileHandle[];\n};\n\n/** Can be used to limit request for local file content to a certain bytes range */\nexport type FileRange = {\n /** From byte index (inclusive) */\n readonly from: number;\n /** To byte index (exclusive) */\n readonly to: number;\n};\n\nexport interface LsDriver {\n /** remote and local storages */\n getStorageList(): Promise<StorageEntry[]>;\n\n listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;\n\n /** Opens system file open dialog allowing to select single file and awaits user action */\n showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;\n\n /** Opens system file open dialog allowing to multiple files and awaits user action */\n showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;\n\n /** Given a handle to a local file, allows to get file size */\n getLocalFileSize(file: LocalImportFileHandle): Promise<number>;\n\n /** Given a handle to a local file, allows to get its content */\n getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;\n\n /**\n * Resolves browser's File object into platforma's import file handle.\n *\n * This method is useful among other things for implementation of UI\n * components, that handle file Drag&Drop.\n * */\n fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;\n\n /** Saves currently opened block webview as a PDF. */\n exportToPdf?(): Promise<void>;\n}\n\n/** Gets a file path from an import handle. */\nexport function getFilePathFromHandle(handle: ImportFileHandle): string {\n if (isImportFileHandleIndex(handle)) {\n const trimmed = handle.slice(indexPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { path: string };\n return data.path;\n } else if (isImportFileHandleUpload(handle)) {\n const trimmed = handle.slice(uploadPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { localPath: string };\n return data.localPath;\n }\n\n assertNever(handle);\n}\n\nfunction extractFileName(filePath: string) {\n return filePath.replace(/^.*[\\\\/]/, '');\n}\n\n/** Gets a file name from an import handle. */\nexport function getFileNameFromHandle(handle: ImportFileHandle): string {\n return extractFileName(getFilePathFromHandle(handle));\n}\n","/**\n * Represents a JavaScript representation of a value in a PColumn. Can be null, a number, or a string.\n * These are the primitive types that can be stored directly in PColumns.\n *\n * Note: Actual columns can hold more value types, which are converted to these JavaScript types\n * once they enter the JavaScript runtime.\n */\nexport type PColumnValue = null | number | string;\n\n/**\n * Represents a key for a PColumn value.\n * Can be an array of strings or numbers.\n */\nexport type PColumnKey = (number | string)[];\n\n/**\n * Represents a single entry in a PColumn's data structure.\n * Contains a key and a value.\n */\nexport type PColumnDataEntry<T> = {\n /** Key for the value */\n key: PColumnKey;\n\n /** Value / blob at the given key */\n value: T;\n};\n\n/**\n * Represents column data stored as a simple JSON structure.\n * Used for small datasets that can be efficiently stored directly in memory.\n */\nexport type JsonDataInfo = {\n /** Identifier for this data format ('Json') */\n type: 'Json';\n\n /** Number of axes that make up the complete key (tuple length) */\n keyLength: number;\n\n /**\n * Key-value pairs where keys are stringified tuples of axis values\n * and values are the column values for those coordinates\n */\n data: Record<string, PColumnValue>;\n};\n\n/**\n * Represents column data partitioned across multiple JSON blobs.\n * Used for larger datasets that need to be split into manageable chunks.\n */\nexport type JsonPartitionedDataInfo<Blob> = {\n /** Identifier for this data format ('JsonPartitioned') */\n type: 'JsonPartitioned';\n\n /** Number of leading axes used for partitioning */\n partitionKeyLength: number;\n\n /** Map of stringified partition keys to blob references */\n parts: Record<string, Blob>;\n};\n\n/**\n * Represents a binary format chunk containing index and values as separate blobs.\n * Used for efficient storage and retrieval of column data in binary format.\n */\nexport type BinaryChunk<Blob> = {\n /** Binary blob containing structured index information */\n index: Blob;\n\n /** Binary blob containing the actual values */\n values: Blob;\n};\n\n/**\n * Represents column data partitioned across multiple binary chunks.\n * Optimized for efficient storage and retrieval of large datasets.\n */\nexport type BinaryPartitionedDataInfo<Blob> = {\n /** Identifier for this data format ('BinaryPartitioned') */\n type: 'BinaryPartitioned';\n\n /** Number of leading axes used for partitioning */\n partitionKeyLength: number;\n\n /** Map of stringified partition keys to binary chunks */\n parts: Record<string, BinaryChunk<Blob>>;\n};\n\n/**\n * Union type representing all possible data storage formats for PColumn data.\n * The specific format used depends on data size, access patterns, and performance requirements.\n *\n * @template Blob - Type parameter representing the storage reference type (could be ResourceInfo, PFrameBlobId, etc.)\n */\nexport type DataInfo<Blob> =\n | JsonDataInfo\n | JsonPartitionedDataInfo<Blob>\n | BinaryPartitionedDataInfo<Blob>;\n\n/**\n * Type guard function that checks if the given value is a valid DataInfo.\n *\n * @param value - The value to check\n * @returns True if the value is a valid DataInfo, false otherwise\n */\nexport function isDataInfo<Blob>(value: unknown): value is DataInfo<Blob> {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n const data = value as Record<string, unknown>;\n if (!('type' in data)) {\n return false;\n }\n\n switch (data.type) {\n case 'Json':\n return (\n typeof data.keyLength === 'number'\n && data.data !== undefined\n && typeof data.data === 'object'\n );\n case 'JsonPartitioned':\n return (\n typeof data.partitionKeyLength === 'number'\n && data.parts !== undefined\n && typeof data.parts === 'object'\n );\n case 'BinaryPartitioned':\n return (\n typeof data.partitionKeyLength === 'number'\n && data.parts !== undefined\n && typeof data.parts === 'object'\n );\n default:\n return false;\n }\n}\n\n/**\n * Maps blob references in a DataInfo object from one type to another using a mapping function.\n *\n * @template B1 - Source blob type\n * @template B2 - Target blob type\n * @param dataInfo - The source DataInfo object\n * @param mapFn - Function to transform blobs from type B1 to type B2\n * @returns A new DataInfo object with transformed blob references\n */\nexport function mapDataInfo<B1, B2>(\n dataInfo: DataInfo<B1>,\n mapFn: (blob: B1) => B2,\n): DataInfo<B2>;\nexport function mapDataInfo<B1, B2>(\n dataInfo: DataInfo<B1> | undefined,\n mapFn: (blob: B1) => B2,\n): DataInfo<B2> | undefined {\n if (dataInfo === undefined) {\n return undefined;\n }\n\n switch (dataInfo.type) {\n case 'Json':\n // Json type doesn't contain blobs, so return as is\n return dataInfo;\n case 'JsonPartitioned': {\n // Map each blob in parts\n const newParts: Record<string, B2> = {};\n for (const [key, blob] of Object.entries(dataInfo.parts)) {\n newParts[key] = mapFn(blob);\n }\n return {\n ...dataInfo,\n parts: newParts,\n };\n }\n case 'BinaryPartitioned': {\n // Map each index and values blob in parts\n const newParts: Record<string, BinaryChunk<B2>> = {};\n for (const [key, chunk] of Object.entries(dataInfo.parts)) {\n newParts[key] = {\n index: mapFn(chunk.index),\n values: mapFn(chunk.values),\n };\n }\n return {\n ...dataInfo,\n parts: newParts,\n };\n }\n }\n}\n\n/**\n * @param dataInfo - The source DataInfo object\n * @param cb - Callback, function that have access to every blob to visit them all\n * @returns Nothing\n */\nexport function visitDataInfo<B>(\n dataInfo: DataInfo<B>,\n cb: (blob: B) => void,\n): void {\n switch (dataInfo.type) {\n case 'Json':\n // Json type doesn't contain blobs, so return as is\n break;\n case 'JsonPartitioned': {\n // Visit each blob in parts\n for (const [_, blob] of Object.entries(dataInfo.parts)) {\n cb(blob);\n }\n break;\n }\n case 'BinaryPartitioned': {\n // Visit each index and values blob in parts\n for (const [_, chunk] of Object.entries(dataInfo.parts)) {\n cb(chunk.index);\n cb(chunk.values);\n }\n break;\n }\n }\n}\n\n//\n// Lightway representation for ExplicitJsonData\n//\n\n/**\n * Represents a single key-value entry in a column's explicit data structure.\n * Used when directly instantiating PColumns with explicit data.\n */\nexport type PColumnValuesEntry = {\n key: PColumnKey;\n val: PColumnValue;\n};\n\n/**\n * Array of key-value entries representing explicit column data.\n * Used for lightweight explicit instantiation of PColumns.\n */\nexport type PColumnValues = PColumnValuesEntry[];\n\n/**\n * Entry-based representation of JsonDataInfo\n */\nexport interface JsonDataInfoEntries {\n type: 'Json';\n keyLength: number;\n data: PColumnDataEntry<PColumnValue>[];\n}\n\n/**\n * Entry-based representation of JsonPartitionedDataInfo\n */\nexport interface JsonPartitionedDataInfoEntries<Blob> {\n type: 'JsonPartitioned';\n partitionKeyLength: number;\n parts: PColumnDataEntry<Blob>[];\n}\n\n/**\n * Entry-based representation of BinaryPartitionedDataInfo\n */\nexport interface BinaryPartitionedDataInfoEntries<Blob> {\n type: 'BinaryPartitioned';\n partitionKeyLength: number;\n parts: PColumnDataEntry<BinaryChunk<Blob>>[];\n}\n\n/**\n * Union type representing all possible entry-based partitioned data storage formats\n */\nexport type PartitionedDataInfoEntries<Blob> =\n | JsonPartitionedDataInfoEntries<Blob>\n | BinaryPartitionedDataInfoEntries<Blob>;\n\n/**\n * Union type representing all possible entry-based data storage formats\n */\nexport type DataInfoEntries<Blob> =\n | JsonDataInfoEntries\n | PartitionedDataInfoEntries<Blob>;\n\n/**\n * Type guard function that checks if the given value is a valid DataInfoEntries.\n *\n * @param value - The value to check\n * @returns True if the value is a valid DataInfoEntries, false otherwise\n */\nexport function isDataInfoEntries<Blob>(value: unknown): value is DataInfoEntries<Blob> {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n const data = value as Record<string, unknown>;\n if (!('type' in data)) {\n return false;\n }\n\n switch (data.type) {\n case 'Json':\n return (\n typeof data.keyLength === 'number'\n && Array.isArray(data.data)\n );\n case 'JsonPartitioned':\n return (\n typeof data.partitionKeyLength === 'number'\n && Array.isArray(data.parts)\n );\n case 'BinaryPartitioned':\n return (\n typeof data.partitionKeyLength === 'number'\n && Array.isArray(data.parts)\n );\n default:\n return false;\n }\n}\n\n/**\n * Type guard function that checks if the given value is a valid PartitionedDataInfoEntries.\n *\n * @template Blob - Type parameter representing the storage reference type\n * @param value - The value to check\n * @returns True if the value is a valid PartitionedDataInfoEntries, false otherwise\n */\nexport function isPartitionedDataInfoEntries<Blob>(value: unknown): value is PartitionedDataInfoEntries<Blob> {\n if (!isDataInfoEntries(value)) return false;\n return value.type === 'JsonPartitioned' || value.type === 'BinaryPartitioned';\n}\n\n/**\n * Converts DataInfo to DataInfoEntries\n *\n * @param dataInfo - The record-based DataInfo object\n * @returns The equivalent entry-based DataInfoEntries object\n */\nexport function dataInfoToEntries<Blob>(dataInfo: DataInfo<Blob>): DataInfoEntries<Blob> {\n switch (dataInfo.type) {\n case 'Json': {\n const entries: PColumnDataEntry<PColumnValue>[] = Object.entries(dataInfo.data).map(([keyStr, value]) => {\n const key = JSON.parse(keyStr) as PColumnKey;\n return { key, value };\n });\n\n return {\n type: 'Json',\n keyLength: dataInfo.keyLength,\n data: entries,\n };\n }\n case 'JsonPartitioned': {\n const parts: PColumnDataEntry<Blob>[] = Object.entries(dataInfo.parts).map(([keyStr, blob]) => {\n const key = JSON.parse(keyStr) as PColumnKey;\n return { key, value: blob };\n });\n\n return {\n type: 'JsonPartitioned',\n partitionKeyLength: dataInfo.partitionKeyLength,\n parts,\n };\n }\n case 'BinaryPartitioned': {\n const parts: PColumnDataEntry<BinaryChunk<Blob>>[] = Object.entries(dataInfo.parts).map(([keyStr, chunk]) => {\n const key = JSON.parse(keyStr) as PColumnKey;\n return { key, value: chunk };\n });\n\n return {\n type: 'BinaryPartitioned',\n partitionKeyLength: dataInfo.partitionKeyLength,\n parts,\n };\n }\n }\n}\n\n/**\n * Converts DataInfoEntries to DataInfo\n *\n * @param dataInfoEntries - The entry-based DataInfoEntries object\n * @returns The equivalent record-based DataInfo object\n */\nexport function entriesToDataInfo<Blob>(dataInfoEntries: DataInfoEntries<Blob>): DataInfo<Blob> {\n switch (dataInfoEntries.type) {\n case 'Json': {\n const data: Record<string, PColumnValue> = {};\n for (const entry of dataInfoEntries.data) {\n data[JSON.stringify(entry.key)] = entry.value;\n }\n\n return {\n type: 'Json',\n keyLength: dataInfoEntries.keyLength,\n data,\n };\n }\n case 'JsonPartitioned': {\n const parts: Record<string, Blob> = {};\n for (const entry of dataInfoEntries.parts) {\n parts[JSON.stringify(entry.key)] = entry.value;\n }\n\n return {\n type: 'JsonPartitioned',\n partitionKeyLength: dataInfoEntries.partitionKeyLength,\n parts,\n };\n }\n case 'BinaryPartitioned': {\n const parts: Record<string, BinaryChunk<Blob>> = {};\n for (const entry of dataInfoEntries.parts) {\n parts[JSON.stringify(entry.key)] = entry.value;\n }\n\n return {\n type: 'BinaryPartitioned',\n partitionKeyLength: dataInfoEntries.partitionKeyLength,\n parts,\n };\n }\n }\n}\n\n/**\n * Maps blob references in a DataInfoEntries object from one type to another using a mapping function.\n *\n * @template B1 - Source blob type\n * @template B2 - Target blob type\n * @param dataInfoEntries - The source DataInfoEntries object\n * @param mapFn - Function to transform blobs from type B1 to type B2\n * @returns A new DataInfoEntries object with transformed blob references\n */\nexport function mapDataInfoEntries<B1, B2>(\n dataInfoEntries: DataInfoEntries<B1>,\n mapFn: (blob: B1) => B2,\n): DataInfoEntries<B2>;\nexport function mapDataInfoEntries<B1, B2>(\n dataInfoEntries: DataInfoEntries<B1> | undefined,\n mapFn: (blob: B1) => B2,\n): DataInfoEntries<B2> | undefined {\n if (dataInfoEntries === undefined) {\n return undefined;\n }\n\n switch (dataInfoEntries.type) {\n case 'Json':\n // Json type doesn't contain blobs, so return as is\n return dataInfoEntries;\n case 'JsonPartitioned': {\n // Map each blob in parts\n const newParts = dataInfoEntries.parts.map((entry) => ({\n key: entry.key,\n value: mapFn(entry.value),\n }));\n\n return {\n ...dataInfoEntries,\n parts: newParts,\n };\n }\n case 'BinaryPartitioned': {\n // Map each index and values blob in parts\n const newParts = dataInfoEntries.parts.map((entry) => ({\n key: entry.key,\n value: {\n index: mapFn(entry.value.index),\n values: mapFn(entry.value.values),\n },\n }));\n\n return {\n ...dataInfoEntries,\n parts: newParts,\n };\n }\n }\n}\n","import type { PObject, PObjectId, PObjectSpec } from '../../../pool';\nimport canonicalize from 'canonicalize';\n\n/** PFrame columns and axes within them may store one of these types. */\nexport type ValueType = 'Int' | 'Long' | 'Float' | 'Double' | 'String' | 'Bytes';\n\n/**\n * Specification of an individual axis.\n *\n * Each axis is a part of a composite key that addresses data inside the PColumn.\n *\n * Each record inside a PColumn is addressed by a unique tuple of values set for\n * all the axes specified in the column spec.\n * */\nexport interface AxisSpec {\n /** Type of the axis value. Should not use non-key types like float or double. */\n readonly type: ValueType;\n\n /** Name of the axis */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Any additional information attached to the axis that does not affect its\n * identifier */\n readonly annotations?: Record<string, string>;\n\n /**\n * Parent axes provide contextual grouping for the axis in question, establishing\n * a hierarchy where the current axis is dependent on one or more axes for its\n * full definition and meaning. For instance, in a data structure where each\n * \"container\" axis may contain multiple \"item\" axes, the `item` axis would\n * list the index of the `container` axis in this field to denote its dependency.\n *\n * This means that the identity or significance of the `item` axis is only\n * interpretable when combined with its parent `container` axis. An `item` axis\n * index by itself may be non-unique and only gains uniqueness within the context\n * of its parent `container`. Therefore, the `parentAxes` field is essential for\n * mapping these relationships and ensuring data coherence across nested or\n * multi-level data models.\n *\n * A list of zero-based indices of parent axes in the overall axes specification\n * from the column spec. Each index corresponds to the position of a parent axis\n * in the list that defines the structure of the data model.\n */\n readonly parentAxes?: number[];\n}\n\n/** Common type representing spec for all the axes in a column */\nexport type AxesSpec = AxisSpec[];\n\n/**\n * Full column specification including all axes specs and specs of the column\n * itself.\n *\n * A PColumn in its essence represents a mapping from a fixed size, explicitly\n * typed tuple to an explicitly typed value.\n *\n * (axis1Value1, axis2Value1, ...) -> columnValue\n *\n * Each element in tuple correspond to the axis having the same index in axesSpec.\n * */\nexport interface PUniversalColumnSpec extends PObjectSpec {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: 'PColumn';\n\n /** Type of column values */\n readonly valueType: string;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Any additional information attached to the column that does not affect its\n * identifier */\n readonly annotations?: Record<string, string>;\n\n /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */\n readonly parentAxes?: number[];\n\n /** Axes specifications */\n readonly axesSpec: AxesSpec;\n}\n\n/**\n * Specification of a data column.\n *\n * Data column is a specialized type of PColumn that stores only simple values (strings and numbers)\n * addressed by multiple keys. This is in contrast to other PColumn variants that can store more complex\n * values like files or other abstract data types. Data columns are optimized for storing and processing\n * basic tabular data.\n */\nexport interface PDataColumnSpec extends PUniversalColumnSpec {\n /** Type of column values */\n readonly valueType: ValueType;\n}\n\n// @todo: change this to PUniversalColumnSpec\nexport type PColumnSpec = PDataColumnSpec;\n\n/** Unique PColumnSpec identifier */\nexport type PColumnSpecId = {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: 'PColumn';\n\n /** Type of column values */\n readonly valueType: ValueType;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */\n readonly parentAxes?: number[];\n\n /** Axes id */\n readonly axesId: AxesId;\n};\n\nexport function getPColumnSpecId(spec: PColumnSpec): PColumnSpecId {\n return {\n kind: spec.kind,\n valueType: spec.valueType,\n name: spec.name,\n domain: spec.domain,\n parentAxes: spec.parentAxes,\n axesId: getAxesId(spec.axesSpec),\n };\n}\n\nexport interface PColumn<Data> extends PObject<Data> {\n /** PColumn spec, allowing it to be found among other PObjects */\n readonly spec: PColumnSpec;\n}\n\n/** Columns in a PFrame also have internal identifier, this object represents\n * combination of specs and such id */\nexport interface PColumnIdAndSpec {\n /** Internal column id within the PFrame */\n readonly columnId: PObjectId;\n\n /** Column spec */\n readonly spec: PColumnSpec;\n}\n\n/** Get column id and spec from a column */\nexport function getColumnIdAndSpec<Data>(column: PColumn<Data>): PColumnIdAndSpec {\n return {\n columnId: column.id,\n spec: column.spec,\n };\n}\n\n/** Information returned by {@link PFrame.listColumns} method */\nexport interface PColumnInfo extends PColumnIdAndSpec {\n /** True if data was associated with this PColumn */\n readonly hasData: boolean;\n}\n\nexport interface AxisId {\n /** Type of the axis or column value. For an axis should not use non-key\n * types like float or double. */\n readonly type: ValueType;\n\n /** Name of the axis or column */\n readonly name: string;\n\n /** Adds auxiliary information to the axis or column name and type to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n}\n\n/** Array of axis ids */\nexport type AxesId = AxisId[];\n\n/** Extracts axis ids from axis spec */\nexport function getAxisId(spec: AxisSpec): AxisId {\n const { type, name, domain } = spec;\n const result = { type, name };\n if (domain && Object.entries(domain).length > 0) {\n Object.assign(result, { domain });\n }\n return result;\n}\n\n/** Extracts axes ids from axes spec array from column spec */\nexport function getAxesId(spec: AxesSpec): AxesId {\n return spec.map(getAxisId);\n}\n\n/**\n * Canonicalizes axis id\n * @deprecated Use {@link canonicalizeJson} instead to preserve type\n */\nexport function canonicalizeAxisId(id: AxisId): string {\n return canonicalize(getAxisId(id))!;\n}\n\n/** Returns true if all domains from query are found in target */\nfunction matchDomain(query?: Record<string, string>, target?: Record<string, string>) {\n if (query === undefined) return target === undefined;\n if (target === undefined) return true;\n for (const k in target) {\n if (query[k] !== target[k]) return false;\n }\n return true;\n}\n\n/** Returns whether \"match\" axis id is compatible with the \"query\" */\nexport function matchAxisId(query: AxisId, target: AxisId): boolean {\n return query.name === target.name && matchDomain(query.domain, target.domain);\n}\n","import type { PTableColumnId, PTableColumnSpec } from './table_common';\nimport type { PTableVector } from './data_types';\nimport type { PObjectId } from '../../pool';\nimport { assertNever } from '../../util';\nimport type { PColumn } from './spec/spec';\nimport type { PColumnValues } from './data_info';\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'column';\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Axis filter slicing target axis from column axes.\n * If the axis has parents or is a parent, slicing cannot be applied (an error will be thrown).\n * */\nexport interface ConstantAxisFilter {\n /** Filter type discriminator */\n readonly type: 'constant';\n\n /** Index of axis to slice (zero-based) */\n readonly axisIndex: number;\n\n /** Equality filter reference value, see {@link SingleValueEqualPredicate} */\n readonly constant: string | number;\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface SlicedColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'slicedColumn';\n\n /** Local column */\n readonly column: Col;\n\n /** New column id */\n readonly newId: PObjectId;\n\n /** Non-empty list of axis filters */\n readonly axisFilters: ConstantAxisFilter[];\n}\n\n/** Defines a terminal column node in the join request tree */\nexport interface InlineColumnJoinEntry {\n /** Node type discriminator */\n readonly type: 'inlineColumn';\n\n /** Column definition */\n readonly column: PColumn<PColumnValues>;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: 'inner';\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: 'full';\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: 'outer';\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | SlicedColumnJoinEntry<Col>\n | InlineColumnJoinEntry\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: 'IsNA';\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: 'Equal';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueInSetPredicate {\n /** Comparison operator */\n readonly operator: 'InSet';\n\n /** Reference values, NA values will not match */\n readonly references: (string | number)[];\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'IEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: 'Less';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'LessOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: 'Greater';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'GreaterOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: 'StringContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: 'Matches';\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: 'StringContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueInSetPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: 'bySingleColumnV2';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Partition filters */\n readonly partitionFilters: PTableRecordFilter[];\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n};\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(\n def: PTableDef<C1>,\n cb: (c: C1) => C2,\n): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(\n entry: JoinEntry<C1>,\n cb: (c: C1) => C2,\n): JoinEntry<C2> {\n switch (entry.type) {\n case 'column':\n return {\n type: 'column',\n column: cb(entry.column),\n };\n case 'slicedColumn':\n return {\n type: 'slicedColumn',\n column: cb(entry.column),\n newId: entry.newId,\n axisFilters: entry.axisFilters,\n };\n case 'inlineColumn':\n return entry;\n case 'inner':\n case 'full':\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb)),\n };\n case 'outer':\n return {\n type: 'outer',\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb)),\n };\n default:\n assertNever(entry);\n }\n}\n","import type { Branded } from '../../../branding';\nimport type { AnchoredPColumnId } from './selectors';\nimport type { FilteredPColumnId } from './filtered_column';\nimport canonicalize from 'canonicalize';\nimport type { PObjectId } from '../../../pool';\n/**\n * Universal column identifier optionally anchored and optionally filtered.\n */\nexport type UniversalPColumnId = AnchoredPColumnId | FilteredPColumnId;\n\n/**\n * Canonically serialized {@link UniversalPColumnId}.\n */\nexport type SUniversalPColumnId = Branded<PObjectId, 'SUniversalPColumnId', '__pl_model_brand_2__'>;\n\n/**\n * Canonically serializes a {@link UniversalPColumnId} to a string.\n * @param id - The column identifier to serialize\n * @returns The canonically serialized string\n */\nexport function stringifyColumnId(id: UniversalPColumnId): SUniversalPColumnId {\n return canonicalize(id)! as SUniversalPColumnId;\n}\n\n/**\n * Parses a canonically serialized {@link UniversalPColumnId} from a string.\n * @param str - The string to parse\n * @returns The parsed column identifier\n */\nexport function parseColumnId(str: SUniversalPColumnId): UniversalPColumnId {\n return JSON.parse(str) as UniversalPColumnId;\n}\n","import canonicalize from 'canonicalize';\nimport type { PValue } from '../data_types';\nimport type { AxisFilter } from './filtered_column';\nimport type { SUniversalPColumnId, UniversalPColumnId } from './ids';\nimport { stringifyColumnId } from './ids';\nimport type { AAxisSelector, AnchorAxisRef, AnchorAxisRefByIdx, AnchoredPColumnId, AnchoredPColumnSelector, AxisSelector, PColumnSelector } from './selectors';\nimport type { AxisId, PColumnSpec } from './spec';\nimport { getAxisId, matchAxisId } from './spec';\n\n//\n// Helper functions\n//\n\nfunction axisKey(axis: AxisId): string {\n return canonicalize(getAxisId(axis))!;\n}\n\nfunction domainKey(key: string, value: string): string {\n return JSON.stringify([key, value]);\n}\n\n/**\n * Context for resolving and generating anchored references to columns and axes\n * Maintains maps of known domain values and axes that can be referenced by anchors\n */\nexport class AnchoredIdDeriver {\n private readonly domains = new Map<string, string>();\n private readonly axes = new Map<string, AnchorAxisRefByIdx>();\n /**\n * Domain packs are used to group domain keys that can be anchored to the same anchor\n * This is used to optimize the lookup of domain anchors\n */\n private readonly domainPacks: string[][] = [];\n /**\n * Maps domain packs to anchors\n */\n private readonly domainPackToAnchor = new Map<string, string>();\n\n /**\n * Creates a new anchor context from a set of anchor column specifications\n * @param anchors Record of anchor column specifications indexed by anchor ID\n */\n constructor(public readonly anchors: Record<string, PColumnSpec>) {\n const anchorEntries = Object.entries(anchors);\n anchorEntries.sort((a, b) => a[0].localeCompare(b[0]));\n for (const [anchorId, spec] of anchorEntries) {\n for (let axisIdx = 0; axisIdx < spec.axesSpec.length; axisIdx++) {\n const axis = spec.axesSpec[axisIdx];\n const key = axisKey(axis);\n this.axes.set(key, { anchor: anchorId, idx: axisIdx });\n }\n if (spec.domain !== undefined) {\n const domainEntries = Object.entries(spec.domain);\n domainEntries.sort((a, b) => a[0].localeCompare(b[0]));\n\n this.domainPackToAnchor.set(JSON.stringify(domainEntries), anchorId);\n this.domainPacks.push(domainEntries.map(([dKey]) => dKey));\n\n for (const [dKey, dValue] of domainEntries) {\n const key = domainKey(dKey, dValue);\n this.domains.set(key, anchorId);\n }\n }\n }\n }\n\n /**\n * Derives an anchored column identifier from a column specification\n * @param spec Column specification to anchor\n * @returns An anchored column identifier that can be used to identify columns similar to the input specification\n */\n derive(spec: PColumnSpec): AnchoredPColumnId;\n\n /**\n * Derives an anchored column identifier from a column specification\n * @param spec Column specification to anchor\n * @param axisFilters Axis filters to apply to the column\n * @returns An anchored and sliced column identifier that can be used to identify columns similar to the input specification\n */\n derive(spec: PColumnSpec, axisFilters?: AxisFilter[]): UniversalPColumnId;\n\n /**\n * Implementation of derive method\n */\n derive(spec: PColumnSpec, axisFilters?: AxisFilter[]): UniversalPColumnId {\n const result: AnchoredPColumnId = {\n name: spec.name,\n axes: [],\n };\n\n let skipDomains: Set<string> | undefined = undefined;\n if (spec.domain !== undefined) {\n outer:\n for (const domainPack of this.domainPacks) {\n const dAnchor: string[][] = [];\n for (const domainKey of domainPack) {\n const dValue = spec.domain[domainKey];\n if (dValue !== undefined)\n dAnchor.push([domainKey, dValue]);\n else\n break outer;\n }\n const domainAnchor = this.domainPackToAnchor.get(JSON.stringify(dAnchor));\n if (domainAnchor !== undefined) {\n result.domainAnchor = domainAnchor;\n skipDomains = new Set(domainPack);\n break;\n }\n }\n }\n\n for (const [dKey, dValue] of Object.entries(spec.domain ?? {})) {\n if (skipDomains !== undefined && skipDomains.has(dKey))\n continue;\n const key = domainKey(dKey, dValue);\n const anchorId = this.domains.get(key);\n result.domain ??= {};\n result.domain[dKey] = anchorId ? { anchor: anchorId } : dValue;\n }\n\n result.axes = spec.axesSpec.map((axis) => {\n const key = axisKey(axis);\n const anchorAxisRef = this.axes.get(key);\n if (anchorAxisRef === undefined) return getAxisId(axis);\n else return anchorAxisRef;\n });\n\n // If no axis filters are provided, return the anchored ID as is\n if (!axisFilters || axisFilters.length === 0) {\n return result;\n }\n\n // Process axis filters and create a sliced column ID\n const resolvedFilters: [number, PValue][] = [];\n\n for (const filter of axisFilters) {\n const [axisIdOrIndex, value] = filter;\n\n // If it's already a numeric index, validate it\n if (typeof axisIdOrIndex === 'number') {\n if (axisIdOrIndex < 0 || axisIdOrIndex >= spec.axesSpec.length) {\n throw new Error(`Axis index ${axisIdOrIndex} is out of bounds (0-${spec.axesSpec.length - 1})`);\n }\n resolvedFilters.push([axisIdOrIndex, value]);\n } else {\n // If it's a string (axis name), resolve it to an index\n const axisIndex = spec.axesSpec.findIndex((axis) => axis.name === axisIdOrIndex);\n if (axisIndex === -1) {\n throw new Error(`Axis with name \"${axisIdOrIndex}\" not found in the column specification`);\n }\n resolvedFilters.push([axisIndex, value]);\n }\n }\n\n // Sort filters by axis index to ensure consistency\n resolvedFilters.sort((a, b) => a[0] - b[0]);\n\n return {\n source: result,\n axisFilters: resolvedFilters,\n };\n }\n\n /**\n * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column\n * @param spec Column specification to anchor\n * @param axisFilters Optional axis filters to apply to the column\n * @returns A canonicalized string representation of the anchored column identifier\n */\n deriveS(spec: PColumnSpec, axisFilters?: AxisFilter[]): SUniversalPColumnId {\n return stringifyColumnId(this.derive(spec, axisFilters));\n }\n}\n\n/**\n * Options for the resolveAnchors function\n */\nexport type ResolveAnchorsOptions = {\n /**\n * If true, missing domain keys in anchors will be ignored.\n * If false (default), an error will be thrown.\n */\n ignoreMissingDomains?: boolean;\n};\n\n/**\n * Resolves anchored references in a column matcher to create a non-anchored matcher.\n * Doing an opposite operation to {@link AnchorIdDeriver.derive()}.\n *\n * @param anchors - Record of anchor column specifications indexed by anchor id\n * @param matcher - An anchored column matcher (or id, which is subtype of it) containing references that need to be resolved\n * @param options - Options for resolving anchors\n * @returns A non-anchored column matcher with all references resolved to actual values\n */\nexport function resolveAnchors(anchors: Record<string, PColumnSpec>, matcher: AnchoredPColumnSelector, options?: ResolveAnchorsOptions): PColumnSelector {\n const result = { ...matcher };\n const ignoreMissingDomains = options?.ignoreMissingDomains ?? false;\n\n if (result.domainAnchor !== undefined) {\n const anchorSpec = anchors[result.domainAnchor];\n if (!anchorSpec)\n throw new Error(`Anchor \"${result.domainAnchor}\" not found`);\n\n const anchorDomains = anchorSpec.domain || {};\n result.domain = { ...anchorDomains, ...result.domain };\n delete result.domainAnchor;\n }\n\n if (result.domain) {\n const resolvedDomain: Record<string, string> = {};\n for (const [key, value] of Object.entries(result.domain)) {\n if (typeof value === 'string') {\n resolvedDomain[key] = value;\n } else {\n // It's an AnchorDomainRef\n const anchorSpec = anchors[value.anchor];\n if (!anchorSpec)\n throw new Error(`Anchor \"${value.anchor}\" not found for domain key \"${key}\"`);\n\n if (!anchorSpec.domain || anchorSpec.domain[key] === undefined) {\n if (!ignoreMissingDomains)\n throw new Error(`Domain key \"${key}\" not found in anchor \"${value.anchor}\"`);\n continue;\n }\n\n resolvedDomain[key] = anchorSpec.domain[key];\n }\n }\n result.domain = resolvedDomain;\n }\n\n if (result.axes)\n result.axes = result.axes.map((axis) => resolveAxisReference(anchors, axis));\n\n return result as PColumnSelector;\n}\n\n/**\n * Resolves an anchored axis reference to a concrete AxisId\n */\nfunction resolveAxisReference(anchors: Record<string, PColumnSpec>, axisRef: AAxisSelector): AxisSelector {\n if (!isAnchorAxisRef(axisRef))\n return axisRef;\n\n // It's an anchored reference\n const anchorId = axisRef.anchor;\n const anchorSpec = anchors[anchorId];\n if (!anchorSpec)\n throw new Error(`Anchor \"${anchorId}\" not found for axis reference`);\n\n if ('idx' in axisRef) {\n // AnchorAxisRefByIdx\n if (axisRef.idx < 0 || axisRef.idx >= anchorSpec.axesSpec.length)\n throw new Error(`Axis index ${axisRef.idx} out of bounds for anchor \"${anchorId}\"`);\n return anchorSpec.axesSpec[axisRef.idx];\n } else if ('name' in axisRef) {\n // AnchorAxisRefByName\n const matches = anchorSpec.axesSpec.filter((axis) => axis.name === axisRef.name);\n if (matches.length > 1)\n throw new Error(`Multiple axes with name \"${axisRef.name}\" found in anchor \"${anchorId}\"`);\n if (matches.length === 0)\n throw new Error(`Axis with name \"${axisRef.name}\" not found in anchor \"${anchorId}\"`);\n return matches[0];\n } else if ('id' in axisRef) {\n // AnchorAxisRefByMatcher\n const matches = anchorSpec.axesSpec.filter((axis) => matchAxisId(axisRef.id, getAxisId(axis)));\n if (matches.length > 1)\n throw new Error(`Multiple matching axes found for matcher in anchor \"${anchorId}\"`);\n if (matches.length === 0)\n throw new Error(`No matching axis found for matcher in anchor \"${anchorId}\"`);\n return matches[0];\n }\n\n throw new Error(`Unsupported axis reference type`);\n}\n\n/**\n * Type guard to check if a value is an anchored axis reference\n */\nfunction isAnchorAxisRef(value: AAxisSelector): value is AnchorAxisRef {\n return typeof value === 'object' && 'anchor' in value;\n}\n","import type { Branded } from '../branding';\nimport type { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\nimport type { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport interface PObjectSpec {\n /** PObject kind discriminator */\n readonly kind: string;\n\n /** Name is common part of PObject identity */\n readonly name: string;\n\n /** Domain is a set of key-value pairs that can be used to identify the object */\n readonly domain?: Record<string, string>;\n\n /** Additional information attached to the object */\n readonly annotations?: Record<string, string>;\n}\n\n/** Stable PObject id */\nexport type PObjectId = Branded<string, 'PColumnId'>;\n\n/**\n * Full PObject representation.\n *\n * @template Data type of the object referencing or describing the \"data\" part of the PObject\n * */\nexport interface PObject<Data> {\n /** Fully rendered PObjects are assigned a stable identifier. */\n readonly id: PObjectId;\n\n /** PObject spec, allowing it to be found among other PObjects */\n readonly spec: PObjectSpec;\n\n /** A handle to data object */\n readonly data: Data;\n}\n\nexport function isPColumnSpec(spec: PObjectSpec): spec is PColumnSpec {\n return spec.kind === 'PColumn';\n}\n\nexport function isPColumn<T>(obj: PObject<T>): obj is PColumn<T> {\n return isPColumnSpec(obj.spec);\n}\n\nexport function isPColumnSpecResult(\n r: ResultPoolEntry<PObjectSpec>,\n): r is ResultPoolEntry<PColumnSpec> {\n return isPColumnSpec(r.obj);\n}\n\nexport function isPColumnResult<T>(\n r: ResultPoolEntry<PObject<T>>,\n): r is ResultPoolEntry<PColumn<T>> {\n return isPColumnSpec(r.obj.spec);\n}\n\nexport function ensurePColumn<T>(obj: PObject<T>): PColumn<T> {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n}\n\nexport function mapPObjectData<D1, D2>(pObj: PColumn<D1>, cb: (d: D1) => D2): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | undefined,\n cb: (d: D1) => D2\n): PColumn<D2> | undefined;\nexport function mapPObjectData<D1, D2>(pObj: PObject<D1>, cb: (d: D1) => D2): PObject<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2\n): PObject<D2> | undefined;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined {\n return pObj === undefined\n ? undefined\n : {\n ...pObj,\n data: cb(pObj.data),\n };\n}\n\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case 'column':\n columns.set(entry.column.id, entry.column);\n return;\n case 'slicedColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'inlineColumn':\n return;\n case 'full':\n case 'inner':\n for (const e of entry.entries) addAllColumns(e);\n return;\n case 'outer':\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n","import { isPColumnSpec, type PObjectSpec } from '../../../pool';\nimport type { AxisId, PColumnSpec, ValueType } from './spec';\nimport { getAxisId } from './spec';\n\n/**\n * Defines a pattern for matching axes within the PFrame data model.\n *\n * AxisSelector provides a flexible way to identify axes based on their\n * properties. All fields are optional, allowing for partial matching.\n * When multiple properties are specified, all must match for an axis\n * to be selected (logical AND).\n *\n * This interface is used in various selection and matching operations\n * throughout the PFrame system, such as column queries and axis lookups.\n */\nexport interface AxisSelector {\n /**\n * Optional value type to match against.\n * When specified, only axes with this exact type will match.\n * Can be a single type or an array of types to match against any of them.\n * Valid types include: 'Int', 'Long', 'Float', 'Double', 'String', 'Bytes'.\n */\n type?: ValueType | ValueType[];\n\n /**\n * Optional name to match against.\n * When specified, only axes with this exact name will match.\n */\n name?: string;\n\n /**\n * Optional domain key-value pairs to match against.\n * Domains provide additional context to uniquely identify an axis beyond its name and type.\n * When specified, an axis will match only if it contains all the key-value pairs defined here.\n * An axis with additional domain entries not present in this selector will still match.\n */\n domain?: Record<string, string>;\n}\n\n/**\n * Reference to an axis by its numerical index within the anchor column's axes array\n * Format: [anchorId, axisIndex]\n */\nexport type AnchorAxisRefByIdx = { anchor: string; idx: number };\n\n/**\n * Reference to an axis by its name within the anchor column\n * Format: [anchorId, axisName]\n */\nexport type AnchorAxisRefByName = { anchor: string; name: string };\n\n/**\n * Reference to an axis using an AxisId matcher within the anchor\n * Format: [anchorId, axisMatcher]\n */\nexport type AnchorAxisRefByMatcher = { anchor: string; id: AxisId };\n\n/**\n * Basic anchor axis reference that can be either by index or a direct AxisId\n */\nexport type AnchorAxisIdOrRefBasic = AnchorAxisRefByIdx | AxisId;\n\n/** Union of all possible ways to reference an axis in an anchored context */\nexport type AnchorAxisRef = AnchorAxisRefByIdx | AnchorAxisRefByName | AnchorAxisRefByMatcher;\n\n/** Reference to a domain value through an anchor */\nexport type AnchorDomainRef = { anchor: string };\n\n/**\n * Domain value that can be either a direct string value or a reference to a domain through an anchor\n * Used to establish domain context that can be resolved relative to other anchored columns\n */\nexport type ADomain = string | AnchorDomainRef;\n/**\n * Axis identifier that can be either a direct AxisId or a reference to an axis through an anchor\n * Allows referring to axes in a way that can be resolved in different contexts\n */\nexport type AAxisSelector = AxisSelector | AnchorAxisRef;\n\n/**\n * Match resolution strategy for PColumns\n * Specifies how to handle when multiple columns match the criteria\n * (default is \"expectSingle\")\n */\nexport type AnchoredColumnMatchStrategy = 'expectSingle' | 'expectMultiple' | 'takeFirst';\n\n/**\n * Matcher for PColumns in an anchored context\n * Supports partial matching on axes, allowing for flexible column discovery\n */\nexport interface AnchoredPColumnSelector {\n /** Optional name of the column to match; can't be used together with namePattern */\n name?: string;\n /** Optional regexp pattern for column name matching; can't be used together with name */\n namePattern?: string;\n /** Optional value type to match. If an array is provided, matches if the column's type is any of the specified types */\n type?: ValueType | ValueType[];\n /** If specified, the domain values must be anchored to this anchor */\n domainAnchor?: string;\n /** Optional domain values to match, can include anchored references, if domainAnchor is specified,\n * interpreted as additional domains to domain from the anchor */\n domain?: Record<string, ADomain>;\n /** Optional axes to match, can include anchored references */\n axes?: AAxisSelector[];\n /** When true, allows matching if only a subset of axes match */\n partialAxesMatch?: boolean;\n /** Optional annotations to match with exact values */\n annotations?: Record<string, string>;\n /** Optional annotation patterns to match with regex patterns */\n annotationPatterns?: Record<string, string>;\n /** Match resolution strategy, default is \"expectSingle\" */\n matchStrategy?: AnchoredColumnMatchStrategy;\n}\n\n/**\n * Matcher for PColumns in a non-anchored context\n */\nexport interface PColumnSelector extends AnchoredPColumnSelector {\n domainAnchor?: never;\n domain?: Record<string, string>;\n axes?: AxisSelector[];\n}\n\n/**\n * Strict identifier for PColumns in an anchored context\n * Unlike APColumnMatcher, this requires exact matches on domain and axes\n */\nexport interface AnchoredPColumnId extends AnchoredPColumnSelector {\n /** Name is required for exact column identification */\n name: string;\n /** No namePattern in ID */\n namePattern?: never;\n /** Type is not used in exact column identification */\n type?: never;\n /** Full axes specification using only basic references */\n axes: AnchorAxisIdOrRefBasic[];\n /** Partial axes matching is not allowed for exact identification */\n partialAxesMatch?: never;\n /** Annotations are not used in exact column identification */\n annotations?: never;\n /** Annotation patterns are not used in exact column identification */\n annotationPatterns?: never;\n /** \"Id\" implies single match strategy */\n matchStrategy?: never;\n}\n\n/**\n * Determines if an axis ID matches an axis selector.\n *\n * @param selector - The selector with criteria to match against\n * @param axis - The AxisId to check against the selector\n * @returns true if the AxisId matches all specified criteria in the selector, false otherwise\n */\nexport function matchAxis(selector: AxisSelector, axis: AxisId): boolean {\n // Match name if specified\n if (selector.name !== undefined && selector.name !== axis.name)\n return false;\n\n // Match type if specified\n if (selector.type !== undefined) {\n if (Array.isArray(selector.type)) {\n if (!selector.type.includes(axis.type))\n return false;\n } else if (selector.type !== axis.type) {\n return false;\n }\n }\n\n // Match domain if specified - using existing logic from matchAxisId\n if (selector.domain !== undefined) {\n const axisDomain = axis.domain || {};\n for (const [key, value] of Object.entries(selector.domain))\n if (axisDomain[key] !== value)\n return false;\n }\n\n return true;\n}\n\n/**\n * Determines if a given PColumnSpec matches a selector.\n *\n * @param pcolumn - The PColumnSpec to check against the selector\n * @param selector - The selector criteria to match against\n * @returns true if the PColumnSpec matches all criteria in the selector, false otherwise\n */\nexport function matchPColumn(pcolumn: PColumnSpec, selector: PColumnSelector): boolean {\n // Match name if specified\n if (selector.name !== undefined && pcolumn.name !== selector.name)\n return false;\n\n // Match name pattern if specified\n if (selector.namePattern !== undefined && !new RegExp(selector.namePattern).test(pcolumn.name))\n return false;\n\n // Match type if specified\n if (selector.type !== undefined) {\n if (Array.isArray(selector.type)) {\n if (!selector.type.includes(pcolumn.valueType))\n return false;\n } else if (selector.type !== pcolumn.valueType) {\n return false;\n }\n }\n\n // Match domain if specified\n if (selector.domain !== undefined) {\n const columnDomain = pcolumn.domain || {};\n for (const [key, value] of Object.entries(selector.domain))\n if (columnDomain[key] !== value)\n return false;\n }\n\n // Match axes if specified\n if (selector.axes !== undefined) {\n const pcolumnAxes = pcolumn.axesSpec.map(getAxisId);\n\n if (selector.partialAxesMatch) {\n // For partial matching, all selector axes must match at least one column axis\n for (const selectorAxis of selector.axes)\n if (!pcolumnAxes.some((columnAxis) => matchAxis(selectorAxis, columnAxis)))\n return false;\n } else {\n // For exact matching, column must have the same number of axes and all must match\n if (pcolumnAxes.length !== selector.axes.length)\n return false;\n\n // Each selector axis must match a corresponding column axis\n for (let i = 0; i < selector.axes.length; i++)\n if (!matchAxis(selector.axes[i], pcolumnAxes[i]))\n return false;\n }\n }\n\n // Match annotations if specified\n if (selector.annotations !== undefined) {\n const columnAnnotations = pcolumn.annotations || {};\n for (const [key, value] of Object.entries(selector.annotations))\n if (columnAnnotations[key] !== value)\n return false;\n }\n\n // Match annotation patterns if specified\n if (selector.annotationPatterns !== undefined) {\n const columnAnnotations = pcolumn.annotations || {};\n for (const [key, pattern] of Object.entries(selector.annotationPatterns)) {\n const value = columnAnnotations[key];\n if (value === undefined || !new RegExp(pattern).test(value))\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Convert a predicate or array of selectors to a single predicate function\n * @param predicateOrSelectors - Either a function that takes a PColumnSpec and returns a boolean,\n * or an array of PColumnSelectors, or a single PColumnSelector\n * @returns A function that takes a PColumnSpec and returns a boolean\n */\nexport function selectorsToPredicate(predicateOrSelectors: PColumnSelector | PColumnSelector[]): ((spec: PObjectSpec) => boolean) {\n if (Array.isArray(predicateOrSelectors))\n return (spec) => predicateOrSelectors.some((selector) => isPColumnSpec(spec) && matchPColumn(spec, selector));\n else\n return (spec) => isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);\n}\n","import type { Branded } from '../../../branding';\nimport { isPColumnSpec, type PObjectSpec } from '../../../pool';\nimport { getAxesId } from './spec';\nimport canonicalize from 'canonicalize';\nexport type NativePObjectId = Branded<string, 'NativePObjectId'>;\n\nexport function deriveNativeId(spec: PObjectSpec): NativePObjectId {\n const result: Record<string, unknown> = {\n kind: spec.kind,\n name: spec.name,\n };\n if (spec.domain !== undefined)\n result.domain = spec.domain;\n if (isPColumnSpec(spec))\n result.axesSpec = getAxesId(spec.axesSpec);\n return canonicalize(result) as NativePObjectId;\n}\n","import { z } from 'zod';\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe('Crucial marker for the block dependency tree reconstruction'),\n blockId: z.string()\n .describe('Upstream block id'),\n name: z.string()\n .describe('Name of the output provided to the upstream block\\'s output context'),\n requireEnrichments: z.literal(true).optional()\n .describe('True if current block that stores this reference in its args, may need enrichments '\n + 'for the references value originating from the blocks in between current and referenced block'),\n })\n .describe(\n 'Universal reference type, allowing to set block connections. It is crucial that '\n + '{@link __isRef} is present and equal to true, internal logic relies on this marker '\n + 'to build block dependency trees.',\n )\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/**\n * Type guard to check if a value is a PlRef.\n *\n * @param value - The value to check.\n * @returns True if the value is a PlRef, false otherwise.\n */\nexport function isPlRef(value: unknown): value is PlRef {\n return (\n typeof value === 'object'\n && value !== null\n && '__isRef' in value\n && (value as { __isRef: unknown }).__isRef === true\n && 'blockId' in value\n && 'name' in value\n );\n}\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/**\n * Creates a PlRef with the given blockId and name.\n *\n * @param blockId - The blockId of the reference.\n * @param name - The name of the reference.\n * @param requireEnrichments - Whether the reference requires enrichments.\n */\nexport function createPlRef(blockId: string, name: string, requireEnrichments: boolean = false) {\n if (requireEnrichments)\n return {\n __isRef: true,\n blockId,\n name,\n requireEnrichments: true,\n };\n else\n return {\n __isRef: true,\n blockId,\n name,\n };\n}\n\n/**\n * Creates a new PlRef based on an existing one, explicitly setting (default) or removing the\n * requireEnrichments property.\n *\n * @param ref - The original PlRef object.\n * @param requireEnrichments - If true, the `requireEnrichments: true` property is added\n * to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.\n * @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.\n */\nexport function withEnrichments(ref: PlRef, requireEnrichments: boolean = true): PlRef {\n if (requireEnrichments)\n return {\n ...ref,\n requireEnrichments: true,\n };\n else {\n const { requireEnrichments: _, ...rest } = ref;\n return rest;\n }\n}\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef, ignoreEnrichments: boolean = false) {\n return ref1.blockId === ref2.blockId && ref1.name === ref2.name && (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments);\n}\n","export type ValueOrError<V, E> =\n | {\n ok: true;\n value: V;\n }\n | {\n ok: false;\n error: E;\n };\n\nexport function mapValueInVOE<V1, V2, E>(\n voe: ValueOrError<V1, E>,\n cb: (value: V1) => V2,\n): ValueOrError<V2, E> {\n return voe.ok ? { ok: true, value: cb(voe.value) } : voe;\n}\n","import { z } from 'zod';\nimport { base32Encode } from './base32_encode';\n\n/** Number of raw bytes in the PlId. */\nexport const PlIdBytes = 15;\n/** Characters in string representation */\nexport const PlIdLength = 24; // = 15 bytes * 8 bits / 5 bits per char in base32\n\nexport const PlId = z\n .string()\n .length(PlIdLength)\n .regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/) // RFC4648\n .brand('PlId');\nexport type PlId = z.infer<typeof PlId>;\n\nexport function uniquePlId(): PlId {\n const data = new Uint8Array(PlIdBytes);\n crypto.getRandomValues(data);\n return PlId.parse(base32Encode(data, 'RFC4648'));\n}\n\nexport function plId(bytes: Uint8Array): PlId {\n if (bytes.length !== PlIdBytes) throw new Error(`Wrong number of bytes: ${bytes.length}`);\n return PlId.parse(base32Encode(bytes, 'RFC4648'));\n}\n\nexport async function digestPlId(data: string): Promise<PlId> {\n const encoder = new TextEncoder();\n const bytes = await crypto.subtle.digest('SHA-256', encoder.encode(data));\n return plId(new Uint8Array(bytes.slice(0, 15)));\n}\n"],"names":["z","assertNever","x","uploadPrefix","indexPrefix","isImportFileHandleUpload","handle","isImportFileHandleIndex","getFilePathFromHandle","trimmed","extractFileName","filePath","getFileNameFromHandle","isDataInfo","value","data","mapDataInfo","dataInfo","mapFn","newParts","key","blob","chunk","isDataInfoEntries","isPartitionedDataInfoEntries","dataInfoToEntries","entries","keyStr","parts","entriesToDataInfo","dataInfoEntries","entry","getAxisId","spec","type","name","domain","result","getAxesId","canonicalizeAxisId","id","canonicalize","matchDomain","query","target","k","matchAxisId","mapPTableDef","def","cb","mapJoinEntry","col","stringifyColumnId","axisKey","axis","domainKey","AnchoredIdDeriver","anchors","__publicField","anchorEntries","a","b","anchorId","axisIdx","domainEntries","dKey","dValue","axisFilters","skipDomains","outer","domainPack","dAnchor","domainAnchor","anchorAxisRef","resolvedFilters","filter","axisIdOrIndex","axisIndex","resolveAnchors","matcher","options","ignoreMissingDomains","anchorSpec","anchorDomains","resolvedDomain","resolveAxisReference","axisRef","isAnchorAxisRef","matches","isPColumnSpec","isPColumn","obj","ensurePColumn","mapPObjectData","pObj","extractAllColumns","columns","addAllColumns","e","matchAxis","selector","axisDomain","matchPColumn","pcolumn","columnDomain","pcolumnAxes","selectorAxis","columnAxis","i","columnAnnotations","pattern","selectorsToPredicate","predicateOrSelectors","deriveNativeId","isPlRef","withEnrichments","ref","requireEnrichments","_","rest","mapValueInVOE","voe","PlIdLength"],"mappings":";;;AAyB0BA,EAAE,OAAO;AAAA;AAAA,EAEjC,MAAMA,EAAE,OAAO;AAAA;AAAA,EAEf,IAAIA,EAAE,OAAO;AACf,CAAC;AC9BM,SAASC,EAAYC,GAAiB;AACrC,QAAA,IAAI,MAAM,wBAAwBA,CAAC;AAC3C;ACGA,MAAMC,IAAe,oBACfC,IAAc;AASb,SAASC,EACdC,GACkC;AAC3BA,SAAAA,EAAO,WAAWH,CAAY;AACvC;AAEO,SAASI,EAAwBD,GAA2D;AAC1FA,SAAAA,EAAO,WAAWF,CAAW;AACtC;AA0GO,SAASI,EAAsBF,GAAkC;AAClEC,MAAAA,EAAwBD,CAAM,GAAG;AACnC,UAAMG,IAAUH,EAAO,MAAMF,EAAY,MAAM;AAE/C,WADa,KAAK,MAAM,mBAAmBK,CAAO,CAAC,EACvC;AAAA,EAAA,WACHJ,EAAyBC,CAAM,GAAG;AAC3C,UAAMG,IAAUH,EAAO,MAAMH,EAAa,MAAM;AAEhD,WADa,KAAK,MAAM,mBAAmBM,CAAO,CAAC,EACvC;AAAA,EAAA;AAGdR,EAAAA,EAAYK,CAAM;AACpB;AAEA,SAASI,EAAgBC,GAAkB;AAClCA,SAAAA,EAAS,QAAQ,YAAY,EAAE;AACxC;AAGO,SAASC,EAAsBN,GAAkC;AAC/DI,SAAAA,EAAgBF,EAAsBF,CAAM,CAAC;AACtD;AC9CO,SAASO,EAAiBC,GAAyC;AACpE,MAAA,CAACA,KAAS,OAAOA,KAAU;AACtB,WAAA;AAGT,QAAMC,IAAOD;AACT,MAAA,EAAE,UAAUC;AACP,WAAA;AAGT,UAAQA,EAAK,MAAM;AAAA,IACjB,KAAK;AAED,aAAA,OAAOA,EAAK,aAAc,YACvBA,EAAK,SAAS,UACd,OAAOA,EAAK,QAAS;AAAA,IAE5B,KAAK;AAED,aAAA,OAAOA,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IAAa;AAEN1H,EACjB,OAAA,EACA,OAAO0H,CAAU,EACjB,MAAM,oCAAoC,EAC1C,MAAM,MAAM;"}
@@ -1,10 +1,10 @@
1
1
  import { isDataInfo as ae, extractAllColumns as Ee, mapPTableDef as Te, selectorsToPredicate as W, withEnrichments as ce, AnchoredIdDeriver as he, isPlRef as Fe, mapValueInVOE as ke, mapPObjectData as le, ensurePColumn as Oe, isPColumnSpec as z, isPColumn as be, resolveAnchors as pe, deriveNativeId as De, isPartitionedDataInfoEntries as Re, getAxisId as de, entriesToDataInfo as $e, isDataInfoEntries as _e, dataInfoToEntries as Ke, canonicalizeAxisId as je, mapDataInfo as Ne } from "../../../lib/model/common/dist/index.js";
2
- import { PlIdLength as _t, getAxesId as wt, getFileNameFromHandle as Pt, getFilePathFromHandle as At, isImportFileHandleIndex as xt, isImportFileHandleUpload as It, mapJoinEntry as St, matchAxis as Ct, matchAxisId as Lt, matchPColumn as Et, stringifyColumnId as Tt } from "../../../lib/model/common/dist/index.js";
2
+ import { PlIdLength as _t, getAxesId as wt, getFileNameFromHandle as Pt, getFilePathFromHandle as At, isImportFileHandleIndex as xt, isImportFileHandleUpload as It, mapJoinEntry as St, matchAxis as Lt, matchAxisId as Ct, matchPColumn as Et, stringifyColumnId as Tt } from "../../../lib/model/common/dist/index.js";
3
3
  import we from "../../../_virtual/canonicalize.js";
4
4
  import K from "../../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.js";
5
5
  import { BasePlErrorLike as kt, ErrorLike as Ot, PlErrorLike as Dt, StandardErrorLike as Rt } from "../../../lib/model/pl-error-like/dist/index.js";
6
6
  var Be = Object.defineProperty, Ve = (n, e, t) => e in n ? Be(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, I = (n, e, t) => Ve(n, typeof e != "symbol" ? e + "" : e, t);
7
- function Q(n) {
7
+ function X(n) {
8
8
  return { type: "Immediate", value: n };
9
9
  }
10
10
  function Je() {
@@ -283,20 +283,20 @@ const We = "staging", He = "main", qe = "pl7.app/label", Ge = "pl7.app/trace", z
283
283
  importance: K.number().optional(),
284
284
  id: K.string().optional(),
285
285
  label: K.string()
286
- }), Xe = K.array(ze), Ye = 1e-3, Qe = "__LABEL__", fe = "__LABEL__@1";
286
+ }), Ye = K.array(ze), Qe = 1e-3, Xe = "__LABEL__", fe = "__LABEL__@1";
287
287
  function Ae(n, e, t = {}) {
288
288
  const r = /* @__PURE__ */ new Map(), i = t.forceTraceElements !== void 0 && t.forceTraceElements.length > 0 ? new Set(t.forceTraceElements) : void 0, s = /* @__PURE__ */ new Map(), o = n.map((f) => {
289
289
  var P, u;
290
290
  const h = e(f);
291
- let v, C, L;
292
- "spec" in h && typeof h.spec == "object" ? (v = h.spec, C = h.prefixTrace, L = h.suffixTrace) : v = h;
293
- const p = (P = v.annotations) == null ? void 0 : P[qe], A = (u = v.annotations) == null ? void 0 : u[Ge], d = (A ? Xe.safeParse(JSON.parse(A)).data : void 0) ?? [], g = [
294
- ...C ?? [],
291
+ let v, L, C;
292
+ "spec" in h && typeof h.spec == "object" ? (v = h.spec, L = h.prefixTrace, C = h.suffixTrace) : v = h;
293
+ const p = (P = v.annotations) == null ? void 0 : P[qe], A = (u = v.annotations) == null ? void 0 : u[Ge], d = (A ? Ye.safeParse(JSON.parse(A)).data : void 0) ?? [], g = [
294
+ ...L ?? [],
295
295
  ...d,
296
- ...L ?? []
296
+ ...C ?? []
297
297
  ];
298
298
  if (p !== void 0) {
299
- const x = { label: p, type: Qe, importance: -2 };
299
+ const x = { label: p, type: Xe, importance: -2 };
300
300
  t.addLabelAsSuffix ? g.push(x) : g.splice(0, 0, x);
301
301
  }
302
302
  const m = [], T = /* @__PURE__ */ new Map();
@@ -308,7 +308,7 @@ function Ae(n, e, t = {}) {
308
308
  k,
309
309
  Math.max(
310
310
  r.get(k) ?? Number.NEGATIVE_INFINITY,
311
- O - (g.length - x) * Ye
311
+ O - (g.length - x) * Qe
312
312
  )
313
313
  ), m.push({ ...g[x], fullType: k, occurrenceIndex: R });
314
314
  }
@@ -325,17 +325,17 @@ function Ae(n, e, t = {}) {
325
325
  const N = (f, P = !1) => {
326
326
  const u = [];
327
327
  for (let h = 0; h < o.length; h++) {
328
- const v = o[h], C = v.fullTrace.filter((A) => f.has(A.fullType) || i && i.has(A.type));
329
- if (C.length === 0)
328
+ const v = o[h], L = v.fullTrace.filter((A) => f.has(A.fullType) || i && i.has(A.type));
329
+ if (L.length === 0)
330
330
  if (P)
331
331
  u.push({
332
332
  label: "Unlabeled",
333
333
  value: v.value
334
334
  });
335
335
  else return;
336
- const L = C.map((A) => A.label), p = t.separator ?? " / ";
336
+ const C = L.map((A) => A.label), p = t.separator ?? " / ";
337
337
  u.push({
338
- label: L.join(p),
338
+ label: C.join(p),
339
339
  value: v.value
340
340
  });
341
341
  }
@@ -357,7 +357,7 @@ function Ae(n, e, t = {}) {
357
357
  }
358
358
  return N(/* @__PURE__ */ new Set([...a, ...l]), !0);
359
359
  }
360
- const H = "PColumnData/", ne = H + "ResourceMap", ie = H + "Partitioned/ResourceMap", U = H + "JsonPartitioned", j = H + "BinaryPartitioned", xe = H + "Partitioned/", Y = xe + "JsonPartitioned", M = xe + "BinaryPartitioned", se = (n) => {
360
+ const H = "PColumnData/", ne = H + "ResourceMap", ie = H + "Partitioned/ResourceMap", U = H + "JsonPartitioned", j = H + "BinaryPartitioned", xe = H + "Partitioned/", Q = xe + "JsonPartitioned", M = xe + "BinaryPartitioned", se = (n) => {
361
361
  if (n.endsWith(".index"))
362
362
  return { baseKey: n.substring(0, n.length - 6), type: "index" };
363
363
  if (n.endsWith(".values"))
@@ -380,7 +380,7 @@ function Ze(n) {
380
380
  i = t.partitionKeyLength;
381
381
  break;
382
382
  case M:
383
- case Y:
383
+ case Q:
384
384
  i = t.superPartitionKeyLength + t.partitionKeyLength;
385
385
  break;
386
386
  }
@@ -396,7 +396,7 @@ function Ze(n) {
396
396
  break;
397
397
  case ie:
398
398
  case M:
399
- case Y:
399
+ case Q:
400
400
  for (const s of n.listInputFields()) {
401
401
  const o = [...JSON.parse(s)], a = n.resolve({ field: s, assertFieldType: "Input" });
402
402
  if (a !== void 0)
@@ -449,7 +449,7 @@ function tt(n) {
449
449
  function oe(n, e = []) {
450
450
  if (n === void 0 || !n.getIsReadyOrError()) return;
451
451
  const t = n.resourceType.name, r = n.getDataAsJson();
452
- if (e.length > 0 && (t === Y || t === M))
452
+ if (e.length > 0 && (t === Q || t === M))
453
453
  throw new Error(`Unexpected nested super-partitioned resource: ${t}`);
454
454
  switch (t) {
455
455
  case ne:
@@ -498,7 +498,7 @@ function oe(n, e = []) {
498
498
  parts: i
499
499
  };
500
500
  }
501
- case Y: {
501
+ case Q: {
502
502
  if (typeof (r == null ? void 0 : r.superPartitionKeyLength) != "number" || typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
503
503
  throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${t}`);
504
504
  const i = r.superPartitionKeyLength + r.partitionKeyLength, s = [];
@@ -708,20 +708,20 @@ class me {
708
708
  v = pe(r.anchors, u, t);
709
709
  } else
710
710
  v = u;
711
- const C = /* @__PURE__ */ new Set(), L = [];
711
+ const L = /* @__PURE__ */ new Set(), C = [];
712
712
  for (const d of this.providers) {
713
713
  const g = d.selectColumns(v);
714
714
  for (const m of g) {
715
715
  if (y(m.spec)) continue;
716
- if (C.has(m.id))
716
+ if (L.has(m.id))
717
717
  throw new Error(`Duplicate column id ${m.id} in provider ${d.constructor.name}`);
718
718
  const T = De(m.spec);
719
- F.has(T) || (C.add(m.id), F.add(T), L.push(m));
719
+ F.has(T) || (L.add(m.id), F.add(T), C.push(m));
720
720
  }
721
721
  }
722
- if (L.length === 0) continue;
722
+ if (C.length === 0) continue;
723
723
  const p = ut(u), A = p.length > 0;
724
- for (const d of L) {
724
+ for (const d of C) {
725
725
  if (!z(d.spec)) continue;
726
726
  const g = d.spec;
727
727
  if (A) {
@@ -762,8 +762,8 @@ class me {
762
762
  const Se = { ...g, axesSpec: k };
763
763
  for (const _ of O) {
764
764
  const V = _.map((D, $) => {
765
- const q = Ie[$], Ce = de(g.axesSpec[q]), ue = B[$], Le = (ue == null ? void 0 : ue[D]) ?? String(D);
766
- return { axisIdx: q, axisId: Ce, value: D, label: Le };
765
+ const q = Ie[$], Le = de(g.axesSpec[q]), ue = B[$], Ce = (ue == null ? void 0 : ue[D]) ?? String(D);
766
+ return { axisIdx: q, axisId: Le, value: D, label: Ce };
767
767
  });
768
768
  E.push({
769
769
  type: "split",
@@ -793,9 +793,9 @@ class me {
793
793
  l
794
794
  ), P = [];
795
795
  for (const { value: u, label: h } of f) {
796
- const { originalColumn: v, spec: C } = u, L = u.type === "split" ? u.axisFilters : void 0, p = at(L);
796
+ const { originalColumn: v, spec: L } = u, C = u.type === "split" ? u.axisFilters : void 0, p = at(C);
797
797
  let A;
798
- r ? A = r.deriveS(C, p) : A = lt(v.id, p);
798
+ r ? A = r.deriveS(L, p) : A = lt(v.id, p);
799
799
  let d = { ...u.adjustedSpec };
800
800
  o && (d = {
801
801
  ...d,
@@ -1256,7 +1256,7 @@ class G {
1256
1256
  this.ctx.logError(e);
1257
1257
  }
1258
1258
  }
1259
- const ht = "1.41.6", X = ht;
1259
+ const ht = "1.42.1", Y = ht;
1260
1260
  function pt(n) {
1261
1261
  return n.__renderLambda === !0;
1262
1262
  }
@@ -1274,8 +1274,8 @@ const dt = class b {
1274
1274
  void 0,
1275
1275
  {},
1276
1276
  {},
1277
- Q(!0),
1278
- Q([]),
1277
+ X(!0),
1278
+ X([]),
1279
1279
  void 0,
1280
1280
  void 0,
1281
1281
  { ...b.INITIAL_BLOCK_FEATURE_FLAGS }
@@ -1349,7 +1349,7 @@ const dt = class b {
1349
1349
  );
1350
1350
  }
1351
1351
  sections(e) {
1352
- return Array.isArray(e) ? this.sections(Q(e)) : typeof e == "function" ? (J("sections", () => e(new G())), new b(
1352
+ return Array.isArray(e) ? this.sections(X(e)) : typeof e == "function" ? (J("sections", () => e(new G())), new b(
1353
1353
  this._renderingMode,
1354
1354
  this._initialArgs,
1355
1355
  this._initialUiState,
@@ -1475,7 +1475,7 @@ const dt = class b {
1475
1475
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
1476
1476
  const t = {
1477
1477
  v3: {
1478
- sdkVersion: X,
1478
+ sdkVersion: Y,
1479
1479
  renderingMode: this._renderingMode,
1480
1480
  initialArgs: this._initialArgs,
1481
1481
  initialUiState: this._initialUiState,
@@ -1487,7 +1487,7 @@ const dt = class b {
1487
1487
  featureFlags: this._featureFlags
1488
1488
  },
1489
1489
  // fields below are added to allow previous desktop versions read generated configs
1490
- sdkVersion: X,
1490
+ sdkVersion: Y,
1491
1491
  renderingMode: this._renderingMode,
1492
1492
  initialArgs: this._initialArgs,
1493
1493
  inputsValid: te(this._inputsValid),
@@ -1496,7 +1496,7 @@ const dt = class b {
1496
1496
  Object.entries(this._outputs).map(([r, i]) => [r, te(i)])
1497
1497
  )
1498
1498
  };
1499
- return globalThis.platformaApiVersion = e, Je() ? Pe({ sdkVersion: X, apiVersion: platformaApiVersion }) : { config: t };
1499
+ return globalThis.platformaApiVersion = e, Je() ? Pe({ sdkVersion: Y, apiVersion: platformaApiVersion }) : { config: t };
1500
1500
  }
1501
1501
  };
1502
1502
  I(dt, "INITIAL_BLOCK_FEATURE_FLAGS", {
@@ -1505,7 +1505,7 @@ I(dt, "INITIAL_BLOCK_FEATURE_FLAGS", {
1505
1505
  requiresModelAPIVersion: 1
1506
1506
  });
1507
1507
  function yt() {
1508
- return Pe({ sdkVersion: X, apiVersion: platformaApiVersion });
1508
+ return Pe({ sdkVersion: Y, apiVersion: platformaApiVersion });
1509
1509
  }
1510
1510
  export {
1511
1511
  he as AnchoredIdDeriver,
@@ -1520,13 +1520,13 @@ export {
1520
1520
  j as RT_BINARY_PARTITIONED,
1521
1521
  M as RT_BINARY_SUPER_PARTITIONED,
1522
1522
  U as RT_JSON_PARTITIONED,
1523
- Y as RT_JSON_SUPER_PARTITIONED,
1523
+ Q as RT_JSON_SUPER_PARTITIONED,
1524
1524
  ne as RT_RESOURCE_MAP,
1525
1525
  ie as RT_RESOURCE_MAP_PARTITIONED,
1526
1526
  G as RenderCtx,
1527
1527
  ct as ResultPool,
1528
1528
  Rt as StandardErrorLike,
1529
- Xe as Trace,
1529
+ Ye as Trace,
1530
1530
  ze as TraceEntry,
1531
1531
  S as TreeNodeAccessor,
1532
1532
  je as canonicalizeAxisId,
@@ -1543,7 +1543,7 @@ export {
1543
1543
  de as getAxisId,
1544
1544
  Pt as getFileNameFromHandle,
1545
1545
  At as getFilePathFromHandle,
1546
- Q as getImmediate,
1546
+ X as getImmediate,
1547
1547
  Ze as getPartitionKeysList,
1548
1548
  yt as getRawPlatformaInstance,
1549
1549
  tt as getUniquePartitionKeys,
@@ -1562,8 +1562,8 @@ export {
1562
1562
  le as mapPObjectData,
1563
1563
  Te as mapPTableDef,
1564
1564
  ke as mapValueInVOE,
1565
- Ct as matchAxis,
1566
- Lt as matchAxisId,
1565
+ Lt as matchAxis,
1566
+ Ct as matchAxisId,
1567
1567
  Et as matchPColumn,
1568
1568
  oe as parsePColumnData,
1569
1569
  pe as resolveAnchors,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/uikit",
3
- "version": "2.3.23",
3
+ "version": "2.3.25",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -31,7 +31,7 @@
31
31
  "d3-axis": "^3.0.0",
32
32
  "resize-observer-polyfill": "^1.5.1",
33
33
  "@milaboratories/helpers": "^1.6.19",
34
- "@platforma-sdk/model": "^1.41.6"
34
+ "@platforma-sdk/model": "^1.42.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@vitejs/plugin-vue": "^5.2.3",
@@ -41,9 +41,9 @@
41
41
  "vue-tsc": "^2.2.10",
42
42
  "yarpm": "^1.2.0",
43
43
  "svgo": "^3.3.2",
44
+ "@milaboratories/eslint-config": "^1.0.4",
44
45
  "@milaboratories/ts-configs": "1.0.5",
45
- "@milaboratories/build-configs": "1.0.5",
46
- "@milaboratories/eslint-config": "^1.0.4"
46
+ "@milaboratories/build-configs": "1.0.5"
47
47
  },
48
48
  "scripts": {
49
49
  "dev": "vite",