@object-ui/app-shell 6.2.3 → 7.1.0
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/CHANGELOG.md +1229 -0
- package/README.md +292 -0
- package/dist/assistant/assistantBus.d.ts +72 -0
- package/dist/assistant/assistantBus.js +133 -0
- package/dist/chrome/CommandPalette.d.ts +1 -1
- package/dist/chrome/CommandPalette.js +26 -22
- package/dist/chrome/ConditionalAuthWrapper.d.ts +1 -1
- package/dist/chrome/ConsoleToaster.d.ts +1 -1
- package/dist/chrome/ConsoleToaster.js +3 -1
- package/dist/chrome/ErrorBoundary.d.ts +1 -1
- package/dist/chrome/KeyboardShortcutsDialog.d.ts +1 -1
- package/dist/chrome/KeyboardShortcutsDialog.js +16 -5
- package/dist/chrome/LoadingScreen.d.ts +1 -1
- package/dist/chrome/LoadingScreen.js +22 -26
- package/dist/chrome/RouteFader.d.ts +1 -1
- package/dist/chrome/ThemeProvider.d.ts +1 -1
- package/dist/components/ManagedByBadge.d.ts +1 -1
- package/dist/console/AppContent.d.ts +1 -1
- package/dist/console/AppContent.js +184 -39
- package/dist/console/ConsoleShell.d.ts +7 -7
- package/dist/console/ConsoleShell.js +32 -3
- package/dist/console/ai/AiChatPage.d.ts +88 -1
- package/dist/console/ai/AiChatPage.js +747 -66
- package/dist/console/ai/ConversationsSidebar.d.ts +26 -1
- package/dist/console/ai/ConversationsSidebar.js +149 -34
- package/dist/console/ai/LiveCanvas.d.ts +28 -0
- package/dist/console/ai/LiveCanvas.js +80 -0
- package/dist/console/ai/reconcileTurn.d.ts +8 -0
- package/dist/console/ai/reconcileTurn.js +20 -0
- package/dist/console/auth/AuthPageLayout.d.ts +1 -1
- package/dist/console/auth/ForgotPasswordPage.d.ts +1 -1
- package/dist/console/auth/LoginPage.d.ts +1 -1
- package/dist/console/auth/RegisterPage.d.ts +1 -1
- package/dist/console/auth/RegisterPage.js +23 -3
- package/dist/console/cloud-connection/CloudConnectionPanel.d.ts +1 -0
- package/dist/console/cloud-connection/CloudConnectionPanel.js +169 -0
- package/dist/console/home/AppCard.d.ts +1 -1
- package/dist/console/home/AppCard.js +6 -12
- package/dist/console/home/HomeAppsStrip.d.ts +8 -0
- package/dist/console/home/HomeAppsStrip.js +61 -0
- package/dist/console/home/HomeLayout.d.ts +1 -1
- package/dist/console/home/HomeLayout.js +3 -1
- package/dist/console/home/HomePage.d.ts +1 -2
- package/dist/console/home/HomePage.js +149 -21
- package/dist/console/home/HomeRail.d.ts +22 -0
- package/dist/console/home/HomeRail.js +62 -0
- package/dist/console/home/QuickActions.d.ts +1 -1
- package/dist/console/home/QuickActions.js +3 -11
- package/dist/console/home/RecentApps.d.ts +1 -1
- package/dist/console/home/RecentApps.js +2 -2
- package/dist/console/home/StarredApps.d.ts +1 -1
- package/dist/console/home/StarredApps.js +2 -2
- package/dist/console/marketplace/InstalledListWidget.d.ts +1 -0
- package/dist/console/marketplace/InstalledListWidget.js +93 -0
- package/dist/console/marketplace/MarkdownText.d.ts +1 -1
- package/dist/console/marketplace/MarketplaceAccessDenied.d.ts +1 -1
- package/dist/console/marketplace/MarketplaceInstalledPage.d.ts +8 -14
- package/dist/console/marketplace/MarketplaceInstalledPage.js +14 -66
- package/dist/console/marketplace/MarketplacePackagePage.d.ts +1 -1
- package/dist/console/marketplace/MarketplacePackagePage.js +249 -8
- package/dist/console/marketplace/MarketplacePage.d.ts +1 -1
- package/dist/console/marketplace/MarketplacePage.js +60 -3
- package/dist/console/marketplace/PackageIcon.d.ts +1 -1
- package/dist/console/marketplace/PluginDisclosure.d.ts +14 -0
- package/dist/console/marketplace/PluginDisclosure.js +38 -0
- package/dist/console/marketplace/marketplaceApi.d.ts +123 -0
- package/dist/console/marketplace/marketplaceApi.js +254 -1
- package/dist/console/organizations/CreateWorkspaceDialog.d.ts +1 -1
- package/dist/console/organizations/OrganizationsLayout.d.ts +1 -1
- package/dist/console/organizations/OrganizationsPage.d.ts +1 -1
- package/dist/console/organizations/manage/AcceptInvitationPage.d.ts +1 -1
- package/dist/console/organizations/manage/InvitationsPage.d.ts +1 -1
- package/dist/console/organizations/manage/InviteMemberDialog.d.ts +1 -1
- package/dist/console/organizations/manage/MembersPage.d.ts +1 -1
- package/dist/console/organizations/manage/OrganizationLayout.d.ts +1 -1
- package/dist/console/organizations/manage/SettingsPage.d.ts +1 -1
- package/dist/context/CommandPaletteProvider.d.ts +44 -0
- package/dist/context/CommandPaletteProvider.js +71 -0
- package/dist/context/FavoritesProvider.d.ts +1 -1
- package/dist/context/NavigationContext.d.ts +1 -1
- package/dist/context/RecentItemsProvider.d.ts +2 -2
- package/dist/context/UserStateAdapters.d.ts +1 -1
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +1 -0
- package/dist/hooks/index.d.ts +5 -2
- package/dist/hooks/index.js +4 -1
- package/dist/hooks/useActionModal.d.ts +53 -0
- package/dist/hooks/useActionModal.js +111 -0
- package/dist/hooks/useChatConversation.d.ts +137 -4
- package/dist/hooks/useChatConversation.js +316 -25
- package/dist/hooks/useConsoleActionRuntime.d.ts +70 -0
- package/dist/hooks/useConsoleActionRuntime.js +564 -0
- package/dist/hooks/useConversationList.js +61 -3
- package/dist/hooks/useHomeInbox.d.ts +13 -0
- package/dist/hooks/useHomeInbox.js +142 -0
- package/dist/hooks/useNavPins.js +17 -23
- package/dist/hooks/useNavigationSync.d.ts +33 -0
- package/dist/hooks/useNavigationSync.js +98 -12
- package/dist/hooks/useReconcileOnError.d.ts +40 -0
- package/dist/hooks/useReconcileOnError.js +37 -0
- package/dist/hooks/useRecordApprovals.d.ts +18 -19
- package/dist/hooks/useRecordApprovals.js +24 -40
- package/dist/hooks/useResponsiveSidebar.js +14 -5
- package/dist/hooks/useSettleSignal.d.ts +19 -0
- package/dist/hooks/useSettleSignal.js +20 -0
- package/dist/hooks/useTrackRouteAsRecent.js +35 -0
- package/dist/hooks/useUrlOverlay.d.ts +62 -0
- package/dist/hooks/useUrlOverlay.js +88 -0
- package/dist/index.d.ts +18 -8
- package/dist/index.js +17 -5
- package/dist/layout/ActivityFeed.d.ts +1 -1
- package/dist/layout/AppHeader.d.ts +3 -2
- package/dist/layout/AppHeader.js +237 -72
- package/dist/layout/AppSidebar.d.ts +2 -1
- package/dist/layout/AppSidebar.js +26 -46
- package/dist/layout/AppSwitcher.d.ts +2 -1
- package/dist/layout/AppSwitcher.js +9 -5
- package/dist/layout/AuthPageLayout.d.ts +1 -1
- package/dist/layout/ConnectionStatus.d.ts +1 -1
- package/dist/layout/ConnectionStatus.js +9 -6
- package/dist/layout/ConsoleChatbotFab.d.ts +19 -1
- package/dist/layout/ConsoleChatbotFab.js +16 -2
- package/dist/layout/ConsoleFloatingChatbot.d.ts +34 -2
- package/dist/layout/ConsoleFloatingChatbot.js +391 -41
- package/dist/layout/ConsoleLayout.d.ts +1 -1
- package/dist/layout/ConsoleLayout.js +27 -11
- package/dist/layout/ContextSelectors.d.ts +44 -0
- package/dist/layout/ContextSelectors.js +242 -0
- package/dist/layout/InboxPopover.d.ts +6 -1
- package/dist/layout/InboxPopover.js +25 -6
- package/dist/layout/LocaleSwitcher.d.ts +1 -1
- package/dist/layout/LocalizedSidebarTrigger.d.ts +2 -0
- package/dist/layout/LocalizedSidebarTrigger.js +15 -0
- package/dist/layout/MobileViewSwitcherContext.d.ts +1 -1
- package/dist/layout/ModeToggle.d.ts +1 -1
- package/dist/layout/PageHeader.d.ts +1 -1
- package/dist/layout/UnifiedSidebar.d.ts +2 -1
- package/dist/layout/UnifiedSidebar.js +116 -15
- package/dist/layout/agentPicker.d.ts +56 -0
- package/dist/layout/agentPicker.js +40 -0
- package/dist/observability/index.d.ts +1 -0
- package/dist/observability/index.js +1 -0
- package/dist/observability/settleSignal.d.ts +64 -0
- package/dist/observability/settleSignal.js +131 -0
- package/dist/preview/CommitTimeline.d.ts +15 -0
- package/dist/preview/CommitTimeline.js +82 -0
- package/dist/preview/DraftChangesPanel.d.ts +19 -0
- package/dist/preview/DraftChangesPanel.js +114 -0
- package/dist/preview/DraftPreviewBar.d.ts +8 -0
- package/dist/preview/DraftPreviewBar.js +86 -0
- package/dist/preview/PreviewDraftEmptyState.d.ts +16 -0
- package/dist/preview/PreviewDraftEmptyState.js +47 -0
- package/dist/preview/PreviewModeContext.d.ts +57 -0
- package/dist/preview/PreviewModeContext.js +99 -0
- package/dist/preview/UnpublishedAppBar.d.ts +8 -0
- package/dist/preview/UnpublishedAppBar.js +83 -0
- package/dist/preview/commitHistory.d.ts +28 -0
- package/dist/preview/commitHistory.js +48 -0
- package/dist/preview/draftStatus.d.ts +20 -0
- package/dist/preview/draftStatus.js +27 -0
- package/dist/preview/usePublishAllDrafts.d.ts +18 -0
- package/dist/preview/usePublishAllDrafts.js +106 -0
- package/dist/providers/AdapterProvider.d.ts +1 -1
- package/dist/providers/AdapterProvider.js +6 -1
- package/dist/providers/ExpressionProvider.d.ts +1 -1
- package/dist/providers/MetadataProvider.d.ts +17 -2
- package/dist/providers/MetadataProvider.js +192 -12
- package/dist/runtime-config.d.ts +46 -2
- package/dist/runtime-config.js +39 -2
- package/dist/services/builtinComponents.js +68 -59
- package/dist/skeletons/SkeletonDashboard.d.ts +1 -1
- package/dist/skeletons/SkeletonDetail.d.ts +1 -1
- package/dist/skeletons/SkeletonGrid.d.ts +1 -1
- package/dist/utils/appRoute.d.ts +21 -0
- package/dist/utils/appRoute.js +25 -0
- package/dist/utils/deriveRelatedLists.d.ts +54 -0
- package/dist/utils/deriveRelatedLists.js +91 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/managedByEmptyState.d.ts +8 -1
- package/dist/utils/managedByEmptyState.js +13 -7
- package/dist/utils/preferLocal.d.ts +18 -0
- package/dist/utils/preferLocal.js +24 -0
- package/dist/views/ActionConfirmDialog.d.ts +1 -1
- package/dist/views/ActionConfirmDialog.js +3 -1
- package/dist/views/ActionParamDialog.d.ts +6 -1
- package/dist/views/ActionParamDialog.js +9 -3
- package/dist/views/ActionResultDialog.d.ts +13 -0
- package/dist/views/ActionResultDialog.js +134 -0
- package/dist/views/ComponentNavView.d.ts +14 -1
- package/dist/views/CreateViewDialog.d.ts +1 -1
- package/dist/views/DashboardConfigPanel.d.ts +28 -0
- package/dist/views/DashboardConfigPanel.js +81 -0
- package/dist/views/DashboardView.d.ts +4 -3
- package/dist/views/DashboardView.js +38 -239
- package/dist/views/FlowRunner.d.ts +31 -0
- package/dist/views/FlowRunner.js +121 -0
- package/dist/views/InterfaceListPage.d.ts +49 -0
- package/dist/views/InterfaceListPage.js +347 -0
- package/dist/views/MetadataInspector.d.ts +2 -2
- package/dist/views/ObjectView.d.ts +1 -1
- package/dist/views/ObjectView.js +209 -532
- package/dist/views/PageView.d.ts +8 -3
- package/dist/views/PageView.js +45 -32
- package/dist/views/RecordDetailView.d.ts +1 -1
- package/dist/views/RecordDetailView.js +363 -148
- package/dist/views/RecordFormPage.d.ts +1 -1
- package/dist/views/RecordFormPage.js +26 -1
- package/dist/views/ReportConfigPanel.d.ts +37 -0
- package/dist/views/ReportConfigPanel.js +85 -0
- package/dist/views/ReportView.d.ts +1 -1
- package/dist/views/ReportView.js +116 -7
- package/dist/views/RuntimeDraftBar.d.ts +30 -0
- package/dist/views/RuntimeDraftBar.js +112 -0
- package/dist/views/ScreenView.d.ts +70 -0
- package/dist/views/ScreenView.js +73 -0
- package/dist/views/SearchResultsPage.d.ts +1 -1
- package/dist/views/SearchResultsPage.js +8 -18
- package/dist/views/ViewConfigPanel.d.ts +24 -17
- package/dist/views/ViewConfigPanel.js +121 -77
- package/dist/views/index.d.ts +1 -1
- package/dist/views/index.js +1 -1
- package/dist/views/metadata-admin/AuditPanel.d.ts +28 -0
- package/dist/views/metadata-admin/AuditPanel.js +79 -0
- package/dist/views/metadata-admin/DiagnosticsPage.d.ts +20 -0
- package/dist/views/metadata-admin/DiagnosticsPage.js +69 -0
- package/dist/views/metadata-admin/DirectoryPage.d.ts +16 -1
- package/dist/views/metadata-admin/DirectoryPage.js +101 -24
- package/dist/views/metadata-admin/DraftReviewPanel.d.ts +33 -0
- package/dist/views/metadata-admin/DraftReviewPanel.js +77 -0
- package/dist/views/metadata-admin/EmbeddedItemEditor.d.ts +17 -1
- package/dist/views/metadata-admin/EmbeddedItemEditor.js +15 -8
- package/dist/views/metadata-admin/JsonSourceEditor.d.ts +39 -0
- package/dist/views/metadata-admin/JsonSourceEditor.js +196 -0
- package/dist/views/metadata-admin/LayeredDiff.d.ts +39 -1
- package/dist/views/metadata-admin/LayeredDiff.js +171 -5
- package/dist/views/metadata-admin/MetadataDetailDrawer.d.ts +15 -1
- package/dist/views/metadata-admin/MetadataTypeActions.d.ts +48 -0
- package/dist/views/metadata-admin/MetadataTypeActions.js +165 -0
- package/dist/views/metadata-admin/PackagesPage.d.ts +18 -0
- package/dist/views/metadata-admin/PackagesPage.js +403 -0
- package/dist/views/metadata-admin/PageShell.d.ts +1 -1
- package/dist/views/metadata-admin/PageShell.js +9 -4
- package/dist/views/metadata-admin/PermissionMatrixEditor.d.ts +35 -1
- package/dist/views/metadata-admin/QuickFind.d.ts +21 -1
- package/dist/views/metadata-admin/QuickFind.js +6 -3
- package/dist/views/metadata-admin/RelatedPanel.d.ts +24 -1
- package/dist/views/metadata-admin/RelatedPanel.js +20 -18
- package/dist/views/metadata-admin/ResourceEditPage.d.ts +40 -1
- package/dist/views/metadata-admin/ResourceEditPage.js +1250 -60
- package/dist/views/metadata-admin/ResourceHistoryPage.d.ts +39 -1
- package/dist/views/metadata-admin/ResourceHistoryPage.js +66 -16
- package/dist/views/metadata-admin/ResourceListPage.d.ts +13 -1
- package/dist/views/metadata-admin/ResourceListPage.js +258 -30
- package/dist/views/metadata-admin/ResourceRouter.d.ts +23 -1
- package/dist/views/metadata-admin/SchemaForm.d.ts +34 -1
- package/dist/views/metadata-admin/SchemaForm.js +559 -49
- package/dist/views/metadata-admin/StudioHomePage.d.ts +22 -0
- package/dist/views/metadata-admin/StudioHomePage.js +205 -0
- package/dist/views/metadata-admin/anchors.js +255 -24
- package/dist/views/metadata-admin/clientValidation.d.ts +50 -0
- package/dist/views/metadata-admin/clientValidation.js +169 -0
- package/dist/views/metadata-admin/color-variant-field.d.ts +30 -0
- package/dist/views/metadata-admin/color-variant-field.js +38 -0
- package/dist/views/metadata-admin/createDerive.d.ts +75 -0
- package/dist/views/metadata-admin/createDerive.js +179 -0
- package/dist/views/metadata-admin/dashboard-schema.d.ts +12 -0
- package/dist/views/metadata-admin/dashboard-schema.js +80 -0
- package/dist/views/metadata-admin/datasource/DatasourceResourcePage.d.ts +35 -0
- package/dist/views/metadata-admin/datasource/DatasourceResourcePage.js +327 -0
- package/dist/views/metadata-admin/datasource/register.d.ts +1 -0
- package/dist/views/metadata-admin/datasource/register.js +24 -0
- package/dist/views/metadata-admin/default-inspector-registry.d.ts +49 -0
- package/dist/views/metadata-admin/default-inspector-registry.js +8 -0
- package/dist/views/metadata-admin/default-schemas.js +115 -10
- package/dist/views/metadata-admin/external/ExternalDatasourcePanel.d.ts +27 -0
- package/dist/views/metadata-admin/external/ExternalDatasourcePanel.js +69 -0
- package/dist/views/metadata-admin/external/ImportObjectDialog.d.ts +27 -0
- package/dist/views/metadata-admin/external/ImportObjectDialog.js +77 -0
- package/dist/views/metadata-admin/external/SchemaBrowser.d.ts +16 -0
- package/dist/views/metadata-admin/external/SchemaBrowser.js +74 -0
- package/dist/views/metadata-admin/external/ValidationPanel.d.ts +16 -0
- package/dist/views/metadata-admin/external/ValidationPanel.js +68 -0
- package/dist/views/metadata-admin/external/api.d.ts +100 -0
- package/dist/views/metadata-admin/external/api.js +124 -0
- package/dist/views/metadata-admin/i18n.d.ts +1 -0
- package/dist/views/metadata-admin/i18n.js +1252 -2
- package/dist/views/metadata-admin/index.d.ts +8 -5
- package/dist/views/metadata-admin/index.js +12 -2
- package/dist/views/metadata-admin/inspector-registry.d.ts +51 -0
- package/dist/views/metadata-admin/inspector-registry.js +11 -0
- package/dist/views/metadata-admin/inspectors/ActionDefaultInspector.d.ts +30 -0
- package/dist/views/metadata-admin/inspectors/ActionDefaultInspector.js +180 -0
- package/dist/views/metadata-admin/inspectors/AppNavInspector.d.ts +16 -0
- package/dist/views/metadata-admin/inspectors/AppNavInspector.js +110 -0
- package/dist/views/metadata-admin/inspectors/ConditionBuilder.d.ts +29 -0
- package/dist/views/metadata-admin/inspectors/ConditionBuilder.js +154 -0
- package/dist/views/metadata-admin/inspectors/DashboardDefaultInspector.d.ts +28 -0
- package/dist/views/metadata-admin/inspectors/DashboardDefaultInspector.js +110 -0
- package/dist/views/metadata-admin/inspectors/DashboardWidgetInspector.d.ts +18 -0
- package/dist/views/metadata-admin/inspectors/DashboardWidgetInspector.js +139 -0
- package/dist/views/metadata-admin/inspectors/DatasetDefaultInspector.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/DatasetDefaultInspector.js +221 -0
- package/dist/views/metadata-admin/inspectors/FlowEdgeInspector.d.ts +16 -0
- package/dist/views/metadata-admin/inspectors/FlowEdgeInspector.js +126 -0
- package/dist/views/metadata-admin/inspectors/FlowInspector.d.ts +12 -0
- package/dist/views/metadata-admin/inspectors/FlowInspector.js +9 -0
- package/dist/views/metadata-admin/inspectors/FlowKeyValueField.d.ts +30 -0
- package/dist/views/metadata-admin/inspectors/FlowKeyValueField.js +125 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeConfigField.d.ts +18 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeConfigField.js +40 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeInspector.d.ts +14 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeInspector.js +205 -0
- package/dist/views/metadata-admin/inspectors/FlowObjectListField.d.ts +26 -0
- package/dist/views/metadata-admin/inspectors/FlowObjectListField.js +105 -0
- package/dist/views/metadata-admin/inspectors/FlowReferenceField.d.ts +83 -0
- package/dist/views/metadata-admin/inspectors/FlowReferenceField.js +181 -0
- package/dist/views/metadata-admin/inspectors/FlowStringListField.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/FlowStringListField.js +60 -0
- package/dist/views/metadata-admin/inspectors/InspectorComboField.d.ts +40 -0
- package/dist/views/metadata-admin/inspectors/InspectorComboField.js +61 -0
- package/dist/views/metadata-admin/inspectors/ObjectDefaultInspector.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/ObjectDefaultInspector.js +55 -0
- package/dist/views/metadata-admin/inspectors/ObjectFieldInspector.d.ts +23 -0
- package/dist/views/metadata-admin/inspectors/ObjectFieldInspector.js +365 -0
- package/dist/views/metadata-admin/inspectors/PageBlockInspector.d.ts +48 -0
- package/dist/views/metadata-admin/inspectors/PageBlockInspector.js +332 -0
- package/dist/views/metadata-admin/inspectors/ReportDefaultInspector.d.ts +58 -0
- package/dist/views/metadata-admin/inspectors/ReportDefaultInspector.js +218 -0
- package/dist/views/metadata-admin/inspectors/ViewColumnInspector.d.ts +19 -0
- package/dist/views/metadata-admin/inspectors/ViewColumnInspector.js +144 -0
- package/dist/views/metadata-admin/inspectors/ViewInspector.d.ts +19 -0
- package/dist/views/metadata-admin/inspectors/ViewInspector.js +21 -0
- package/dist/views/metadata-admin/inspectors/ViewVariantInspector.d.ts +54 -0
- package/dist/views/metadata-admin/inspectors/ViewVariantInspector.js +191 -0
- package/dist/views/metadata-admin/inspectors/_shared.d.ts +128 -0
- package/dist/views/metadata-admin/inspectors/_shared.js +113 -0
- package/dist/views/metadata-admin/inspectors/datasetFilterCondition.d.ts +24 -0
- package/dist/views/metadata-admin/inspectors/datasetFilterCondition.js +97 -0
- package/dist/views/metadata-admin/inspectors/expression-validate.d.ts +26 -0
- package/dist/views/metadata-admin/inspectors/expression-validate.js +66 -0
- package/dist/views/metadata-admin/inspectors/flow-node-config.d.ts +143 -0
- package/dist/views/metadata-admin/inspectors/flow-node-config.js +506 -0
- package/dist/views/metadata-admin/inspectors/index.d.ts +1 -0
- package/dist/views/metadata-admin/inspectors/index.js +45 -0
- package/dist/views/metadata-admin/inspectors/json-schema-to-fields.d.ts +40 -0
- package/dist/views/metadata-admin/inspectors/json-schema-to-fields.js +227 -0
- package/dist/views/metadata-admin/inspectors/useDatasetFields.d.ts +72 -0
- package/dist/views/metadata-admin/inspectors/useDatasetFields.js +0 -0
- package/dist/views/metadata-admin/issuePath.d.ts +22 -0
- package/dist/views/metadata-admin/issuePath.js +65 -0
- package/dist/views/metadata-admin/mergeServerFields.d.ts +65 -0
- package/dist/views/metadata-admin/mergeServerFields.js +56 -0
- package/dist/views/metadata-admin/package-scope.d.ts +26 -0
- package/dist/views/metadata-admin/package-scope.js +43 -0
- package/dist/views/metadata-admin/preview-registry.d.ts +55 -0
- package/dist/views/metadata-admin/previews/ActionPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/ActionPreview.js +238 -0
- package/dist/views/metadata-admin/previews/AddWidgetPicker.d.ts +12 -0
- package/dist/views/metadata-admin/previews/AddWidgetPicker.js +56 -0
- package/dist/views/metadata-admin/previews/AgentPreview.d.ts +24 -0
- package/dist/views/metadata-admin/previews/AgentPreview.js +100 -0
- package/dist/views/metadata-admin/previews/AppNavCanvas.d.ts +31 -0
- package/dist/views/metadata-admin/previews/AppNavCanvas.js +260 -0
- package/dist/views/metadata-admin/previews/AppPreview.d.ts +16 -1
- package/dist/views/metadata-admin/previews/AppPreview.js +23 -14
- package/dist/views/metadata-admin/previews/BookPreview.d.ts +20 -0
- package/dist/views/metadata-admin/previews/BookPreview.js +132 -0
- package/dist/views/metadata-admin/previews/DashboardPreview.d.ts +16 -1
- package/dist/views/metadata-admin/previews/DashboardPreview.js +110 -8
- package/dist/views/metadata-admin/previews/DatasetPreview.d.ts +18 -0
- package/dist/views/metadata-admin/previews/DatasetPreview.js +105 -0
- package/dist/views/metadata-admin/previews/DatasourcePreview.d.ts +23 -0
- package/dist/views/metadata-admin/previews/DatasourcePreview.js +68 -0
- package/dist/views/metadata-admin/previews/EmailTemplatePreview.d.ts +14 -1
- package/dist/views/metadata-admin/previews/FieldStub.d.ts +30 -0
- package/dist/views/metadata-admin/previews/FieldStub.js +104 -0
- package/dist/views/metadata-admin/previews/FieldsListEditor.d.ts +50 -0
- package/dist/views/metadata-admin/previews/FieldsListEditor.js +97 -0
- package/dist/views/metadata-admin/previews/FlowCanvas.d.ts +49 -0
- package/dist/views/metadata-admin/previews/FlowCanvas.js +416 -0
- package/dist/views/metadata-admin/previews/FlowPreview.d.ts +20 -0
- package/dist/views/metadata-admin/previews/FlowPreview.js +120 -0
- package/dist/views/metadata-admin/previews/FlowRunsPanel.d.ts +46 -0
- package/dist/views/metadata-admin/previews/FlowRunsPanel.js +97 -0
- package/dist/views/metadata-admin/previews/FlowSimulatorPanel.d.ts +25 -0
- package/dist/views/metadata-admin/previews/FlowSimulatorPanel.js +204 -0
- package/dist/views/metadata-admin/previews/JobPreview.d.ts +28 -0
- package/dist/views/metadata-admin/previews/JobPreview.js +290 -0
- package/dist/views/metadata-admin/previews/ObjectFormCanvas.d.ts +30 -0
- package/dist/views/metadata-admin/previews/ObjectFormCanvas.js +547 -0
- package/dist/views/metadata-admin/previews/ObjectPreview.d.ts +14 -1
- package/dist/views/metadata-admin/previews/ObjectPreview.js +5 -30
- package/dist/views/metadata-admin/previews/OutlineStrip.d.ts +32 -0
- package/dist/views/metadata-admin/previews/OutlineStrip.js +8 -0
- package/dist/views/metadata-admin/previews/PageBlockCanvas.d.ts +49 -0
- package/dist/views/metadata-admin/previews/PageBlockCanvas.js +510 -0
- package/dist/views/metadata-admin/previews/PagePreview.d.ts +10 -1
- package/dist/views/metadata-admin/previews/PagePreview.js +200 -5
- package/dist/views/metadata-admin/previews/PermissionPreview.d.ts +27 -0
- package/dist/views/metadata-admin/previews/PermissionPreview.js +115 -0
- package/dist/views/metadata-admin/previews/PreviewShell.d.ts +29 -6
- package/dist/views/metadata-admin/previews/PreviewShell.js +16 -3
- package/dist/views/metadata-admin/previews/ReportPreview.d.ts +18 -1
- package/dist/views/metadata-admin/previews/ReportPreview.js +23 -15
- package/dist/views/metadata-admin/previews/RolePreview.d.ts +19 -0
- package/dist/views/metadata-admin/previews/RolePreview.js +14 -0
- package/dist/views/metadata-admin/previews/ScreenPreview.d.ts +38 -0
- package/dist/views/metadata-admin/previews/ScreenPreview.js +61 -0
- package/dist/views/metadata-admin/previews/SkillPreview.d.ts +22 -0
- package/dist/views/metadata-admin/previews/SkillPreview.js +34 -0
- package/dist/views/metadata-admin/previews/ToolPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/ToolPreview.js +122 -0
- package/dist/views/metadata-admin/previews/TranslationPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/TranslationPreview.js +52 -0
- package/dist/views/metadata-admin/previews/ValidationPreview.d.ts +27 -0
- package/dist/views/metadata-admin/previews/ValidationPreview.js +110 -0
- package/dist/views/metadata-admin/previews/ViewColumnPanes.d.ts +62 -0
- package/dist/views/metadata-admin/previews/ViewColumnPanes.js +140 -0
- package/dist/views/metadata-admin/previews/ViewPreview.d.ts +23 -1
- package/dist/views/metadata-admin/previews/ViewPreview.js +101 -73
- package/dist/views/metadata-admin/previews/block-config.d.ts +82 -0
- package/dist/views/metadata-admin/previews/block-config.js +324 -0
- package/dist/views/metadata-admin/previews/block-types.d.ts +40 -0
- package/dist/views/metadata-admin/previews/block-types.js +110 -0
- package/dist/views/metadata-admin/previews/field-types.d.ts +53 -0
- package/dist/views/metadata-admin/previews/field-types.js +97 -0
- package/dist/views/metadata-admin/previews/flow-canvas-layout.d.ts +102 -0
- package/dist/views/metadata-admin/previews/flow-canvas-layout.js +227 -0
- package/dist/views/metadata-admin/previews/flow-canvas-parts.d.ts +96 -0
- package/dist/views/metadata-admin/previews/flow-canvas-parts.js +373 -0
- package/dist/views/metadata-admin/previews/form-preview.d.ts +24 -0
- package/dist/views/metadata-admin/previews/form-preview.js +29 -0
- package/dist/views/metadata-admin/previews/index.js +43 -0
- package/dist/views/metadata-admin/previews/object-fields-bridge.d.ts +66 -0
- package/dist/views/metadata-admin/previews/object-fields-bridge.js +171 -0
- package/dist/views/metadata-admin/previews/object-fields-io.d.ts +130 -0
- package/dist/views/metadata-admin/previews/object-fields-io.js +243 -0
- package/dist/views/metadata-admin/previews/screen-spec.d.ts +43 -0
- package/dist/views/metadata-admin/previews/screen-spec.js +108 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-types.d.ts +102 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-types.js +2 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-validate.d.ts +15 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-validate.js +185 -0
- package/dist/views/metadata-admin/previews/simulator/flow-simulator.d.ts +73 -0
- package/dist/views/metadata-admin/previews/simulator/flow-simulator.js +426 -0
- package/dist/views/metadata-admin/previews/useDatasetCatalog.d.ts +47 -0
- package/dist/views/metadata-admin/previews/useDatasetCatalog.js +133 -0
- package/dist/views/metadata-admin/previews/useFlowNodePalette.d.ts +44 -0
- package/dist/views/metadata-admin/previews/useFlowNodePalette.js +124 -0
- package/dist/views/metadata-admin/previews/useMetaOptions.d.ts +8 -0
- package/dist/views/metadata-admin/previews/useMetaOptions.js +50 -0
- package/dist/views/metadata-admin/previews/useObjectFields.d.ts +23 -0
- package/dist/views/metadata-admin/previews/useObjectFields.js +79 -0
- package/dist/views/metadata-admin/previews/useObjectOptions.d.ts +8 -0
- package/dist/views/metadata-admin/previews/useObjectOptions.js +43 -0
- package/dist/views/metadata-admin/previews/view-column-io.d.ts +42 -0
- package/dist/views/metadata-admin/previews/view-column-io.js +73 -0
- package/dist/views/metadata-admin/previews/widget-types.d.ts +24 -0
- package/dist/views/metadata-admin/previews/widget-types.js +40 -0
- package/dist/views/metadata-admin/registry.d.ts +140 -19
- package/dist/views/metadata-admin/report-schema.d.ts +26 -0
- package/dist/views/metadata-admin/report-schema.js +121 -0
- package/dist/views/metadata-admin/useMetadata.d.ts +100 -2
- package/dist/views/metadata-admin/useMetadata.js +155 -4
- package/dist/views/metadata-admin/view-item-normalize.d.ts +20 -0
- package/dist/views/metadata-admin/view-item-normalize.js +68 -0
- package/dist/views/metadata-admin/view-schema.d.ts +16 -0
- package/dist/views/metadata-admin/view-schema.js +107 -0
- package/dist/views/metadata-admin/view-variant-model.d.ts +23 -0
- package/dist/views/metadata-admin/view-variant-model.js +64 -0
- package/dist/views/metadata-admin/widgets.d.ts +89 -1
- package/dist/views/metadata-admin/widgets.js +491 -17
- package/dist/views/runtime-metadata-persistence.d.ts +78 -0
- package/dist/views/runtime-metadata-persistence.js +89 -0
- package/dist/views/useOpenRecordList.d.ts +18 -0
- package/dist/views/useOpenRecordList.js +36 -0
- package/dist/views/userFilterUrlState.d.ts +15 -0
- package/dist/views/userFilterUrlState.js +53 -0
- package/dist/views/view-config-adapter.d.ts +38 -0
- package/dist/views/view-config-adapter.js +80 -0
- package/package.json +52 -34
- package/dist/views/DesignDrawer.d.ts +0 -28
- package/dist/views/DesignDrawer.js +0 -51
- package/dist/views/metadata-admin/DesignerEditorWrapper.d.ts +0 -68
- package/dist/views/metadata-admin/DesignerEditorWrapper.js +0 -158
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
|
|
2
|
+
import { evalCondition } from './simulator/flow-sim-validate';
|
|
3
|
+
/**
|
|
4
|
+
* Interpolate `{var}` references, mirroring the simulator's `{var}` syntax
|
|
5
|
+
* (flow-simulator.ts). Known vars are substituted; unknown refs stay literal so
|
|
6
|
+
* the author still sees the dependency in the design preview.
|
|
7
|
+
*/
|
|
8
|
+
export function interpolate(text, vars) {
|
|
9
|
+
if (!text)
|
|
10
|
+
return '';
|
|
11
|
+
if (!vars)
|
|
12
|
+
return text;
|
|
13
|
+
return text.replace(/\{([^{}]+)\}/g, (m, k) => {
|
|
14
|
+
const v = vars[String(k).trim()];
|
|
15
|
+
return v === undefined || v === null ? m : String(v);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A field's `visibleWhen` gate, evaluated against the current variables using
|
|
20
|
+
* the SAME evaluator the simulator uses for edge conditions (so the preview
|
|
21
|
+
* agrees with the simulator). Real metadata mixes `{var}` and bare-var styles
|
|
22
|
+
* (e.g. `{createOpportunity} == true`, `stage == "review"`), so brace
|
|
23
|
+
* placeholders are normalised to bare identifiers first.
|
|
24
|
+
*
|
|
25
|
+
* Fail-OPEN: a missing condition, an unparseable one, or one that references a
|
|
26
|
+
* not-yet-set variable (the inspector has no run state) keeps the field
|
|
27
|
+
* visible — the design preview never hides a configured field just because it
|
|
28
|
+
* lacks the data to decide. With live run state (the simulator) it gates
|
|
29
|
+
* faithfully: `createOpportunity == false` hides the field.
|
|
30
|
+
*/
|
|
31
|
+
export function isFieldVisibleWhen(visibleWhen, variables) {
|
|
32
|
+
if (typeof visibleWhen !== 'string' || !visibleWhen.trim())
|
|
33
|
+
return true;
|
|
34
|
+
if (!variables)
|
|
35
|
+
return true;
|
|
36
|
+
const normalized = visibleWhen.replace(/\{([\w.]+)\}/g, '$1');
|
|
37
|
+
const { result, error } = evalCondition(normalized, variables);
|
|
38
|
+
return error ? true : result;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Coerce the authored `config.fields` rows into runtime `ScreenFieldSpec`s,
|
|
42
|
+
* dropping any whose `visibleWhen` evaluates false against `variables` — exactly
|
|
43
|
+
* what the runtime `screen` executor emits (it filters server-side before
|
|
44
|
+
* sending the ScreenSpec).
|
|
45
|
+
*/
|
|
46
|
+
function toScreenFields(raw, variables) {
|
|
47
|
+
if (!Array.isArray(raw))
|
|
48
|
+
return [];
|
|
49
|
+
const out = [];
|
|
50
|
+
for (const f of raw) {
|
|
51
|
+
if (!f || typeof f !== 'object')
|
|
52
|
+
continue;
|
|
53
|
+
const row = f;
|
|
54
|
+
if (typeof row.name !== 'string' || !row.name)
|
|
55
|
+
continue;
|
|
56
|
+
if (!isFieldVisibleWhen(row.visibleWhen, variables))
|
|
57
|
+
continue;
|
|
58
|
+
out.push({
|
|
59
|
+
name: row.name,
|
|
60
|
+
label: typeof row.label === 'string' ? row.label : undefined,
|
|
61
|
+
type: typeof row.type === 'string' ? row.type : undefined,
|
|
62
|
+
required: row.required === true,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
/** Count of authored field rows hidden by their `visibleWhen` against `variables`. */
|
|
68
|
+
export function hiddenFieldCount(node, variables) {
|
|
69
|
+
const raw = node.config?.fields;
|
|
70
|
+
if (!Array.isArray(raw))
|
|
71
|
+
return 0;
|
|
72
|
+
let hidden = 0;
|
|
73
|
+
for (const f of raw) {
|
|
74
|
+
if (!f || typeof f !== 'object')
|
|
75
|
+
continue;
|
|
76
|
+
const row = f;
|
|
77
|
+
if (typeof row.name !== 'string' || !row.name)
|
|
78
|
+
continue;
|
|
79
|
+
if (!isFieldVisibleWhen(row.visibleWhen, variables))
|
|
80
|
+
hidden++;
|
|
81
|
+
}
|
|
82
|
+
return hidden;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Map a screen node's authored `config` onto the runtime `ScreenSpec` — the
|
|
86
|
+
* same keys the engine's `screen` executor reads (title / description / fields
|
|
87
|
+
* / objectName / mode / defaults / idVariable). `fields` are gated by their
|
|
88
|
+
* `visibleWhen` against `variables` (omit `variables` to keep every field).
|
|
89
|
+
*/
|
|
90
|
+
export function buildScreenSpec(node, variables) {
|
|
91
|
+
const c = (node.config && typeof node.config === 'object' ? node.config : {});
|
|
92
|
+
const objectName = typeof c.objectName === 'string' && c.objectName ? c.objectName : undefined;
|
|
93
|
+
const mode = c.mode === 'edit' ? 'edit' : c.mode === 'create' ? 'create' : undefined;
|
|
94
|
+
const defaults = c.defaults && typeof c.defaults === 'object' && !Array.isArray(c.defaults)
|
|
95
|
+
? c.defaults
|
|
96
|
+
: undefined;
|
|
97
|
+
return {
|
|
98
|
+
nodeId: node.id,
|
|
99
|
+
title: typeof c.title === 'string' ? c.title : undefined,
|
|
100
|
+
description: typeof c.description === 'string' ? c.description : undefined,
|
|
101
|
+
fields: toScreenFields(c.fields, variables),
|
|
102
|
+
kind: objectName ? 'object-form' : 'fields',
|
|
103
|
+
objectName,
|
|
104
|
+
mode,
|
|
105
|
+
defaults,
|
|
106
|
+
idVariable: typeof c.idVariable === 'string' ? c.idVariable : undefined,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the designer-time flow simulator.
|
|
3
|
+
*
|
|
4
|
+
* The simulator is a CLIENT-SIDE, BACKEND-FREE interpreter used to debug a flow
|
|
5
|
+
* draft inside the visual designer. It NEVER calls a `dataSource`: every
|
|
6
|
+
* side-effecting node (CRUD / connector / http / script) is MOCKED, so running
|
|
7
|
+
* a simulation can never write or delete real data and never needs a live
|
|
8
|
+
* environment. Its guiding rule (per design review) is: *never silently
|
|
9
|
+
* simulate semantics that differ from the runtime* — anything we cannot
|
|
10
|
+
* faithfully model (join synchronization, subflows, boundary events, arbitrary
|
|
11
|
+
* script code) is surfaced as an explicit pause/notice instead of a fake
|
|
12
|
+
* "success".
|
|
13
|
+
*/
|
|
14
|
+
export interface SimNode {
|
|
15
|
+
id: string;
|
|
16
|
+
type: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
config?: Record<string, unknown>;
|
|
19
|
+
connectorConfig?: Record<string, unknown>;
|
|
20
|
+
[k: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface SimEdge {
|
|
23
|
+
id?: string;
|
|
24
|
+
source: string;
|
|
25
|
+
target: string;
|
|
26
|
+
condition?: string | {
|
|
27
|
+
source?: string;
|
|
28
|
+
};
|
|
29
|
+
isDefault?: boolean;
|
|
30
|
+
label?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Connection type (FlowEdgeSchema). A `'back'` edge is an ADR-0044 declared
|
|
33
|
+
* back-edge: traversed normally at run time, but excluded from DAG cycle
|
|
34
|
+
* validation so a revise/rework loop can re-enter an earlier node.
|
|
35
|
+
*/
|
|
36
|
+
type?: string;
|
|
37
|
+
}
|
|
38
|
+
export type SimStatus = 'idle' | 'running' | 'paused' | 'done' | 'error';
|
|
39
|
+
/** One evaluated outgoing edge of a decision (kept for the debug timeline). */
|
|
40
|
+
export interface SimEdgeEval {
|
|
41
|
+
edgeId: string;
|
|
42
|
+
target: string;
|
|
43
|
+
condition?: string;
|
|
44
|
+
result: boolean;
|
|
45
|
+
error?: string;
|
|
46
|
+
isDefault?: boolean;
|
|
47
|
+
selected: boolean;
|
|
48
|
+
}
|
|
49
|
+
export type SimStepStatus = 'ok' | 'mocked' | 'paused' | 'skipped' | 'error';
|
|
50
|
+
/** A single executed node, rich enough to debug decisions and data writes. */
|
|
51
|
+
export interface SimStep {
|
|
52
|
+
seq: number;
|
|
53
|
+
nodeId: string;
|
|
54
|
+
type: string;
|
|
55
|
+
label: string;
|
|
56
|
+
status: SimStepStatus;
|
|
57
|
+
/** Variable names → values written by this node (mocked side effects). */
|
|
58
|
+
wrote?: Record<string, unknown>;
|
|
59
|
+
/** Per-edge condition diagnostics for a decision node. */
|
|
60
|
+
edges?: SimEdgeEval[];
|
|
61
|
+
/** Human-readable note (e.g. "mocked", "paused for screen input"). */
|
|
62
|
+
note?: string;
|
|
63
|
+
/** Evaluation/structural error surfaced to the author. */
|
|
64
|
+
error?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface SimState {
|
|
67
|
+
status: SimStatus;
|
|
68
|
+
variables: Record<string, unknown>;
|
|
69
|
+
steps: SimStep[];
|
|
70
|
+
/** Node ids waiting to execute. */
|
|
71
|
+
frontier: string[];
|
|
72
|
+
/** Last executed (or currently paused) node. */
|
|
73
|
+
activeNodeId: string | null;
|
|
74
|
+
visitedNodeIds: string[];
|
|
75
|
+
traversedEdgeIds: string[];
|
|
76
|
+
/** Set while `status === 'paused'` ("wait" or "screen"). */
|
|
77
|
+
pausedReason?: string;
|
|
78
|
+
error?: string;
|
|
79
|
+
}
|
|
80
|
+
export type DiagnosticLevel = 'error' | 'warning';
|
|
81
|
+
export interface Diagnostic {
|
|
82
|
+
level: DiagnosticLevel;
|
|
83
|
+
nodeId?: string;
|
|
84
|
+
message: string;
|
|
85
|
+
/**
|
|
86
|
+
* For a cycle error: the node path that closes the loop (e.g. `['a','b','a']`),
|
|
87
|
+
* so the designer can paint the offending edges/nodes inline on the canvas.
|
|
88
|
+
*/
|
|
89
|
+
cycle?: string[];
|
|
90
|
+
}
|
|
91
|
+
export interface FlowValidation {
|
|
92
|
+
errors: Diagnostic[];
|
|
93
|
+
warnings: Diagnostic[];
|
|
94
|
+
/** Resolved entry node id, when exactly one is determinable. */
|
|
95
|
+
startNodeId?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Author-supplied mock outputs, keyed by node id. The value is merged into the
|
|
99
|
+
* simulation variables according to the node type (single `outputVariable` or a
|
|
100
|
+
* `outputVariables` list). For a `screen` node it supplies the captured inputs.
|
|
101
|
+
*/
|
|
102
|
+
export type MockResults = Record<string, unknown>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FlowValidation, SimEdge, SimNode } from './flow-sim-types';
|
|
2
|
+
/** Evaluate a CEL condition, capturing (not swallowing) any failure. */
|
|
3
|
+
export declare function evalCondition(expr: string, variables: Record<string, unknown>): {
|
|
4
|
+
result: boolean;
|
|
5
|
+
error?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Find a directed cycle in `edges` over `nodeIds`, returned as the node path
|
|
9
|
+
* that closes the loop (e.g. `['a','b','a']`), or `null` when the graph is a
|
|
10
|
+
* DAG. Iterative DFS with a recursion-stack colour map; the first cycle found
|
|
11
|
+
* wins (enough to report — the author fixes one at a time).
|
|
12
|
+
*/
|
|
13
|
+
export declare function findCycle(nodeIds: string[], edges: SimEdge[]): string[] | null;
|
|
14
|
+
/** Static structural checks; `errors` block Run, `warnings` are advisory. */
|
|
15
|
+
export declare function validateFlowDraft(nodes: SimNode[], edges: SimEdge[]): FlowValidation;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
|
|
2
|
+
/**
|
|
3
|
+
* Preflight graph validation + CEL helpers for the flow simulator.
|
|
4
|
+
*
|
|
5
|
+
* Validation runs BEFORE a simulation so the debugger refuses to "Run" a
|
|
6
|
+
* structurally broken flow (which the real runtime would reject) instead of
|
|
7
|
+
* producing misleading partial output. Condition evaluation deliberately does
|
|
8
|
+
* NOT swallow errors the way the shared `evaluatePlainCondition` does — a
|
|
9
|
+
* debugger must tell the author *why* a branch was false (parse error, missing
|
|
10
|
+
* variable, type error), so we capture and surface the message.
|
|
11
|
+
*/
|
|
12
|
+
import { ExpressionEvaluator } from '@object-ui/core';
|
|
13
|
+
const edgeCondString = (c) => typeof c === 'string' ? c : undefined;
|
|
14
|
+
/** Evaluate a CEL condition, capturing (not swallowing) any failure. */
|
|
15
|
+
export function evalCondition(expr, variables) {
|
|
16
|
+
const source = expr.trim();
|
|
17
|
+
if (!source)
|
|
18
|
+
return { result: false, error: 'Empty condition.' };
|
|
19
|
+
try {
|
|
20
|
+
const evaluator = new ExpressionEvaluator({ ...variables, data: variables });
|
|
21
|
+
const isTemplate = /\$\{/.test(source);
|
|
22
|
+
const raw = isTemplate
|
|
23
|
+
? evaluator.evaluate(source, { throwOnError: true })
|
|
24
|
+
: evaluator.evaluateExpression(source);
|
|
25
|
+
return { result: raw === true };
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return { result: false, error: err.message || 'Evaluation failed.' };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Find a directed cycle in `edges` over `nodeIds`, returned as the node path
|
|
33
|
+
* that closes the loop (e.g. `['a','b','a']`), or `null` when the graph is a
|
|
34
|
+
* DAG. Iterative DFS with a recursion-stack colour map; the first cycle found
|
|
35
|
+
* wins (enough to report — the author fixes one at a time).
|
|
36
|
+
*/
|
|
37
|
+
export function findCycle(nodeIds, edges) {
|
|
38
|
+
const adj = new Map();
|
|
39
|
+
for (const id of nodeIds)
|
|
40
|
+
adj.set(id, []);
|
|
41
|
+
for (const e of edges) {
|
|
42
|
+
if (adj.has(e.source) && adj.has(e.target))
|
|
43
|
+
adj.get(e.source).push(e.target);
|
|
44
|
+
}
|
|
45
|
+
const WHITE = 0, GRAY = 1, BLACK = 2;
|
|
46
|
+
const color = new Map(nodeIds.map((id) => [id, WHITE]));
|
|
47
|
+
const stack = [];
|
|
48
|
+
const visit = (start) => {
|
|
49
|
+
// Explicit stack of {node, next-child-index} frames so a deep graph can't
|
|
50
|
+
// blow the JS call stack.
|
|
51
|
+
const frames = [{ id: start, i: 0 }];
|
|
52
|
+
color.set(start, GRAY);
|
|
53
|
+
stack.push(start);
|
|
54
|
+
while (frames.length) {
|
|
55
|
+
const frame = frames[frames.length - 1];
|
|
56
|
+
const children = adj.get(frame.id) ?? [];
|
|
57
|
+
if (frame.i < children.length) {
|
|
58
|
+
const next = children[frame.i++];
|
|
59
|
+
const c = color.get(next);
|
|
60
|
+
if (c === GRAY) {
|
|
61
|
+
// Back into the active path → cycle. Slice from `next` to close it.
|
|
62
|
+
const from = stack.indexOf(next);
|
|
63
|
+
return [...stack.slice(from), next];
|
|
64
|
+
}
|
|
65
|
+
if (c === WHITE) {
|
|
66
|
+
color.set(next, GRAY);
|
|
67
|
+
stack.push(next);
|
|
68
|
+
frames.push({ id: next, i: 0 });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
color.set(frame.id, BLACK);
|
|
73
|
+
stack.pop();
|
|
74
|
+
frames.pop();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
};
|
|
79
|
+
for (const id of nodeIds) {
|
|
80
|
+
if (color.get(id) === WHITE) {
|
|
81
|
+
const cycle = visit(id);
|
|
82
|
+
if (cycle)
|
|
83
|
+
return cycle;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
/** Static structural checks; `errors` block Run, `warnings` are advisory. */
|
|
89
|
+
export function validateFlowDraft(nodes, edges) {
|
|
90
|
+
const errors = [];
|
|
91
|
+
const warnings = [];
|
|
92
|
+
const ids = nodes.map((n) => n.id);
|
|
93
|
+
const idSet = new Set();
|
|
94
|
+
for (const id of ids) {
|
|
95
|
+
if (!id) {
|
|
96
|
+
errors.push({ level: 'error', message: 'A node is missing an id.' });
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (idSet.has(id))
|
|
100
|
+
errors.push({ level: 'error', nodeId: id, message: `Duplicate node id "${id}".` });
|
|
101
|
+
idSet.add(id);
|
|
102
|
+
}
|
|
103
|
+
for (const e of edges) {
|
|
104
|
+
if (!idSet.has(e.source))
|
|
105
|
+
errors.push({ level: 'error', message: `Edge source "${e.source}" does not exist.` });
|
|
106
|
+
if (!idSet.has(e.target))
|
|
107
|
+
errors.push({ level: 'error', message: `Edge target "${e.target}" does not exist.` });
|
|
108
|
+
}
|
|
109
|
+
// Entry resolution: prefer an explicit `start` node, else a node with no
|
|
110
|
+
// incoming edge. Zero or many → the author must fix it before running.
|
|
111
|
+
const incoming = new Set(edges.map((e) => e.target));
|
|
112
|
+
const startNodes = nodes.filter((n) => n.type === 'start');
|
|
113
|
+
const roots = nodes.filter((n) => !incoming.has(n.id));
|
|
114
|
+
let startNodeId;
|
|
115
|
+
if (startNodes.length === 1) {
|
|
116
|
+
startNodeId = startNodes[0].id;
|
|
117
|
+
if (incoming.has(startNodeId)) {
|
|
118
|
+
warnings.push({ level: 'warning', nodeId: startNodeId, message: 'Start node has an incoming edge.' });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else if (startNodes.length > 1) {
|
|
122
|
+
errors.push({ level: 'error', message: `Flow has ${startNodes.length} start nodes; expected one.` });
|
|
123
|
+
}
|
|
124
|
+
else if (roots.length === 1) {
|
|
125
|
+
startNodeId = roots[0].id;
|
|
126
|
+
warnings.push({ level: 'warning', nodeId: startNodeId, message: 'No "start" node; using the only root node as the entry.' });
|
|
127
|
+
}
|
|
128
|
+
else if (roots.length === 0) {
|
|
129
|
+
errors.push({ level: 'error', message: 'No entry node (every node has an incoming edge — the graph is fully cyclic).' });
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
errors.push({ level: 'error', message: `Cannot determine a single entry node (${roots.length} candidates). Add a "start" node.` });
|
|
133
|
+
}
|
|
134
|
+
// Per-decision: at most one default; warn on missing default (possible dead end).
|
|
135
|
+
for (const n of nodes) {
|
|
136
|
+
if (n.type !== 'decision')
|
|
137
|
+
continue;
|
|
138
|
+
const out = edges.filter((e) => e.source === n.id);
|
|
139
|
+
const defaults = out.filter((e) => e.isDefault);
|
|
140
|
+
if (defaults.length > 1) {
|
|
141
|
+
errors.push({ level: 'error', nodeId: n.id, message: `Decision "${n.id}" has ${defaults.length} default branches.` });
|
|
142
|
+
}
|
|
143
|
+
if (out.length === 0) {
|
|
144
|
+
warnings.push({ level: 'warning', nodeId: n.id, message: `Decision "${n.id}" has no outgoing branches.` });
|
|
145
|
+
}
|
|
146
|
+
else if (defaults.length === 0 && out.every((e) => edgeCondString(e.condition))) {
|
|
147
|
+
warnings.push({ level: 'warning', nodeId: n.id, message: `Decision "${n.id}" has no default branch; it may dead-end when no condition matches.` });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Unreachable nodes (advisory) — BFS from the resolved entry.
|
|
151
|
+
if (startNodeId) {
|
|
152
|
+
const reachable = new Set([startNodeId]);
|
|
153
|
+
const queue = [startNodeId];
|
|
154
|
+
while (queue.length) {
|
|
155
|
+
const cur = queue.shift();
|
|
156
|
+
for (const e of edges) {
|
|
157
|
+
if (e.source === cur && idSet.has(e.target) && !reachable.has(e.target)) {
|
|
158
|
+
reachable.add(e.target);
|
|
159
|
+
queue.push(e.target);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
for (const n of nodes) {
|
|
164
|
+
if (!reachable.has(n.id)) {
|
|
165
|
+
warnings.push({ level: 'warning', nodeId: n.id, message: `Node "${n.id}" is unreachable from the entry.` });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// DAG-modulo-back-edges (ADR-0044): the engine requires the flow graph MINUS
|
|
170
|
+
// declared back-edges to be acyclic. A declared revise loop (its closing edge
|
|
171
|
+
// marked `type: 'back'`) is excluded and passes; any *unmarked* cycle is an
|
|
172
|
+
// error — the author must opt in, edge by edge, exactly as `registerFlow`
|
|
173
|
+
// enforces server-side.
|
|
174
|
+
const forwardEdges = edges.filter((e) => e.type !== 'back');
|
|
175
|
+
const cycle = findCycle(ids.filter((id) => !!id), forwardEdges);
|
|
176
|
+
if (cycle) {
|
|
177
|
+
errors.push({
|
|
178
|
+
level: 'error',
|
|
179
|
+
nodeId: cycle[0],
|
|
180
|
+
cycle,
|
|
181
|
+
message: `Cycle detected (${cycle.join(' → ')}). Mark the connection that closes the loop as a back-edge (Connection type → Back-edge) to declare an intentional revise/rework loop.`,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return { errors, warnings, startNodeId };
|
|
185
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FlowSimulator — a deterministic, backend-free interpreter that walks a flow
|
|
3
|
+
* draft for designer-time debugging. See `flow-sim-types.ts` for the contract.
|
|
4
|
+
*
|
|
5
|
+
* Supported faithfully: start, decision (edge-first CEL routing), the CRUD /
|
|
6
|
+
* get / http / connector / script(notification|code) side-effects (MOCKED), and
|
|
7
|
+
* end. `wait`, `screen`, and `approval` PAUSE for manual continuation (an approval
|
|
8
|
+
* resumes down the chosen decision's branch — approve / reject / revise). `loop` resolves its
|
|
9
|
+
* collection and exposes the iterator but is a labelled single pass (the edge
|
|
10
|
+
* model has no separate body/exit edge). `parallel_gateway` fans out WITHOUT
|
|
11
|
+
* join synchronization; the ADR-0031 structured containers (`parallel`,
|
|
12
|
+
* `try_catch` — nested body regions), `join_gateway`, `subflow` and
|
|
13
|
+
* `boundary_event` are marked unsupported rather than faked. A hard step
|
|
14
|
+
* ceiling guards cycles.
|
|
15
|
+
*/
|
|
16
|
+
import type { MockResults, SimEdge, SimNode, SimState, SimStep } from './flow-sim-types';
|
|
17
|
+
export declare class FlowSimulator {
|
|
18
|
+
private nodes;
|
|
19
|
+
private edges;
|
|
20
|
+
private mocks;
|
|
21
|
+
private seq;
|
|
22
|
+
state: SimState;
|
|
23
|
+
constructor(nodes: SimNode[], edges: SimEdge[]);
|
|
24
|
+
/** Validate + seed variables and queue the entry node. Returns the validation. */
|
|
25
|
+
reset(seedVariables?: Record<string, unknown>, mocks?: MockResults): import("./flow-sim-types").FlowValidation;
|
|
26
|
+
get done(): boolean;
|
|
27
|
+
/** Execute one queued node. Returns the recorded step, or null when idle. */
|
|
28
|
+
step(): SimStep | null;
|
|
29
|
+
/** Run to completion (or until a pause / error). */
|
|
30
|
+
runToEnd(): SimState;
|
|
31
|
+
/**
|
|
32
|
+
* Continue a flow paused on a `wait`, `screen`, or `approval` node.
|
|
33
|
+
* - `screenOutputs` — inputs captured from a paused screen.
|
|
34
|
+
* - `decision` — the branch an approval resumes down (ADR-0019/0044:
|
|
35
|
+
* `approve` / `reject` / `revise`). The run takes ONLY the out-edge whose
|
|
36
|
+
* label matches, mirroring how the engine resumes a suspended approval by
|
|
37
|
+
* branch label — instead of fanning out to every out-edge.
|
|
38
|
+
*/
|
|
39
|
+
resume(opts?: {
|
|
40
|
+
screenOutputs?: Record<string, unknown>;
|
|
41
|
+
decision?: string;
|
|
42
|
+
}): void;
|
|
43
|
+
/**
|
|
44
|
+
* Resume a suspended approval down the chosen decision's out-edge: the one
|
|
45
|
+
* whose `label` equals `decision` (case-insensitive — `approve` / `reject` /
|
|
46
|
+
* `revise`). With no match (or no decision) it falls back to fanning out —
|
|
47
|
+
* mirroring the engine's unmatched-`branchLabel` fallback — and logs that so
|
|
48
|
+
* the author notices the unrouted decision.
|
|
49
|
+
*/
|
|
50
|
+
private resumeApproval;
|
|
51
|
+
private execute;
|
|
52
|
+
private executeDecision;
|
|
53
|
+
/**
|
|
54
|
+
* assignment node — set flow variables. Normalizes the three authoring
|
|
55
|
+
* shapes the engine accepts (Studio's `{ assignments: { var: value } }`
|
|
56
|
+
* map, the example `{ assignments: [{ variable, value }] }` array, and the
|
|
57
|
+
* legacy flat `{ var: value }`) and interpolates `{var}` templates — so the
|
|
58
|
+
* Debug run mirrors runtime instead of silently no-oping.
|
|
59
|
+
*/
|
|
60
|
+
private executeAssignment;
|
|
61
|
+
/** Resolve `{var}` templates in an assignment value against live variables. */
|
|
62
|
+
private interpolateValue;
|
|
63
|
+
private executeLoop;
|
|
64
|
+
/** Resolve a `{var}` template ref or a plain variable name from `variables`. */
|
|
65
|
+
private resolveRef;
|
|
66
|
+
/** Apply a node's mock output to the simulation variables; returns what it wrote. */
|
|
67
|
+
private applyMock;
|
|
68
|
+
private mockNote;
|
|
69
|
+
/** Enqueue every outgoing target (linear nodes have one; parallel fans out). */
|
|
70
|
+
private enqueueSuccessors;
|
|
71
|
+
private traverse;
|
|
72
|
+
private record;
|
|
73
|
+
}
|