xmlui 0.7.14 → 0.7.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{apiInterceptorWorker-FBzCR_-x.mjs → apiInterceptorWorker-21XItUaB.mjs} +1 -1
- package/dist/{grammar.tmLanguage-D3zpG8BQ.mjs → grammar.tmLanguage-Qpdanc5_.mjs} +6 -6
- package/dist/{index-rxu3P0l4.mjs → index-CFCUmuUo.mjs} +10368 -10074
- package/dist/index.css +1 -1
- package/dist/scripts/bin/build.js +17 -7
- package/dist/scripts/bin/vite-ueml-plugin.js +17 -7
- package/dist/scripts/bin/viteConfig.js +17 -7
- package/dist/scripts/package.json +209 -0
- package/dist/scripts/src/abstractions/scripting/ScriptingSourceTreeExp.js +51 -0
- package/dist/scripts/src/components/APICall/APICall.js +74 -0
- package/dist/scripts/src/components/APICall/APICallNative.js +31 -0
- package/dist/scripts/src/components/Accordion/Accordion.js +78 -0
- package/dist/scripts/src/components/Accordion/AccordionContext.js +20 -0
- package/dist/scripts/src/components/Accordion/AccordionItem.js +28 -0
- package/dist/scripts/src/components/Accordion/AccordionItemNative.js +79 -0
- package/dist/scripts/src/components/Accordion/AccordionNative.js +122 -0
- package/dist/scripts/src/components/Alert/Alert.js +42 -0
- package/dist/scripts/src/components/Alert/AlertNative.js +8 -0
- package/dist/scripts/src/components/Animation/Animation.js +59 -0
- package/dist/scripts/src/components/Animation/AnimationNative.js +75 -0
- package/dist/scripts/src/components/App/App.js +76 -0
- package/dist/scripts/src/components/App/AppLayoutContext.js +49 -0
- package/dist/scripts/src/components/App/AppNative.js +204 -0
- package/dist/scripts/src/components/App/AppStateContext.js +9 -0
- package/dist/scripts/src/components/App/Sheet.js +99 -0
- package/dist/scripts/src/components/AppHeader/AppHeader.js +59 -0
- package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +58 -0
- package/dist/scripts/src/components/AppState/AppState.js +26 -0
- package/dist/scripts/src/components/AppState/AppStateNative.js +24 -0
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +83 -0
- package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +16 -0
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +225 -0
- package/dist/scripts/src/components/Avatar/Avatar.js +47 -0
- package/dist/scripts/src/components/Avatar/AvatarNative.js +40 -0
- package/dist/scripts/src/components/Backdrop/Backdrop.js +31 -0
- package/dist/scripts/src/components/Backdrop/BackdropNative.js +14 -0
- package/dist/scripts/src/components/Badge/Badge.js +58 -0
- package/dist/scripts/src/components/Badge/BadgeNative.js +22 -0
- package/dist/scripts/src/components/BarChart/BarChart.js +49 -0
- package/dist/scripts/src/components/BarChart/BarChartNative.js +176 -0
- package/dist/scripts/src/components/Bookmark/Bookmark.js +23 -0
- package/dist/scripts/src/components/Bookmark/BookmarkNative.js +24 -0
- package/dist/scripts/src/components/Breakout/Breakout.js +16 -0
- package/dist/scripts/src/components/Breakout/BreakoutNative.js +12 -0
- package/dist/scripts/src/components/Button/Button.js +142 -0
- package/dist/scripts/src/components/Button/ButtonNative.js +88 -0
- package/dist/scripts/src/components/ButtonGroup/ButtonGroup.js +41 -0
- package/dist/scripts/src/components/ButtonGroup/ButtonGroupNative.js +8 -0
- package/dist/scripts/src/components/Card/Card.js +57 -0
- package/dist/scripts/src/components/Card/CardNative.js +26 -0
- package/dist/scripts/src/components/Carousel/Carousel.js +68 -0
- package/dist/scripts/src/components/Carousel/CarouselItem.js +16 -0
- package/dist/scripts/src/components/Carousel/CarouselItemNative.js +13 -0
- package/dist/scripts/src/components/Carousel/CarouselNative.js +163 -0
- package/dist/scripts/src/components/ChangeListener/ChangeListener.js +24 -0
- package/dist/scripts/src/components/ChangeListener/ChangeListenerNative.js +26 -0
- package/dist/scripts/src/components/Chart/Chart.js +24 -0
- package/dist/scripts/src/components/Chart/ChartNative.js +165 -0
- package/dist/scripts/src/components/Checkbox/Checkbox.js +68 -0
- package/dist/scripts/src/components/Column/Column.js +34 -0
- package/dist/scripts/src/components/Column/ColumnNative.js +38 -0
- package/dist/scripts/src/components/Column/TableContext.js +12 -0
- package/dist/scripts/src/components/ComponentProvider.js +503 -0
- package/dist/scripts/src/components/ComponentRegistryContext.js +44 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +38 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparatorNative.js +16 -0
- package/dist/scripts/src/components/DatePicker/DatePicker.js +62 -0
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +196 -0
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +125 -0
- package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +95 -0
- package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +26 -0
- package/dist/scripts/src/components/EmojiSelector/EmojiSelectorNative.js +52 -0
- package/dist/scripts/src/components/FileInput/FileInput.js +64 -0
- package/dist/scripts/src/components/FileInput/FileInputNative.js +128 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +46 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +112 -0
- package/dist/scripts/src/components/FlowLayout/FlowLayout.js +53 -0
- package/dist/scripts/src/components/FlowLayout/FlowLayoutNative.js +108 -0
- package/dist/scripts/src/components/Footer/Footer.js +35 -0
- package/dist/scripts/src/components/Footer/FooterNative.js +20 -0
- package/dist/scripts/src/components/Form/Form.js +89 -0
- package/dist/scripts/src/components/Form/FormContext.js +9 -0
- package/dist/scripts/src/components/Form/FormNative.js +317 -0
- package/dist/scripts/src/components/Form/formActions.js +114 -0
- package/dist/scripts/src/components/FormItem/FormItem.js +125 -0
- package/dist/scripts/src/components/FormItem/FormItemNative.js +157 -0
- package/dist/scripts/src/components/FormItem/HelperText.js +27 -0
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +40 -0
- package/dist/scripts/src/components/FormItem/Validations.js +351 -0
- package/dist/scripts/src/components/FormSection/FormSection.js +41 -0
- package/dist/scripts/src/components/Heading/Heading.js +258 -0
- package/dist/scripts/src/components/Heading/HeadingNative.js +47 -0
- package/dist/scripts/src/components/HoverCard/HoverCard.js +19 -0
- package/dist/scripts/src/components/HoverCard/HovercardNative.js +44 -0
- package/dist/scripts/src/components/Icon/ApiIcon.js +10 -0
- package/dist/scripts/src/components/Icon/Attach.js +10 -0
- package/dist/scripts/src/components/Icon/Binding.js +11 -0
- package/dist/scripts/src/components/Icon/BoardIcon.js +7 -0
- package/dist/scripts/src/components/Icon/BoxIcon.js +10 -0
- package/dist/scripts/src/components/Icon/CheckIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronLeft.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronRight.js +7 -0
- package/dist/scripts/src/components/Icon/CodeFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/CodeSandbox.js +10 -0
- package/dist/scripts/src/components/Icon/CompactListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ContentCopyIcon.js +7 -0
- package/dist/scripts/src/components/Icon/DatabaseIcon.js +11 -0
- package/dist/scripts/src/components/Icon/DocFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/DocIcon.js +10 -0
- package/dist/scripts/src/components/Icon/DotMenuHorizontalIcon.js +7 -0
- package/dist/scripts/src/components/Icon/DotMenuIcon.js +7 -0
- package/dist/scripts/src/components/Icon/EmailIcon.js +7 -0
- package/dist/scripts/src/components/Icon/EmptyFolderIcon.js +10 -0
- package/dist/scripts/src/components/Icon/ErrorIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ExpressionIcon.js +10 -0
- package/dist/scripts/src/components/Icon/FillPlusCricleIcon.js +7 -0
- package/dist/scripts/src/components/Icon/FilterIcon.js +10 -0
- package/dist/scripts/src/components/Icon/FolderIcon.js +10 -0
- package/dist/scripts/src/components/Icon/GlobeIcon.js +7 -0
- package/dist/scripts/src/components/Icon/HomeIcon.js +7 -0
- package/dist/scripts/src/components/Icon/HyperLinkIcon.js +7 -0
- package/dist/scripts/src/components/Icon/Icon.js +32 -0
- package/dist/scripts/src/components/Icon/IconNative.js +102 -0
- package/dist/scripts/src/components/Icon/ImageFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/LinkIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/LooseListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/MoonIcon.js +10 -0
- package/dist/scripts/src/components/Icon/MoreOptionsIcon.js +7 -0
- package/dist/scripts/src/components/Icon/NoSortIcon.js +8 -0
- package/dist/scripts/src/components/Icon/PDFIcon.js +10 -0
- package/dist/scripts/src/components/Icon/PenIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PhoneIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PhotoIcon.js +10 -0
- package/dist/scripts/src/components/Icon/PlusIcon.js +7 -0
- package/dist/scripts/src/components/Icon/SearchIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ShareIcon.js +10 -0
- package/dist/scripts/src/components/Icon/SortAscendingIcon.js +8 -0
- package/dist/scripts/src/components/Icon/SortDescendingIcon.js +8 -0
- package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
- package/dist/scripts/src/components/Icon/TrashIcon.js +7 -0
- package/dist/scripts/src/components/Icon/TrendingDownIcon.js +10 -0
- package/dist/scripts/src/components/Icon/TrendingLevelIcon.js +10 -0
- package/dist/scripts/src/components/Icon/TrendingUpIcon.js +10 -0
- package/dist/scripts/src/components/Icon/TxtIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UnknownFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UnlinkIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UserIcon.js +7 -0
- package/dist/scripts/src/components/Icon/WarningIcon.js +7 -0
- package/dist/scripts/src/components/Icon/XlsIcon.js +10 -0
- package/dist/scripts/src/components/IconInfoCard/IconInfoCard.js +39 -0
- package/dist/scripts/src/components/IconProvider.js +264 -0
- package/dist/scripts/src/components/IconRegistryContext.js +317 -0
- package/dist/scripts/src/components/Image/Image.js +35 -0
- package/dist/scripts/src/components/Image/ImageNative.js +15 -0
- package/dist/scripts/src/components/Input/InputAdornment.js +14 -0
- package/dist/scripts/src/components/Items/Items.js +33 -0
- package/dist/scripts/src/components/Items/ItemsNative.js +29 -0
- package/dist/scripts/src/components/Link/Link.js +64 -0
- package/dist/scripts/src/components/Link/LinkNative.js +26 -0
- package/dist/scripts/src/components/List/List.js +81 -0
- package/dist/scripts/src/components/List/ListNative.js +425 -0
- package/dist/scripts/src/components/Logo/Logo.js +16 -0
- package/dist/scripts/src/components/Logo/LogoNative.js +15 -0
- package/dist/scripts/src/components/Map/Map.js +75 -0
- package/dist/scripts/src/components/Map/world_countries.json +45307 -0
- package/dist/scripts/src/components/Markdown/Markdown.js +45 -0
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +107 -0
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +116 -0
- package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +64 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +167 -0
- package/dist/scripts/src/components/ModalDialog/ModalVisibilityContext.js +60 -0
- package/dist/scripts/src/components/NavGroup/NavGroup.js +34 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +91 -0
- package/dist/scripts/src/components/NavLink/NavLink.js +71 -0
- package/dist/scripts/src/components/NavLink/NavLinkNative.js +61 -0
- package/dist/scripts/src/components/NavPanel/NavPanel.js +31 -0
- package/dist/scripts/src/components/NavPanel/NavPanelNative.js +74 -0
- package/dist/scripts/src/components/NoResult/NoResult.js +38 -0
- package/dist/scripts/src/components/NoResult/NoResultNative.js +13 -0
- package/dist/scripts/src/components/NumberBox/NumberBox.js +61 -0
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +336 -0
- package/dist/scripts/src/components/NumberBox/numberbox-abstractions.js +74 -0
- package/dist/scripts/src/components/OffCanvas/OffCanvas.js +57 -0
- package/dist/scripts/src/components/OffCanvas/OffCanvasNative.js +48 -0
- package/dist/scripts/src/components/Option/Option.js +33 -0
- package/dist/scripts/src/components/Option/OptionTypeProvider.js +16 -0
- package/dist/scripts/src/components/PageHeader/PageHeader.js +36 -0
- package/dist/scripts/src/components/PageMetaTitle/PageMetaTilteNative.js +9 -0
- package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +18 -0
- package/dist/scripts/src/components/Pages/Pages.js +33 -0
- package/dist/scripts/src/components/Pages/PagesNative.js +69 -0
- package/dist/scripts/src/components/PieChart/PieChart.js +45 -0
- package/dist/scripts/src/components/PieChart/PieChartNative.js +165 -0
- package/dist/scripts/src/components/PositionedContainer/PositionedContainer.js +24 -0
- package/dist/scripts/src/components/PositionedContainer/PositionedContainerNative.js +14 -0
- package/dist/scripts/src/components/ProgressBar/ProgressBar.js +36 -0
- package/dist/scripts/src/components/ProgressBar/ProgressBarNative.js +12 -0
- package/dist/scripts/src/components/Queue/Queue.js +71 -0
- package/dist/scripts/src/components/Queue/QueueNative.js +278 -0
- package/dist/scripts/src/components/Queue/queueActions.js +87 -0
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +68 -0
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +103 -0
- package/dist/scripts/src/components/Range/Range.js +56 -0
- package/dist/scripts/src/components/Range/RangeNative.js +8 -0
- package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +21 -0
- package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapterNative.js +131 -0
- package/dist/scripts/src/components/Redirect/Redirect.js +20 -0
- package/dist/scripts/src/components/Select/OptionContext.js +12 -0
- package/dist/scripts/src/components/Select/Select.js +98 -0
- package/dist/scripts/src/components/Select/SelectContext.js +9 -0
- package/dist/scripts/src/components/Select/SelectNative.js +213 -0
- package/dist/scripts/src/components/SelectionStore/SelectionStore.js +22 -0
- package/dist/scripts/src/components/SelectionStore/SelectionStoreNative.js +94 -0
- package/dist/scripts/src/components/Slider/Slider.js +54 -0
- package/dist/scripts/src/components/Slider/SliderNative.js +8 -0
- package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +19 -0
- package/dist/scripts/src/components/SpaceFiller/SpaceFillerNative.js +10 -0
- package/dist/scripts/src/components/Spinner/Spinner.js +42 -0
- package/dist/scripts/src/components/Spinner/SpinnerNative.js +32 -0
- package/dist/scripts/src/components/Splitter/Splitter.js +89 -0
- package/dist/scripts/src/components/Splitter/SplitterNative.js +159 -0
- package/dist/scripts/src/components/Splitter/utils.js +17 -0
- package/dist/scripts/src/components/Stack/Stack.js +110 -0
- package/dist/scripts/src/components/Stack/StackNative.js +39 -0
- package/dist/scripts/src/components/StateViewer/StateViewerNative.js +19 -0
- package/dist/scripts/src/components/StickyBox/StickyBox.js +30 -0
- package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +15 -0
- package/dist/scripts/src/components/Switch/Switch.js +72 -0
- package/dist/scripts/src/components/Table/Table.js +184 -0
- package/dist/scripts/src/components/Table/TableNative.js +470 -0
- package/dist/scripts/src/components/Table/useRowSelection.js +245 -0
- package/dist/scripts/src/components/TableHeader/TableHeader.js +34 -0
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +74 -0
- package/dist/scripts/src/components/TableOfContents/TableOfContentsNative.js +56 -0
- package/dist/scripts/src/components/Tabs/TabContext.js +45 -0
- package/dist/scripts/src/components/Tabs/TabItem.js +20 -0
- package/dist/scripts/src/components/Tabs/TabItemNative.js +24 -0
- package/dist/scripts/src/components/Tabs/Tabs.js +55 -0
- package/dist/scripts/src/components/Tabs/TabsNative.js +72 -0
- package/dist/scripts/src/components/Text/Text.js +122 -0
- package/dist/scripts/src/components/Text/TextNative.js +124 -0
- package/dist/scripts/src/components/TextArea/TextArea.js +65 -0
- package/dist/scripts/src/components/TextArea/TextAreaNative.js +176 -0
- package/dist/scripts/src/components/TextArea/TextAreaResizable.js +73 -0
- package/dist/scripts/src/components/TextArea/useComposedRef.js +60 -0
- package/dist/scripts/src/components/TextBox/TextBox.js +85 -0
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +109 -0
- package/dist/scripts/src/components/Theme/NotificationToast.js +50 -0
- package/dist/scripts/src/components/Theme/Theme.js +43 -0
- package/dist/scripts/src/components/Theme/ThemeNative.js +126 -0
- package/dist/scripts/src/components/ThemeChanger/ThemeChanger.js +115 -0
- package/dist/scripts/src/components/ThemeChanger/ToneChangerButton.js +28 -0
- package/dist/scripts/src/components/Toggle/Toggle.js +98 -0
- package/dist/scripts/src/components/Toolbar/Toolbar.js +32 -0
- package/dist/scripts/src/components/ToolbarButton/ToolbarButton.js +38 -0
- package/dist/scripts/src/components/Tree/TreeComponent.js +32 -0
- package/dist/scripts/src/components/Tree/TreeNative.js +69 -0
- package/dist/scripts/src/components/TrendLabel/TrendLabel.js +37 -0
- package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +59 -0
- package/dist/scripts/src/components/abstractions.js +151 -0
- package/dist/scripts/src/components/chart-color-schemes.js +43 -0
- package/dist/scripts/src/components/component-utils.js +17 -0
- package/dist/scripts/src/components/container-helpers.js +25 -0
- package/dist/scripts/src/components/metadata-helpers.js +245 -0
- package/dist/scripts/src/components/slot-helpers.js +22 -0
- package/dist/scripts/src/components-core/ApiBoundComponent.js +194 -0
- package/dist/scripts/src/components-core/AppContext.js +16 -0
- package/dist/scripts/src/components-core/AppRoot.js +424 -0
- package/dist/scripts/src/components-core/ComponentBed.js +325 -0
- package/dist/scripts/src/components-core/ComponentDecorator.js +90 -0
- package/dist/scripts/src/components-core/CompoundComponent.js +144 -0
- package/dist/scripts/src/components-core/DebugViewProvider.js +43 -0
- package/dist/scripts/src/components-core/EngineError.js +91 -0
- package/dist/scripts/src/components-core/ErrorBoundary.js +59 -0
- package/dist/scripts/src/components-core/Fragment.js +15 -0
- package/dist/scripts/src/components-core/InspectorContext.js +176 -0
- package/dist/scripts/src/components-core/InvalidComponent.js +17 -0
- package/dist/scripts/src/components-core/LoaderComponent.js +92 -0
- package/dist/scripts/src/components-core/RestApiProxy.js +354 -0
- package/dist/scripts/src/components-core/ScrollContext.js +11 -0
- package/dist/scripts/src/components-core/Slot.js +17 -0
- package/dist/scripts/src/components-core/StandaloneApp.js +589 -0
- package/dist/scripts/src/components-core/StandaloneComponentManager.js +51 -0
- package/dist/scripts/src/components-core/TableOfContentsContext.js +110 -0
- package/dist/scripts/src/components-core/UnknownComponent.js +15 -0
- package/dist/scripts/src/components-core/XmluiCodeHighlighter.js +110 -0
- package/dist/scripts/src/components-core/abstractions/ComponentRenderer.js +2 -0
- package/dist/scripts/src/components-core/abstractions/LoaderRenderer.js +2 -0
- package/dist/scripts/src/components-core/abstractions/containers.js +18 -0
- package/dist/scripts/src/components-core/abstractions/standalone.js +2 -0
- package/dist/scripts/src/components-core/abstractions/treeAbstractions.js +2 -0
- package/dist/scripts/src/components-core/action/APICall.js +283 -0
- package/dist/scripts/src/components-core/action/FileDownloadAction.js +80 -0
- package/dist/scripts/src/components-core/action/FileUploadAction.js +88 -0
- package/dist/scripts/src/components-core/action/NavigateAction.js +20 -0
- package/dist/scripts/src/components-core/action/TimedAction.js +21 -0
- package/dist/scripts/src/components-core/action/actions.js +15 -0
- package/dist/scripts/src/components-core/appContext/date-functions.js +19 -0
- package/dist/scripts/src/components-core/appContext/math-function.js +27 -0
- package/dist/scripts/src/components-core/appContext/misc-utils.js +12 -0
- package/dist/scripts/src/components-core/component-hooks.js +25 -0
- package/dist/scripts/src/components-core/constants.js +18 -0
- package/dist/scripts/src/components-core/container/Container.js +1241 -0
- package/dist/scripts/src/components-core/container/buildProxy.js +54 -0
- package/dist/scripts/src/components-core/container/collectFnVarDeps.js +49 -0
- package/dist/scripts/src/components-core/container/valueExtractor.js +205 -0
- package/dist/scripts/src/components-core/descriptorHelper.js +72 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +198 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +94 -0
- package/dist/scripts/src/components-core/interception/Backend.js +129 -0
- package/dist/scripts/src/components-core/interception/Errors.js +129 -0
- package/dist/scripts/src/components-core/interception/InMemoryDb.js +41 -0
- package/dist/scripts/src/components-core/interception/IndexedDb.js +205 -0
- package/dist/scripts/src/components-core/interception/ReadonlyCollection.js +145 -0
- package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
- package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +46 -0
- package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
- package/dist/scripts/src/components-core/loader/ApiLoader.js +54 -0
- package/dist/scripts/src/components-core/loader/DataLoader.js +149 -0
- package/dist/scripts/src/components-core/loader/ExternalDataLoader.js +62 -0
- package/dist/scripts/src/components-core/loader/Loader.js +126 -0
- package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +40 -0
- package/dist/scripts/src/components-core/loader/PageableLoader.js +262 -0
- package/dist/scripts/src/components-core/markup-check.js +279 -0
- package/dist/scripts/src/components-core/renderers.js +45 -0
- package/dist/scripts/src/components-core/reportEngineError.js +62 -0
- package/dist/scripts/src/components-core/script-runner/BindingTreeEvaluationContext.js +35 -0
- package/dist/scripts/src/components-core/script-runner/ICustomOperations.js +34 -0
- package/dist/scripts/src/components-core/script-runner/ParameterParser.js +117 -0
- package/dist/scripts/src/components-core/script-runner/asyncProxy.js +149 -0
- package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +34 -0
- package/dist/scripts/src/components-core/script-runner/custom-operations-registry.js +40 -0
- package/dist/scripts/src/components-core/script-runner/custom-ui-data.js +40 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +593 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +497 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +482 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-async.js +766 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-common.js +193 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +752 -0
- package/dist/scripts/src/components-core/script-runner/statement-queue.js +62 -0
- package/dist/scripts/src/components-core/script-runner/syncProxy.js +31 -0
- package/dist/scripts/src/components-core/script-runner/visitors.js +361 -0
- package/dist/scripts/src/components-core/theming/ThemeContext.js +53 -0
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +335 -0
- package/dist/scripts/src/components-core/theming/abstractions.js +11 -0
- package/dist/scripts/src/components-core/theming/extendThemeUtils.js +114 -0
- package/dist/scripts/src/components-core/theming/hvar.js +105 -0
- package/dist/scripts/src/components-core/theming/themeVars.js +62 -0
- package/dist/scripts/src/components-core/theming/themes/base-utils.js +31 -0
- package/dist/scripts/src/components-core/theming/themes/palette.js +55 -0
- package/dist/scripts/src/components-core/theming/themes/root.js +287 -0
- package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
- package/dist/scripts/src/components-core/theming/themes/theme-colors.js +561 -0
- package/dist/scripts/src/components-core/theming/themes/xmlui.js +58 -0
- package/dist/scripts/src/components-core/theming/transformThemeVars.js +300 -0
- package/dist/scripts/src/components-core/utils/DataLoaderQueryKeyGenerator.js +35 -0
- package/dist/scripts/src/components-core/utils/LruCache.js +184 -0
- package/dist/scripts/src/components-core/utils/actionUtils.js +32 -0
- package/dist/scripts/src/components-core/utils/classnames.js +58 -0
- package/dist/scripts/src/components-core/utils/compound-utils.js +11 -0
- package/dist/scripts/src/components-core/utils/css-utils.js +163 -0
- package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
- package/dist/scripts/src/components-core/utils/extractParam.js +148 -0
- package/dist/scripts/src/components-core/utils/hooks.js +249 -0
- package/dist/scripts/src/components-core/utils/mergeProps.js +45 -0
- package/dist/scripts/src/components-core/utils/misc.js +472 -0
- package/dist/scripts/src/components-core/utils/request-params.js +70 -0
- package/dist/scripts/src/components-core/utils/statementUtils.js +221 -0
- package/dist/scripts/src/components-core/utils/treeUtils.js +48 -0
- package/dist/scripts/src/index.js +69 -0
- package/dist/scripts/src/parsers/common/GenericToken.js +2 -0
- package/dist/scripts/src/parsers/scripting-exp/TokenType.js +112 -0
- package/dist/scripts/src/parsers/style-parser/StyleInputStream.js +39 -0
- package/dist/scripts/src/parsers/style-parser/StyleLexer.js +623 -0
- package/dist/scripts/src/parsers/style-parser/StyleParser.js +1036 -0
- package/dist/scripts/src/parsers/style-parser/errors.js +37 -0
- package/dist/scripts/src/parsers/style-parser/source-tree.js +2 -0
- package/dist/scripts/src/parsers/style-parser/style-compiler.js +558 -0
- package/dist/scripts/src/parsers/style-parser/tokens.js +43 -0
- package/dist/scripts/src/parsers/xmlui-parser/ParserError.js +7 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +80 -32
- package/dist/scripts/src/syntax/grammar.tmLanguage.json +348 -0
- package/dist/scripts/src/syntax/textMate/xmlui.json +630 -0
- package/dist/style.css +1 -1
- package/dist/xmlui-metadata.mjs +2636 -2563
- package/dist/xmlui-metadata.umd.js +16 -16
- package/dist/xmlui-standalone.umd.js +186 -186
- package/dist/xmlui.d.ts +1868 -13
- package/dist/xmlui.mjs +1 -1
- package/package.json +5 -5
- package/dist/xmlui.umd.js +0 -293
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Backend = exports.HeaderService = exports.CookieService = exports.defaultBackendEnvironment = void 0;
|
|
16
|
+
const lodash_es_1 = require("lodash-es");
|
|
17
|
+
const misc_1 = require("@components-core/utils/misc");
|
|
18
|
+
const statementUtils_1 = require("@components-core/utils/statementUtils");
|
|
19
|
+
const Errors_1 = __importDefault(require("@components-core/interception/Errors"));
|
|
20
|
+
const date_functions_1 = require("@components-core/appContext/date-functions");
|
|
21
|
+
const misc_utils_1 = require("@components-core/appContext/misc-utils");
|
|
22
|
+
const date_utils_1 = require("@components-core/utils/date-utils");
|
|
23
|
+
// Use this backend environment as the default
|
|
24
|
+
exports.defaultBackendEnvironment = {
|
|
25
|
+
getDate: (date) => date ? new Date(date) : new Date(),
|
|
26
|
+
};
|
|
27
|
+
const mapValuesDeep = (obj, cb) => {
|
|
28
|
+
if ((0, lodash_es_1.isArray)(obj)) {
|
|
29
|
+
return obj.map((innerObj) => mapValuesDeep(innerObj, cb));
|
|
30
|
+
}
|
|
31
|
+
else if ((0, lodash_es_1.isObject)(obj)) {
|
|
32
|
+
return (0, lodash_es_1.mapValues)(obj, (val) => mapValuesDeep(val, cb));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return cb(obj);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
class CookieService {
|
|
39
|
+
constructor() {
|
|
40
|
+
this.cookies = {};
|
|
41
|
+
}
|
|
42
|
+
setCookie(key, value) {
|
|
43
|
+
this.cookies[key] = value;
|
|
44
|
+
}
|
|
45
|
+
getCookieHeader() {
|
|
46
|
+
const cookieArrays = [];
|
|
47
|
+
Object.entries(this.cookies).forEach(([key, value]) => {
|
|
48
|
+
if (Array.isArray(value)) {
|
|
49
|
+
value.forEach(val => cookieArrays.push(['Set-Cookie', `${key}=${val}`]));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
cookieArrays.push(['Set-Cookie', `${key}=${value}`]);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return new Headers(cookieArrays);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.CookieService = CookieService;
|
|
59
|
+
class HeaderService {
|
|
60
|
+
constructor() {
|
|
61
|
+
this.headers = {};
|
|
62
|
+
}
|
|
63
|
+
setHeader(key, value) {
|
|
64
|
+
this.headers[key] = value;
|
|
65
|
+
}
|
|
66
|
+
getHeaders() {
|
|
67
|
+
const headersArray = [];
|
|
68
|
+
Object.entries(this.headers).forEach(([key, value]) => {
|
|
69
|
+
headersArray.push([key, value]);
|
|
70
|
+
});
|
|
71
|
+
return new Headers(headersArray);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.HeaderService = HeaderService;
|
|
75
|
+
class Backend {
|
|
76
|
+
constructor(definition, db, authService) {
|
|
77
|
+
this.definition = definition;
|
|
78
|
+
this.db = db;
|
|
79
|
+
this.authService = authService;
|
|
80
|
+
this.apiStateHash = {};
|
|
81
|
+
this.resolvedHelpers = mapValuesDeep(definition.helpers, (helper) => {
|
|
82
|
+
if (typeof helper === "string") {
|
|
83
|
+
return (...params) => this.runFn(helper, ...params);
|
|
84
|
+
}
|
|
85
|
+
return helper;
|
|
86
|
+
});
|
|
87
|
+
if (definition.initialize) {
|
|
88
|
+
this.runFn(definition.initialize);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
executeOperation(operationId, requestParams, cookieService, headerService) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
var _a;
|
|
94
|
+
const handler = (_a = this.definition.operations) === null || _a === void 0 ? void 0 : _a[operationId];
|
|
95
|
+
if (!handler) {
|
|
96
|
+
throw new Error(`Unknown backend operation: ${operationId}`);
|
|
97
|
+
}
|
|
98
|
+
return yield this.runFn(handler, requestParams, cookieService, headerService);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
runFn(src, ...args) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
104
|
+
let localContext = Object.assign(Object.assign({}, this.resolvedHelpers), { "$db": this.db, "$state": this.apiStateHash, "$authService": this.authService, "$env": exports.defaultBackendEnvironment, "$loggedInUser": this.authService.getLoggedInUser(), "$pathParams": (_a = args[0]) === null || _a === void 0 ? void 0 : _a.pathParams, "$queryParams": (_b = args[0]) === null || _b === void 0 ? void 0 : _b.queryParams, "$requestBody": (_c = args[0]) === null || _c === void 0 ? void 0 : _c.requestBody, "$cookies": (_d = args[0]) === null || _d === void 0 ? void 0 : _d.cookies, "$requestHeaders": (_e = args[0]) === null || _e === void 0 ? void 0 : _e.requestHeaders, "$cookieService": args[1], "$headerService": args[2] //TODO really ugly, temporary solution
|
|
105
|
+
});
|
|
106
|
+
const evalContext = createEvalContext({
|
|
107
|
+
localContext: localContext,
|
|
108
|
+
eventArgs: args,
|
|
109
|
+
appContext: Object.assign(Object.assign(Object.assign({}, date_functions_1.dateFunctions), misc_utils_1.miscellaneousUtils), { delay: misc_1.delay,
|
|
110
|
+
Errors: Errors_1.default, createFile: (...args) => new File(args[0], args[1], args[2]), getDate: date_utils_1.getDate }),
|
|
111
|
+
});
|
|
112
|
+
yield (0, statementUtils_1.runEventHandlerCode)(src, evalContext);
|
|
113
|
+
return ((_g = (_f = evalContext.mainThread) === null || _f === void 0 ? void 0 : _f.blocks) === null || _g === void 0 ? void 0 : _g.length)
|
|
114
|
+
? evalContext.mainThread.blocks[evalContext.mainThread.blocks.length - 1].returnValue
|
|
115
|
+
: undefined;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.Backend = Backend;
|
|
120
|
+
function createEvalContext(parts) {
|
|
121
|
+
return Object.assign({
|
|
122
|
+
mainThread: {
|
|
123
|
+
childThreads: [],
|
|
124
|
+
blocks: [{ vars: {} }],
|
|
125
|
+
loops: [],
|
|
126
|
+
breakLabelValue: -1,
|
|
127
|
+
},
|
|
128
|
+
}, parts);
|
|
129
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConflictError = exports.UnauthorizedError = exports.NotFoundError = exports.HttpError = exports.HttpStatusCode = void 0;
|
|
4
|
+
//stolen from axios
|
|
5
|
+
var HttpStatusCode;
|
|
6
|
+
(function (HttpStatusCode) {
|
|
7
|
+
HttpStatusCode[HttpStatusCode["Continue"] = 100] = "Continue";
|
|
8
|
+
HttpStatusCode[HttpStatusCode["SwitchingProtocols"] = 101] = "SwitchingProtocols";
|
|
9
|
+
HttpStatusCode[HttpStatusCode["Processing"] = 102] = "Processing";
|
|
10
|
+
HttpStatusCode[HttpStatusCode["EarlyHints"] = 103] = "EarlyHints";
|
|
11
|
+
HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
|
|
12
|
+
HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
|
|
13
|
+
HttpStatusCode[HttpStatusCode["Accepted"] = 202] = "Accepted";
|
|
14
|
+
HttpStatusCode[HttpStatusCode["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
|
|
15
|
+
HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
|
|
16
|
+
HttpStatusCode[HttpStatusCode["ResetContent"] = 205] = "ResetContent";
|
|
17
|
+
HttpStatusCode[HttpStatusCode["PartialContent"] = 206] = "PartialContent";
|
|
18
|
+
HttpStatusCode[HttpStatusCode["MultiStatus"] = 207] = "MultiStatus";
|
|
19
|
+
HttpStatusCode[HttpStatusCode["AlreadyReported"] = 208] = "AlreadyReported";
|
|
20
|
+
HttpStatusCode[HttpStatusCode["ImUsed"] = 226] = "ImUsed";
|
|
21
|
+
HttpStatusCode[HttpStatusCode["MultipleChoices"] = 300] = "MultipleChoices";
|
|
22
|
+
HttpStatusCode[HttpStatusCode["MovedPermanently"] = 301] = "MovedPermanently";
|
|
23
|
+
HttpStatusCode[HttpStatusCode["Found"] = 302] = "Found";
|
|
24
|
+
HttpStatusCode[HttpStatusCode["SeeOther"] = 303] = "SeeOther";
|
|
25
|
+
HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
|
|
26
|
+
HttpStatusCode[HttpStatusCode["UseProxy"] = 305] = "UseProxy";
|
|
27
|
+
HttpStatusCode[HttpStatusCode["Unused"] = 306] = "Unused";
|
|
28
|
+
HttpStatusCode[HttpStatusCode["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
29
|
+
HttpStatusCode[HttpStatusCode["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
30
|
+
HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
|
|
31
|
+
HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
|
|
32
|
+
HttpStatusCode[HttpStatusCode["PaymentRequired"] = 402] = "PaymentRequired";
|
|
33
|
+
HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
|
|
34
|
+
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
|
|
35
|
+
HttpStatusCode[HttpStatusCode["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
36
|
+
HttpStatusCode[HttpStatusCode["NotAcceptable"] = 406] = "NotAcceptable";
|
|
37
|
+
HttpStatusCode[HttpStatusCode["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
38
|
+
HttpStatusCode[HttpStatusCode["RequestTimeout"] = 408] = "RequestTimeout";
|
|
39
|
+
HttpStatusCode[HttpStatusCode["Conflict"] = 409] = "Conflict";
|
|
40
|
+
HttpStatusCode[HttpStatusCode["Gone"] = 410] = "Gone";
|
|
41
|
+
HttpStatusCode[HttpStatusCode["LengthRequired"] = 411] = "LengthRequired";
|
|
42
|
+
HttpStatusCode[HttpStatusCode["PreconditionFailed"] = 412] = "PreconditionFailed";
|
|
43
|
+
HttpStatusCode[HttpStatusCode["PayloadTooLarge"] = 413] = "PayloadTooLarge";
|
|
44
|
+
HttpStatusCode[HttpStatusCode["UriTooLong"] = 414] = "UriTooLong";
|
|
45
|
+
HttpStatusCode[HttpStatusCode["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
|
|
46
|
+
HttpStatusCode[HttpStatusCode["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
|
|
47
|
+
HttpStatusCode[HttpStatusCode["ExpectationFailed"] = 417] = "ExpectationFailed";
|
|
48
|
+
HttpStatusCode[HttpStatusCode["ImATeapot"] = 418] = "ImATeapot";
|
|
49
|
+
HttpStatusCode[HttpStatusCode["MisdirectedRequest"] = 421] = "MisdirectedRequest";
|
|
50
|
+
HttpStatusCode[HttpStatusCode["UnprocessableEntity"] = 422] = "UnprocessableEntity";
|
|
51
|
+
HttpStatusCode[HttpStatusCode["Locked"] = 423] = "Locked";
|
|
52
|
+
HttpStatusCode[HttpStatusCode["FailedDependency"] = 424] = "FailedDependency";
|
|
53
|
+
HttpStatusCode[HttpStatusCode["TooEarly"] = 425] = "TooEarly";
|
|
54
|
+
HttpStatusCode[HttpStatusCode["UpgradeRequired"] = 426] = "UpgradeRequired";
|
|
55
|
+
HttpStatusCode[HttpStatusCode["PreconditionRequired"] = 428] = "PreconditionRequired";
|
|
56
|
+
HttpStatusCode[HttpStatusCode["TooManyRequests"] = 429] = "TooManyRequests";
|
|
57
|
+
HttpStatusCode[HttpStatusCode["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
|
|
58
|
+
HttpStatusCode[HttpStatusCode["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
|
|
59
|
+
HttpStatusCode[HttpStatusCode["InternalServerError"] = 500] = "InternalServerError";
|
|
60
|
+
HttpStatusCode[HttpStatusCode["NotImplemented"] = 501] = "NotImplemented";
|
|
61
|
+
HttpStatusCode[HttpStatusCode["BadGateway"] = 502] = "BadGateway";
|
|
62
|
+
HttpStatusCode[HttpStatusCode["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
63
|
+
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
64
|
+
HttpStatusCode[HttpStatusCode["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
|
|
65
|
+
HttpStatusCode[HttpStatusCode["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
|
|
66
|
+
HttpStatusCode[HttpStatusCode["InsufficientStorage"] = 507] = "InsufficientStorage";
|
|
67
|
+
HttpStatusCode[HttpStatusCode["LoopDetected"] = 508] = "LoopDetected";
|
|
68
|
+
HttpStatusCode[HttpStatusCode["NotExtended"] = 510] = "NotExtended";
|
|
69
|
+
HttpStatusCode[HttpStatusCode["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
|
|
70
|
+
})(HttpStatusCode || (exports.HttpStatusCode = HttpStatusCode = {}));
|
|
71
|
+
class HttpError extends Error {
|
|
72
|
+
constructor(status, details) {
|
|
73
|
+
super((details === null || details === void 0 ? void 0 : details.message) || "Not found");
|
|
74
|
+
this.details = details;
|
|
75
|
+
this.status = status;
|
|
76
|
+
Object.setPrototypeOf(this, HttpError.prototype);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.HttpError = HttpError;
|
|
80
|
+
class NotFoundError extends HttpError {
|
|
81
|
+
constructor(details) {
|
|
82
|
+
super(HttpStatusCode.NotFound, details);
|
|
83
|
+
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.NotFoundError = NotFoundError;
|
|
87
|
+
class UnauthorizedError extends HttpError {
|
|
88
|
+
constructor(details) {
|
|
89
|
+
super(HttpStatusCode.Unauthorized, details);
|
|
90
|
+
Object.setPrototypeOf(this, UnauthorizedError.prototype);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
94
|
+
class ConflictError extends HttpError {
|
|
95
|
+
constructor(details) {
|
|
96
|
+
super(HttpStatusCode.Conflict, details);
|
|
97
|
+
Object.setPrototypeOf(this, ConflictError.prototype);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.ConflictError = ConflictError;
|
|
101
|
+
function convertErrorDetails(messageOrDetails) {
|
|
102
|
+
let details;
|
|
103
|
+
if (messageOrDetails) {
|
|
104
|
+
if (typeof messageOrDetails === "string") {
|
|
105
|
+
details = {
|
|
106
|
+
message: messageOrDetails,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
details = messageOrDetails;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return details;
|
|
114
|
+
}
|
|
115
|
+
const Errors = {
|
|
116
|
+
NotFound404: (messageOrDetails) => {
|
|
117
|
+
return new NotFoundError(convertErrorDetails(messageOrDetails));
|
|
118
|
+
},
|
|
119
|
+
Unauthorized401: (messageOrDetails) => {
|
|
120
|
+
return new UnauthorizedError(convertErrorDetails(messageOrDetails));
|
|
121
|
+
},
|
|
122
|
+
HttpError: (errorCode, messageOrDetails) => {
|
|
123
|
+
return new HttpError(errorCode, convertErrorDetails(messageOrDetails));
|
|
124
|
+
},
|
|
125
|
+
Conflict409: (messageOrDetails) => {
|
|
126
|
+
return new ConflictError(convertErrorDetails(messageOrDetails));
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
exports.default = Errors;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.InMemoryDb = void 0;
|
|
13
|
+
class InMemoryDb {
|
|
14
|
+
constructor(tables, initialData = {}, config) {
|
|
15
|
+
this.tables = tables;
|
|
16
|
+
this.initialData = initialData;
|
|
17
|
+
this.config = config;
|
|
18
|
+
}
|
|
19
|
+
getItems(collectionName) {
|
|
20
|
+
throw new Error("Method not implemented.");
|
|
21
|
+
}
|
|
22
|
+
getItem(collectionName, predicate) {
|
|
23
|
+
throw new Error("Method not implemented.");
|
|
24
|
+
}
|
|
25
|
+
getItemById(collectionName, id) {
|
|
26
|
+
throw new Error("Method not implemented.");
|
|
27
|
+
}
|
|
28
|
+
deleteItems(collectionName, predicate) {
|
|
29
|
+
throw new Error("Method not implemented.");
|
|
30
|
+
}
|
|
31
|
+
insertItem(collectionName, item) {
|
|
32
|
+
throw new Error("Method not implemented.");
|
|
33
|
+
}
|
|
34
|
+
updateItem(collectionName, item) {
|
|
35
|
+
throw new Error("Method not implemented.");
|
|
36
|
+
}
|
|
37
|
+
initialize() {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.InMemoryDb = InMemoryDb;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.IndexedDb = void 0;
|
|
16
|
+
const dexie_1 = __importDefault(require("dexie"));
|
|
17
|
+
const ReadonlyCollection_1 = require("@components-core/interception/ReadonlyCollection");
|
|
18
|
+
class IndexedDb {
|
|
19
|
+
constructor(tables, initialData = {}, config) {
|
|
20
|
+
this.tables = tables;
|
|
21
|
+
this.initialData = initialData;
|
|
22
|
+
this.config = config;
|
|
23
|
+
// private repository: Record<string, Array<any>>;
|
|
24
|
+
// private maxIdsByCollections: Record<string, number> = {};
|
|
25
|
+
this.db = null;
|
|
26
|
+
this.getItems = (resourceId) => this.getDb().table(resourceId).toArray();
|
|
27
|
+
this.findItems = (resourceId, predicate) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const ret = yield this.getItems(resourceId);
|
|
29
|
+
const results = yield Promise.all(ret.map(predicate));
|
|
30
|
+
return ret.filter((_v, index) => results[index]);
|
|
31
|
+
});
|
|
32
|
+
this.getItem = (resourceId, predicate) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const ret = yield this.getItems(resourceId);
|
|
34
|
+
const results = yield Promise.all(ret.map(predicate));
|
|
35
|
+
return ret.find((_v, index) => results[index]);
|
|
36
|
+
});
|
|
37
|
+
this.getItemById = (resourceId, id) => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return yield this.getItem(resourceId, (item) => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return item.id + "" === id + "";
|
|
40
|
+
}));
|
|
41
|
+
});
|
|
42
|
+
this.deleteItems = (resourceId, predicate) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
// this.repository[resourceId] = this.repository[resourceId]?.filter((item) => !predicate(item));
|
|
44
|
+
});
|
|
45
|
+
this.insertItem = (resourceId, item) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const id = yield this.getDb().table(resourceId).add(item);
|
|
47
|
+
return this.getItemById(resourceId, id);
|
|
48
|
+
});
|
|
49
|
+
this.updateItem = (resourceId, item) => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
yield this.getDb().table(resourceId).update(item.id, item);
|
|
51
|
+
return yield this.getItemById(resourceId, item.id);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
getDb() {
|
|
55
|
+
if (this.db === null) {
|
|
56
|
+
throw new Error("Db is not initialized yet");
|
|
57
|
+
}
|
|
58
|
+
return this.db;
|
|
59
|
+
}
|
|
60
|
+
initialize() {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
const resolvedInitialData = typeof this.initialData === "function" ? yield this.initialData() : this.initialData;
|
|
64
|
+
const schema = {};
|
|
65
|
+
const tableNames = new Set();
|
|
66
|
+
if (this.tables) {
|
|
67
|
+
this.tables.forEach((tableDescriptor) => {
|
|
68
|
+
const schemaArray = [];
|
|
69
|
+
if (tableDescriptor.pk.length === 1) {
|
|
70
|
+
schemaArray.push(tableDescriptor.pk[0]);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
schemaArray.push(`[${tableDescriptor.pk.join("+")}]`); //indexeddb compound index looks like this: [field+anotherfield]
|
|
74
|
+
}
|
|
75
|
+
if (tableDescriptor.indexes) {
|
|
76
|
+
schemaArray.push(...tableDescriptor.indexes);
|
|
77
|
+
}
|
|
78
|
+
schema[tableDescriptor.name] = schemaArray.join(", ");
|
|
79
|
+
tableNames.add(tableDescriptor.name);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
Object.entries(resolvedInitialData).forEach(([key]) => {
|
|
84
|
+
schema[key] = "++id";
|
|
85
|
+
tableNames.add(key);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const targetVersion = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.version) !== undefined && typeof ((_b = this.config) === null || _b === void 0 ? void 0 : _b.version) === "number" ? (_c = this.config) === null || _c === void 0 ? void 0 : _c.version : 1;
|
|
89
|
+
const shouldInitializeData = yield this.dropDbOnVersionChange(targetVersion);
|
|
90
|
+
this.db = this.createDbInstance();
|
|
91
|
+
this.db.version(targetVersion).stores(schema);
|
|
92
|
+
if (shouldInitializeData) {
|
|
93
|
+
yield Promise.all(Object.entries(resolvedInitialData).map((_a) => __awaiter(this, [_a], void 0, function* ([key, value]) {
|
|
94
|
+
try {
|
|
95
|
+
yield this.getDb().table(key).bulkAdd(value);
|
|
96
|
+
}
|
|
97
|
+
catch (ignored) {
|
|
98
|
+
console.error(ignored);
|
|
99
|
+
}
|
|
100
|
+
})));
|
|
101
|
+
}
|
|
102
|
+
tableNames.forEach((key) => {
|
|
103
|
+
this[`$${key}`] = createTableWrapper(this.getDb().table(key));
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
createDbInstance() {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
return new dexie_1.default((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.database) !== null && _b !== void 0 ? _b : "defaultIndexDb");
|
|
110
|
+
}
|
|
111
|
+
dropDbOnVersionChange(targetVersion) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
const tempDb = this.createDbInstance();
|
|
114
|
+
if (!(yield dexie_1.default.exists(tempDb.name))) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
yield tempDb.open();
|
|
118
|
+
if (tempDb.verno !== targetVersion) {
|
|
119
|
+
yield tempDb.delete();
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
tempDb.close();
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
// --- This method signifies that a section of operations is executed in a transaction
|
|
129
|
+
transaction(actions) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
if (!this.db)
|
|
132
|
+
return;
|
|
133
|
+
const tables = this.db.tables;
|
|
134
|
+
yield this.db.transaction("rw", tables, actions);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.IndexedDb = IndexedDb;
|
|
139
|
+
// Wraps an indexDb Table into an object that provides helpful methods
|
|
140
|
+
function createTableWrapper(table) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
// --- Function to retrieve the current table data
|
|
143
|
+
const getDataFn = () => table.db.table(table.name);
|
|
144
|
+
// --- Helper method to filter the table data
|
|
145
|
+
const filteredData = (predicate) => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const dataSnapshot = yield table.toArray();
|
|
147
|
+
const results = yield Promise.all(dataSnapshot.map(predicate !== null && predicate !== void 0 ? predicate : (() => __awaiter(this, void 0, void 0, function* () { return true; }))));
|
|
148
|
+
return dataSnapshot.filter((_v, index) => results[index]);
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
native: getDataFn,
|
|
152
|
+
insert: (item) => __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
const id = yield table.add(item);
|
|
154
|
+
return getDataFn().get(id);
|
|
155
|
+
}),
|
|
156
|
+
update: (item) => __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
yield table.update(item.id, item);
|
|
158
|
+
return getDataFn().get(item.id);
|
|
159
|
+
}),
|
|
160
|
+
save: (item) => __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
const key = yield table.put(item);
|
|
162
|
+
return table.get(key);
|
|
163
|
+
}),
|
|
164
|
+
deleteById: (id) => __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
yield table.delete(id);
|
|
166
|
+
}),
|
|
167
|
+
byId: (id) => __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
if (id === undefined || id === null) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
let safeId = id;
|
|
172
|
+
if (table.schema.primKey.src === "++id") {
|
|
173
|
+
//it's an auto incremented id, must be a number
|
|
174
|
+
safeId = Number(id);
|
|
175
|
+
}
|
|
176
|
+
return table.get(safeId);
|
|
177
|
+
}),
|
|
178
|
+
toArray: () => __awaiter(this, void 0, void 0, function* () { return yield table.toArray(); }),
|
|
179
|
+
single: (predicate) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).single(predicate); }),
|
|
180
|
+
singleOrDefault: (predicate, defValue) => __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).singleOrDefault(predicate, defValue);
|
|
182
|
+
}),
|
|
183
|
+
where: (predicate) => __awaiter(this, void 0, void 0, function* () { return new ReadonlyCollection_1.ReadOnlyCollection(yield filteredData(predicate)); }),
|
|
184
|
+
whereAsArray: (predicate) => __awaiter(this, void 0, void 0, function* () { return yield filteredData(predicate); }),
|
|
185
|
+
orderBy: (...mappers) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).orderBy(...mappers); }),
|
|
186
|
+
orderByAsArray: (...mappers) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).orderByAsArray(...mappers); }),
|
|
187
|
+
groupBy: (groupKey) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).groupBy(groupKey); }),
|
|
188
|
+
groupByAsArray: (groupKey) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).groupByAsArray(groupKey); }),
|
|
189
|
+
distinct: (distinctValue) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).distinct(distinctValue); }),
|
|
190
|
+
distinctAsArray: (distinctValue) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).distinctAsArray(distinctValue); }),
|
|
191
|
+
maxValue: (...args_1) => __awaiter(this, [...args_1], void 0, function* (fieldName = "id", predicate) {
|
|
192
|
+
return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).maxValue(fieldName, predicate);
|
|
193
|
+
}),
|
|
194
|
+
skip: (count) => __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).skip(count);
|
|
196
|
+
}),
|
|
197
|
+
take: (count) => __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).take(count);
|
|
199
|
+
}),
|
|
200
|
+
skipTake: (skip, take) => __awaiter(this, void 0, void 0, function* () {
|
|
201
|
+
return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).skipTake(skip, take);
|
|
202
|
+
}),
|
|
203
|
+
};
|
|
204
|
+
});
|
|
205
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ReadOnlyCollection = void 0;
|
|
13
|
+
const misc_1 = require("@components-core/utils/misc");
|
|
14
|
+
class ReadOnlyCollection {
|
|
15
|
+
constructor(items) {
|
|
16
|
+
this.list = [];
|
|
17
|
+
for (const item of items) {
|
|
18
|
+
this.list.push(item);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
get length() {
|
|
22
|
+
return this.list.length;
|
|
23
|
+
}
|
|
24
|
+
toArray() {
|
|
25
|
+
return this.list.slice(0);
|
|
26
|
+
}
|
|
27
|
+
at(index) {
|
|
28
|
+
if (index < 0 || index > this.list.length - 1) {
|
|
29
|
+
throw new Error(`Index (${index}) is out of range [0..${Math.max(this.list.length - 1, 0)}]`);
|
|
30
|
+
}
|
|
31
|
+
return this.list[index];
|
|
32
|
+
}
|
|
33
|
+
all() {
|
|
34
|
+
return new ReadOnlyCollection(this.list);
|
|
35
|
+
}
|
|
36
|
+
single(predicate) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const filtered = yield this.where(predicate);
|
|
39
|
+
if (filtered.length === 0) {
|
|
40
|
+
throw new Error("No items found with the specified predicate");
|
|
41
|
+
}
|
|
42
|
+
else if (filtered.length > 1) {
|
|
43
|
+
throw new Error("Multiple items found with the specified predicate");
|
|
44
|
+
}
|
|
45
|
+
return filtered.at(0);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
singleOrDefault(predicate, defValue) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const filtered = yield this.where(predicate);
|
|
51
|
+
if (filtered.length === 0) {
|
|
52
|
+
return defValue;
|
|
53
|
+
}
|
|
54
|
+
else if (filtered.length > 1) {
|
|
55
|
+
throw new Error("Multiple items found with the specified predicate");
|
|
56
|
+
}
|
|
57
|
+
return filtered.at(0);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
where(predicate) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
return new ReadOnlyCollection(yield this.whereAsArray(predicate));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
whereAsArray(predicate) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const results = yield Promise.all(this.list.map(predicate !== null && predicate !== void 0 ? predicate : (() => __awaiter(this, void 0, void 0, function* () { return true; }))));
|
|
68
|
+
return this.list.filter((_v, index) => results[index]);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
orderBy(...mappers) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
return new ReadOnlyCollection(yield (0, misc_1.orderBy)(this.list, ...mappers));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
orderByAsArray(...mappers) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
return yield (0, misc_1.orderBy)(this.list, ...mappers);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
groupBy(groupKey) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
return new ReadOnlyCollection(yield this.groupByAsArray(groupKey));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
groupByAsArray(groupKey) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const grouped = new Map();
|
|
89
|
+
for (const item of this.list) {
|
|
90
|
+
const key = yield groupKey(item);
|
|
91
|
+
const matchingList = grouped.get(key);
|
|
92
|
+
if (matchingList === undefined) {
|
|
93
|
+
grouped.set(key, [item]);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
matchingList.push(item);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const groupedItems = [];
|
|
100
|
+
for (const [key, items] of grouped.entries()) {
|
|
101
|
+
groupedItems.push({ key, items });
|
|
102
|
+
}
|
|
103
|
+
return groupedItems;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
distinct(distinctValue) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
distinctValue !== null && distinctValue !== void 0 ? distinctValue : (distinctValue = (x) => __awaiter(this, void 0, void 0, function* () { return x; }));
|
|
109
|
+
const values = new Set();
|
|
110
|
+
for (const item of this.list) {
|
|
111
|
+
values.add(yield distinctValue(item));
|
|
112
|
+
}
|
|
113
|
+
return new ReadOnlyCollection(values.values());
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
distinctAsArray(distinctValue) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
return (yield this.distinct(distinctValue)).toArray();
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
maxValue() {
|
|
122
|
+
return __awaiter(this, arguments, void 0, function* (fieldName = "id", predicate) {
|
|
123
|
+
let values = predicate ? (yield new ReadOnlyCollection(this.list)
|
|
124
|
+
.where(predicate)).toArray() : this.list;
|
|
125
|
+
values = yield (0, misc_1.orderBy)(values, (item) => item[fieldName], true);
|
|
126
|
+
return values.length === 0 ? undefined : values[0][fieldName];
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
skip(count) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
return new ReadOnlyCollection(this.list.slice(count));
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
take(count) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
return new ReadOnlyCollection(this.list.slice(0, count));
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
skipTake(skip, take) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
return new ReadOnlyCollection(this.list.slice(skip, take + skip));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.ReadOnlyCollection = ReadOnlyCollection;
|