@platforma-sdk/ui-vue 1.85.2 → 1.86.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +210 -211
- package/.turbo/turbo-formatter$colon$check.log +4 -6
- package/.turbo/turbo-linter$colon$check.log +4 -6
- package/.turbo/turbo-types$colon$check.log +3 -5
- package/CHANGELOG.md +32 -0
- package/dist/AgGridVue/AgGridTheme.js +1 -2
- package/dist/AgGridVue/AgGridTheme.js.map +1 -1
- package/dist/AgGridVue/ag-override.js +1 -2
- package/dist/AgGridVue/ag-override.js.map +1 -1
- package/dist/AgGridVue/createAgGridColDef.js +2 -3
- package/dist/AgGridVue/createAgGridColDef.js.map +1 -1
- package/dist/AgGridVue/index.js +5 -4
- package/dist/AgGridVue/selection.js +1 -2
- package/dist/AgGridVue/selection.js.map +1 -1
- package/dist/AgGridVue/useAgGridOptions.js +1 -2
- package/dist/AgGridVue/useAgGridOptions.js.map +1 -1
- package/dist/_virtual/_plugin-vue_export-helper.js +1 -2
- package/dist/components/BlockLayout.js +1 -2
- package/dist/components/BlockLayout.js.map +1 -1
- package/dist/components/BlockLayout.style.js +3 -3
- package/dist/components/BlockLayout.style.js.map +1 -1
- package/dist/components/BlockLayout.vue2.js +2 -3
- package/dist/components/BlockLayout.vue2.js.map +1 -1
- package/dist/components/BlockLoader.js +1 -2
- package/dist/components/BlockLoader.js.map +1 -1
- package/dist/components/BlockLoader.vue2.js +2 -3
- package/dist/components/BlockLoader.vue2.js.map +1 -1
- package/dist/components/LoaderPage.js +2 -3
- package/dist/components/LoaderPage.js.map +1 -1
- package/dist/components/NotFound.js +1 -2
- package/dist/components/NotFound.js.map +1 -1
- package/dist/components/NotFound.vue2.js +2 -3
- package/dist/components/NotFound.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.js +1 -2
- package/dist/components/PlAdvancedFilter/FilterEditor.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.style.js +16 -16
- package/dist/components/PlAdvancedFilter/FilterEditor.style.js.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.vue.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js +86 -83
- package/dist/components/PlAdvancedFilter/FilterEditor.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/OperandButton.js +1 -2
- package/dist/components/PlAdvancedFilter/OperandButton.js.map +1 -1
- package/dist/components/PlAdvancedFilter/OperandButton.style.js +6 -6
- package/dist/components/PlAdvancedFilter/OperandButton.style.js.map +1 -1
- package/dist/components/PlAdvancedFilter/OperandButton.vue2.js +2 -3
- package/dist/components/PlAdvancedFilter/OperandButton.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.js +1 -2
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.style.js +11 -11
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.style.js.map +1 -1
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js +4 -5
- package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js.map +1 -1
- package/dist/components/PlAdvancedFilter/constants.js +1 -2
- package/dist/components/PlAdvancedFilter/constants.js.map +1 -1
- package/dist/components/PlAdvancedFilter/index.js +4 -5
- package/dist/components/PlAdvancedFilter/index.js.map +1 -1
- package/dist/components/PlAdvancedFilter/types.d.ts +2 -0
- package/dist/components/PlAdvancedFilter/types.d.ts.map +1 -1
- package/dist/components/PlAdvancedFilter/utils.js +2 -3
- package/dist/components/PlAdvancedFilter/utils.js.map +1 -1
- package/dist/components/PlAgCellFile/PlAgCellFile.js +1 -2
- package/dist/components/PlAgCellFile/PlAgCellFile.js.map +1 -1
- package/dist/components/PlAgCellFile/PlAgCellFile.vue2.js +2 -3
- package/dist/components/PlAgCellFile/PlAgCellFile.vue2.js.map +1 -1
- package/dist/components/PlAgCellFile/index.js +1 -1
- package/dist/components/PlAgCellProgress/PlAgCellProgress.js +1 -2
- package/dist/components/PlAgCellProgress/PlAgCellProgress.js.map +1 -1
- package/dist/components/PlAgCellProgress/PlAgCellProgress.vue2.js +2 -3
- package/dist/components/PlAgCellProgress/PlAgCellProgress.vue2.js.map +1 -1
- package/dist/components/PlAgCellProgress/index.js +1 -1
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.js +1 -2
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.js.map +1 -1
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.vue2.js +2 -3
- package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.vue2.js.map +1 -1
- package/dist/components/PlAgCellStatusTag/index.js +1 -1
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.js +1 -2
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.js.map +1 -1
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.vue2.js +2 -3
- package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.vue2.js.map +1 -1
- package/dist/components/PlAgChartHistogramCell/index.js +1 -1
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.js +1 -2
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.js.map +1 -1
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.vue2.js +2 -3
- package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.vue2.js.map +1 -1
- package/dist/components/PlAgChartStackedBarCell/index.js +1 -1
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.js +1 -2
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.js.map +1 -1
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue.d.ts.map +1 -1
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue2.js +41 -36
- package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue2.js.map +1 -1
- package/dist/components/PlAgColumnHeader/index.js +1 -1
- package/dist/components/PlAgColumnHeader/types.d.ts +2 -0
- package/dist/components/PlAgColumnHeader/types.d.ts.map +1 -1
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.js +1 -2
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.js.map +1 -1
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.vue2.js +2 -3
- package/dist/components/PlAgCsvExporter/PlAgCsvExporter.vue2.js.map +1 -1
- package/dist/components/PlAgCsvExporter/export-csv.js +3 -4
- package/dist/components/PlAgCsvExporter/export-csv.js.map +1 -1
- package/dist/components/PlAgCsvExporter/index.js +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.js +1 -2
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.style.js +3 -3
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.style.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.vue2.js +4 -5
- package/dist/components/PlAgDataTable/PlAgDataTableSheets.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.js +1 -2
- package/dist/components/PlAgDataTable/PlAgDataTableV2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.style.js +5 -5
- package/dist/components/PlAgDataTable/PlAgDataTableV2.style.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue.d.ts.map +1 -1
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js +130 -129
- package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.js +1 -2
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.vue2.js +2 -3
- package/dist/components/PlAgDataTable/PlAgOverlayLoading.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.js +1 -2
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.vue2.js +2 -3
- package/dist/components/PlAgDataTable/PlAgOverlayNoRows.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgRowCount.js +1 -2
- package/dist/components/PlAgDataTable/PlAgRowCount.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgRowCount.vue2.js +2 -3
- package/dist/components/PlAgDataTable/PlAgRowCount.vue2.js.map +1 -1
- package/dist/components/PlAgDataTable/compositions/useFilterableColumns.js +1 -2
- package/dist/components/PlAgDataTable/compositions/useFilterableColumns.js.map +1 -1
- package/dist/components/PlAgDataTable/compositions/useGrid.js +1 -2
- package/dist/components/PlAgDataTable/compositions/useGrid.js.map +1 -1
- package/dist/components/PlAgDataTable/index.js +11 -11
- package/dist/components/PlAgDataTable/index.js.map +1 -1
- package/dist/components/PlAgDataTable/pl-ag-overlay-loading.module.js +7 -7
- package/dist/components/PlAgDataTable/pl-ag-overlay-loading.module.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/common.js +1 -2
- package/dist/components/PlAgDataTable/sources/common.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/focus-row.js +1 -2
- package/dist/components/PlAgDataTable/sources/focus-row.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/grid-state.js +3 -4
- package/dist/components/PlAgDataTable/sources/grid-state.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/menu-items.js +1 -2
- package/dist/components/PlAgDataTable/sources/menu-items.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/row-number.js +2 -3
- package/dist/components/PlAgDataTable/sources/row-number.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-source-v2.d.ts +2 -0
- package/dist/components/PlAgDataTable/sources/table-source-v2.d.ts.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-source-v2.js +49 -52
- package/dist/components/PlAgDataTable/sources/table-source-v2.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-state-v2.js +2 -3
- package/dist/components/PlAgDataTable/sources/table-state-v2.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/value-rendering.js +6 -9
- package/dist/components/PlAgDataTable/sources/value-rendering.js.map +1 -1
- package/dist/components/PlAgDataTable/types.js +1 -2
- package/dist/components/PlAgDataTable/types.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.js +1 -2
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.style.js +6 -6
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.style.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue.d.ts.map +1 -1
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue2.js +44 -38
- package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue2.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/index.js +1 -1
- package/dist/components/PlAgGridColumnManager/useFilteredItems.js +2 -3
- package/dist/components/PlAgGridColumnManager/useFilteredItems.js.map +1 -1
- package/dist/components/PlAgGridColumnManager/useGridColumns.js +1 -2
- package/dist/components/PlAgGridColumnManager/useGridColumns.js.map +1 -1
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.js +1 -2
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.js.map +1 -1
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue2.js +2 -3
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue2.js.map +1 -1
- package/dist/components/PlAgRowNumCheckbox/index.js +1 -1
- package/dist/components/PlAgRowNumCheckbox/pl-ag-row-num-checkbox.module.js +7 -7
- package/dist/components/PlAgRowNumCheckbox/pl-ag-row-num-checkbox.module.js.map +1 -1
- package/dist/components/PlAgRowNumHeader.js +1 -2
- package/dist/components/PlAgRowNumHeader.js.map +1 -1
- package/dist/components/PlAgRowNumHeader.vue2.js +2 -3
- package/dist/components/PlAgRowNumHeader.vue2.js.map +1 -1
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.js +1 -2
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.js.map +1 -1
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.vue2.js +2 -3
- package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.vue2.js.map +1 -1
- package/dist/components/PlAgTextAndButtonCell/index.js +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.js +1 -2
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.style.js +9 -9
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js +2 -3
- package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.js +1 -2
- package/dist/components/PlAnnotations/components/FilterSidebar.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.style.js +5 -5
- package/dist/components/PlAnnotations/components/FilterSidebar.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js +2 -3
- package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.js +1 -2
- package/dist/components/PlAnnotations/components/PlAnnotations.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.style.js +3 -3
- package/dist/components/PlAnnotations/components/PlAnnotations.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js +2 -3
- package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.js +1 -2
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.style.js +5 -5
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.style.js.map +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue2.js +2 -3
- package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue2.js.map +1 -1
- package/dist/components/PlAnnotations/components/style.module.js +6 -6
- package/dist/components/PlAnnotations/components/style.module.js.map +1 -1
- package/dist/components/PlAnnotations/index.js +3 -2
- package/dist/components/PlAnnotations/utils.js +1 -2
- package/dist/components/PlAnnotations/utils.js.map +1 -1
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.js +1 -2
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.js.map +1 -1
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue2.js +2 -3
- package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue2.js.map +1 -1
- package/dist/components/PlAppErrorNotificationAlert/index.js +1 -1
- package/dist/components/PlBtnExportArchive/Item.js +1 -2
- package/dist/components/PlBtnExportArchive/Item.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Item.style.js +7 -7
- package/dist/components/PlBtnExportArchive/Item.style.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Item.vue2.js +2 -3
- package/dist/components/PlBtnExportArchive/Item.vue2.js.map +1 -1
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.js +1 -2
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.js.map +1 -1
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.style.js +6 -6
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.style.js.map +1 -1
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue2.js +16 -17
- package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue2.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Summary.js +1 -2
- package/dist/components/PlBtnExportArchive/Summary.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Summary.style.js +6 -6
- package/dist/components/PlBtnExportArchive/Summary.style.js.map +1 -1
- package/dist/components/PlBtnExportArchive/Summary.vue2.js +2 -3
- package/dist/components/PlBtnExportArchive/Summary.vue2.js.map +1 -1
- package/dist/components/PlBtnExportArchive/index.js +1 -1
- package/dist/components/PlDatasetSelector/PlDatasetSelector.js +1 -2
- package/dist/components/PlDatasetSelector/PlDatasetSelector.js.map +1 -1
- package/dist/components/PlDatasetSelector/PlDatasetSelector.vue2.js +3 -8
- package/dist/components/PlDatasetSelector/PlDatasetSelector.vue2.js.map +1 -1
- package/dist/components/PlDatasetSelector/index.js +1 -1
- package/dist/components/PlTableFastSearch/PlTableFastSearch.js +1 -2
- package/dist/components/PlTableFastSearch/PlTableFastSearch.js.map +1 -1
- package/dist/components/PlTableFastSearch/PlTableFastSearch.vue2.js +2 -3
- package/dist/components/PlTableFastSearch/PlTableFastSearch.vue2.js.map +1 -1
- package/dist/components/PlTableFastSearch/index.js +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.js +1 -2
- package/dist/components/PlTableFilters/PlTableFiltersV2.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.style.js +6 -6
- package/dist/components/PlTableFilters/PlTableFiltersV2.style.js.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue.d.ts +2 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue.d.ts.map +1 -1
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue2.js +72 -68
- package/dist/components/PlTableFilters/PlTableFiltersV2.vue2.js.map +1 -1
- package/dist/components/PlTableFilters/index.js +1 -1
- package/dist/components/PlTableFilters/suggest-source.js +1 -2
- package/dist/components/PlTableFilters/suggest-source.js.map +1 -1
- package/dist/composition/AgGrid/index.js +1 -2
- package/dist/composition/AgGrid/index.js.map +1 -1
- package/dist/composition/fileContent.js +9 -5
- package/dist/composition/fileContent.js.map +1 -1
- package/dist/composition/usePlugin.js +1 -2
- package/dist/composition/usePlugin.js.map +1 -1
- package/dist/computedResult.js +1 -2
- package/dist/computedResult.js.map +1 -1
- package/dist/createModel.js +8 -7
- package/dist/createModel.js.map +1 -1
- package/dist/defineApp.js +5 -3
- package/dist/defineApp.js.map +1 -1
- package/dist/defineStore.js +1 -2
- package/dist/defineStore.js.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/UpdateSerializer.js +2 -2
- package/dist/internal/UpdateSerializer.js.map +1 -1
- package/dist/internal/createAppV3.js +2 -3
- package/dist/internal/createAppV3.js.map +1 -1
- package/dist/internal/getServices.js +4 -5
- package/dist/internal/getServices.js.map +1 -1
- package/dist/internal/service_factories.js +1 -2
- package/dist/internal/service_factories.js.map +1 -1
- package/dist/internal/utils.js +1 -2
- package/dist/internal/utils.js.map +1 -1
- package/dist/lib/util/helpers/dist/functions.js +1 -2
- package/dist/lib/util/helpers/dist/functions.js.map +1 -1
- package/dist/lib/util/helpers/dist/hash.js +0 -1
- package/dist/lib/util/helpers/dist/hash.js.map +1 -1
- package/dist/lib/util/helpers/dist/index.js +7 -6
- package/dist/lib/util/helpers/dist/objects.js +7 -6
- package/dist/lib/util/helpers/dist/objects.js.map +1 -1
- package/dist/lib/util/helpers/dist/prettyBytes.js +1 -2
- package/dist/lib/util/helpers/dist/prettyBytes.js.map +1 -1
- package/dist/lib/util/helpers/dist/random.js +1 -2
- package/dist/lib/util/helpers/dist/random.js.map +1 -1
- package/dist/lib/util/helpers/dist/strings.js +1 -2
- package/dist/lib/util/helpers/dist/strings.js.map +1 -1
- package/dist/lib/util/helpers/dist/uniqId.js +1 -2
- package/dist/lib/util/helpers/dist/uniqId.js.map +1 -1
- package/dist/lib/util/helpers/dist/utils.js +1 -2
- package/dist/lib/util/helpers/dist/utils.js.map +1 -1
- package/dist/lib.js +38 -38
- package/dist/objectHash.js +1 -2
- package/dist/objectHash.js.map +1 -1
- package/dist/plugins/Monetization/EndOfPeriod.js +1 -2
- package/dist/plugins/Monetization/EndOfPeriod.js.map +1 -1
- package/dist/plugins/Monetization/EndOfPeriod.style.js +3 -3
- package/dist/plugins/Monetization/EndOfPeriod.style.js.map +1 -1
- package/dist/plugins/Monetization/EndOfPeriod.vue2.js +2 -3
- package/dist/plugins/Monetization/EndOfPeriod.vue2.js.map +1 -1
- package/dist/plugins/Monetization/LimitCard.js +1 -2
- package/dist/plugins/Monetization/LimitCard.js.map +1 -1
- package/dist/plugins/Monetization/LimitCard.style.js +16 -16
- package/dist/plugins/Monetization/LimitCard.style.js.map +1 -1
- package/dist/plugins/Monetization/LimitCard.vue2.js +3 -4
- package/dist/plugins/Monetization/LimitCard.vue2.js.map +1 -1
- package/dist/plugins/Monetization/MonetizationSidebar.js +1 -2
- package/dist/plugins/Monetization/MonetizationSidebar.js.map +1 -1
- package/dist/plugins/Monetization/MonetizationSidebar.vue2.js +2 -3
- package/dist/plugins/Monetization/MonetizationSidebar.vue2.js.map +1 -1
- package/dist/plugins/Monetization/RunStatus.js +1 -2
- package/dist/plugins/Monetization/RunStatus.js.map +1 -1
- package/dist/plugins/Monetization/RunStatus.style.js +9 -9
- package/dist/plugins/Monetization/RunStatus.style.js.map +1 -1
- package/dist/plugins/Monetization/RunStatus.vue2.js +2 -3
- package/dist/plugins/Monetization/RunStatus.vue2.js.map +1 -1
- package/dist/plugins/Monetization/UserCabinetCard.js +1 -2
- package/dist/plugins/Monetization/UserCabinetCard.js.map +1 -1
- package/dist/plugins/Monetization/UserCabinetCard.style.js +10 -10
- package/dist/plugins/Monetization/UserCabinetCard.style.js.map +1 -1
- package/dist/plugins/Monetization/UserCabinetCard.vue2.js +2 -3
- package/dist/plugins/Monetization/UserCabinetCard.vue2.js.map +1 -1
- package/dist/plugins/Monetization/index.js +1 -1
- package/dist/plugins/Monetization/useButtonTarget.js +2 -7
- package/dist/plugins/Monetization/useButtonTarget.js.map +1 -1
- package/dist/plugins/Monetization/useInfo.js +1 -2
- package/dist/plugins/Monetization/useInfo.js.map +1 -1
- package/dist/plugins/Monetization/validation.js +2 -3
- package/dist/plugins/Monetization/validation.js.map +1 -1
- package/dist/urls.js +1 -2
- package/dist/urls.js.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/utils.js.map +1 -1
- package/package.json +25 -21
- package/src/components/PlAdvancedFilter/FilterEditor.test.ts +1 -1
- package/src/components/PlAdvancedFilter/FilterEditor.vue +15 -8
- package/src/components/PlAdvancedFilter/types.ts +2 -0
- package/src/components/PlAgColumnHeader/PlAgColumnHeader.vue +7 -5
- package/src/components/PlAgColumnHeader/types.ts +2 -0
- package/src/components/PlAgDataTable/PlAgDataTableSheets.vue +1 -1
- package/src/components/PlAgDataTable/PlAgDataTableV2.vue +1 -0
- package/src/components/PlAgDataTable/sources/table-source-v2.ts +17 -2
- package/src/components/PlAgDataTable/sources/table-state-v2.test.ts +1 -1
- package/src/components/PlAgGridColumnManager/PlAgGridColumnManager.vue +21 -13
- package/src/components/PlTableFilters/PlTableFiltersV2.vue +8 -1
- package/dist/_virtual/_rolldown/runtime.js +0 -17
- /package/dist/components/{BlockLayout.vue.css → BlockLayout.style.css} +0 -0
- /package/dist/components/PlAdvancedFilter/{FilterEditor.vue.css → FilterEditor.style.css} +0 -0
- /package/dist/components/PlAdvancedFilter/{OperandButton.vue.css → OperandButton.style.css} +0 -0
- /package/dist/components/PlAdvancedFilter/{PlAdvancedFilter.vue.css → PlAdvancedFilter.style.css} +0 -0
- /package/dist/components/PlAgDataTable/{PlAgDataTableSheets.vue.css → PlAgDataTableSheets.style.css} +0 -0
- /package/dist/components/PlAgDataTable/{PlAgDataTableV2.vue.css → PlAgDataTableV2.style.css} +0 -0
- /package/dist/components/PlAgGridColumnManager/{PlAgGridColumnManager.vue.css → PlAgGridColumnManager.style.css} +0 -0
- /package/dist/components/PlAnnotations/components/{AnnotationsSidebar.vue.css → AnnotationsSidebar.style.css} +0 -0
- /package/dist/components/PlAnnotations/components/{FilterSidebar.vue.css → FilterSidebar.style.css} +0 -0
- /package/dist/components/PlAnnotations/components/{PlAnnotations.vue.css → PlAnnotations.style.css} +0 -0
- /package/dist/components/PlAnnotations/components/{PlAnnotationsModal.vue.css → PlAnnotationsModal.style.css} +0 -0
- /package/dist/components/PlBtnExportArchive/{Item.vue.css → Item.style.css} +0 -0
- /package/dist/components/PlBtnExportArchive/{PlBtnExportArchive.vue.css → PlBtnExportArchive.style.css} +0 -0
- /package/dist/components/PlBtnExportArchive/{Summary.vue.css → Summary.style.css} +0 -0
- /package/dist/components/PlTableFilters/{PlTableFiltersV2.vue.css → PlTableFiltersV2.style.css} +0 -0
- /package/dist/plugins/Monetization/{EndOfPeriod.vue.css → EndOfPeriod.style.css} +0 -0
- /package/dist/plugins/Monetization/{LimitCard.vue.css → LimitCard.style.css} +0 -0
- /package/dist/plugins/Monetization/{RunStatus.vue.css → RunStatus.style.css} +0 -0
- /package/dist/plugins/Monetization/{UserCabinetCard.vue.css → UserCabinetCard.style.css} +0 -0
package/dist/defineApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineApp.js","names":[],"sources":["../src/defineApp.ts"],"sourcesContent":["import { notEmpty } from \"@milaboratories/helpers\";\nimport type {\n PlatformaV3,\n BlockCodeKnownFeatureFlags,\n UiServices as AllUiServices,\n} from \"@platforma-sdk/model\";\nimport {\n getPlatformaApiVersion,\n unwrapResult,\n type BlockOutputsBase,\n type BlockModelInfo,\n} from \"@platforma-sdk/model\";\nimport type { App as VueApp, Component, Reactive } from \"vue\";\nimport { inject, markRaw, reactive } from \"vue\";\nimport { createAppV3, type BaseAppV3 } from \"./internal/createAppV3\";\nimport type { AppSettings, ExtendSettings, Routes } from \"./types\";\n\nconst pluginKey = Symbol(\"sdk-vue\");\nexport const pluginDataKey = Symbol(\"plugin-data-access\");\n\nexport function useSdkPlugin(): SdkPlugin {\n return inject(pluginKey)!;\n}\n\nexport function useFeatureFlags() {\n const sdk = useSdkPlugin();\n return sdk.featureFlags;\n}\n\nexport function defineAppV3<\n Data = unknown,\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n Href extends `/${string}` = `/${string}`,\n Plugins extends Record<string, unknown> = Record<string, unknown>,\n UiServices extends Partial<AllUiServices> = Partial<AllUiServices>,\n Extend extends ExtendSettings<Href> = ExtendSettings<Href>,\n>(\n platforma: PlatformaV3<Data, Args, Outputs, Href, Plugins, UiServices> & {\n blockModelInfo: BlockModelInfo;\n },\n extendApp: (app: BaseAppV3<Data, Args, Outputs, Href, Plugins, UiServices>) => Extend,\n settings: AppSettings = {},\n): SdkPluginV3<Data, Args, Outputs, Href, Plugins, Extend, UiServices> {\n let app: AppV3<Data, Args, Outputs, Href, Plugins, Extend, UiServices> | undefined = undefined;\n\n // Captured during install() so V3 can provide plugin data access after async load\n let vueAppInstance: VueApp | undefined;\n\n const runtimeApiVersion = 3;\n const blockRequestedApiVersion = getPlatformaApiVersion();\n\n const loadApp = async () => {\n if (blockRequestedApiVersion !== runtimeApiVersion) {\n throw new Error(`Block requested API version ${blockRequestedApiVersion} but runtime API version is ${runtimeApiVersion}.\n Please update the desktop app to use the latest API version.`);\n }\n\n await platforma.loadBlockState().then((stateOrError) => {\n const state = unwrapResult(stateOrError);\n plugin.loaded = true;\n const { app: baseApp, pluginAccess } = createAppV3<\n Data,\n Args,\n Outputs,\n Href,\n Plugins,\n UiServices\n >(state, platforma, settings);\n\n if (!vueAppInstance) {\n throw new Error(\n \"Plugin data injection failed: Vue app instance not captured during install()\",\n );\n }\n vueAppInstance.provide(pluginDataKey, pluginAccess);\n\n const localState = extendApp(baseApp);\n\n const routes = Object.fromEntries(\n Object.entries(localState.routes as Routes<Href>).map(([href, component]) => {\n const c = typeof component === \"function\" ? component() : component;\n return [href, markRaw(c as Component)];\n }),\n );\n\n app = Object.assign(baseApp, {\n ...localState,\n getRoute(href: Href): Component | undefined {\n return routes[href];\n },\n } as AppV3<Data, Args, Outputs, Href, Plugins, Extend, UiServices>);\n });\n };\n\n const plugin = reactive({\n apiVersion: 3,\n featureFlags: platforma.blockModelInfo.featureFlags,\n loaded: false,\n error: undefined,\n useApp<PageHref extends Href = Href>() {\n return notEmpty(app, \"App is not loaded\") as AppV3<\n Data,\n Args,\n Outputs,\n PageHref,\n Plugins,\n Extend,\n UiServices\n >;\n },\n install(app: VueApp) {\n vueAppInstance = app;\n app.provide(pluginKey, this);\n loadApp().catch((err) => {\n console.error(\"load initial state error\", err);\n plugin.error = err;\n });\n },\n });\n\n return plugin as SdkPluginV3<Data, Args, Outputs, Href, Plugins, Extend, UiServices>;\n}\n\nexport type AppV3<\n Data = unknown,\n Args = unknown,\n Outputs extends BlockOutputsBase = NonNullable<unknown>,\n Href extends `/${string}` = `/${string}`,\n Plugins extends Record<string, unknown> = Record<string, unknown>,\n Local extends ExtendSettings<Href> = ExtendSettings<Href>,\n UiServices extends Partial<AllUiServices> = Partial<AllUiServices>,\n> = BaseAppV3<Data, Args, Outputs, Href, Plugins, UiServices> &\n Reactive<Omit<Local, \"routes\">> & { getRoute(href: Href): Component | undefined };\n\n// ---------------------------------------------------------------------------\n// SdkPlugin types\n// ---------------------------------------------------------------------------\n\nexport type SdkPluginV3<\n Data = unknown,\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n Href extends `/${string}` = `/${string}`,\n Plugins extends Record<string, unknown> = Record<string, unknown>,\n Local extends ExtendSettings<Href> = ExtendSettings<Href>,\n UiServices extends Partial<AllUiServices> = Partial<AllUiServices>,\n> = {\n apiVersion: 3;\n featureFlags: BlockCodeKnownFeatureFlags;\n loaded: boolean;\n error: unknown;\n useApp<PageHref extends Href = Href>(): AppV3<\n Data,\n Args,\n Outputs,\n PageHref,\n Plugins,\n Local,\n UiServices\n >;\n install(app: VueApp): void;\n};\n\nexport type SdkPlugin = SdkPluginV3;\n"],"mappings":";;;;;;AAiBA,
|
|
1
|
+
{"version":3,"file":"defineApp.js","names":["pluginKey","pluginDataKey","useSdkPlugin","inject","useFeatureFlags","defineAppV3","app","vueAppInstance","blockRequestedApiVersion","getPlatformaApiVersion","loadApp","platforma","state","unwrapResult","stateOrError","baseApp","createAppV3","settings","pluginAccess","localState","extendApp","routes","href","component","c","markRaw","plugin","reactive","notEmpty","err"],"sources":["../src/defineApp.ts"],"sourcesContent":["import { notEmpty } from \"@milaboratories/helpers\";\nimport type {\n PlatformaV3,\n BlockCodeKnownFeatureFlags,\n UiServices as AllUiServices,\n} from \"@platforma-sdk/model\";\nimport {\n getPlatformaApiVersion,\n unwrapResult,\n type BlockOutputsBase,\n type BlockModelInfo,\n} from \"@platforma-sdk/model\";\nimport type { App as VueApp, Component, Reactive } from \"vue\";\nimport { inject, markRaw, reactive } from \"vue\";\nimport { createAppV3, type BaseAppV3 } from \"./internal/createAppV3\";\nimport type { AppSettings, ExtendSettings, Routes } from \"./types\";\n\nconst pluginKey = Symbol(\"sdk-vue\");\nexport const pluginDataKey = Symbol(\"plugin-data-access\");\n\nexport function useSdkPlugin(): SdkPlugin {\n return inject(pluginKey)!;\n}\n\nexport function useFeatureFlags() {\n const sdk = useSdkPlugin();\n return sdk.featureFlags;\n}\n\nexport function defineAppV3<\n Data = unknown,\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n Href extends `/${string}` = `/${string}`,\n Plugins extends Record<string, unknown> = Record<string, unknown>,\n UiServices extends Partial<AllUiServices> = Partial<AllUiServices>,\n Extend extends ExtendSettings<Href> = ExtendSettings<Href>,\n>(\n platforma: PlatformaV3<Data, Args, Outputs, Href, Plugins, UiServices> & {\n blockModelInfo: BlockModelInfo;\n },\n extendApp: (app: BaseAppV3<Data, Args, Outputs, Href, Plugins, UiServices>) => Extend,\n settings: AppSettings = {},\n): SdkPluginV3<Data, Args, Outputs, Href, Plugins, Extend, UiServices> {\n let app: AppV3<Data, Args, Outputs, Href, Plugins, Extend, UiServices> | undefined = undefined;\n\n // Captured during install() so V3 can provide plugin data access after async load\n let vueAppInstance: VueApp | undefined;\n\n const runtimeApiVersion = 3;\n const blockRequestedApiVersion = getPlatformaApiVersion();\n\n const loadApp = async () => {\n if (blockRequestedApiVersion !== runtimeApiVersion) {\n throw new Error(`Block requested API version ${blockRequestedApiVersion} but runtime API version is ${runtimeApiVersion}.\n Please update the desktop app to use the latest API version.`);\n }\n\n await platforma.loadBlockState().then((stateOrError) => {\n const state = unwrapResult(stateOrError);\n plugin.loaded = true;\n const { app: baseApp, pluginAccess } = createAppV3<\n Data,\n Args,\n Outputs,\n Href,\n Plugins,\n UiServices\n >(state, platforma, settings);\n\n if (!vueAppInstance) {\n throw new Error(\n \"Plugin data injection failed: Vue app instance not captured during install()\",\n );\n }\n vueAppInstance.provide(pluginDataKey, pluginAccess);\n\n const localState = extendApp(baseApp);\n\n const routes = Object.fromEntries(\n Object.entries(localState.routes as Routes<Href>).map(([href, component]) => {\n const c = typeof component === \"function\" ? component() : component;\n return [href, markRaw(c as Component)];\n }),\n );\n\n app = Object.assign(baseApp, {\n ...localState,\n getRoute(href: Href): Component | undefined {\n return routes[href];\n },\n } as AppV3<Data, Args, Outputs, Href, Plugins, Extend, UiServices>);\n });\n };\n\n const plugin = reactive({\n apiVersion: 3,\n featureFlags: platforma.blockModelInfo.featureFlags,\n loaded: false,\n error: undefined,\n useApp<PageHref extends Href = Href>() {\n return notEmpty(app, \"App is not loaded\") as AppV3<\n Data,\n Args,\n Outputs,\n PageHref,\n Plugins,\n Extend,\n UiServices\n >;\n },\n install(app: VueApp) {\n vueAppInstance = app;\n app.provide(pluginKey, this);\n loadApp().catch((err) => {\n console.error(\"load initial state error\", err);\n plugin.error = err;\n });\n },\n });\n\n return plugin as SdkPluginV3<Data, Args, Outputs, Href, Plugins, Extend, UiServices>;\n}\n\nexport type AppV3<\n Data = unknown,\n Args = unknown,\n Outputs extends BlockOutputsBase = NonNullable<unknown>,\n Href extends `/${string}` = `/${string}`,\n Plugins extends Record<string, unknown> = Record<string, unknown>,\n Local extends ExtendSettings<Href> = ExtendSettings<Href>,\n UiServices extends Partial<AllUiServices> = Partial<AllUiServices>,\n> = BaseAppV3<Data, Args, Outputs, Href, Plugins, UiServices> &\n Reactive<Omit<Local, \"routes\">> & { getRoute(href: Href): Component | undefined };\n\n// ---------------------------------------------------------------------------\n// SdkPlugin types\n// ---------------------------------------------------------------------------\n\nexport type SdkPluginV3<\n Data = unknown,\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n Href extends `/${string}` = `/${string}`,\n Plugins extends Record<string, unknown> = Record<string, unknown>,\n Local extends ExtendSettings<Href> = ExtendSettings<Href>,\n UiServices extends Partial<AllUiServices> = Partial<AllUiServices>,\n> = {\n apiVersion: 3;\n featureFlags: BlockCodeKnownFeatureFlags;\n loaded: boolean;\n error: unknown;\n useApp<PageHref extends Href = Href>(): AppV3<\n Data,\n Args,\n Outputs,\n PageHref,\n Plugins,\n Local,\n UiServices\n >;\n install(app: VueApp): void;\n};\n\nexport type SdkPlugin = SdkPluginV3;\n"],"mappings":";;;;;;AAiBA,IAAMA,IAAY,OAAO,SAAS,GACrBC,IAAgB,OAAO,oBAAoB;AAExD,SAAgBC,IAA0B;CACxC,OAAOC,EAAOH,CAAS;AACzB;AAEA,SAAgBI,IAAkB;CAEhC,OADYF,EACL,CAAA,CAAI;AACb;AAEA,SAAgBG,EASd,GAGA,GACA,IAAwB,CAAC,GAC4C;CACrE,IAAIC,GAGAC,GAGEC,IAA2BC,EAAuB,GAElDC,IAAU,YAAY;EAC1B,IAAIF,MAA6B,GAC/B,MAAU,MAAM,+BAA+BA,EAAyB;mEACX;EAG/D,MAAMG,EAAU,eAAe,CAAC,CAAC,MAAM,MAAiB;GACtD,IAAMC,IAAQC,EAAaC,CAAY;GACvC,EAAO,SAAS;GAChB,IAAM,EAAE,KAAKC,GAAS,oBAAiBC,EAOrCJ,GAAOD,GAAWM,CAAQ;GAE5B,IAAI,CAACV,GACH,MAAU,MACR,8EACF;GAEF,EAAe,QAAQN,GAAeiB,CAAY;GAElD,IAAMC,IAAaC,EAAUL,CAAO,GAE9BM,IAAS,OAAO,YACpB,OAAO,QAAQF,EAAW,MAAsB,CAAC,CAAC,KAAK,CAACG,GAAMC,OAAe;IAC3E,IAAMC,IAAI,OAAOD,KAAc,aAAaA,EAAU,IAAIA;IAC1D,OAAO,CAACD,GAAMG,EAAQD,CAAc,CAAC;GACvC,CAAC,CACH;GAEA,IAAM,OAAO,OAAOT,GAAS;IAC3B,GAAGI;IACH,SAAS,GAAmC;KAC1C,OAAOE,EAAOC;IAChB;GACF,CAAkE;EACpE,CAAC;CACH,GAEMI,IAASC,EAAS;EACtB,YAAY;EACZ,cAAchB,EAAU,eAAe;EACvC,QAAQ;EACR,OAAO,KAAA;EACP,SAAuC;GACrC,OAAOiB,EAAStB,GAAK,mBAAmB;EAS1C;EACA,QAAQ,GAAa;GAGnB,AAFA,IAAiBA,GACjBA,EAAI,QAAQN,GAAW,IAAI,GAC3BU,EAAQ,CAAC,CAAC,OAAO,MAAQ;IAEvB,AADA,QAAQ,MAAM,4BAA4BmB,CAAG,GAC7C,EAAO,QAAQA;GACjB,CAAC;EACH;CACF,CAAC;CAED,OAAOH;AACT"}
|
package/dist/defineStore.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { effectScope as e, getCurrentScope as t, onScopeDispose as n, reactive as r } from "vue";
|
|
2
|
-
|
|
2
|
+
// src/defineStore.ts
|
|
3
3
|
var i = /* @__PURE__ */ new Map();
|
|
4
4
|
function a(a, o) {
|
|
5
5
|
let s = t() ?? e(), c = s.run(() => (n(() => {
|
|
@@ -13,7 +13,6 @@ function o(e) {
|
|
|
13
13
|
let t = Symbol();
|
|
14
14
|
return () => (i.has(t) || i.set(t, a(t, e)), i.get(t));
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { o as defineStore };
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=defineStore.js.map
|
package/dist/defineStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineStore.js","names":[],"sources":["../src/defineStore.ts"],"sourcesContent":["import { reactive, onScopeDispose, getCurrentScope, effectScope } from \"vue\";\n\nconst shelf = new Map<symbol, unknown>();\n\nfunction initStore<S extends object>(key: symbol, cb: () => S) {\n const scope = getCurrentScope() ?? effectScope();\n\n const store = scope.run(() => {\n onScopeDispose(() => {\n shelf.delete(key);\n });\n\n return reactive(cb());\n }) as S;\n\n (store as Disposable)[Symbol.dispose] = () => {\n scope.stop();\n };\n\n return store;\n}\n\nexport function defineStore<S extends object>(cb: () => S) {\n const key = Symbol();\n\n return () => {\n if (!shelf.has(key)) {\n shelf.set(key, initStore(key, cb));\n }\n return shelf.get(key) as S & Disposable;\n };\n}\n"],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"defineStore.js","names":["shelf","initStore","scope","getCurrentScope","effectScope","store","onScopeDispose","key","reactive","cb","defineStore"],"sources":["../src/defineStore.ts"],"sourcesContent":["import { reactive, onScopeDispose, getCurrentScope, effectScope } from \"vue\";\n\nconst shelf = new Map<symbol, unknown>();\n\nfunction initStore<S extends object>(key: symbol, cb: () => S) {\n const scope = getCurrentScope() ?? effectScope();\n\n const store = scope.run(() => {\n onScopeDispose(() => {\n shelf.delete(key);\n });\n\n return reactive(cb());\n }) as S;\n\n (store as Disposable)[Symbol.dispose] = () => {\n scope.stop();\n };\n\n return store;\n}\n\nexport function defineStore<S extends object>(cb: () => S) {\n const key = Symbol();\n\n return () => {\n if (!shelf.has(key)) {\n shelf.set(key, initStore(key, cb));\n }\n return shelf.get(key) as S & Disposable;\n };\n}\n"],"mappings":";;AAEA,IAAMA,oBAAQ,IAAI,IAAqB;AAEvC,SAASC,EAA4B,GAAa,GAAa;CAC7D,IAAMC,IAAQC,EAAgB,KAAKC,EAAY,GAEzCC,IAAQH,EAAM,WAClBI,QAAqB;EACnB,EAAM,OAAOC,CAAG;CAClB,CAAC,GAEMC,EAASC,EAAG,CAAC,EACrB;CAMD,OAJA,EAAsB,OAAO,iBAAiB;EAC5C,EAAM,KAAK;CACb,GAEOJ;AACT;AAEA,SAAgBK,EAA8B,GAAa;CACzD,IAAMH,IAAM,OAAO;CAEnB,cACOP,EAAM,IAAIO,CAAG,KAChBP,EAAM,IAAIO,GAAKN,EAAUM,GAAKE,CAAE,CAAC,GAE5BT,EAAM,IAAIO,CAAG;AAExB"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "./_virtual/_rolldown/runtime.js";
|
|
2
1
|
import { MultiError as e, UnresolvedError as t, ensureError as n, ensureOutputHasStableFlag as r, formatZodError as i, identity as a, isDefined as o, isZodError as s, unwrapOutput as c, wrapOptionalResult as l } from "./utils.js";
|
|
3
2
|
import { defineAppV3 as u, pluginDataKey as d, useFeatureFlags as f, useSdkPlugin as p } from "./defineApp.js";
|
|
4
3
|
import m from "./components/BlockLayout.js";
|
|
@@ -39,8 +38,8 @@ import { ReactiveFileContent as te } from "./composition/fileContent.js";
|
|
|
39
38
|
import "./lib.js";
|
|
40
39
|
import { setAutoFreeze as ne } from "immer";
|
|
41
40
|
export * from "@milaboratories/uikit";
|
|
41
|
+
// src/index.ts
|
|
42
42
|
ne(!1);
|
|
43
|
-
//#endregion
|
|
44
43
|
export { A as AgGridTheme, m as BlockLayout, x as DeferredCircular, e as MultiError, D as PlAdvancedFilterComponent, O as PlAdvancedFilterSupportedFilters, P as PlAgCellFile, M as PlAgCellProgress, L as PlAgCellStatusTag, I as PlAgChartHistogramCell, F as PlAgChartStackedBarCell, w as PlAgColumnHeader, ee as PlAgCsvExporter, v as PlAgDataTableRowNumberColId, j as PlAgDataTableV2, E as PlAgGridColumnManager, h as PlAgOverlayLoading, g as PlAgOverlayNoRows, T as PlAgTextAndButtonCell, W as PlAnnotations, G as PlAnnotationsModal, K as PlBtnExportArchive, j as PlDataTableV2, q as PlDatasetSelector, k as PlTableFiltersV2, te as ReactiveFileContent, t as UnresolvedError, Z as activateAgGrid, y as autoSizeRowNumberColumn, $ as computedResult, N as createAgGridColDef, Y as createModel, C as defaultMainMenuItems, u as defineAppV3, X as defineStore, z as deselectAll, n as ensureError, S as ensureNodeVisible, r as ensureOutputHasStableFlag, i as formatZodError, B as getSelectedRowsCount, V as getTotalRowsCount, a as identity, o as isDefined, H as isSelectionEnabled, s as isZodError, b as makeRowNumberColDef, Q as objectHash, d as pluginDataKey, U as selectAll, c as unwrapOutput, R as useAgGridOptions, f as useFeatureFlags, _ as usePlDataTableSettingsV2, J as usePlugin, p as useSdkPlugin, l as wrapOptionalResult };
|
|
45
44
|
|
|
46
45
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { setAutoFreeze } from \"immer\";\n\nsetAutoFreeze(false);\n\nexport * from \"./lib\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","names":["BlockLayout_default","PlAgOverlayLoading_default","PlAgOverlayNoRows_default","PlAgColumnHeader_default","PlAgTextAndButtonCell_default","PlAgCsvExporter_default","PlAgGridColumnManager_default","PlAdvancedFilter_default","PlTableFiltersV2_default","PlAgDataTableV2_default","PlAgCellProgress_default","PlAgCellFile_default","PlAgChartStackedBarCell_default","PlAgChartHistogramCell_default","PlAgCellStatusTag_default","PlAnnotations_default","PlAnnotationsModal_default","PlBtnExportArchive_default","PlDatasetSelector_default","setAutoFreeze","AgGridTheme","DeferredCircular","MultiError","PlAdvancedFilterSupportedFilters","PlAgDataTableRowNumberColId","ReactiveFileContent","UnresolvedError","activateAgGrid","autoSizeRowNumberColumn","computedResult","createAgGridColDef","createModel","defaultMainMenuItems","defineAppV3","defineStore","deselectAll","ensureError","ensureNodeVisible","ensureOutputHasStableFlag","formatZodError","getSelectedRowsCount","getTotalRowsCount","identity","isDefined","isSelectionEnabled","isZodError","makeRowNumberColDef","objectHash","pluginDataKey","selectAll","unwrapOutput","useAgGridOptions","useFeatureFlags","usePlDataTableSettingsV2","usePlugin","useSdkPlugin","wrapOptionalResult"],"sources":["../src/index.ts"],"sourcesContent":["import { setAutoFreeze } from \"immer\";\n\nsetAutoFreeze(false);\n\nexport * from \"./lib\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEAmB,GAAc,EAAK"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { delay as e } from "../lib/util/helpers/dist/utils.js";
|
|
2
2
|
import "../lib/util/helpers/dist/index.js";
|
|
3
3
|
import { hasAbortError as t } from "@platforma-sdk/model";
|
|
4
|
-
|
|
4
|
+
// src/internal/UpdateSerializer.ts
|
|
5
5
|
var n = class {
|
|
6
|
+
options;
|
|
6
7
|
ongoingRun = Promise.resolve(!0);
|
|
7
8
|
ongoingOperation = Promise.resolve();
|
|
8
9
|
counter = 0;
|
|
@@ -41,7 +42,6 @@ var n = class {
|
|
|
41
42
|
return this.ongoingOperation = r, await r, !0;
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
|
-
//#endregion
|
|
45
45
|
export { n as UpdateSerializer };
|
|
46
46
|
|
|
47
47
|
//# sourceMappingURL=UpdateSerializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateSerializer.js","names":[],"sources":["../../src/internal/UpdateSerializer.ts"],"sourcesContent":["import { delay } from \"@milaboratories/helpers\";\nimport { hasAbortError } from \"@platforma-sdk/model\";\n\nexport type RetryState = {\n i: number;\n};\n\nexport type OnNext = (e: unknown, state: RetryState) => { delayMs: number };\n\nexport class UpdateSerializer {\n private ongoingRun: Promise<boolean> = Promise.resolve(true);\n private ongoingOperation: Promise<void> = Promise.resolve();\n private counter = 0;\n\n constructor(\n private readonly options: {\n debounceSpan?: number;\n } = {},\n ) {}\n\n async allSettled(): Promise<void> {\n await delay(this.options.debounceSpan ?? 0);\n let completed = false;\n do {\n await delay(0);\n completed = await this.ongoingRun\n .then(() => {\n return true;\n })\n .catch((e) => {\n console.log(\"ongoingRun error\", e);\n return false;\n });\n } while (!completed);\n }\n\n async retry<T>(op: () => Promise<T>, onNext: OnNext): Promise<T> {\n const state: RetryState = {\n i: 0,\n };\n\n while (true) {\n try {\n state.i++;\n return await op();\n } catch (e: unknown) {\n const { delayMs } = onNext(e, state);\n\n if (hasAbortError(e)) {\n throw e;\n }\n\n await delay(delayMs);\n }\n }\n }\n\n /**\n * @returns true if operation succeeded, or false if operation was evicted by a more recent call\n */\n public async run(op: () => Promise<void>): Promise<boolean> {\n return (this.ongoingRun = this._run(op));\n }\n\n /**\n * @returns true if operation succeeded, or false if operation was evicted by a more recent call\n */\n private async _run(op: () => Promise<void>): Promise<boolean> {\n // assigning a sequential update id to the call\n this.counter++;\n const myId = this.counter;\n\n if (this.options.debounceSpan) {\n await delay(this.options.debounceSpan);\n }\n\n // checking that this update is still the most recent\n if (this.counter !== myId) {\n // operation was canceled, because another operation was queued\n // after we started waiting for previous operation to finish\n return false;\n }\n\n // awaiting previous operation to finish\n try {\n await this.ongoingOperation;\n } catch {\n // ignoring the error here, original caller will receive any rejections\n }\n\n // checking that this update is still the most recent\n if (this.counter !== myId) {\n // operation was canceled, because another operation was queued\n // after we started waiting for previous operation to finish\n return false;\n }\n\n // asynchronously starting the operation\n const opPromise = this.retry(\n () => op(),\n (e) => {\n console.warn(\"UpdateSerializer.run error, retrying...\", e);\n return {\n delayMs: 100, // TODO: flexible delay\n };\n },\n );\n // publishing the promise for the next operation to await\n this.ongoingOperation = opPromise;\n // actually awaiting for the operation result, any rejections will be thrown here\n await opPromise;\n\n // operation was successfully called\n return true;\n }\n}\n"],"mappings":";;;;AASA,
|
|
1
|
+
{"version":3,"file":"UpdateSerializer.js","names":["UpdateSerializer","options","delay","completed","state","op","e","onNext","hasAbortError","delayMs","myId","opPromise"],"sources":["../../src/internal/UpdateSerializer.ts"],"sourcesContent":["import { delay } from \"@milaboratories/helpers\";\nimport { hasAbortError } from \"@platforma-sdk/model\";\n\nexport type RetryState = {\n i: number;\n};\n\nexport type OnNext = (e: unknown, state: RetryState) => { delayMs: number };\n\nexport class UpdateSerializer {\n private ongoingRun: Promise<boolean> = Promise.resolve(true);\n private ongoingOperation: Promise<void> = Promise.resolve();\n private counter = 0;\n\n constructor(\n private readonly options: {\n debounceSpan?: number;\n } = {},\n ) {}\n\n async allSettled(): Promise<void> {\n await delay(this.options.debounceSpan ?? 0);\n let completed = false;\n do {\n await delay(0);\n completed = await this.ongoingRun\n .then(() => {\n return true;\n })\n .catch((e) => {\n console.log(\"ongoingRun error\", e);\n return false;\n });\n } while (!completed);\n }\n\n async retry<T>(op: () => Promise<T>, onNext: OnNext): Promise<T> {\n const state: RetryState = {\n i: 0,\n };\n\n while (true) {\n try {\n state.i++;\n return await op();\n } catch (e: unknown) {\n const { delayMs } = onNext(e, state);\n\n if (hasAbortError(e)) {\n throw e;\n }\n\n await delay(delayMs);\n }\n }\n }\n\n /**\n * @returns true if operation succeeded, or false if operation was evicted by a more recent call\n */\n public async run(op: () => Promise<void>): Promise<boolean> {\n return (this.ongoingRun = this._run(op));\n }\n\n /**\n * @returns true if operation succeeded, or false if operation was evicted by a more recent call\n */\n private async _run(op: () => Promise<void>): Promise<boolean> {\n // assigning a sequential update id to the call\n this.counter++;\n const myId = this.counter;\n\n if (this.options.debounceSpan) {\n await delay(this.options.debounceSpan);\n }\n\n // checking that this update is still the most recent\n if (this.counter !== myId) {\n // operation was canceled, because another operation was queued\n // after we started waiting for previous operation to finish\n return false;\n }\n\n // awaiting previous operation to finish\n try {\n await this.ongoingOperation;\n } catch {\n // ignoring the error here, original caller will receive any rejections\n }\n\n // checking that this update is still the most recent\n if (this.counter !== myId) {\n // operation was canceled, because another operation was queued\n // after we started waiting for previous operation to finish\n return false;\n }\n\n // asynchronously starting the operation\n const opPromise = this.retry(\n () => op(),\n (e) => {\n console.warn(\"UpdateSerializer.run error, retrying...\", e);\n return {\n delayMs: 100, // TODO: flexible delay\n };\n },\n );\n // publishing the promise for the next operation to await\n this.ongoingOperation = opPromise;\n // actually awaiting for the operation result, any rejections will be thrown here\n await opPromise;\n\n // operation was successfully called\n return true;\n }\n}\n"],"mappings":";;;;AASA,IAAaA,IAAb,MAA8B;CAMT;CALnB,aAAuC,QAAQ,QAAQ,EAAI;CAC3D,mBAA0C,QAAQ,QAAQ;CAC1D,UAAkB;CAElB,YACE,IAEI,CAAC,GACL;EAHiB,KAAA,UAAAC;CAGhB;CAEH,MAAM,aAA4B;EAChC,MAAMC,EAAM,KAAK,QAAQ,gBAAgB,CAAC;EAC1C,IAAIC,IAAY;EAChB;GAEE,AADA,MAAMD,EAAM,CAAC,GACb,IAAY,MAAM,KAAK,WACpB,WACQ,EACR,CAAC,CACD,OAAO,OACN,QAAQ,IAAI,oBAAoB,CAAC,GAC1B,GACR;SACI,CAACC;CACZ;CAEA,MAAM,MAAS,GAAsB,GAA4B;EAC/D,IAAMC,IAAoB,EACxB,GAAG,EACL;EAEA,SACE,IAAI;GAEF,OADA,EAAM,KACC,MAAMC,EAAG;EAClB,SAASC,GAAY;GACnB,IAAM,EAAE,eAAYC,EAAOD,GAAGF,CAAK;GAEnC,IAAII,EAAcF,CAAC,GACjB,MAAMA;GAGR,MAAMJ,EAAMO,CAAO;EACrB;CAEJ;CAKA,MAAa,IAAI,GAA2C;EAC1D,OAAQ,KAAK,aAAa,KAAK,KAAKJ,CAAE;CACxC;CAKA,MAAc,KAAK,GAA2C;EAE5D,KAAK;EACL,IAAMK,IAAO,KAAK;EAOlB,IALI,KAAK,QAAQ,gBACf,MAAMR,EAAM,KAAK,QAAQ,YAAY,GAInC,KAAK,YAAYQ,GAGnB,OAAO;EAIT,IAAI;GACF,MAAM,KAAK;EACb,QAAQ,CAER;EAGA,IAAI,KAAK,YAAYA,GAGnB,OAAO;EAIT,IAAMC,IAAY,KAAK,YACfN,EAAG,IACR,OACC,QAAQ,KAAK,2CAA2C,CAAC,GAClD,EACL,SAAS,IACX,EAEJ;EAOA,OALA,KAAK,mBAAmBM,GAExB,MAAMA,GAGC;CACT;AACF"}
|
|
@@ -99,7 +99,7 @@ function C(C, w, T) {
|
|
|
99
99
|
for (let [n, r] of Object.entries(R.value.outputs)) {
|
|
100
100
|
if (!n.startsWith(t)) continue;
|
|
101
101
|
let i = n.slice(t.length);
|
|
102
|
-
w.blockModelInfo.outputs[n]?.withStatus ?
|
|
102
|
+
e[i] = w.blockModelInfo.outputs[n]?.withStatus ? r ? a(r) : void 0 : r.ok && r.value !== void 0 ? r.value : void 0;
|
|
103
103
|
}
|
|
104
104
|
return e;
|
|
105
105
|
}), o = u(() => {
|
|
@@ -154,7 +154,6 @@ function C(C, w, T) {
|
|
|
154
154
|
pluginAccess: Q
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
|
|
158
|
-
export { C as createAppV3 };
|
|
157
|
+
export { C as createAppV3, S as createNextAuthorMarker };
|
|
159
158
|
|
|
160
159
|
//# sourceMappingURL=createAppV3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAppV3.js","names":[],"sources":["../../src/internal/createAppV3.ts"],"sourcesContent":["import { deepClone, delay, uniqueId } from \"@milaboratories/helpers\";\nimport type { Mutable } from \"@milaboratories/helpers\";\nimport type {\n NavigationState,\n BlockOutputsBase,\n BlockStateV3,\n PlatformaV3,\n ValueWithUTag,\n AuthorMarker,\n PlatformaExtended,\n InferPluginUiEntries,\n PluginHandle,\n InferFactoryData,\n InferFactoryOutputs,\n PluginFactoryLike,\n UiServices as AllUiServices,\n InferFactoryUiServices,\n} from \"@platforma-sdk/model\";\nimport {\n hasAbortError,\n unwrapResult,\n deriveDataFromStorage,\n getPluginData,\n isPluginOutputKey,\n pluginOutputPrefix,\n} from \"@platforma-sdk/model\";\nimport type { Ref } from \"vue\";\nimport { reactive, computed, ref, markRaw } from \"vue\";\nimport type { OutputValues, OutputErrors, AppSettings } from \"../types\";\nimport { parseQuery } from \"../urls\";\nimport { ensureOutputHasStableFlag, MultiError } from \"../utils\";\nimport { applyPatch } from \"fast-json-patch\";\nimport { UpdateSerializer } from \"./UpdateSerializer\";\nimport { watchIgnorable } from \"@vueuse/core\";\nimport type { PluginState, PluginAccess } from \"../composition/usePlugin\";\nimport { logDebug, logError } from \"./utils\";\nimport { getServices } from \"./getServices\";\n\nexport const patchPoolingDelay = 150;\n\n/** Internal per-plugin state with reconciliation support. */\ninterface InternalPluginState<\n Data = unknown,\n Outputs = unknown,\n Services = Record<string, unknown>,\n> extends PluginState<Data, Outputs, Services> {\n readonly ignoreUpdates: (fn: () => void) => void;\n}\n\nexport const createNextAuthorMarker = (marker: AuthorMarker | undefined): AuthorMarker => ({\n authorId: marker?.authorId ?? uniqueId(),\n localVersion: (marker?.localVersion ?? 0) + 1,\n});\n\n/**\n * Creates an application instance with reactive state management, outputs, and methods for state updates and navigation.\n *\n * @template Args - The type of arguments used in the application.\n * @template Outputs - The type of block outputs extending `BlockOutputsBase`.\n * @template Data - The type of the block data.\n * @template Href - The type of navigation href, defaulting to a string starting with `/`.\n *\n * @param state - Initial state of the application, including args, outputs, UI state, and navigation state.\n * @param platforma - A platform interface for interacting with block states.\n * @param settings - Application settings, such as debug flags.\n *\n * @returns A reactive application object with methods, getters, and state.\n */\nexport function createAppV3<\n Data = unknown,\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n Href extends `/${string}` = `/${string}`,\n Plugins extends Record<string, unknown> = Record<string, unknown>,\n UiServices extends Partial<AllUiServices> = Partial<AllUiServices>,\n>(\n state: ValueWithUTag<BlockStateV3<Data, Outputs, Href>>,\n platforma: PlatformaExtended<PlatformaV3<Data, Args, Outputs, Href, Plugins, UiServices>>,\n settings: AppSettings,\n) {\n const debug = settings.debug ? logDebug : () => {};\n const error = logError;\n\n const data = {\n isExternalSnapshot: false,\n author: {\n authorId: uniqueId(),\n localVersion: 0,\n },\n };\n\n const nextAuthorMarker = () => {\n data.author = createNextAuthorMarker(data.author);\n debug(\"nextAuthorMarker\", data.author);\n return data.author;\n };\n\n const closedRef = ref(false);\n\n const uTagRef = ref(state.uTag);\n\n const debounceSpan = settings.debounceSpan ?? 200;\n\n const setDataQueue = new UpdateSerializer({ debounceSpan });\n const pluginDataQueues = new Map<PluginHandle, UpdateSerializer>();\n const getPluginDataQueue = (handle: PluginHandle): UpdateSerializer => {\n let queue = pluginDataQueues.get(handle);\n if (!queue) {\n queue = new UpdateSerializer({ debounceSpan });\n pluginDataQueues.set(handle, queue);\n }\n return queue;\n };\n const setNavigationStateQueue = new UpdateSerializer({ debounceSpan });\n\n /** Lazily-created per-plugin reactive states. */\n const pluginStates = new Map<PluginHandle, InternalPluginState>();\n /**\n * Reactive snapshot of the application state, including args, outputs, UI state, and navigation state.\n */\n const snapshot = ref<{\n outputs: Partial<Readonly<Outputs>>;\n blockStorage: unknown;\n navigationState: NavigationState<Href>;\n }>(state.value) as Ref<{\n outputs: Partial<Readonly<Outputs>>;\n blockStorage: unknown;\n navigationState: NavigationState<Href>;\n }>;\n\n const updateData = async (value: Data) => {\n return platforma.mutateStorage({ operation: \"update-block-data\", value }, nextAuthorMarker());\n };\n\n const updatePluginData = async (handle: PluginHandle, value: unknown) => {\n return platforma.mutateStorage(\n { operation: \"update-plugin-data\", pluginId: handle, value },\n nextAuthorMarker(),\n );\n };\n\n const setNavigationState = async (state: NavigationState<Href>) => {\n return platforma.setNavigationState(state);\n };\n\n const outputs = computed<OutputValues<Outputs>>(() => {\n const entries = Object.entries(snapshot.value.outputs as Partial<Readonly<Outputs>>)\n .filter(([k]) => !isPluginOutputKey(k))\n .map(([k, outputWithStatus]) =>\n platforma.blockModelInfo.outputs[k]?.withStatus\n ? [k, ensureOutputHasStableFlag(outputWithStatus)]\n : [\n k,\n outputWithStatus.ok && outputWithStatus.value !== undefined\n ? outputWithStatus.value\n : undefined,\n ],\n );\n return Object.fromEntries(entries);\n });\n\n const outputErrors = computed<OutputErrors<Outputs>>(() => {\n const entries = Object.entries(snapshot.value.outputs as Partial<Readonly<Outputs>>)\n .filter(([k]) => !isPluginOutputKey(k))\n .map(([k, vOrErr]) => [\n k,\n vOrErr && vOrErr.ok === false ? new MultiError(vOrErr.errors) : undefined,\n ]);\n return Object.fromEntries(entries);\n });\n\n const appModel = reactive({\n apiVersion: 3,\n error: \"\",\n model: {\n data: deepClone(deriveDataFromStorage<Data>(snapshot.value.blockStorage)) as Data,\n outputs,\n outputErrors,\n },\n }) as {\n error: string;\n model: {\n data: Data;\n outputs: OutputValues<Outputs>;\n outputErrors: OutputErrors<Outputs>;\n };\n };\n\n const { ignoreUpdates } = watchIgnorable(\n () => appModel.model,\n (_newData) => {\n const newData = deepClone(_newData);\n debug(\"setDataQueue appModel.model, data\", newData.data);\n setDataQueue.run(() => updateData(newData.data).then(unwrapResult));\n },\n { deep: true },\n );\n\n const updateAppModel = (newData: { data: Data }) => {\n debug(\"updateAppModel\", newData);\n appModel.model.data = deepClone(newData.data) as Data;\n };\n\n (async () => {\n window.addEventListener(\"beforeunload\", () => {\n closedRef.value = true;\n platforma\n .dispose()\n .then(unwrapResult)\n .catch((err) => {\n error(\"platforma error in dispose\", err);\n });\n });\n\n while (!closedRef.value) {\n try {\n const patches = await platforma.getPatches(uTagRef.value).then(unwrapResult);\n\n debug(\"patches.length\", patches.value.length);\n debug(\"uTagRef.value\", uTagRef.value);\n debug(\"patches.uTag\", patches.uTag);\n debug(\"patches.author\", patches.author);\n debug(\"data.author\", data.author);\n\n uTagRef.value = patches.uTag;\n\n if (patches.value.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, patchPoolingDelay));\n continue;\n }\n\n const isAuthorChanged = data.author?.authorId !== patches.author?.authorId;\n\n // Immutable behavior, apply external changes to the snapshot\n if (isAuthorChanged || data.isExternalSnapshot) {\n debug(\"got external changes, applying them to the snapshot\", patches.value);\n ignoreUpdates(() => {\n snapshot.value = applyPatch(snapshot.value, patches.value, false, false).newDocument;\n updateAppModel({ data: deriveDataFromStorage<Data>(snapshot.value.blockStorage) });\n // Reconcile plugin data from external source\n for (const [handle, pluginState] of pluginStates) {\n pluginState.ignoreUpdates(() => {\n pluginState.model.data = deepClone(\n getPluginData(snapshot.value.blockStorage, handle),\n );\n });\n }\n data.isExternalSnapshot = isAuthorChanged;\n });\n } else {\n // Mutable behavior\n debug(\"outputs changed\", patches.value);\n ignoreUpdates(() => {\n snapshot.value = applyPatch(snapshot.value, patches.value).newDocument;\n });\n }\n\n await new Promise((resolve) => setTimeout(resolve, patchPoolingDelay));\n } catch (err) {\n if (hasAbortError(err)) {\n debug(\"patches loop aborted\");\n closedRef.value = true;\n } else {\n error(\"error in patches loop\", err);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n }\n })();\n\n const cloneData = () => deepClone(appModel.model.data) as Data;\n const cloneNavigationState = () =>\n deepClone(snapshot.value.navigationState) as Mutable<NavigationState<Href>>;\n\n const methods = {\n cloneData,\n cloneNavigationState,\n /**\n * Updates the UI state by applying a callback.\n *\n * @param cb - Callback to modify the current UI state.\n * @returns A promise resolving after the update is applied.\n * @todo Make it mutable since there is already an initial one\n */\n updateData(cb: (data: Data) => Data): Promise<boolean> {\n const newData = cb(cloneData());\n debug(\"updateData\", newData);\n appModel.model.data = newData;\n return setDataQueue.run(() => updateData(newData).then(unwrapResult));\n },\n /**\n * Navigates to a specific href by updating the navigation state.\n *\n * @param href - The target href to navigate to.\n * @returns A promise resolving after the navigation state is updated.\n */\n navigateTo(href: Href) {\n const newState = cloneNavigationState();\n newState.href = href;\n return setNavigationStateQueue.run(() => setNavigationState(newState).then(unwrapResult));\n },\n async allSettled() {\n await delay(0);\n const allQueues = [\n setDataQueue.allSettled(),\n ...Array.from(pluginDataQueues.values()).map((q) => q.allSettled()),\n ];\n await Promise.all(allQueues);\n },\n };\n\n const services = getServices<UiServices>({ platforma });\n\n /** Creates a lazily-cached per-plugin reactive state. */\n const createPluginState = <F extends PluginFactoryLike>(\n handle: PluginHandle<F>,\n ): InternalPluginState<InferFactoryData<F>, InferFactoryOutputs<F>> => {\n const prefix = pluginOutputPrefix(handle);\n\n const pluginOutputs = computed(() => {\n const result: Record<string, unknown> = {};\n for (const [key, outputWithStatus] of Object.entries(\n snapshot.value.outputs as Partial<Readonly<Outputs>>,\n )) {\n if (!key.startsWith(prefix)) continue;\n const outputKey = key.slice(prefix.length);\n if (platforma.blockModelInfo.outputs[key]?.withStatus) {\n result[outputKey] = outputWithStatus\n ? ensureOutputHasStableFlag(outputWithStatus)\n : undefined;\n } else {\n result[outputKey] =\n outputWithStatus.ok && outputWithStatus.value !== undefined\n ? outputWithStatus.value\n : undefined;\n }\n }\n return result;\n });\n\n const pluginOutputErrors = computed(() => {\n const result: Record<string, Error | undefined> = {};\n for (const [key, vOrErr] of Object.entries(\n snapshot.value.outputs as Partial<Readonly<Outputs>>,\n )) {\n if (!key.startsWith(prefix)) continue;\n result[key.slice(prefix.length)] =\n vOrErr && vOrErr.ok === false ? new MultiError(vOrErr.errors) : undefined;\n }\n return result;\n });\n\n const pluginModel = reactive({\n data: deepClone(getPluginData(snapshot.value.blockStorage, handle)),\n outputs: pluginOutputs,\n outputErrors: pluginOutputErrors,\n }) as InternalPluginState<InferFactoryData<F>, InferFactoryOutputs<F>>[\"model\"];\n\n const { ignoreUpdates } = watchIgnorable(\n () => pluginModel.data,\n (newData) => {\n if (newData === undefined) return;\n debug(\"plugin setData\", handle, newData);\n getPluginDataQueue(handle).run(() =>\n updatePluginData(handle, deepClone(newData)).then(unwrapResult),\n );\n },\n { deep: true },\n );\n\n return {\n model: pluginModel,\n services: markRaw(services),\n ignoreUpdates,\n };\n };\n\n /** Plugin internals — provided via separate injection key, not exposed on useApp(). */\n const pluginAccess: PluginAccess = {\n getOrCreatePluginState<F extends PluginFactoryLike>(handle: PluginHandle<F>) {\n const existing = pluginStates.get(handle);\n if (existing) {\n return existing as unknown as PluginState<\n InferFactoryData<F>,\n InferFactoryOutputs<F>,\n InferFactoryUiServices<F>\n >;\n }\n const state = createPluginState(handle);\n pluginStates.set(handle, state);\n return state as unknown as PluginState<\n InferFactoryData<F>,\n InferFactoryOutputs<F>,\n InferFactoryUiServices<F>\n >;\n },\n };\n\n const plugins = Object.fromEntries(\n platforma.blockModelInfo.pluginIds.map((id) => {\n const rawDef = platforma.blockModelInfo.pluginPublicOutputs?.[id] ?? {};\n const keys = Object.keys(rawDef);\n if (keys.length === 0) {\n return [id, { handle: id, publicOutputs: {} }];\n }\n const state = pluginAccess.getOrCreatePluginState(id);\n // reactive() ensures publicOutputs is its own proxy, so access via toRaw(app) still unwraps correctly.\n const publicOutputs = reactive(\n Object.fromEntries(\n keys.map((key) => {\n const { getter } = rawDef[key];\n return [\n key,\n computed(() => {\n const data = state.model.data;\n return data != null ? getter(data) : undefined;\n }),\n ];\n }),\n ),\n );\n return [id, { handle: id, publicOutputs }];\n }),\n ) as InferPluginUiEntries<Plugins>;\n\n const getters = {\n closedRef,\n snapshot,\n plugins,\n services: markRaw(services),\n queryParams: computed(() => parseQuery<Href>(snapshot.value.navigationState.href as Href)),\n href: computed(() => snapshot.value.navigationState.href),\n hasErrors: computed(() =>\n Object.values(snapshot.value.outputs as Partial<Readonly<Outputs>>).some((v) => !v?.ok),\n ),\n };\n\n const app = Object.assign(reactive(Object.assign(appModel, getters)), methods);\n\n if (settings.debug) {\n // @ts-expect-error (to inspect in console in debug mode)\n globalThis.__block_app__ = app;\n }\n\n return { app, pluginAccess };\n}\n\nexport type BaseAppV3<\n Data = unknown,\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n Href extends `/${string}` = `/${string}`,\n Plugins extends Record<string, unknown> = Record<string, unknown>,\n UiServices extends Partial<AllUiServices> = Partial<AllUiServices>,\n> = ReturnType<typeof createAppV3<Data, Args, Outputs, Href, Plugins, UiServices>>[\"app\"];\n"],"mappings":";;;;;;;;;;;;;AAiDA,IAAa,KAA0B,OAAoD;CACzF,UAAU,GAAQ,YAAY,GAAU;CACxC,eAAe,GAAQ,gBAAgB,KAAK;CAC7C;AAgBD,SAAgB,EAQd,GACA,GACA,GACA;CACA,IAAM,IAAQ,EAAS,QAAQ,UAAiB,IAC1C,IA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AAyB;EAC3E,IAAM,IAAW,EAAa,IAAI,EAAO;AACzC,MAAI,EACF,QAAO;EAMT,IAAM,IAAQ,EAAkB,EAAO;AAEvC,SADA,EAAa,IAAI,GAAQ,EAAM,EACxB;IAMV,EA6BK,KAAU;EACd;EACA;EACA,SA9Bc,OAAO,YACrB,EAAU,eAAe,UAAU,KAAK,MAAO;GAC7C,IAAM,IAAS,EAAU,eAAe,sBAAsB,MAAO,EAAE,EACjE,IAAO,OAAO,KAAK,EAAO;AAChC,OAAI,EAAK,WAAW,EAClB,QAAO,CAAC,GAAI;IAAE,QAAQ;IAAI,eAAe,EAAE;IAAE,CAAC;GAEhD,IAAM,IAAQ,EAAa,uBAAuB,EAAG;AAgBrD,UAAO,CAAC,GAAI;IAAE,QAAQ;IAAI,eAdJ,EACpB,OAAO,YACL,EAAK,KAAK,MAAQ;KAChB,IAAM,EAAE,cAAW,EAAO;AAC1B,YAAO,CACL,GACA,QAAe;MACb,IAAM,IAAO,EAAM,MAAM;AACzB,aAAO,KAAQ,OAAsB,KAAA,IAAf,EAAO,EAAK;OAClC,CACH;MACD,CACH,CACF;IACwC,CAAC;IAC1C,CACH;EAMC,UAAU,EAAQ,EAAS;EAC3B,aAAa,QAAe,EAAiB,EAAS,MAAM,gBAAgB,KAAa,CAAC;EAC1F,MAAM,QAAe,EAAS,MAAM,gBAAgB,KAAK;EACzD,WAAW,QACT,OAAO,OAAO,EAAS,MAAM,QAAsC,CAAC,MAAM,MAAM,CAAC,GAAG,GAAG,CACxF;EACF,EAEK,IAAM,OAAO,OAAO,EAAS,OAAO,OAAO,GAAU,GAAQ,CAAC,EAAE,EAAQ;AAO9E,QALI,EAAS,UAEX,WAAW,gBAAgB,IAGtB;EAAE;EAAK;EAAc"}
|
|
1
|
+
{"version":3,"file":"createAppV3.js","names":["createNextAuthorMarker","marker","uniqueId","createAppV3","debug","settings","logDebug","error","logError","data","nextAuthorMarker","closedRef","ref","uTagRef","state","debounceSpan","setDataQueue","UpdateSerializer","pluginDataQueues","getPluginDataQueue","queue","handle","setNavigationStateQueue","pluginStates","snapshot","updateData","platforma","updatePluginData","setNavigationState","outputs","computed","entries","k","isPluginOutputKey","outputWithStatus","ensureOutputHasStableFlag","outputErrors","vOrErr","MultiError","appModel","reactive","deepClone","deriveDataFromStorage","watchIgnorable","newData","_newData","unwrapResult","updateAppModel","err","patches","resolve","isAuthorChanged","ignoreUpdates","applyPatch","pluginState","getPluginData","hasAbortError","cloneData","cloneNavigationState","methods","cb","newState","href","delay","allQueues","q","services","getServices","createPluginState","prefix","pluginOutputPrefix","pluginOutputs","result","key","outputKey","pluginOutputErrors","pluginModel","markRaw","pluginAccess","existing","getters","rawDef","id","keys","getter","parseQuery","v","app"],"sources":["../../src/internal/createAppV3.ts"],"sourcesContent":["import { deepClone, delay, uniqueId } from \"@milaboratories/helpers\";\nimport type { Mutable } from \"@milaboratories/helpers\";\nimport type {\n NavigationState,\n BlockOutputsBase,\n BlockStateV3,\n PlatformaV3,\n ValueWithUTag,\n AuthorMarker,\n PlatformaExtended,\n InferPluginUiEntries,\n PluginHandle,\n InferFactoryData,\n InferFactoryOutputs,\n PluginFactoryLike,\n UiServices as AllUiServices,\n InferFactoryUiServices,\n} from \"@platforma-sdk/model\";\nimport {\n hasAbortError,\n unwrapResult,\n deriveDataFromStorage,\n getPluginData,\n isPluginOutputKey,\n pluginOutputPrefix,\n} from \"@platforma-sdk/model\";\nimport type { Ref } from \"vue\";\nimport { reactive, computed, ref, markRaw } from \"vue\";\nimport type { OutputValues, OutputErrors, AppSettings } from \"../types\";\nimport { parseQuery } from \"../urls\";\nimport { ensureOutputHasStableFlag, MultiError } from \"../utils\";\nimport { applyPatch } from \"fast-json-patch\";\nimport { UpdateSerializer } from \"./UpdateSerializer\";\nimport { watchIgnorable } from \"@vueuse/core\";\nimport type { PluginState, PluginAccess } from \"../composition/usePlugin\";\nimport { logDebug, logError } from \"./utils\";\nimport { getServices } from \"./getServices\";\n\nexport const patchPoolingDelay = 150;\n\n/** Internal per-plugin state with reconciliation support. */\ninterface InternalPluginState<\n Data = unknown,\n Outputs = unknown,\n Services = Record<string, unknown>,\n> extends PluginState<Data, Outputs, Services> {\n readonly ignoreUpdates: (fn: () => void) => void;\n}\n\nexport const createNextAuthorMarker = (marker: AuthorMarker | undefined): AuthorMarker => ({\n authorId: marker?.authorId ?? uniqueId(),\n localVersion: (marker?.localVersion ?? 0) + 1,\n});\n\n/**\n * Creates an application instance with reactive state management, outputs, and methods for state updates and navigation.\n *\n * @template Args - The type of arguments used in the application.\n * @template Outputs - The type of block outputs extending `BlockOutputsBase`.\n * @template Data - The type of the block data.\n * @template Href - The type of navigation href, defaulting to a string starting with `/`.\n *\n * @param state - Initial state of the application, including args, outputs, UI state, and navigation state.\n * @param platforma - A platform interface for interacting with block states.\n * @param settings - Application settings, such as debug flags.\n *\n * @returns A reactive application object with methods, getters, and state.\n */\nexport function createAppV3<\n Data = unknown,\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n Href extends `/${string}` = `/${string}`,\n Plugins extends Record<string, unknown> = Record<string, unknown>,\n UiServices extends Partial<AllUiServices> = Partial<AllUiServices>,\n>(\n state: ValueWithUTag<BlockStateV3<Data, Outputs, Href>>,\n platforma: PlatformaExtended<PlatformaV3<Data, Args, Outputs, Href, Plugins, UiServices>>,\n settings: AppSettings,\n) {\n const debug = settings.debug ? logDebug : () => {};\n const error = logError;\n\n const data = {\n isExternalSnapshot: false,\n author: {\n authorId: uniqueId(),\n localVersion: 0,\n },\n };\n\n const nextAuthorMarker = () => {\n data.author = createNextAuthorMarker(data.author);\n debug(\"nextAuthorMarker\", data.author);\n return data.author;\n };\n\n const closedRef = ref(false);\n\n const uTagRef = ref(state.uTag);\n\n const debounceSpan = settings.debounceSpan ?? 200;\n\n const setDataQueue = new UpdateSerializer({ debounceSpan });\n const pluginDataQueues = new Map<PluginHandle, UpdateSerializer>();\n const getPluginDataQueue = (handle: PluginHandle): UpdateSerializer => {\n let queue = pluginDataQueues.get(handle);\n if (!queue) {\n queue = new UpdateSerializer({ debounceSpan });\n pluginDataQueues.set(handle, queue);\n }\n return queue;\n };\n const setNavigationStateQueue = new UpdateSerializer({ debounceSpan });\n\n /** Lazily-created per-plugin reactive states. */\n const pluginStates = new Map<PluginHandle, InternalPluginState>();\n /**\n * Reactive snapshot of the application state, including args, outputs, UI state, and navigation state.\n */\n const snapshot = ref<{\n outputs: Partial<Readonly<Outputs>>;\n blockStorage: unknown;\n navigationState: NavigationState<Href>;\n }>(state.value) as Ref<{\n outputs: Partial<Readonly<Outputs>>;\n blockStorage: unknown;\n navigationState: NavigationState<Href>;\n }>;\n\n const updateData = async (value: Data) => {\n return platforma.mutateStorage({ operation: \"update-block-data\", value }, nextAuthorMarker());\n };\n\n const updatePluginData = async (handle: PluginHandle, value: unknown) => {\n return platforma.mutateStorage(\n { operation: \"update-plugin-data\", pluginId: handle, value },\n nextAuthorMarker(),\n );\n };\n\n const setNavigationState = async (state: NavigationState<Href>) => {\n return platforma.setNavigationState(state);\n };\n\n const outputs = computed<OutputValues<Outputs>>(() => {\n const entries = Object.entries(snapshot.value.outputs as Partial<Readonly<Outputs>>)\n .filter(([k]) => !isPluginOutputKey(k))\n .map(([k, outputWithStatus]) =>\n platforma.blockModelInfo.outputs[k]?.withStatus\n ? [k, ensureOutputHasStableFlag(outputWithStatus)]\n : [\n k,\n outputWithStatus.ok && outputWithStatus.value !== undefined\n ? outputWithStatus.value\n : undefined,\n ],\n );\n return Object.fromEntries(entries);\n });\n\n const outputErrors = computed<OutputErrors<Outputs>>(() => {\n const entries = Object.entries(snapshot.value.outputs as Partial<Readonly<Outputs>>)\n .filter(([k]) => !isPluginOutputKey(k))\n .map(([k, vOrErr]) => [\n k,\n vOrErr && vOrErr.ok === false ? new MultiError(vOrErr.errors) : undefined,\n ]);\n return Object.fromEntries(entries);\n });\n\n const appModel = reactive({\n apiVersion: 3,\n error: \"\",\n model: {\n data: deepClone(deriveDataFromStorage<Data>(snapshot.value.blockStorage)) as Data,\n outputs,\n outputErrors,\n },\n }) as {\n error: string;\n model: {\n data: Data;\n outputs: OutputValues<Outputs>;\n outputErrors: OutputErrors<Outputs>;\n };\n };\n\n const { ignoreUpdates } = watchIgnorable(\n () => appModel.model,\n (_newData) => {\n const newData = deepClone(_newData);\n debug(\"setDataQueue appModel.model, data\", newData.data);\n setDataQueue.run(() => updateData(newData.data).then(unwrapResult));\n },\n { deep: true },\n );\n\n const updateAppModel = (newData: { data: Data }) => {\n debug(\"updateAppModel\", newData);\n appModel.model.data = deepClone(newData.data) as Data;\n };\n\n (async () => {\n window.addEventListener(\"beforeunload\", () => {\n closedRef.value = true;\n platforma\n .dispose()\n .then(unwrapResult)\n .catch((err) => {\n error(\"platforma error in dispose\", err);\n });\n });\n\n while (!closedRef.value) {\n try {\n const patches = await platforma.getPatches(uTagRef.value).then(unwrapResult);\n\n debug(\"patches.length\", patches.value.length);\n debug(\"uTagRef.value\", uTagRef.value);\n debug(\"patches.uTag\", patches.uTag);\n debug(\"patches.author\", patches.author);\n debug(\"data.author\", data.author);\n\n uTagRef.value = patches.uTag;\n\n if (patches.value.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, patchPoolingDelay));\n continue;\n }\n\n const isAuthorChanged = data.author?.authorId !== patches.author?.authorId;\n\n // Immutable behavior, apply external changes to the snapshot\n if (isAuthorChanged || data.isExternalSnapshot) {\n debug(\"got external changes, applying them to the snapshot\", patches.value);\n ignoreUpdates(() => {\n snapshot.value = applyPatch(snapshot.value, patches.value, false, false).newDocument;\n updateAppModel({ data: deriveDataFromStorage<Data>(snapshot.value.blockStorage) });\n // Reconcile plugin data from external source\n for (const [handle, pluginState] of pluginStates) {\n pluginState.ignoreUpdates(() => {\n pluginState.model.data = deepClone(\n getPluginData(snapshot.value.blockStorage, handle),\n );\n });\n }\n data.isExternalSnapshot = isAuthorChanged;\n });\n } else {\n // Mutable behavior\n debug(\"outputs changed\", patches.value);\n ignoreUpdates(() => {\n snapshot.value = applyPatch(snapshot.value, patches.value).newDocument;\n });\n }\n\n await new Promise((resolve) => setTimeout(resolve, patchPoolingDelay));\n } catch (err) {\n if (hasAbortError(err)) {\n debug(\"patches loop aborted\");\n closedRef.value = true;\n } else {\n error(\"error in patches loop\", err);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n }\n })();\n\n const cloneData = () => deepClone(appModel.model.data) as Data;\n const cloneNavigationState = () =>\n deepClone(snapshot.value.navigationState) as Mutable<NavigationState<Href>>;\n\n const methods = {\n cloneData,\n cloneNavigationState,\n /**\n * Updates the UI state by applying a callback.\n *\n * @param cb - Callback to modify the current UI state.\n * @returns A promise resolving after the update is applied.\n * @todo Make it mutable since there is already an initial one\n */\n updateData(cb: (data: Data) => Data): Promise<boolean> {\n const newData = cb(cloneData());\n debug(\"updateData\", newData);\n appModel.model.data = newData;\n return setDataQueue.run(() => updateData(newData).then(unwrapResult));\n },\n /**\n * Navigates to a specific href by updating the navigation state.\n *\n * @param href - The target href to navigate to.\n * @returns A promise resolving after the navigation state is updated.\n */\n navigateTo(href: Href) {\n const newState = cloneNavigationState();\n newState.href = href;\n return setNavigationStateQueue.run(() => setNavigationState(newState).then(unwrapResult));\n },\n async allSettled() {\n await delay(0);\n const allQueues = [\n setDataQueue.allSettled(),\n ...Array.from(pluginDataQueues.values()).map((q) => q.allSettled()),\n ];\n await Promise.all(allQueues);\n },\n };\n\n const services = getServices<UiServices>({ platforma });\n\n /** Creates a lazily-cached per-plugin reactive state. */\n const createPluginState = <F extends PluginFactoryLike>(\n handle: PluginHandle<F>,\n ): InternalPluginState<InferFactoryData<F>, InferFactoryOutputs<F>> => {\n const prefix = pluginOutputPrefix(handle);\n\n const pluginOutputs = computed(() => {\n const result: Record<string, unknown> = {};\n for (const [key, outputWithStatus] of Object.entries(\n snapshot.value.outputs as Partial<Readonly<Outputs>>,\n )) {\n if (!key.startsWith(prefix)) continue;\n const outputKey = key.slice(prefix.length);\n if (platforma.blockModelInfo.outputs[key]?.withStatus) {\n result[outputKey] = outputWithStatus\n ? ensureOutputHasStableFlag(outputWithStatus)\n : undefined;\n } else {\n result[outputKey] =\n outputWithStatus.ok && outputWithStatus.value !== undefined\n ? outputWithStatus.value\n : undefined;\n }\n }\n return result;\n });\n\n const pluginOutputErrors = computed(() => {\n const result: Record<string, Error | undefined> = {};\n for (const [key, vOrErr] of Object.entries(\n snapshot.value.outputs as Partial<Readonly<Outputs>>,\n )) {\n if (!key.startsWith(prefix)) continue;\n result[key.slice(prefix.length)] =\n vOrErr && vOrErr.ok === false ? new MultiError(vOrErr.errors) : undefined;\n }\n return result;\n });\n\n const pluginModel = reactive({\n data: deepClone(getPluginData(snapshot.value.blockStorage, handle)),\n outputs: pluginOutputs,\n outputErrors: pluginOutputErrors,\n }) as InternalPluginState<InferFactoryData<F>, InferFactoryOutputs<F>>[\"model\"];\n\n const { ignoreUpdates } = watchIgnorable(\n () => pluginModel.data,\n (newData) => {\n if (newData === undefined) return;\n debug(\"plugin setData\", handle, newData);\n getPluginDataQueue(handle).run(() =>\n updatePluginData(handle, deepClone(newData)).then(unwrapResult),\n );\n },\n { deep: true },\n );\n\n return {\n model: pluginModel,\n services: markRaw(services),\n ignoreUpdates,\n };\n };\n\n /** Plugin internals — provided via separate injection key, not exposed on useApp(). */\n const pluginAccess: PluginAccess = {\n getOrCreatePluginState<F extends PluginFactoryLike>(handle: PluginHandle<F>) {\n const existing = pluginStates.get(handle);\n if (existing) {\n return existing as unknown as PluginState<\n InferFactoryData<F>,\n InferFactoryOutputs<F>,\n InferFactoryUiServices<F>\n >;\n }\n const state = createPluginState(handle);\n pluginStates.set(handle, state);\n return state as unknown as PluginState<\n InferFactoryData<F>,\n InferFactoryOutputs<F>,\n InferFactoryUiServices<F>\n >;\n },\n };\n\n const plugins = Object.fromEntries(\n platforma.blockModelInfo.pluginIds.map((id) => {\n const rawDef = platforma.blockModelInfo.pluginPublicOutputs?.[id] ?? {};\n const keys = Object.keys(rawDef);\n if (keys.length === 0) {\n return [id, { handle: id, publicOutputs: {} }];\n }\n const state = pluginAccess.getOrCreatePluginState(id);\n // reactive() ensures publicOutputs is its own proxy, so access via toRaw(app) still unwraps correctly.\n const publicOutputs = reactive(\n Object.fromEntries(\n keys.map((key) => {\n const { getter } = rawDef[key];\n return [\n key,\n computed(() => {\n const data = state.model.data;\n return data != null ? getter(data) : undefined;\n }),\n ];\n }),\n ),\n );\n return [id, { handle: id, publicOutputs }];\n }),\n ) as InferPluginUiEntries<Plugins>;\n\n const getters = {\n closedRef,\n snapshot,\n plugins,\n services: markRaw(services),\n queryParams: computed(() => parseQuery<Href>(snapshot.value.navigationState.href as Href)),\n href: computed(() => snapshot.value.navigationState.href),\n hasErrors: computed(() =>\n Object.values(snapshot.value.outputs as Partial<Readonly<Outputs>>).some((v) => !v?.ok),\n ),\n };\n\n const app = Object.assign(reactive(Object.assign(appModel, getters)), methods);\n\n if (settings.debug) {\n // @ts-expect-error (to inspect in console in debug mode)\n globalThis.__block_app__ = app;\n }\n\n return { app, pluginAccess };\n}\n\nexport type BaseAppV3<\n Data = unknown,\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n Href extends `/${string}` = `/${string}`,\n Plugins extends Record<string, unknown> = Record<string, unknown>,\n UiServices extends Partial<AllUiServices> = Partial<AllUiServices>,\n> = ReturnType<typeof createAppV3<Data, Args, Outputs, Href, Plugins, UiServices>>[\"app\"];\n"],"mappings":";;;;;;;;;;;;;AAiDA,IAAaA,KAA0B,OAAoD;CACzF,UAAUC,GAAQ,YAAYC,EAAS;CACvC,eAAeD,GAAQ,gBAAgB,KAAK;AAC9C;AAgBA,SAAgBE,EAQd,GACA,GACA,GACA;CACA,IAAMC,IAAQC,EAAS,QAAQC,UAAiB,CAAC,GAC3CC,IAAQC,GAERC,IAAO;EACX,oBAAoB;EACpB,QAAQ;GACN,UAAUP,EAAS;GACnB,cAAc;EAChB;CACF,GAEMQ,WACJ,EAAK,SAASV,EAAuBS,EAAK,MAAM,GAChDL,EAAM,oBAAoBK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CAMD;EACA,UAAUoE,EAAQX,CAAQ;EAC1B,aAAapC,QAAeuD,EAAiB7D,EAAS,MAAM,gBAAgB,IAAY,CAAC;EACzF,MAAMM,QAAeN,EAAS,MAAM,gBAAgB,IAAI;EACxD,WAAWM,QACT,OAAO,OAAON,EAAS,MAAM,OAAqC,CAAC,CAAC,MAAM,MAAM,CAAC8D,GAAG,EAAE,CACxF;CACF,GAEMC,IAAM,OAAO,OAAO/C,EAAS,OAAO,OAAOD,GAAUyC,EAAO,CAAC,GAAGrB,CAAO;CAO7E,OALItD,EAAS,UAEX,WAAW,gBAAgBkF,IAGtB;EAAE;EAAK;CAAa;AAC7B"}
|
|
@@ -2,18 +2,17 @@ import { logError as e } from "./utils.js";
|
|
|
2
2
|
import { createUiServiceRegistry as t } from "./service_factories.js";
|
|
3
3
|
import { buildServices as n, createServiceProxy as r, getRawPlatformaInstance as i } from "@platforma-sdk/model";
|
|
4
4
|
import { isNil as a } from "es-toolkit";
|
|
5
|
-
|
|
5
|
+
// src/internal/getServices.ts
|
|
6
6
|
var o = null;
|
|
7
7
|
function s(s) {
|
|
8
8
|
if (!a(o)) return o;
|
|
9
|
-
let c = s?.platforma ?? i(), l = t({ proxy:
|
|
9
|
+
let c = s?.platforma ?? i(), l = r(c.serviceDispatch), u = t({ proxy: l }), d = n(c.serviceDispatch, u);
|
|
10
10
|
return window.addEventListener("beforeunload", () => {
|
|
11
|
-
|
|
11
|
+
u.dispose().catch((t) => {
|
|
12
12
|
e("uiRegistry error in dispose", t);
|
|
13
13
|
});
|
|
14
|
-
}), o =
|
|
14
|
+
}), o = d;
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { s as getServices };
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=getServices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getServices.js","names":[],"sources":["../../src/internal/getServices.ts"],"sourcesContent":["import {\n BlockDefaultUiServices,\n buildServices,\n createServiceProxy,\n getRawPlatformaInstance,\n PlatformaV3,\n UiServices,\n} from \"@platforma-sdk/model\";\nimport { createUiServiceRegistry } from \"./service_factories\";\nimport { isNil } from \"es-toolkit\";\nimport { logError } from \"./utils\";\n\nlet cachedServices: null | Partial<UiServices> = null;\n\nexport function getServices<Services extends Partial<UiServices> = BlockDefaultUiServices>(deps?: {\n platforma?: PlatformaV3<any, any, any, any, any, Services>;\n}): Services {\n if (!isNil(cachedServices)) {\n return cachedServices as Services;\n }\n\n const platforma =\n deps?.platforma ??\n (getRawPlatformaInstance() as PlatformaV3<any, any, any, any, any, Services>);\n const proxy = createServiceProxy(platforma.serviceDispatch);\n const uiRegistry = createUiServiceRegistry({ proxy });\n const services = buildServices<Services>(platforma.serviceDispatch, uiRegistry);\n\n window.addEventListener(\"beforeunload\", () => {\n uiRegistry.dispose().catch((err) => {\n logError(\"uiRegistry error in dispose\", err);\n });\n });\n\n return (cachedServices = services) as Services;\n}\n"],"mappings":";;;;;AAYA,
|
|
1
|
+
{"version":3,"file":"getServices.js","names":["cachedServices","getServices","isNil","platforma","deps","getRawPlatformaInstance","proxy","createServiceProxy","uiRegistry","createUiServiceRegistry","services","buildServices","err"],"sources":["../../src/internal/getServices.ts"],"sourcesContent":["import {\n BlockDefaultUiServices,\n buildServices,\n createServiceProxy,\n getRawPlatformaInstance,\n PlatformaV3,\n UiServices,\n} from \"@platforma-sdk/model\";\nimport { createUiServiceRegistry } from \"./service_factories\";\nimport { isNil } from \"es-toolkit\";\nimport { logError } from \"./utils\";\n\nlet cachedServices: null | Partial<UiServices> = null;\n\nexport function getServices<Services extends Partial<UiServices> = BlockDefaultUiServices>(deps?: {\n platforma?: PlatformaV3<any, any, any, any, any, Services>;\n}): Services {\n if (!isNil(cachedServices)) {\n return cachedServices as Services;\n }\n\n const platforma =\n deps?.platforma ??\n (getRawPlatformaInstance() as PlatformaV3<any, any, any, any, any, Services>);\n const proxy = createServiceProxy(platforma.serviceDispatch);\n const uiRegistry = createUiServiceRegistry({ proxy });\n const services = buildServices<Services>(platforma.serviceDispatch, uiRegistry);\n\n window.addEventListener(\"beforeunload\", () => {\n uiRegistry.dispose().catch((err) => {\n logError(\"uiRegistry error in dispose\", err);\n });\n });\n\n return (cachedServices = services) as Services;\n}\n"],"mappings":";;;;;AAYA,IAAIA,IAA6C;AAEjD,SAAgBC,EAA2E,GAE9E;CACX,IAAI,CAACC,EAAMF,CAAc,GACvB,OAAOA;CAGT,IAAMG,IACJC,GAAM,aACLC,EAAwB,GACrBC,IAAQC,EAAmBJ,EAAU,eAAe,GACpDK,IAAaC,EAAwB,EAAE,SAAM,CAAC,GAC9CC,IAAWC,EAAwBR,EAAU,iBAAiBK,CAAU;CAQ9E,OANA,OAAO,iBAAiB,sBAAsB;EAC5C,EAAW,QAAQ,CAAC,CAAC,OAAO,MAAQ;GAClC,EAAS,+BAA+BI,CAAG;EAC7C,CAAC;CACH,CAAC,GAEO,IAAiBF;AAC3B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Services as e, UiServiceRegistry as t } from "@milaboratories/pl-model-common";
|
|
2
2
|
import { SpecDriver as n } from "@milaboratories/pf-spec-driver";
|
|
3
3
|
import { ColumnsCollectionDriverImpl as r } from "@milaboratories/columns-collection-driver";
|
|
4
|
-
|
|
4
|
+
// src/internal/service_factories.ts
|
|
5
5
|
function i(i) {
|
|
6
6
|
return new t(e, {
|
|
7
7
|
PFrameSpec: () => new n(),
|
|
@@ -10,7 +10,6 @@ function i(i) {
|
|
|
10
10
|
ColumnsCollection: () => new r()
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
//#endregion
|
|
14
13
|
export { i as createUiServiceRegistry };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=service_factories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service_factories.js","names":[],"sources":["../../src/internal/service_factories.ts"],"sourcesContent":["/**\n * UI service factories — add a factory for each new service here.\n *\n * Each entry maps a Services key to a factory function that creates the\n * UI-side driver instance:\n * - WASM services: instantiated directly (e.g. SpecDriver)\n * - Node services: proxied via IPC using NodeServiceProxy\n */\n\nimport { Services, UiServiceRegistry } from \"@milaboratories/pl-model-common\";\nimport { SpecDriver } from \"@milaboratories/pf-spec-driver\";\nimport { ColumnsCollectionDriverImpl } from \"@milaboratories/columns-collection-driver\";\nimport type { ServiceProxy } from \"@platforma-sdk/model\";\n\nexport type UiServiceOptions = {\n proxy: ServiceProxy;\n};\n\nexport function createUiServiceRegistry(options: UiServiceOptions) {\n return new UiServiceRegistry(Services, {\n PFrameSpec: () => new SpecDriver(),\n PFrame: () => options.proxy(Services.PFrame),\n Dialog: () => options.proxy(Services.Dialog),\n ColumnsCollection: () => new ColumnsCollectionDriverImpl(),\n });\n}\n"],"mappings":";;;;AAkBA,
|
|
1
|
+
{"version":3,"file":"service_factories.js","names":["createUiServiceRegistry","UiServiceRegistry","Services","SpecDriver","options","ColumnsCollectionDriverImpl"],"sources":["../../src/internal/service_factories.ts"],"sourcesContent":["/**\n * UI service factories — add a factory for each new service here.\n *\n * Each entry maps a Services key to a factory function that creates the\n * UI-side driver instance:\n * - WASM services: instantiated directly (e.g. SpecDriver)\n * - Node services: proxied via IPC using NodeServiceProxy\n */\n\nimport { Services, UiServiceRegistry } from \"@milaboratories/pl-model-common\";\nimport { SpecDriver } from \"@milaboratories/pf-spec-driver\";\nimport { ColumnsCollectionDriverImpl } from \"@milaboratories/columns-collection-driver\";\nimport type { ServiceProxy } from \"@platforma-sdk/model\";\n\nexport type UiServiceOptions = {\n proxy: ServiceProxy;\n};\n\nexport function createUiServiceRegistry(options: UiServiceOptions) {\n return new UiServiceRegistry(Services, {\n PFrameSpec: () => new SpecDriver(),\n PFrame: () => options.proxy(Services.PFrame),\n Dialog: () => options.proxy(Services.Dialog),\n ColumnsCollection: () => new ColumnsCollectionDriverImpl(),\n });\n}\n"],"mappings":";;;;AAkBA,SAAgBA,EAAwB,GAA2B;CACjE,OAAO,IAAIC,EAAkBC,GAAU;EACrC,kBAAkB,IAAIC,EAAW;EACjC,cAAcC,EAAQ,MAAMF,EAAS,MAAM;EAC3C,cAAcE,EAAQ,MAAMF,EAAS,MAAM;EAC3C,yBAAyB,IAAIG,EAA4B;CAC3D,CAAC;AACH"}
|
package/dist/internal/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/utils.ts
|
|
2
2
|
var e = (e, ...t) => {
|
|
3
3
|
console.log(`%c>>> %c${e}`, "color: orange; font-weight: bold", "color: orange", ...t.map((e) => n(e)));
|
|
4
4
|
}, t = (e, ...t) => {
|
|
@@ -10,7 +10,6 @@ var e = (e, ...t) => {
|
|
|
10
10
|
return e instanceof Error ? e.message : String(e);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
13
|
export { e as logDebug, t as logError };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../src/internal/utils.ts"],"sourcesContent":["export const logDebug = (msg: string, ...rest: unknown[]) => {\n console.log(\n `%c>>> %c${msg}`,\n \"color: orange; font-weight: bold\",\n \"color: orange\",\n ...rest.map((r) => stringifyForDebug(r)),\n );\n};\n\nexport const logError = (msg: string, ...rest: unknown[]) => {\n console.error(\n `%c>>> %c${msg}`,\n \"color: red; font-weight: bold\",\n \"color: red\",\n ...rest.map((r) => stringifyForDebug(r)),\n );\n};\n\nconst stringifyForDebug = (v: unknown) => {\n try {\n return JSON.stringify(v, null, 2);\n } catch (err) {\n return err instanceof Error ? err.message : String(err);\n }\n};\n"],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"utils.js","names":["logDebug","rest","msg","stringifyForDebug","r","logError","v","err"],"sources":["../../src/internal/utils.ts"],"sourcesContent":["export const logDebug = (msg: string, ...rest: unknown[]) => {\n console.log(\n `%c>>> %c${msg}`,\n \"color: orange; font-weight: bold\",\n \"color: orange\",\n ...rest.map((r) => stringifyForDebug(r)),\n );\n};\n\nexport const logError = (msg: string, ...rest: unknown[]) => {\n console.error(\n `%c>>> %c${msg}`,\n \"color: red; font-weight: bold\",\n \"color: red\",\n ...rest.map((r) => stringifyForDebug(r)),\n );\n};\n\nconst stringifyForDebug = (v: unknown) => {\n try {\n return JSON.stringify(v, null, 2);\n } catch (err) {\n return err instanceof Error ? err.message : String(err);\n }\n};\n"],"mappings":";AAAA,IAAaA,KAAY,GAAa,GAAGC,MAAoB;CAC3D,QAAQ,IACN,WAAWC,KACX,oCACA,iBACA,GAAGD,EAAK,KAAK,MAAME,EAAkBC,CAAC,CAAC,CACzC;AACF,GAEaC,KAAY,GAAa,GAAGJ,MAAoB;CAC3D,QAAQ,MACN,WAAWC,KACX,iCACA,cACA,GAAGD,EAAK,KAAK,MAAME,EAAkBC,CAAC,CAAC,CACzC;AACF,GAEMD,KAAqB,MAAe;CACxC,IAAI;EACF,OAAO,KAAK,UAAUG,GAAG,MAAM,CAAC;CAClC,SAASC,GAAK;EACZ,OAAOA,aAAe,QAAQA,EAAI,UAAU,OAAOA,CAAG;CACxD;AACF"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../lib/util/helpers/dist/functions.js
|
|
2
2
|
function e(e, t) {
|
|
3
3
|
return Promise.race([e, new Promise((e, n) => setTimeout(() => n(Error(`Timeout exceeded ${t}`)), t))]);
|
|
4
4
|
}
|
|
5
|
-
//#endregion
|
|
6
5
|
export { e as promiseTimeout };
|
|
7
6
|
|
|
8
7
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","names":[],"sources":["../../../../../../../lib/util/helpers/src/functions.ts"],"sourcesContent":["import type { AnyFunction } from \"./types\";\n\nexport function isFunction(value: unknown): value is AnyFunction {\n return typeof value === \"function\";\n}\n\n/**\n * A utility class that ensures asynchronous locks, allowing only one task to proceed at a time.\n */\nexport class AwaitLock {\n private acquired = false;\n private resolvers: (() => void)[] = [];\n\n acquireAsync(): Promise<void> {\n if (!this.acquired) {\n this.acquired = true;\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n this.resolvers.push(resolve);\n });\n }\n\n release(): void {\n if (!this.acquired) {\n throw new Error(\"Cannot release not acquired lock\");\n }\n\n if (this.resolvers.length) {\n this.resolvers.shift()?.();\n } else {\n this.acquired = false;\n }\n }\n}\n\n/**\n * A utility to add a timeout to a promise, rejecting the promise if the timeout is exceeded.\n */\nexport function promiseTimeout<T>(prom: PromiseLike<T>, ms: number): Promise<T> {\n return Promise.race<T>([\n prom,\n new Promise((_r, reject) => setTimeout(() => reject(Error(`Timeout exceeded ${ms}`)), ms)),\n ]);\n}\n\n/**\n * Debounce utility: delays the execution of a function until a certain time has passed since the last call.\n * @param callback\n * @param ms\n * @param immediate (if first call is required)\n * @returns\n */\nexport function debounce<F extends AnyFunction>(\n callback: F,\n ms: number,\n immediate?: boolean,\n): (...args: Parameters<F>) => void {\n let timeout: ReturnType<typeof setTimeout> | undefined;\n return function (this: unknown, ...args: Parameters<F>) {\n const i = immediate && !timeout;\n if (i) {\n callback.apply(this, args);\n }\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n timeout = undefined;\n if (!i) {\n callback.apply(this, args);\n }\n }, ms);\n };\n}\n\n/**\n * Throttle utility: ensures a function is called at most once every `ms` milliseconds.\n * @param callback\n * @param ms milliseconds\n * @param trailing (ensure last call)\n * @returns\n */\nexport function throttle<F extends AnyFunction>(\n callback: F,\n ms: number,\n trailing = true,\n): (...args: Parameters<F>) => void {\n let t = 0,\n call: AnyFunction | null;\n return function (this: unknown, ...args: Parameters<F>) {\n call = () => {\n callback.apply(this, args);\n t = new Date().getTime() + ms;\n call = null;\n if (trailing) {\n setTimeout(() => {\n call?.();\n }, ms);\n }\n };\n if (new Date().getTime() > t) call();\n };\n}\n\n/**\n * Memoization utility: caches results of function calls based on their arguments to avoid redundant calculations.\n */\nexport const memoize = <F extends AnyFunction>(fn: F) => {\n const cache = new Map();\n return function (...args: Parameters<F>): ReturnType<F> {\n const key = JSON.stringify(args);\n return cache.has(key)\n ? cache.get(key)\n : cache.set(key, fn.call(null, ...args)) && cache.get(key);\n };\n};\n\n/**\n * Function wrapper utility: executes a function before the main function is called.\n */\nexport const wrapFunction = <T extends unknown[], U>(fn: (...args: T) => U, before: () => void) => {\n return (...args: T): U => {\n before();\n return fn(...args);\n };\n};\n\n/**\n * Function piping utility: allows chaining of functions by passing the result of one as input to another\n */\nexport function pipe<A, B>(cb: (a: A) => B) {\n const fn = (a: A) => cb(a);\n\n fn.pipe = <C>(next: (b: B) => C) => pipe((a: A) => next(cb(a)));\n\n return fn;\n}\n\n/**\n * Ensures that only one request can be processed at a time.\n */\nexport function exclusiveRequest<A, R>(request: (...args: A[]) => Promise<R>) {\n let counter = 0n;\n let ongoingOperation: Promise<R> | undefined;\n\n return async function (...params: A[]): Promise<\n | {\n ok: false;\n }\n | {\n ok: true;\n value: R;\n }\n > {\n const myId = ++counter;\n\n try {\n await ongoingOperation;\n } catch {\n // ignoring the error here, original caller will receive any rejections\n }\n\n // checking that this update is still the most recent\n if (counter !== myId) {\n return {\n ok: false,\n };\n }\n\n const promise = request(...params);\n\n ongoingOperation = promise;\n\n const value = await promise;\n\n return {\n ok: true,\n value,\n };\n };\n}\n\nexport function tryDo<R1>(fn: () => R1): R1 | undefined;\nexport function tryDo<R1, R2>(fn: () => R1, fallback: (cause: unknown) => R2): R1 | R2;\nexport function tryDo(fn: () => unknown, fallback?: (cause: unknown) => unknown) {\n try {\n return fn();\n } catch (cause: unknown) {\n return fallback?.(cause);\n }\n}\n"],"mappings":";AAwCA,
|
|
1
|
+
{"version":3,"file":"functions.js","names":["promiseTimeout","prom","reject","ms"],"sources":["../../../../../../../lib/util/helpers/src/functions.ts"],"sourcesContent":["import type { AnyFunction } from \"./types\";\n\nexport function isFunction(value: unknown): value is AnyFunction {\n return typeof value === \"function\";\n}\n\n/**\n * A utility class that ensures asynchronous locks, allowing only one task to proceed at a time.\n */\nexport class AwaitLock {\n private acquired = false;\n private resolvers: (() => void)[] = [];\n\n acquireAsync(): Promise<void> {\n if (!this.acquired) {\n this.acquired = true;\n return Promise.resolve();\n }\n\n return new Promise((resolve) => {\n this.resolvers.push(resolve);\n });\n }\n\n release(): void {\n if (!this.acquired) {\n throw new Error(\"Cannot release not acquired lock\");\n }\n\n if (this.resolvers.length) {\n this.resolvers.shift()?.();\n } else {\n this.acquired = false;\n }\n }\n}\n\n/**\n * A utility to add a timeout to a promise, rejecting the promise if the timeout is exceeded.\n */\nexport function promiseTimeout<T>(prom: PromiseLike<T>, ms: number): Promise<T> {\n return Promise.race<T>([\n prom,\n new Promise((_r, reject) => setTimeout(() => reject(Error(`Timeout exceeded ${ms}`)), ms)),\n ]);\n}\n\n/**\n * Debounce utility: delays the execution of a function until a certain time has passed since the last call.\n * @param callback\n * @param ms\n * @param immediate (if first call is required)\n * @returns\n */\nexport function debounce<F extends AnyFunction>(\n callback: F,\n ms: number,\n immediate?: boolean,\n): (...args: Parameters<F>) => void {\n let timeout: ReturnType<typeof setTimeout> | undefined;\n return function (this: unknown, ...args: Parameters<F>) {\n const i = immediate && !timeout;\n if (i) {\n callback.apply(this, args);\n }\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n timeout = undefined;\n if (!i) {\n callback.apply(this, args);\n }\n }, ms);\n };\n}\n\n/**\n * Throttle utility: ensures a function is called at most once every `ms` milliseconds.\n * @param callback\n * @param ms milliseconds\n * @param trailing (ensure last call)\n * @returns\n */\nexport function throttle<F extends AnyFunction>(\n callback: F,\n ms: number,\n trailing = true,\n): (...args: Parameters<F>) => void {\n let t = 0,\n call: AnyFunction | null;\n return function (this: unknown, ...args: Parameters<F>) {\n call = () => {\n callback.apply(this, args);\n t = new Date().getTime() + ms;\n call = null;\n if (trailing) {\n setTimeout(() => {\n call?.();\n }, ms);\n }\n };\n if (new Date().getTime() > t) call();\n };\n}\n\n/**\n * Memoization utility: caches results of function calls based on their arguments to avoid redundant calculations.\n */\nexport const memoize = <F extends AnyFunction>(fn: F) => {\n const cache = new Map();\n return function (...args: Parameters<F>): ReturnType<F> {\n const key = JSON.stringify(args);\n return cache.has(key)\n ? cache.get(key)\n : cache.set(key, fn.call(null, ...args)) && cache.get(key);\n };\n};\n\n/**\n * Function wrapper utility: executes a function before the main function is called.\n */\nexport const wrapFunction = <T extends unknown[], U>(fn: (...args: T) => U, before: () => void) => {\n return (...args: T): U => {\n before();\n return fn(...args);\n };\n};\n\n/**\n * Function piping utility: allows chaining of functions by passing the result of one as input to another\n */\nexport function pipe<A, B>(cb: (a: A) => B) {\n const fn = (a: A) => cb(a);\n\n fn.pipe = <C>(next: (b: B) => C) => pipe((a: A) => next(cb(a)));\n\n return fn;\n}\n\n/**\n * Ensures that only one request can be processed at a time.\n */\nexport function exclusiveRequest<A, R>(request: (...args: A[]) => Promise<R>) {\n let counter = 0n;\n let ongoingOperation: Promise<R> | undefined;\n\n return async function (...params: A[]): Promise<\n | {\n ok: false;\n }\n | {\n ok: true;\n value: R;\n }\n > {\n const myId = ++counter;\n\n try {\n await ongoingOperation;\n } catch {\n // ignoring the error here, original caller will receive any rejections\n }\n\n // checking that this update is still the most recent\n if (counter !== myId) {\n return {\n ok: false,\n };\n }\n\n const promise = request(...params);\n\n ongoingOperation = promise;\n\n const value = await promise;\n\n return {\n ok: true,\n value,\n };\n };\n}\n\nexport function tryDo<R1>(fn: () => R1): R1 | undefined;\nexport function tryDo<R1, R2>(fn: () => R1, fallback: (cause: unknown) => R2): R1 | R2;\nexport function tryDo(fn: () => unknown, fallback?: (cause: unknown) => unknown) {\n try {\n return fn();\n } catch (cause: unknown) {\n return fallback?.(cause);\n }\n}\n"],"mappings":";AAwCA,SAAgBA,EAAkB,GAAsB,GAAwB;CAC9E,OAAO,QAAQ,KAAQ,CACrBC,GACA,IAAI,SAAS,GAAI,MAAW,iBAAiBC,EAAO,MAAM,oBAAoBC,GAAI,CAAC,GAAGA,CAAE,CAAC,CAC3F,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.js","names":[],"sources":["../../../../../../../lib/util/helpers/src/hash.ts"],"sourcesContent":["import { createGetIncrementalId } from \"./uniqId\";\nimport { isPrimitive } from \"./utils\";\n\nexport function hashString(str: string, seed = 0): number {\n let h1 = 0xdeadbeef ^ seed,\n h2 = 0x41c6ce57 ^ seed;\n\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}\n\nexport function shallowHash(...values: unknown[]): number {\n let str = \"\";\n\n for (let i = 0; i < values.length; i += 1) {\n const value = values[i];\n\n if (isPrimitive(value)) {\n str += \"/\" + String(value);\n } else {\n str += \"/\" + getIdForPointer(value as object);\n }\n }\n\n return hashString(str);\n}\n\nconst mapPointerToMap = new WeakMap<object, string>();\nconst getIncrementalId = createGetIncrementalId();\n\nfunction getIdForPointer(obj: object): string {\n if (!mapPointerToMap.has(obj)) {\n mapPointerToMap.set(obj, getIncrementalId().toString());\n }\n\n return mapPointerToMap.get(obj)!;\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"hash.js","names":["createGetIncrementalId"],"sources":["../../../../../../../lib/util/helpers/src/hash.ts"],"sourcesContent":["import { createGetIncrementalId } from \"./uniqId\";\nimport { isPrimitive } from \"./utils\";\n\nexport function hashString(str: string, seed = 0): number {\n let h1 = 0xdeadbeef ^ seed,\n h2 = 0x41c6ce57 ^ seed;\n\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}\n\nexport function shallowHash(...values: unknown[]): number {\n let str = \"\";\n\n for (let i = 0; i < values.length; i += 1) {\n const value = values[i];\n\n if (isPrimitive(value)) {\n str += \"/\" + String(value);\n } else {\n str += \"/\" + getIdForPointer(value as object);\n }\n }\n\n return hashString(str);\n}\n\nconst mapPointerToMap = new WeakMap<object, string>();\nconst getIncrementalId = createGetIncrementalId();\n\nfunction getIdForPointer(obj: object): string {\n if (!mapPointerToMap.has(obj)) {\n mapPointerToMap.set(obj, getIncrementalId().toString());\n }\n\n return mapPointerToMap.get(obj)!;\n}\n"],"mappings":";AAmCyBA,EAAuB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import "./utils.js";
|
|
2
|
-
import "./strings.js";
|
|
3
|
-
import "./objects.js";
|
|
4
|
-
import "./functions.js";
|
|
5
|
-
import "./prettyBytes.js";
|
|
1
|
+
import { Deferred as e, Fetcher as t, delay as n, isNil as r, notEmpty as i, tapIf as a } from "./utils.js";
|
|
2
|
+
import { uniqueId as o } from "./strings.js";
|
|
3
|
+
import { deepClone as s, getField as c, isJsonEqual as l } from "./objects.js";
|
|
4
|
+
import { promiseTimeout as u } from "./functions.js";
|
|
5
|
+
import { prettyBytes as d } from "./prettyBytes.js";
|
|
6
6
|
import "./error.js";
|
|
7
7
|
import "./uniqId.js";
|
|
8
8
|
import "./hash.js";
|
|
9
|
-
import "./random.js";
|
|
9
|
+
import { randomInt as f } from "./random.js";
|
|
10
|
+
export { e as Deferred, t as Fetcher, s as deepClone, n as delay, c as getField, l as isJsonEqual, r as isNil, i as notEmpty, d as prettyBytes, u as promiseTimeout, f as randomInt, a as tapIf, o as uniqueId };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../lib/util/helpers/dist/objects.js
|
|
2
2
|
var e = Array.isArray;
|
|
3
3
|
function t(e) {
|
|
4
4
|
return typeof e == "object" && !!e;
|
|
@@ -16,8 +16,8 @@ function i(e) {
|
|
|
16
16
|
}
|
|
17
17
|
function a(n, o) {
|
|
18
18
|
if (!(t(n) && t(o))) return n === o;
|
|
19
|
-
if (e(n) && e(o)) return n.length === o.length
|
|
20
|
-
if (r(n) && r(o)) return i(n) === i(o)
|
|
19
|
+
if (e(n) && e(o)) return n.length === o.length && [...n.keys()].every((e) => a(n[e], o[e]));
|
|
20
|
+
if (r(n) && r(o)) return i(n) === i(o) && Object.keys(n).every((e) => a(n[e], o[e]));
|
|
21
21
|
throw Error(`Cannot compare a ${String(n)} and b ${String(o)}`);
|
|
22
22
|
}
|
|
23
23
|
function o(e) {
|
|
@@ -25,17 +25,18 @@ function o(e) {
|
|
|
25
25
|
let t = [];
|
|
26
26
|
for (let n = 0; n < e.length; n++) t[n] = o(e[n]);
|
|
27
27
|
return t;
|
|
28
|
-
}
|
|
28
|
+
}
|
|
29
|
+
if (r(e)) {
|
|
29
30
|
let t = {};
|
|
30
31
|
return Object.keys(e).forEach((n) => {
|
|
31
32
|
t[n] = o(e[n]);
|
|
32
33
|
}), t;
|
|
33
|
-
}
|
|
34
|
+
}
|
|
35
|
+
return e;
|
|
34
36
|
}
|
|
35
37
|
function s(e, t) {
|
|
36
38
|
return e[t];
|
|
37
39
|
}
|
|
38
|
-
//#endregion
|
|
39
40
|
export { o as deepClone, s as getField, e as isArray, a as isJsonEqual, t as isNonPrimitive, n as isObject, r as isPlainObject };
|
|
40
41
|
|
|
41
42
|
//# sourceMappingURL=objects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects.js","names":[],"sources":["../../../../../../../lib/util/helpers/src/objects.ts"],"sourcesContent":["/**/\n\nimport type { PartialBy, PlainObject, UnionToIntersection } from \"./types\";\nimport { isNil } from \"./utils\";\n\n/**\n * Alias to Array.isArray\n */\nexport const isArray = Array.isArray;\n\n//\nexport function isNonPrimitive<V, T extends PlainObject<V> | V[]>(obj: T | unknown): obj is T {\n return obj !== null && typeof obj === \"object\";\n}\n\nexport function isObject(value: unknown): value is object {\n return typeof value === \"object\" && value !== null;\n}\n\n/**\n * Checks if the given value is a plain object.\n *\n * A plain object is defined as an object created by the `{}` literal,\n * an object created with `Object.create(null)`, or an object with a\n * prototype that resolves to `Object.prototype`.\n *\n * @param value - The value to check.\n * @returns `true` if the value is a plain object, otherwise `false`.\n *\n * @example\n * ```typescript\n * isPlainObject({}); // true\n * isPlainObject(Object.create(null)); // true\n * isPlainObject(new Date()); // false\n * isPlainObject(null); // false\n * isPlainObject([]); // false\n * ```\n */\nexport function isPlainObject(value: unknown): value is PlainObject {\n if (!isObject(value)) {\n return false;\n }\n\n const prototype: unknown = Object.getPrototypeOf(value);\n\n return (\n prototype === null ||\n prototype === Object.prototype ||\n Object.getPrototypeOf(prototype) === null\n );\n}\n\nexport function map<U, T extends Record<string, unknown>>(\n obj: T,\n callback: (curr: T[keyof T], key: keyof T) => U,\n) {\n const keys = Object.keys(obj) as Array<keyof T>;\n\n return keys.map((key: keyof T) => {\n return callback(obj[key], key);\n });\n}\n\nfunction definedKeysSize(obj: PlainObject) {\n return Object.values(obj).reduce((length: number, v) => {\n return v !== undefined ? length + 1 : length;\n }, 0);\n}\n\n/**\n * Performs a deep equality check between two values, `a` and `b`, to determine if they are JSON-equivalent.\n *\n * JSON equivalence means that the two values are strictly equal in structure and content, including arrays and plain objects.\n * Non-primitive values that are neither arrays nor plain objects will throw an error.\n *\n * @param a - The first value to compare.\n * @param b - The second value to compare.\n * @returns `true` if the values are JSON-equivalent, otherwise `false`.\n *\n * @throws If the values are non-primitive and not arrays or plain objects.\n *\n * @example\n * ```typescript\n * isJsonEqual(1, 1); // true\n * isJsonEqual({ a: 1 }, { a: 1 }); // true\n * isJsonEqual([1, 2], [1, 2]); // true\n * isJsonEqual({ a: 1 }, { a: 2 }); // false\n * isJsonEqual([1, 2], [2, 1]); // false\n * isJsonEqual(new Date(), new Date()); // Error\n * ```\n */\nexport function isJsonEqual(a: unknown, b: unknown): boolean {\n if (!(isNonPrimitive(a) && isNonPrimitive(b))) {\n return a === b;\n }\n\n if (isArray(a) && isArray(b)) {\n if (a.length !== b.length) {\n return false;\n } else {\n return [...a.keys()].every((k) => isJsonEqual(a[k], b[k]));\n }\n }\n\n if (isPlainObject(a) && isPlainObject(b)) {\n if (definedKeysSize(a) !== definedKeysSize(b)) {\n return false;\n }\n\n return Object.keys(a).every((k) => isJsonEqual(a[k], b[k]));\n }\n\n throw Error(`Cannot compare a ${String(a)} and b ${String(b)}`);\n}\n\n/**\n * Alias to isJsonEqual function\n * @deprecated change to isJsonEqual\n */\nexport const deepEqual = isJsonEqual;\n\nexport function deepClone<T>(obj: T): T {\n if (Array.isArray(obj)) {\n const copy: any[] = [];\n for (let i = 0; i < obj.length; i++) {\n copy[i] = deepClone(obj[i]) as unknown;\n }\n return copy as T;\n } else if (isPlainObject(obj)) {\n const copy: Record<string, any> = {};\n Object.keys(obj).forEach((k) => {\n copy[k] = deepClone(obj[k]);\n });\n return copy as T;\n } else {\n return obj;\n }\n}\n\nexport function shallowClone<T>(obj: T): T {\n if (isNil(obj)) return obj;\n if (Array.isArray(obj)) return obj.slice() as T;\n if (isPlainObject(obj)) return Object.assign({}, obj) as T;\n if (obj instanceof Map) return new Map(obj) as T;\n if (obj instanceof Set) return new Set(obj) as T;\n throw Error(`Not implemented clone strategy for ${JSON.stringify(obj)}`);\n}\n\nexport function shallowDiff<T>(to: T, from: T): Partial<T> {\n const diff: Partial<T> = {};\n\n for (const key in from) {\n if (from[key] !== to[key]) {\n diff[key] = to[key];\n }\n }\n\n return diff;\n}\n\nexport function bindMethods<O extends Record<string, unknown>>(obj: O) {\n Object.entries(obj).forEach(([key, m]) => {\n if (m instanceof Function) {\n //\n obj[key as keyof O] = m.bind(obj);\n }\n });\n\n return obj;\n}\n\nexport function setProp<O, K extends keyof O>(obj: O, key: K, value: O[K]) {\n obj[key] = value;\n return obj;\n}\n\nexport function getProp<O, K extends keyof O>(obj: O, key: K): O[K] {\n return obj[key];\n}\n\nexport function shiftProp<O, K extends keyof O>(obj: O, key: K): [O[K], Omit<O, K>] {\n obj = { ...obj };\n const val = obj[key];\n delete obj[key];\n return [val, obj];\n}\n\nexport function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {\n return Object.assign({}, ...keys.map((k) => ({ [k]: obj[k] }))) as Pick<T, K>;\n}\n\nexport function pickValues<T, K extends keyof T>(obj: T, ...keys: K[]) {\n return keys.map((k) => obj[k]);\n}\n\nexport function omit<T, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K> {\n const o = Object.assign({}, obj) as PartialBy<T, K>;\n keys.forEach((k) => delete o[k]);\n return o;\n}\n\n/**\n * Performs a deep patch of the target object or array using the source object or array.\n *\n * This function recursively merges properties of the source into the target:\n * - If a property in both target and source is a plain object, they are recursively merged.\n * - If a property in both target and source is an array of the same length, the arrays are recursively patched element by element.\n * - Otherwise, the property value in the target is replaced by the corresponding value from the source.\n *\n * The patch is applied in-place to the target object or array, which is also returned for convenience.\n *\n * @typeParam T - The type of the target and source, which must be either a plain object or an array.\n * @param target - The target object or array to be patched. This object/array is modified in-place.\n * @param source - The source object or array providing the new values for the patch.\n * @returns The modified target object or array.\n *\n * @example\n * ```typescript\n * const target = { a: { b: 1 }, c: [1, 2] };\n * const source = { a: { b: 2 }, c: [3, 4], d: 5 };\n * const result = deepPatch(target, source);\n * // target is now: { a: { b: 2 }, c: [3, 4], d: 5 }\n * // result is the same reference as target.\n *\n * const targetArray = [{ a: 1 }, { b: 2 }];\n * const sourceArray = [{ a: 2 }, { b: 3 }];\n * const resultArray = deepPatch(targetArray, sourceArray);\n * // targetArray is now: [{ a: 2 }, { b: 3 }]\n * ```\n */\nexport function deepPatch<T extends PlainObject | unknown[]>(target: T, source: T) {\n const sk = new Set<keyof T>([\n ...(Object.keys(target) as (keyof T)[]),\n ...(Object.keys(source) as (keyof T)[]),\n ]);\n\n sk.forEach((key) => {\n const t = target[key];\n const s = source[key];\n if (isPlainObject(t) && isPlainObject(s)) {\n deepPatch(t, s);\n } else if (isArray(t) && isArray(s) && t.length === s.length) {\n deepPatch(t, s);\n } else {\n target[key] = s;\n }\n });\n\n return target;\n}\n\n/**\n * Reads a property from a union-typed object where the key may exist only on some members of the union.\n *\n * `K` is constrained to keys of the union's intersection, so any key present on at least one union\n * member is accepted. The return type resolves to `T[K]` when `K` is a key of `T`, otherwise `undefined`\n * — matching the runtime behavior of reading a missing property.\n *\n * @param obj - source object (may be a union of shapes)\n * @param prop - property name, must be a key of at least one union member\n * @returns the property value if present, otherwise `undefined`\n */\nexport function getField<T extends object, K extends keyof UnionToIntersection<T>>(\n obj: T,\n prop: K,\n): K extends keyof T ? T[K] : undefined {\n // @ts-expect-error - we want this to be a compile-time error when prop is not in T, but at runtime we just return undefined\n return obj[prop];\n}\n"],"mappings":";AAQA,IAAa,IAAU,MAAM;AAG7B,SAAgB,EAAkD,GAA4B;AAC5F,QAAuB,OAAO,KAAQ,cAA/B;;AAGT,SAAgB,EAAS,GAAiC;AACxD,QAAO,OAAO,KAAU,cAAY;;AAsBtC,SAAgB,EAAc,GAAsC;AAClE,KAAI,CAAC,EAAS,EAAK,CACjB,QAAO;CAGT,IAAM,IAAqB,OAAO,eAAe,EAAK;AAEtD,QACE,MAAc,QACd,MAAc,OAAO,aACrB,OAAO,eAAe,EAAS,KAAM;;AAezC,SAAS,EAAgB,GAAkB;AACzC,QAAO,OAAO,OAAO,EAAI,CAAC,QAAQ,GAAgB,MACzC,MAAM,KAAA,IAAyB,IAAb,IAAS,GACjC,EAAC;;AAyBN,SAAgB,EAAY,GAAY,GAAqB;AAC3D,KAAI,EAAE,EAAe,EAAC,IAAK,EAAe,EAAC,EACzC,QAAO,MAAM;AAGf,KAAI,EAAQ,EAAC,IAAK,EAAQ,EAAC,CAIvB,QAHE,EAAE,WAAW,EAAE,SAGV,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,OAAO,MAAM,EAAY,EAAE,IAAI,EAAE,GAAG,CAAA,GAFlD;AAMX,KAAI,EAAc,EAAC,IAAK,EAAc,EAAC,CAKrC,QAJI,EAAgB,EAAC,KAAM,EAAgB,EAAC,GAIrC,OAAO,KAAK,EAAE,CAAC,OAAO,MAAM,EAAY,EAAE,IAAI,EAAE,GAAG,CAAA,GAHjD;AAMX,OAAM,MAAM,oBAAoB,OAAO,EAAC,CAAE,SAAS,OAAO,EAAC,GAAG;;AAShE,SAAgB,EAAa,GAAW;AACtC,KAAI,MAAM,QAAQ,EAAG,EAAG;EACtB,IAAM,IAAc,EAAC;AACrB,OAAK,IAAI,IAAI,GAAG,IAAI,EAAI,QAAQ,IAC9B,GAAK,KAAK,EAAU,EAAI,GAAE;AAE5B,SAAO;YACE,EAAc,EAAG,EAAG;EAC7B,IAAM,IAA4B,EAAC;AAInC,SAHA,OAAO,KAAK,EAAI,CAAC,SAAS,MAAM;AAC9B,KAAK,KAAK,EAAU,EAAI,GAAE;IAC3B,EACM;OAEP,QAAO;;AA+HX,SAAgB,EACd,GACA,GACsC;AAEtC,QAAO,EAAI"}
|
|
1
|
+
{"version":3,"file":"objects.js","names":["isArray","isNonPrimitive","obj","isObject","value","isPlainObject","prototype","definedKeysSize","v","length","isJsonEqual","a","b","k","deepClone","copy","i","getField","prop"],"sources":["../../../../../../../lib/util/helpers/src/objects.ts"],"sourcesContent":["/**/\n\nimport type { PartialBy, PlainObject, UnionToIntersection } from \"./types\";\nimport { isNil } from \"./utils\";\n\n/**\n * Alias to Array.isArray\n */\nexport const isArray = Array.isArray;\n\n//\nexport function isNonPrimitive<V, T extends PlainObject<V> | V[]>(obj: T | unknown): obj is T {\n return obj !== null && typeof obj === \"object\";\n}\n\nexport function isObject(value: unknown): value is object {\n return typeof value === \"object\" && value !== null;\n}\n\n/**\n * Checks if the given value is a plain object.\n *\n * A plain object is defined as an object created by the `{}` literal,\n * an object created with `Object.create(null)`, or an object with a\n * prototype that resolves to `Object.prototype`.\n *\n * @param value - The value to check.\n * @returns `true` if the value is a plain object, otherwise `false`.\n *\n * @example\n * ```typescript\n * isPlainObject({}); // true\n * isPlainObject(Object.create(null)); // true\n * isPlainObject(new Date()); // false\n * isPlainObject(null); // false\n * isPlainObject([]); // false\n * ```\n */\nexport function isPlainObject(value: unknown): value is PlainObject {\n if (!isObject(value)) {\n return false;\n }\n\n const prototype: unknown = Object.getPrototypeOf(value);\n\n return (\n prototype === null ||\n prototype === Object.prototype ||\n Object.getPrototypeOf(prototype) === null\n );\n}\n\nexport function map<U, T extends Record<string, unknown>>(\n obj: T,\n callback: (curr: T[keyof T], key: keyof T) => U,\n) {\n const keys = Object.keys(obj) as Array<keyof T>;\n\n return keys.map((key: keyof T) => {\n return callback(obj[key], key);\n });\n}\n\nfunction definedKeysSize(obj: PlainObject) {\n return Object.values(obj).reduce((length: number, v) => {\n return v !== undefined ? length + 1 : length;\n }, 0);\n}\n\n/**\n * Performs a deep equality check between two values, `a` and `b`, to determine if they are JSON-equivalent.\n *\n * JSON equivalence means that the two values are strictly equal in structure and content, including arrays and plain objects.\n * Non-primitive values that are neither arrays nor plain objects will throw an error.\n *\n * @param a - The first value to compare.\n * @param b - The second value to compare.\n * @returns `true` if the values are JSON-equivalent, otherwise `false`.\n *\n * @throws If the values are non-primitive and not arrays or plain objects.\n *\n * @example\n * ```typescript\n * isJsonEqual(1, 1); // true\n * isJsonEqual({ a: 1 }, { a: 1 }); // true\n * isJsonEqual([1, 2], [1, 2]); // true\n * isJsonEqual({ a: 1 }, { a: 2 }); // false\n * isJsonEqual([1, 2], [2, 1]); // false\n * isJsonEqual(new Date(), new Date()); // Error\n * ```\n */\nexport function isJsonEqual(a: unknown, b: unknown): boolean {\n if (!(isNonPrimitive(a) && isNonPrimitive(b))) {\n return a === b;\n }\n\n if (isArray(a) && isArray(b)) {\n if (a.length !== b.length) {\n return false;\n } else {\n return [...a.keys()].every((k) => isJsonEqual(a[k], b[k]));\n }\n }\n\n if (isPlainObject(a) && isPlainObject(b)) {\n if (definedKeysSize(a) !== definedKeysSize(b)) {\n return false;\n }\n\n return Object.keys(a).every((k) => isJsonEqual(a[k], b[k]));\n }\n\n throw Error(`Cannot compare a ${String(a)} and b ${String(b)}`);\n}\n\n/**\n * Alias to isJsonEqual function\n * @deprecated change to isJsonEqual\n */\nexport const deepEqual = isJsonEqual;\n\nexport function deepClone<T>(obj: T): T {\n if (Array.isArray(obj)) {\n const copy: any[] = [];\n for (let i = 0; i < obj.length; i++) {\n copy[i] = deepClone(obj[i]) as unknown;\n }\n return copy as T;\n } else if (isPlainObject(obj)) {\n const copy: Record<string, any> = {};\n Object.keys(obj).forEach((k) => {\n copy[k] = deepClone(obj[k]);\n });\n return copy as T;\n } else {\n return obj;\n }\n}\n\nexport function shallowClone<T>(obj: T): T {\n if (isNil(obj)) return obj;\n if (Array.isArray(obj)) return obj.slice() as T;\n if (isPlainObject(obj)) return Object.assign({}, obj) as T;\n if (obj instanceof Map) return new Map(obj) as T;\n if (obj instanceof Set) return new Set(obj) as T;\n throw Error(`Not implemented clone strategy for ${JSON.stringify(obj)}`);\n}\n\nexport function shallowDiff<T>(to: T, from: T): Partial<T> {\n const diff: Partial<T> = {};\n\n for (const key in from) {\n if (from[key] !== to[key]) {\n diff[key] = to[key];\n }\n }\n\n return diff;\n}\n\nexport function bindMethods<O extends Record<string, unknown>>(obj: O) {\n Object.entries(obj).forEach(([key, m]) => {\n if (m instanceof Function) {\n //\n obj[key as keyof O] = m.bind(obj);\n }\n });\n\n return obj;\n}\n\nexport function setProp<O, K extends keyof O>(obj: O, key: K, value: O[K]) {\n obj[key] = value;\n return obj;\n}\n\nexport function getProp<O, K extends keyof O>(obj: O, key: K): O[K] {\n return obj[key];\n}\n\nexport function shiftProp<O, K extends keyof O>(obj: O, key: K): [O[K], Omit<O, K>] {\n obj = { ...obj };\n const val = obj[key];\n delete obj[key];\n return [val, obj];\n}\n\nexport function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K> {\n return Object.assign({}, ...keys.map((k) => ({ [k]: obj[k] }))) as Pick<T, K>;\n}\n\nexport function pickValues<T, K extends keyof T>(obj: T, ...keys: K[]) {\n return keys.map((k) => obj[k]);\n}\n\nexport function omit<T, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K> {\n const o = Object.assign({}, obj) as PartialBy<T, K>;\n keys.forEach((k) => delete o[k]);\n return o;\n}\n\n/**\n * Performs a deep patch of the target object or array using the source object or array.\n *\n * This function recursively merges properties of the source into the target:\n * - If a property in both target and source is a plain object, they are recursively merged.\n * - If a property in both target and source is an array of the same length, the arrays are recursively patched element by element.\n * - Otherwise, the property value in the target is replaced by the corresponding value from the source.\n *\n * The patch is applied in-place to the target object or array, which is also returned for convenience.\n *\n * @typeParam T - The type of the target and source, which must be either a plain object or an array.\n * @param target - The target object or array to be patched. This object/array is modified in-place.\n * @param source - The source object or array providing the new values for the patch.\n * @returns The modified target object or array.\n *\n * @example\n * ```typescript\n * const target = { a: { b: 1 }, c: [1, 2] };\n * const source = { a: { b: 2 }, c: [3, 4], d: 5 };\n * const result = deepPatch(target, source);\n * // target is now: { a: { b: 2 }, c: [3, 4], d: 5 }\n * // result is the same reference as target.\n *\n * const targetArray = [{ a: 1 }, { b: 2 }];\n * const sourceArray = [{ a: 2 }, { b: 3 }];\n * const resultArray = deepPatch(targetArray, sourceArray);\n * // targetArray is now: [{ a: 2 }, { b: 3 }]\n * ```\n */\nexport function deepPatch<T extends PlainObject | unknown[]>(target: T, source: T) {\n const sk = new Set<keyof T>([\n ...(Object.keys(target) as (keyof T)[]),\n ...(Object.keys(source) as (keyof T)[]),\n ]);\n\n sk.forEach((key) => {\n const t = target[key];\n const s = source[key];\n if (isPlainObject(t) && isPlainObject(s)) {\n deepPatch(t, s);\n } else if (isArray(t) && isArray(s) && t.length === s.length) {\n deepPatch(t, s);\n } else {\n target[key] = s;\n }\n });\n\n return target;\n}\n\n/**\n * Reads a property from a union-typed object where the key may exist only on some members of the union.\n *\n * `K` is constrained to keys of the union's intersection, so any key present on at least one union\n * member is accepted. The return type resolves to `T[K]` when `K` is a key of `T`, otherwise `undefined`\n * — matching the runtime behavior of reading a missing property.\n *\n * @param obj - source object (may be a union of shapes)\n * @param prop - property name, must be a key of at least one union member\n * @returns the property value if present, otherwise `undefined`\n */\nexport function getField<T extends object, K extends keyof UnionToIntersection<T>>(\n obj: T,\n prop: K,\n): K extends keyof T ? T[K] : undefined {\n // @ts-expect-error - we want this to be a compile-time error when prop is not in T, but at runtime we just return undefined\n return obj[prop];\n}\n"],"mappings":";AAQA,IAAaA,IAAU,MAAM;AAG7B,SAAgBC,EAAkD,GAA4B;CAC5F,OAAuB,OAAOC,KAAQ,cAA/BA;AACT;AAEA,SAAgBC,EAAS,GAAiC;CACxD,OAAO,OAAOC,KAAU,cAAYA;AACtC;AAqBA,SAAgBC,EAAc,GAAsC;CAClE,IAAI,CAACF,EAASC,CAAK,GACjB,OAAO;CAGT,IAAME,IAAqB,OAAO,eAAeF,CAAK;CAEtD,OACEE,MAAc,QACdA,MAAc,OAAO,aACrB,OAAO,eAAeA,CAAS,MAAM;AAEzC;AAaA,SAASC,EAAgB,GAAkB;CACzC,OAAO,OAAO,OAAOL,CAAG,CAAC,CAAC,QAAQ,GAAgB,MACzCM,MAAM,KAAA,IAAyBC,IAAbA,IAAS,GACjC,CAAC;AACN;AAwBA,SAAgBC,EAAY,GAAY,GAAqB;CAC3D,IAAI,EAAET,EAAeU,CAAC,KAAKV,EAAeW,CAAC,IACzC,OAAOD,MAAMC;CAGf,IAAIZ,EAAQW,CAAC,KAAKX,EAAQY,CAAC,GAIvB,OAHED,EAAE,WAAWC,EAAE,UAGV,CAAC,GAAGD,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,MAAMD,EAAYC,EAAEE,IAAID,EAAEC,EAAE,CAAC;CAI7D,IAAIR,EAAcM,CAAC,KAAKN,EAAcO,CAAC,GAKrC,OAJIL,EAAgBI,CAAC,MAAMJ,EAAgBK,CAAC,KAIrC,OAAO,KAAKD,CAAC,CAAC,CAAC,OAAO,MAAMD,EAAYC,EAAEE,IAAID,EAAEC,EAAE,CAAC;CAG5D,MAAM,MAAM,oBAAoB,OAAOF,CAAC,EAAE,SAAS,OAAOC,CAAC,GAAG;AAChE;AAQA,SAAgBE,EAAa,GAAW;CACtC,IAAI,MAAM,QAAQZ,CAAG,GAAG;EACtB,IAAMa,IAAc,CAAC;EACrB,KAAK,IAAIC,IAAI,GAAGA,IAAId,EAAI,QAAQ,KAC9B,EAAKc,KAAKF,EAAUZ,EAAIc,EAAE;EAE5B,OAAOD;CACT;CAAO,IAAIV,EAAcH,CAAG,GAAG;EAC7B,IAAMa,IAA4B,CAAC;EAInC,OAHA,OAAO,KAAKb,CAAG,CAAC,CAAC,SAAS,MAAM;GAC9B,EAAKW,KAAKC,EAAUZ,EAAIW,EAAE;EAC5B,CAAC,GACME;CACT;CACE,OAAOb;AAEX;AA6HA,SAAgBe,EACd,GACA,GACsC;CAEtC,OAAOf,EAAIgB;AACb"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../lib/util/helpers/dist/prettyBytes.js
|
|
2
2
|
var e = [
|
|
3
3
|
"B",
|
|
4
4
|
"kB",
|
|
@@ -58,7 +58,6 @@ function a(a, o) {
|
|
|
58
58
|
let d = i(Number(a), o.locale), f = s[u];
|
|
59
59
|
return l + d + " " + f;
|
|
60
60
|
}
|
|
61
|
-
//#endregion
|
|
62
61
|
export { a as prettyBytes };
|
|
63
62
|
|
|
64
63
|
//# sourceMappingURL=prettyBytes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettyBytes.js","names":[],"sources":["../../../../../../../lib/util/helpers/src/prettyBytes.ts"],"sourcesContent":["const BYTE_UNITS = [\"B\", \"kB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"];\n\nconst BIBYTE_UNITS = [\"B\", \"kiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\", \"EiB\", \"ZiB\", \"YiB\"];\n\nconst BIT_UNITS = [\"b\", \"kbit\", \"Mbit\", \"Gbit\", \"Tbit\", \"Pbit\", \"Ebit\", \"Zbit\", \"Ybit\"];\n\nconst BIBIT_UNITS = [\"b\", \"kibit\", \"Mibit\", \"Gibit\", \"Tibit\", \"Pibit\", \"Eibit\", \"Zibit\", \"Yibit\"];\n\ntype Options = {\n bits?: boolean;\n binary?: boolean;\n signed?: boolean;\n locale?: string;\n};\n\n/*\nFormats the given number using `Number#toLocaleString`.\n- If locale is a string, the value is expected to be a locale-key (for example: `de`).\n- If locale is true, the system default locale is used for translation.\n- If no value for locale is specified, the number is returned unmodified.\n*/\nconst toLocaleString = (number: number, locale: string | undefined) => {\n let result = String(number);\n if (typeof locale === \"string\" || Array.isArray(locale)) {\n result = number.toLocaleString(locale);\n } else if (locale === true) {\n result = number.toLocaleString(undefined);\n }\n\n return result;\n};\n\nexport function prettyBytes(number: number | bigint, options: Options) {\n number = typeof number === \"bigint\" ? Number(number) : number;\n\n if (!Number.isFinite(number)) {\n throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);\n }\n\n Object.assign(\n {\n bits: false,\n binary: false,\n },\n options,\n );\n\n const UNITS = options.bits\n ? options.binary\n ? BIBIT_UNITS\n : BIT_UNITS\n : options.binary\n ? BIBYTE_UNITS\n : BYTE_UNITS;\n\n if (options.signed && number === 0) {\n return ` 0 ${UNITS[0]}`;\n }\n\n const isNegative = number < 0;\n const prefix = isNegative ? \"-\" : options.signed ? \"+\" : \"\";\n\n if (isNegative) {\n number = -number;\n }\n\n if (number < 1) {\n const numberString = toLocaleString(number, options.locale);\n return prefix + numberString + \" \" + UNITS[0];\n }\n\n const exponent = Math.min(\n Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3),\n UNITS.length - 1,\n );\n number /= (options.binary ? 1024 : 1000) ** exponent;\n\n number = Number(number.toPrecision(3));\n\n const numberString = toLocaleString(Number(number), options.locale);\n\n const unit = UNITS[exponent];\n\n return prefix + numberString + \" \" + unit;\n}\n"],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"prettyBytes.js","names":["BYTE_UNITS","BIBYTE_UNITS","BIT_UNITS","BIBIT_UNITS","toLocaleString","result","number","locale","prettyBytes","options","UNITS","isNegative","prefix","exponent","numberString","unit"],"sources":["../../../../../../../lib/util/helpers/src/prettyBytes.ts"],"sourcesContent":["const BYTE_UNITS = [\"B\", \"kB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"];\n\nconst BIBYTE_UNITS = [\"B\", \"kiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\", \"EiB\", \"ZiB\", \"YiB\"];\n\nconst BIT_UNITS = [\"b\", \"kbit\", \"Mbit\", \"Gbit\", \"Tbit\", \"Pbit\", \"Ebit\", \"Zbit\", \"Ybit\"];\n\nconst BIBIT_UNITS = [\"b\", \"kibit\", \"Mibit\", \"Gibit\", \"Tibit\", \"Pibit\", \"Eibit\", \"Zibit\", \"Yibit\"];\n\ntype Options = {\n bits?: boolean;\n binary?: boolean;\n signed?: boolean;\n locale?: string;\n};\n\n/*\nFormats the given number using `Number#toLocaleString`.\n- If locale is a string, the value is expected to be a locale-key (for example: `de`).\n- If locale is true, the system default locale is used for translation.\n- If no value for locale is specified, the number is returned unmodified.\n*/\nconst toLocaleString = (number: number, locale: string | undefined) => {\n let result = String(number);\n if (typeof locale === \"string\" || Array.isArray(locale)) {\n result = number.toLocaleString(locale);\n } else if (locale === true) {\n result = number.toLocaleString(undefined);\n }\n\n return result;\n};\n\nexport function prettyBytes(number: number | bigint, options: Options) {\n number = typeof number === \"bigint\" ? Number(number) : number;\n\n if (!Number.isFinite(number)) {\n throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);\n }\n\n Object.assign(\n {\n bits: false,\n binary: false,\n },\n options,\n );\n\n const UNITS = options.bits\n ? options.binary\n ? BIBIT_UNITS\n : BIT_UNITS\n : options.binary\n ? BIBYTE_UNITS\n : BYTE_UNITS;\n\n if (options.signed && number === 0) {\n return ` 0 ${UNITS[0]}`;\n }\n\n const isNegative = number < 0;\n const prefix = isNegative ? \"-\" : options.signed ? \"+\" : \"\";\n\n if (isNegative) {\n number = -number;\n }\n\n if (number < 1) {\n const numberString = toLocaleString(number, options.locale);\n return prefix + numberString + \" \" + UNITS[0];\n }\n\n const exponent = Math.min(\n Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3),\n UNITS.length - 1,\n );\n number /= (options.binary ? 1024 : 1000) ** exponent;\n\n number = Number(number.toPrecision(3));\n\n const numberString = toLocaleString(Number(number), options.locale);\n\n const unit = UNITS[exponent];\n\n return prefix + numberString + \" \" + unit;\n}\n"],"mappings":";AAAA,IAAMA,IAAa;CAAC;CAAK;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;AAAI,GAEjEC,IAAe;CAAC;CAAK;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK,GAE3EC,IAAY;CAAC;CAAK;CAAQ;CAAQ;CAAQ;CAAQ;CAAQ;CAAQ;CAAQ;AAAM,GAEhFC,IAAc;CAAC;CAAK;CAAS;CAAS;CAAS;CAAS;CAAS;CAAS;CAAS;AAAO,GAe1FC,KAAkB,GAAgB,MAA+B;CACrE,IAAIC,IAAS,OAAOC,CAAM;CAO1B,OANI,OAAOC,KAAW,YAAY,MAAM,QAAQA,CAAM,IACpD,IAASD,EAAO,eAAeC,CAAM,IAC5BA,MAAW,OACpB,IAASD,EAAO,eAAe,KAAA,CAAS,IAGnCD;AACT;AAEA,SAAgBG,EAAY,GAAyB,GAAkB;CAGrE,IAFA,IAAS,OAAOF,KAAW,WAAW,OAAOA,CAAM,IAAIA,GAEnD,CAAC,OAAO,SAASA,CAAM,GACzB,MAAU,UAAU,iCAAiC,OAAOA,EAAO,IAAIA,GAAQ;CAGjF,OAAO,OACL;EACE,MAAM;EACN,QAAQ;CACV,GACAG,CACF;CAEA,IAAMC,IAAQD,EAAQ,OAClBA,EAAQ,SACNN,IACAD,IACFO,EAAQ,SACNR,IACAD;CAEN,IAAIS,EAAQ,UAAUH,MAAW,GAC/B,OAAO,MAAMI,EAAM;CAGrB,IAAMC,IAAaL,IAAS,GACtBM,IAASD,IAAa,MAAMF,EAAQ,SAAS,MAAM;CAMzD,IAJIE,MACF,IAAS,CAACL,IAGRA,IAAS,GAEX,OAAOM,IADcR,EAAeE,GAAQG,EAAQ,MACzB,IAAI,MAAMC,EAAM;CAG7C,IAAMG,IAAW,KAAK,IACpB,KAAK,MAAMJ,EAAQ,SAAS,KAAK,IAAIH,CAAM,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,MAAMA,CAAM,IAAI,CAAC,GACtFI,EAAM,SAAS,CACjB;CAGA,AAFA,MAAWD,EAAQ,SAAS,OAAO,QAASI,GAE5C,IAAS,OAAOP,EAAO,YAAY,CAAC,CAAC;CAErC,IAAMQ,IAAeV,EAAe,OAAOE,CAAM,GAAGG,EAAQ,MAAM,GAE5DM,IAAOL,EAAMG;CAEnB,OAAOD,IAASE,IAAe,MAAMC;AACvC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../lib/util/helpers/dist/random.js
|
|
2
2
|
var e = Math.random;
|
|
3
3
|
function t() {
|
|
4
4
|
return e() * (2 ** 53 - 1) | 0;
|
|
5
5
|
}
|
|
6
|
-
//#endregion
|
|
7
6
|
export { e as random, t as randomInt };
|
|
8
7
|
|
|
9
8
|
//# sourceMappingURL=random.js.map
|