@manta-eu/react 0.12.0 → 0.13.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/README.md +59 -0
- package/dist/components/AppErrorBoundary.d.ts.map +1 -1
- package/dist/components/AppErrorBoundary.js +14 -11
- package/dist/components/AppErrorBoundary.js.map +1 -1
- package/dist/components/app-gate/AppGate.d.ts +8 -0
- package/dist/components/app-gate/AppGate.d.ts.map +1 -0
- package/dist/components/app-gate/AppGate.js +68 -0
- package/dist/components/app-gate/AppGate.js.map +1 -0
- package/dist/components/app-gate/AwaitingDatastoreStatus.d.ts +7 -0
- package/dist/components/app-gate/AwaitingDatastoreStatus.d.ts.map +1 -0
- package/dist/components/app-gate/AwaitingDatastoreStatus.js +19 -0
- package/dist/components/app-gate/AwaitingDatastoreStatus.js.map +1 -0
- package/dist/components/app-gate/EnterDatastoreRoute.d.ts +2 -0
- package/dist/components/app-gate/EnterDatastoreRoute.d.ts.map +1 -0
- package/dist/components/app-gate/EnterDatastoreRoute.js +25 -0
- package/dist/components/app-gate/EnterDatastoreRoute.js.map +1 -0
- package/dist/components/app-gate/ErrorRoute.d.ts +2 -0
- package/dist/components/app-gate/ErrorRoute.d.ts.map +1 -0
- package/dist/components/app-gate/ErrorRoute.js +27 -0
- package/dist/components/app-gate/ErrorRoute.js.map +1 -0
- package/dist/components/app-gate/FailureAlert.d.ts +5 -0
- package/dist/components/app-gate/FailureAlert.d.ts.map +1 -0
- package/dist/components/app-gate/FailureAlert.js +9 -0
- package/dist/components/app-gate/FailureAlert.js.map +1 -0
- package/dist/components/app-gate/NoDatastoreAccess.d.ts +8 -0
- package/dist/components/app-gate/NoDatastoreAccess.d.ts.map +1 -0
- package/dist/components/app-gate/NoDatastoreAccess.js +9 -0
- package/dist/components/app-gate/NoDatastoreAccess.js.map +1 -0
- package/dist/components/app-gate/NotFoundRoute.d.ts +2 -0
- package/dist/components/app-gate/NotFoundRoute.d.ts.map +1 -0
- package/dist/components/app-gate/NotFoundRoute.js +9 -0
- package/dist/components/app-gate/NotFoundRoute.js.map +1 -0
- package/dist/components/app-gate/PendingInvitations.d.ts +5 -0
- package/dist/components/app-gate/PendingInvitations.d.ts.map +1 -0
- package/dist/components/app-gate/PendingInvitations.js +58 -0
- package/dist/components/app-gate/PendingInvitations.js.map +1 -0
- package/dist/components/app-gate/ServiceError.d.ts +8 -0
- package/dist/components/app-gate/ServiceError.d.ts.map +1 -0
- package/dist/components/app-gate/ServiceError.js +10 -0
- package/dist/components/app-gate/ServiceError.js.map +1 -0
- package/dist/components/app-gate/index.d.ts +3 -0
- package/dist/components/app-gate/index.d.ts.map +1 -0
- package/dist/components/app-gate/index.js +3 -0
- package/dist/components/app-gate/index.js.map +1 -0
- package/dist/components/app-gate/sdk-route-elements.d.ts +23 -0
- package/dist/components/app-gate/sdk-route-elements.d.ts.map +1 -0
- package/dist/components/app-gate/sdk-route-elements.js +35 -0
- package/dist/components/app-gate/sdk-route-elements.js.map +1 -0
- package/dist/components/app-shell/AppShell.d.ts +7 -0
- package/dist/components/app-shell/AppShell.d.ts.map +1 -0
- package/dist/components/app-shell/AppShell.js +10 -0
- package/dist/components/app-shell/AppShell.js.map +1 -0
- package/dist/components/app-shell/AppShellRoutes.d.ts +9 -0
- package/dist/components/app-shell/AppShellRoutes.d.ts.map +1 -0
- package/dist/components/app-shell/AppShellRoutes.js +20 -0
- package/dist/components/app-shell/AppShellRoutes.js.map +1 -0
- package/dist/components/app-shell/GroupDatastores.d.ts +8 -0
- package/dist/components/app-shell/GroupDatastores.d.ts.map +1 -0
- package/dist/components/app-shell/GroupDatastores.js +15 -0
- package/dist/components/app-shell/GroupDatastores.js.map +1 -0
- package/dist/components/app-shell/GroupRoute.d.ts +2 -0
- package/dist/components/app-shell/GroupRoute.d.ts.map +1 -0
- package/dist/components/app-shell/GroupRoute.js +22 -0
- package/dist/components/app-shell/GroupRoute.js.map +1 -0
- package/dist/components/app-shell/index.d.ts +3 -0
- package/dist/components/app-shell/index.d.ts.map +1 -0
- package/dist/components/app-shell/index.js +3 -0
- package/dist/components/app-shell/index.js.map +1 -0
- package/dist/components/authenticated-chat/index.d.ts +1 -2
- package/dist/components/authenticated-chat/index.d.ts.map +1 -1
- package/dist/components/authenticated-chat/index.js +1 -12
- package/dist/components/authenticated-chat/index.js.map +1 -1
- package/dist/components/chat-view/Chat.d.ts +2 -1
- package/dist/components/chat-view/Chat.d.ts.map +1 -1
- package/dist/components/chat-view/Chat.js +3 -2
- package/dist/components/chat-view/Chat.js.map +1 -1
- package/dist/components/chat-view/MessageItem.d.ts.map +1 -1
- package/dist/components/chat-view/MessageItem.js +4 -2
- package/dist/components/chat-view/MessageItem.js.map +1 -1
- package/dist/components/chat-view/tool-part-rendering.d.ts +1 -0
- package/dist/components/chat-view/tool-part-rendering.d.ts.map +1 -1
- package/dist/components/chat-view/tool-part-rendering.js +8 -1
- package/dist/components/chat-view/tool-part-rendering.js.map +1 -1
- package/dist/components/chip/index.d.ts +1 -0
- package/dist/components/chip/index.d.ts.map +1 -1
- package/dist/components/chip/index.js +2 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/embedded-chat/index.d.ts +1 -1
- package/dist/components/embedded-chat/index.d.ts.map +1 -1
- package/dist/components/embedded-chat/index.js +1 -1
- package/dist/components/embedded-chat/index.js.map +1 -1
- package/dist/components/input/input-date-time.d.ts +6 -0
- package/dist/components/input/input-date-time.d.ts.map +1 -1
- package/dist/components/input/input-date-time.js +2 -1
- package/dist/components/input/input-date-time.js.map +1 -1
- package/dist/components/input/input-date.d.ts +22 -0
- package/dist/components/input/input-date.d.ts.map +1 -1
- package/dist/components/input/input-date.js +28 -14
- package/dist/components/input/input-date.js.map +1 -1
- package/dist/components/input/input-time.d.ts +9 -0
- package/dist/components/input/input-time.d.ts.map +1 -1
- package/dist/components/input/input-time.js +29 -18
- package/dist/components/input/input-time.js.map +1 -1
- package/dist/components/layouts/RouteLayout.d.ts +0 -9
- package/dist/components/layouts/RouteLayout.d.ts.map +1 -1
- package/dist/components/layouts/RouteLayout.js +7 -4
- package/dist/components/layouts/RouteLayout.js.map +1 -1
- package/dist/components/layouts/Sidebar.d.ts +1 -8
- package/dist/components/layouts/Sidebar.d.ts.map +1 -1
- package/dist/components/layouts/Sidebar.js +7 -14
- package/dist/components/layouts/Sidebar.js.map +1 -1
- package/dist/components/plan-limits/PlanLimitsDialog.d.ts +20 -0
- package/dist/components/plan-limits/PlanLimitsDialog.d.ts.map +1 -0
- package/dist/components/plan-limits/PlanLimitsDialog.js +109 -0
- package/dist/components/plan-limits/PlanLimitsDialog.js.map +1 -0
- package/dist/components/plan-limits/index.d.ts +4 -0
- package/dist/components/plan-limits/index.d.ts.map +1 -0
- package/dist/components/plan-limits/index.js +2 -0
- package/dist/components/plan-limits/index.js.map +1 -0
- package/dist/components/plan-limits/plan-limits-client.d.ts +15 -0
- package/dist/components/plan-limits/plan-limits-client.d.ts.map +1 -0
- package/dist/components/plan-limits/plan-limits-client.js +44 -0
- package/dist/components/plan-limits/plan-limits-client.js.map +1 -0
- package/dist/components/plan-limits/plan-limits-model.d.ts +66 -0
- package/dist/components/plan-limits/plan-limits-model.d.ts.map +1 -0
- package/dist/components/plan-limits/plan-limits-model.js +123 -0
- package/dist/components/plan-limits/plan-limits-model.js.map +1 -0
- package/dist/components/plan-limits/plan-limits-save.d.ts +31 -0
- package/dist/components/plan-limits/plan-limits-save.d.ts.map +1 -0
- package/dist/components/plan-limits/plan-limits-save.js +43 -0
- package/dist/components/plan-limits/plan-limits-save.js.map +1 -0
- package/dist/components/planning/PlanLimitsAction.d.ts +6 -0
- package/dist/components/planning/PlanLimitsAction.d.ts.map +1 -0
- package/dist/components/planning/PlanLimitsAction.js +19 -0
- package/dist/components/planning/PlanLimitsAction.js.map +1 -0
- package/dist/components/slider/index.d.ts.map +1 -1
- package/dist/components/slider/index.js +2 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/datastore-picker/datastore-picker-rows.d.ts +7 -0
- package/dist/datastore-picker/datastore-picker-rows.d.ts.map +1 -1
- package/dist/datastore-picker/datastore-picker-rows.js +26 -22
- package/dist/datastore-picker/datastore-picker-rows.js.map +1 -1
- package/dist/globals.css +85 -2
- package/dist/hooks/use-action-plans-list.d.ts +3 -0
- package/dist/hooks/use-action-plans-list.d.ts.map +1 -1
- package/dist/hooks/use-action-plans-list.js +8 -9
- package/dist/hooks/use-action-plans-list.js.map +1 -1
- package/dist/hooks/use-activity-feed.d.ts +10 -1
- package/dist/hooks/use-activity-feed.d.ts.map +1 -1
- package/dist/hooks/use-activity-feed.js +9 -11
- package/dist/hooks/use-activity-feed.js.map +1 -1
- package/dist/hooks/use-entity.d.ts +4 -3
- package/dist/hooks/use-entity.d.ts.map +1 -1
- package/dist/hooks/use-entity.js +4 -4
- package/dist/hooks/use-entity.js.map +1 -1
- package/dist/hooks/use-manual-actions.d.ts +1 -1
- package/dist/hooks/use-manual-actions.d.ts.map +1 -1
- package/dist/hooks/use-manual-actions.js +5 -5
- package/dist/hooks/use-manual-actions.js.map +1 -1
- package/dist/hooks/use-unsaved-changes-warning.d.ts +2 -0
- package/dist/hooks/use-unsaved-changes-warning.d.ts.map +1 -0
- package/dist/hooks/use-unsaved-changes-warning.js +13 -0
- package/dist/hooks/use-unsaved-changes-warning.js.map +1 -0
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +4 -3
- package/dist/hooks/useAuth.js.map +1 -1
- package/dist/hooks/useChatPanelSync.d.ts.map +1 -1
- package/dist/hooks/useChatPanelSync.js +2 -3
- package/dist/hooks/useChatPanelSync.js.map +1 -1
- package/dist/hooks/useDatastoreSelection.d.ts.map +1 -1
- package/dist/hooks/useDatastoreSelection.js +11 -4
- package/dist/hooks/useDatastoreSelection.js.map +1 -1
- package/dist/hooks/useExecuteAction.d.ts +1 -0
- package/dist/hooks/useExecuteAction.d.ts.map +1 -1
- package/dist/hooks/useExecuteAction.js.map +1 -1
- package/dist/hooks/useLoginRedirect.d.ts +6 -0
- package/dist/hooks/useLoginRedirect.d.ts.map +1 -0
- package/dist/hooks/useLoginRedirect.js +51 -0
- package/dist/hooks/useLoginRedirect.js.map +1 -0
- package/dist/hooks/usePlanLimits.d.ts +18 -0
- package/dist/hooks/usePlanLimits.d.ts.map +1 -0
- package/dist/hooks/usePlanLimits.js +56 -0
- package/dist/hooks/usePlanLimits.js.map +1 -0
- package/dist/ldo-ui.d.ts +1 -1
- package/dist/ldo-ui.d.ts.map +1 -1
- package/dist/ldo-ui.js.map +1 -1
- package/dist/lib/app-tools.d.ts +18 -0
- package/dist/lib/app-tools.d.ts.map +1 -0
- package/dist/lib/app-tools.js +42 -0
- package/dist/lib/app-tools.js.map +1 -0
- package/dist/lib/chat-types.d.ts +3 -0
- package/dist/lib/chat-types.d.ts.map +1 -1
- package/dist/lib/chat-types.js.map +1 -1
- package/dist/lib/datastore-route-table.d.ts +3 -0
- package/dist/lib/datastore-route-table.d.ts.map +1 -1
- package/dist/lib/datastore-route-table.js +6 -0
- package/dist/lib/datastore-route-table.js.map +1 -1
- package/dist/lib/graphql-error.d.ts +2 -0
- package/dist/lib/graphql-error.d.ts.map +1 -0
- package/dist/lib/graphql-error.js +7 -0
- package/dist/lib/graphql-error.js.map +1 -0
- package/dist/lib/update-notice.d.ts +2 -1
- package/dist/lib/update-notice.d.ts.map +1 -1
- package/dist/lib/update-notice.js +8 -2
- package/dist/lib/update-notice.js.map +1 -1
- package/dist/providers/ActiveChatProvider.d.ts +2 -0
- package/dist/providers/ActiveChatProvider.d.ts.map +1 -1
- package/dist/providers/ActiveChatProvider.js +6 -3
- package/dist/providers/ActiveChatProvider.js.map +1 -1
- package/dist/providers/ActiveDatastoreProvider.d.ts +12 -0
- package/dist/providers/ActiveDatastoreProvider.d.ts.map +1 -1
- package/dist/providers/ActiveDatastoreProvider.js +114 -11
- package/dist/providers/ActiveDatastoreProvider.js.map +1 -1
- package/dist/providers/AuthContext.d.ts +1 -0
- package/dist/providers/AuthContext.d.ts.map +1 -1
- package/dist/providers/AuthContext.js.map +1 -1
- package/dist/providers/MantaClientProvider.d.ts.map +1 -1
- package/dist/providers/MantaClientProvider.js +3 -3
- package/dist/providers/MantaClientProvider.js.map +1 -1
- package/dist/providers/index.d.ts +3 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +2 -2
- package/dist/providers/index.js.map +1 -1
- package/dist/routes/activity/detail/ActivityDetailRoute.d.ts.map +1 -1
- package/dist/routes/activity/detail/ActivityDetailRoute.js +1 -3
- package/dist/routes/activity/detail/ActivityDetailRoute.js.map +1 -1
- package/dist/routes/activity/index.d.ts.map +1 -1
- package/dist/routes/activity/index.js +1 -3
- package/dist/routes/activity/index.js.map +1 -1
- package/dist/routes/chat/index.d.ts +2 -21
- package/dist/routes/chat/index.d.ts.map +1 -1
- package/dist/routes/chat/index.js +4 -2
- package/dist/routes/chat/index.js.map +1 -1
- package/dist/routes/data-collection/index.d.ts.map +1 -1
- package/dist/routes/data-collection/index.js +1 -3
- package/dist/routes/data-collection/index.js.map +1 -1
- package/dist/routes/data-explorer/components/DataExplorerLayout.d.ts.map +1 -1
- package/dist/routes/data-explorer/components/DataExplorerLayout.js +1 -3
- package/dist/routes/data-explorer/components/DataExplorerLayout.js.map +1 -1
- package/dist/routes/data-explorer/components/class-detail/UsedByRules.js +2 -2
- package/dist/routes/data-explorer/components/class-detail/UsedByRules.js.map +1 -1
- package/dist/routes/datastores/index.d.ts.map +1 -1
- package/dist/routes/datastores/index.js +2 -2
- package/dist/routes/datastores/index.js.map +1 -1
- package/dist/routes/explain/index.d.ts.map +1 -1
- package/dist/routes/explain/index.js +1 -3
- package/dist/routes/explain/index.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/DashConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/DashConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/DashConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAdsConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAdsConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAdsConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleMerchantCenterConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/GoogleMerchantCenterConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/GoogleMerchantCenterConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.d.ts +0 -1
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.js +3 -2
- package/dist/routes/integrations/components/connect-forms/InferalCredentialConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/KlaviyoConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/KlaviyoConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/KlaviyoConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/MicrosoftAdsConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/MicrosoftAdsConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/MicrosoftAdsConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.d.ts +0 -1
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.js +4 -3
- package/dist/routes/integrations/components/connect-forms/OAuthSetupConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/TriplewhaleConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/TriplewhaleConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/TriplewhaleConnectForm.js.map +1 -1
- package/dist/routes/integrations/components/connect-forms/WoocommerceConnectForm.d.ts.map +1 -1
- package/dist/routes/integrations/components/connect-forms/WoocommerceConnectForm.js +0 -1
- package/dist/routes/integrations/components/connect-forms/WoocommerceConnectForm.js.map +1 -1
- package/dist/routes/integrations/types.d.ts +2 -1
- package/dist/routes/integrations/types.d.ts.map +1 -1
- package/dist/routes/integrations/types.js +16 -0
- package/dist/routes/integrations/types.js.map +1 -1
- package/dist/routes/memories/components/DateValueInput.d.ts +16 -0
- package/dist/routes/memories/components/DateValueInput.d.ts.map +1 -0
- package/dist/routes/memories/components/DateValueInput.js +35 -0
- package/dist/routes/memories/components/DateValueInput.js.map +1 -0
- package/dist/routes/memories/components/EntityValuePicker.d.ts +11 -0
- package/dist/routes/memories/components/EntityValuePicker.d.ts.map +1 -0
- package/dist/routes/memories/components/EntityValuePicker.js +61 -0
- package/dist/routes/memories/components/EntityValuePicker.js.map +1 -0
- package/dist/routes/memories/components/FieldLabel.d.ts +12 -0
- package/dist/routes/memories/components/FieldLabel.d.ts.map +1 -0
- package/dist/routes/memories/components/FieldLabel.js +12 -0
- package/dist/routes/memories/components/FieldLabel.js.map +1 -0
- package/dist/routes/memories/components/ImportanceSlider.d.ts +2 -0
- package/dist/routes/memories/components/ImportanceSlider.d.ts.map +1 -1
- package/dist/routes/memories/components/ImportanceSlider.js +4 -1
- package/dist/routes/memories/components/ImportanceSlider.js.map +1 -1
- package/dist/routes/memories/components/MemoriesFilters.d.ts +2 -2
- package/dist/routes/memories/components/MemoriesFilters.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoriesFilters.js.map +1 -1
- package/dist/routes/memories/components/MemoriesPanel.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoriesPanel.js +4 -0
- package/dist/routes/memories/components/MemoriesPanel.js.map +1 -1
- package/dist/routes/memories/components/MemoriesTabPanel.d.ts +2 -2
- package/dist/routes/memories/components/MemoriesTabPanel.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryActions.d.ts +2 -0
- package/dist/routes/memories/components/MemoryActions.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryActions.js +3 -3
- package/dist/routes/memories/components/MemoryActions.js.map +1 -1
- package/dist/routes/memories/components/MemoryFields.d.ts +15 -3
- package/dist/routes/memories/components/MemoryFields.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryFields.js +34 -5
- package/dist/routes/memories/components/MemoryFields.js.map +1 -1
- package/dist/routes/memories/components/MemoryFormDialog.d.ts +6 -3
- package/dist/routes/memories/components/MemoryFormDialog.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryFormDialog.js +105 -59
- package/dist/routes/memories/components/MemoryFormDialog.js.map +1 -1
- package/dist/routes/memories/components/MemoryPropertyFields.d.ts +10 -0
- package/dist/routes/memories/components/MemoryPropertyFields.d.ts.map +1 -0
- package/dist/routes/memories/components/MemoryPropertyFields.js +67 -0
- package/dist/routes/memories/components/MemoryPropertyFields.js.map +1 -0
- package/dist/routes/memories/components/RuleDraftDialog.d.ts +7 -0
- package/dist/routes/memories/components/RuleDraftDialog.d.ts.map +1 -0
- package/dist/routes/memories/components/RuleDraftDialog.js +20 -0
- package/dist/routes/memories/components/RuleDraftDialog.js.map +1 -0
- package/dist/routes/memories/components/SchemasTab.d.ts +17 -2
- package/dist/routes/memories/components/SchemasTab.d.ts.map +1 -1
- package/dist/routes/memories/components/SchemasTab.js +146 -28
- package/dist/routes/memories/components/SchemasTab.js.map +1 -1
- package/dist/routes/memories/components/badges.d.ts +7 -0
- package/dist/routes/memories/components/badges.d.ts.map +1 -1
- package/dist/routes/memories/components/badges.js +11 -3
- package/dist/routes/memories/components/badges.js.map +1 -1
- package/dist/routes/memories/hooks/useMemoryColumns.d.ts +4 -2
- package/dist/routes/memories/hooks/useMemoryColumns.d.ts.map +1 -1
- package/dist/routes/memories/hooks/useMemoryColumns.js +31 -15
- package/dist/routes/memories/hooks/useMemoryColumns.js.map +1 -1
- package/dist/routes/memories/index.d.ts +2 -1
- package/dist/routes/memories/index.d.ts.map +1 -1
- package/dist/routes/memories/index.js +72 -30
- package/dist/routes/memories/index.js.map +1 -1
- package/dist/routes/memories/memory-mutation-input.d.ts.map +1 -1
- package/dist/routes/memories/memory-mutation-input.js +5 -2
- package/dist/routes/memories/memory-mutation-input.js.map +1 -1
- package/dist/routes/memories/memory-property-values.d.ts +13 -0
- package/dist/routes/memories/memory-property-values.d.ts.map +1 -0
- package/dist/routes/memories/memory-property-values.js +40 -0
- package/dist/routes/memories/memory-property-values.js.map +1 -0
- package/dist/routes/memories/schemas/AllowedValuesField.d.ts +14 -0
- package/dist/routes/memories/schemas/AllowedValuesField.d.ts.map +1 -0
- package/dist/routes/memories/schemas/AllowedValuesField.js +64 -0
- package/dist/routes/memories/schemas/AllowedValuesField.js.map +1 -0
- package/dist/routes/memories/schemas/MemorySchemaPage.d.ts +127 -0
- package/dist/routes/memories/schemas/MemorySchemaPage.d.ts.map +1 -0
- package/dist/routes/memories/schemas/MemorySchemaPage.js +285 -0
- package/dist/routes/memories/schemas/MemorySchemaPage.js.map +1 -0
- package/dist/routes/memories/schemas/SchemaChangeReviewDialog.d.ts +20 -0
- package/dist/routes/memories/schemas/SchemaChangeReviewDialog.d.ts.map +1 -0
- package/dist/routes/memories/schemas/SchemaChangeReviewDialog.js +54 -0
- package/dist/routes/memories/schemas/SchemaChangeReviewDialog.js.map +1 -0
- package/dist/routes/memories/schemas/SchemaConfirmDialog.d.ts +15 -0
- package/dist/routes/memories/schemas/SchemaConfirmDialog.d.ts.map +1 -0
- package/dist/routes/memories/schemas/SchemaConfirmDialog.js +8 -0
- package/dist/routes/memories/schemas/SchemaConfirmDialog.js.map +1 -0
- package/dist/routes/memories/schemas/SchemaDetailPage.d.ts +15 -0
- package/dist/routes/memories/schemas/SchemaDetailPage.d.ts.map +1 -0
- package/dist/routes/memories/schemas/SchemaDetailPage.js +74 -0
- package/dist/routes/memories/schemas/SchemaDetailPage.js.map +1 -0
- package/dist/routes/memories/schemas/SchemaEditorForm.d.ts +10 -0
- package/dist/routes/memories/schemas/SchemaEditorForm.d.ts.map +1 -0
- package/dist/routes/memories/schemas/SchemaEditorForm.js +242 -0
- package/dist/routes/memories/schemas/SchemaEditorForm.js.map +1 -0
- package/dist/routes/memories/schemas/SchemaTemplatesDialog.d.ts +13 -0
- package/dist/routes/memories/schemas/SchemaTemplatesDialog.d.ts.map +1 -0
- package/dist/routes/memories/schemas/SchemaTemplatesDialog.js +13 -0
- package/dist/routes/memories/schemas/SchemaTemplatesDialog.js.map +1 -0
- package/dist/routes/memories/schemas/ValueTypeSelect.d.ts +12 -0
- package/dist/routes/memories/schemas/ValueTypeSelect.d.ts.map +1 -0
- package/dist/routes/memories/schemas/ValueTypeSelect.js +10 -0
- package/dist/routes/memories/schemas/ValueTypeSelect.js.map +1 -0
- package/dist/routes/memories/schemas/schema-form.d.ts +72 -0
- package/dist/routes/memories/schemas/schema-form.d.ts.map +1 -0
- package/dist/routes/memories/schemas/schema-form.js +279 -0
- package/dist/routes/memories/schemas/schema-form.js.map +1 -0
- package/dist/routes/memories/schemas/schema-impact.d.ts +13 -0
- package/dist/routes/memories/schemas/schema-impact.d.ts.map +1 -0
- package/dist/routes/memories/schemas/schema-impact.js +40 -0
- package/dist/routes/memories/schemas/schema-impact.js.map +1 -0
- package/dist/routes/memories/schemas/schema-route.d.ts +18 -0
- package/dist/routes/memories/schemas/schema-route.d.ts.map +1 -0
- package/dist/routes/memories/schemas/schema-route.js +21 -0
- package/dist/routes/memories/schemas/schema-route.js.map +1 -0
- package/dist/routes/memories/schemas/schema-rule-context.d.ts +17 -0
- package/dist/routes/memories/schemas/schema-rule-context.d.ts.map +1 -0
- package/dist/routes/memories/schemas/schema-rule-context.js +83 -0
- package/dist/routes/memories/schemas/schema-rule-context.js.map +1 -0
- package/dist/routes/memories/schemas/schema-table.d.ts +11 -0
- package/dist/routes/memories/schemas/schema-table.d.ts.map +1 -0
- package/dist/routes/memories/schemas/schema-table.js +34 -0
- package/dist/routes/memories/schemas/schema-table.js.map +1 -0
- package/dist/routes/memories/schemas/useMemorySchemaMutations.d.ts +32 -0
- package/dist/routes/memories/schemas/useMemorySchemaMutations.d.ts.map +1 -0
- package/dist/routes/memories/schemas/useMemorySchemaMutations.js +31 -0
- package/dist/routes/memories/schemas/useMemorySchemaMutations.js.map +1 -0
- package/dist/routes/memories/schemas/useSchemaChangeReview.d.ts +51 -0
- package/dist/routes/memories/schemas/useSchemaChangeReview.d.ts.map +1 -0
- package/dist/routes/memories/schemas/useSchemaChangeReview.js +175 -0
- package/dist/routes/memories/schemas/useSchemaChangeReview.js.map +1 -0
- package/dist/routes/memories/schemas/useSchemaLifecycle.d.ts +46 -0
- package/dist/routes/memories/schemas/useSchemaLifecycle.d.ts.map +1 -0
- package/dist/routes/memories/schemas/useSchemaLifecycle.js +93 -0
- package/dist/routes/memories/schemas/useSchemaLifecycle.js.map +1 -0
- package/dist/routes/memories/schemas/useSchemasTab.d.ts +18 -0
- package/dist/routes/memories/schemas/useSchemasTab.d.ts.map +1 -0
- package/dist/routes/memories/schemas/useSchemasTab.js +92 -0
- package/dist/routes/memories/schemas/useSchemasTab.js.map +1 -0
- package/dist/routes/plans/index.d.ts.map +1 -1
- package/dist/routes/plans/index.js +2 -2
- package/dist/routes/plans/index.js.map +1 -1
- package/dist/routes/rules/components/CreateRuleChatModal.d.ts +7 -1
- package/dist/routes/rules/components/CreateRuleChatModal.d.ts.map +1 -1
- package/dist/routes/rules/components/CreateRuleChatModal.js +9 -4
- package/dist/routes/rules/components/CreateRuleChatModal.js.map +1 -1
- package/dist/routes/rules/components/RuleValueControls.d.ts.map +1 -1
- package/dist/routes/rules/components/RuleValueControls.js +3 -24
- package/dist/routes/rules/components/RuleValueControls.js.map +1 -1
- package/dist/routes/rules/components/rule-value-input.d.ts +11 -0
- package/dist/routes/rules/components/rule-value-input.d.ts.map +1 -0
- package/dist/routes/rules/components/rule-value-input.js +24 -0
- package/dist/routes/rules/components/rule-value-input.js.map +1 -0
- package/dist/routes/rules/components/rules.utils.d.ts +5 -0
- package/dist/routes/rules/components/rules.utils.d.ts.map +1 -1
- package/dist/routes/rules/components/rules.utils.js +18 -3
- package/dist/routes/rules/components/rules.utils.js.map +1 -1
- package/dist/routes/rules/pages.d.ts +1 -1
- package/dist/routes/rules/pages.d.ts.map +1 -1
- package/dist/routes/rules/pages.js +1 -1
- package/dist/routes/rules/pages.js.map +1 -1
- package/dist/shared/graph-derived-queries.d.ts.map +1 -1
- package/dist/shared/graph-derived-queries.js +4 -1
- package/dist/shared/graph-derived-queries.js.map +1 -1
- package/dist/worker/index.d.ts +22 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +110 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/policy.d.ts +21 -0
- package/dist/worker/policy.d.ts.map +1 -0
- package/dist/worker/policy.js +42 -0
- package/dist/worker/policy.js.map +1 -0
- package/dist/worker/proxy.d.ts +14 -0
- package/dist/worker/proxy.d.ts.map +1 -0
- package/dist/worker/proxy.js +58 -0
- package/dist/worker/proxy.js.map +1 -0
- package/dist/worker/session.d.ts +24 -0
- package/dist/worker/session.d.ts.map +1 -0
- package/dist/worker/session.js +72 -0
- package/dist/worker/session.js.map +1 -0
- package/package.json +52 -7
- package/src/app-subpaths.json +9 -1
- package/src/components/AppErrorBoundary.tsx +14 -11
- package/src/components/app-gate/AppGate.tsx +122 -0
- package/src/components/app-gate/AwaitingDatastoreStatus.tsx +35 -0
- package/src/components/app-gate/EnterDatastoreRoute.tsx +30 -0
- package/src/components/app-gate/ErrorRoute.tsx +43 -0
- package/src/components/app-gate/FailureAlert.tsx +15 -0
- package/src/components/app-gate/NoDatastoreAccess.tsx +26 -0
- package/src/components/app-gate/NotFoundRoute.tsx +20 -0
- package/src/components/app-gate/PendingInvitations.tsx +134 -0
- package/src/components/app-gate/ServiceError.tsx +27 -0
- package/src/components/app-gate/index.ts +2 -0
- package/src/components/app-gate/sdk-route-elements.tsx +46 -0
- package/src/components/app-shell/AppShell.tsx +22 -0
- package/src/components/app-shell/AppShellRoutes.tsx +34 -0
- package/src/components/app-shell/GroupDatastores.tsx +28 -0
- package/src/components/app-shell/GroupRoute.tsx +34 -0
- package/src/components/app-shell/index.ts +2 -0
- package/src/components/authenticated-chat/index.tsx +1 -34
- package/src/components/chat-view/Chat.tsx +9 -3
- package/src/components/chat-view/MessageItem.tsx +10 -2
- package/src/components/chat-view/tool-part-rendering.ts +10 -1
- package/src/components/chip/index.tsx +8 -1
- package/src/components/embedded-chat/index.tsx +2 -1
- package/src/components/input/input-date-time.tsx +10 -3
- package/src/components/input/input-date.tsx +93 -21
- package/src/components/input/input-time.tsx +59 -26
- package/src/components/layouts/RouteLayout.tsx +11 -50
- package/src/components/layouts/Sidebar.tsx +21 -23
- package/src/components/plan-limits/PlanLimitsDialog.tsx +331 -0
- package/src/components/plan-limits/index.tsx +3 -0
- package/src/components/plan-limits/plan-limits-client.ts +71 -0
- package/src/components/plan-limits/plan-limits-model.ts +180 -0
- package/src/components/plan-limits/plan-limits-save.ts +68 -0
- package/src/components/planning/PlanLimitsAction.tsx +44 -0
- package/src/components/slider/index.tsx +2 -1
- package/src/datastore-picker/datastore-picker-rows.ts +36 -20
- package/src/hooks/use-action-plans-list.ts +20 -12
- package/src/hooks/use-activity-feed.ts +30 -14
- package/src/hooks/use-entity.ts +11 -6
- package/src/hooks/use-manual-actions.ts +11 -6
- package/src/hooks/use-unsaved-changes-warning.ts +12 -0
- package/src/hooks/useAuth.ts +5 -3
- package/src/hooks/useChatPanelSync.ts +2 -3
- package/src/hooks/useDatastoreSelection.ts +10 -4
- package/src/hooks/useExecuteAction.ts +2 -0
- package/src/hooks/useLoginRedirect.ts +66 -0
- package/src/hooks/usePlanLimits.ts +97 -0
- package/src/ldo-ui.ts +1 -0
- package/src/lib/app-tools.ts +63 -0
- package/src/lib/chat-types.ts +5 -0
- package/src/lib/datastore-route-table.ts +9 -0
- package/src/lib/graphql-error.ts +7 -0
- package/src/lib/update-notice.ts +12 -2
- package/src/providers/ActiveChatProvider.tsx +8 -3
- package/src/providers/ActiveDatastoreProvider.tsx +179 -9
- package/src/providers/AuthContext.ts +1 -0
- package/src/providers/MantaClientProvider.tsx +8 -3
- package/src/providers/index.tsx +7 -4
- package/src/routes/activity/detail/ActivityDetailRoute.tsx +1 -10
- package/src/routes/activity/index.tsx +1 -10
- package/src/routes/chat/index.tsx +11 -47
- package/src/routes/data-collection/index.tsx +1 -11
- package/src/routes/data-explorer/components/DataExplorerLayout.tsx +1 -11
- package/src/routes/data-explorer/components/class-detail/UsedByRules.tsx +2 -2
- package/src/routes/datastores/index.tsx +3 -9
- package/src/routes/explain/index.tsx +1 -11
- package/src/routes/integrations/components/connect-forms/DashConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/GoogleAdsConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/GoogleAnalyticsConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/GoogleMerchantCenterConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/InferalCredentialConnectForm.tsx +5 -3
- package/src/routes/integrations/components/connect-forms/KlaviyoConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/MicrosoftAdsConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/OAuthSetupConnectForm.tsx +7 -7
- package/src/routes/integrations/components/connect-forms/TriplewhaleConnectForm.tsx +0 -1
- package/src/routes/integrations/components/connect-forms/WoocommerceConnectForm.tsx +0 -1
- package/src/routes/integrations/types.ts +22 -6
- package/src/routes/memories/components/DateValueInput.tsx +72 -0
- package/src/routes/memories/components/EntityValuePicker.tsx +132 -0
- package/src/routes/memories/components/FieldLabel.tsx +49 -0
- package/src/routes/memories/components/ImportanceSlider.tsx +5 -1
- package/src/routes/memories/components/MemoriesFilters.tsx +2 -2
- package/src/routes/memories/components/MemoriesPanel.tsx +7 -3
- package/src/routes/memories/components/MemoriesTabPanel.tsx +2 -2
- package/src/routes/memories/components/MemoryActions.tsx +26 -2
- package/src/routes/memories/components/MemoryFields.tsx +75 -12
- package/src/routes/memories/components/MemoryFormDialog.tsx +305 -199
- package/src/routes/memories/components/MemoryPropertyFields.tsx +288 -0
- package/src/routes/memories/components/RuleDraftDialog.tsx +35 -0
- package/src/routes/memories/components/SchemasTab.tsx +481 -118
- package/src/routes/memories/components/badges.tsx +16 -4
- package/src/routes/memories/hooks/useMemoryColumns.tsx +69 -35
- package/src/routes/memories/index.tsx +125 -51
- package/src/routes/memories/memory-mutation-input.ts +5 -2
- package/src/routes/memories/memory-property-values.ts +83 -0
- package/src/routes/memories/schemas/AllowedValuesField.tsx +188 -0
- package/src/routes/memories/schemas/MemorySchemaPage.tsx +476 -0
- package/src/routes/memories/schemas/SchemaChangeReviewDialog.tsx +290 -0
- package/src/routes/memories/schemas/SchemaConfirmDialog.tsx +62 -0
- package/src/routes/memories/schemas/SchemaDetailPage.tsx +373 -0
- package/src/routes/memories/schemas/SchemaEditorForm.tsx +990 -0
- package/src/routes/memories/schemas/SchemaTemplatesDialog.tsx +81 -0
- package/src/routes/memories/schemas/ValueTypeSelect.tsx +37 -0
- package/src/routes/memories/schemas/schema-form.ts +360 -0
- package/src/routes/memories/schemas/schema-impact.ts +66 -0
- package/src/routes/memories/schemas/schema-route.ts +30 -0
- package/src/routes/memories/schemas/schema-rule-context.ts +103 -0
- package/src/routes/memories/schemas/schema-table.ts +54 -0
- package/src/routes/memories/schemas/useMemorySchemaMutations.ts +49 -0
- package/src/routes/memories/schemas/useSchemaChangeReview.ts +238 -0
- package/src/routes/memories/schemas/useSchemaLifecycle.tsx +151 -0
- package/src/routes/memories/schemas/useSchemasTab.ts +119 -0
- package/src/routes/plans/index.tsx +3 -14
- package/src/routes/rules/components/CreateRuleChatModal.tsx +46 -22
- package/src/routes/rules/components/RuleValueControls.tsx +3 -35
- package/src/routes/rules/components/rule-value-input.ts +34 -0
- package/src/routes/rules/components/rules.utils.ts +25 -3
- package/src/routes/rules/pages.ts +5 -1
- package/src/shared/graph-derived-queries.ts +6 -0
- package/src/themes/manta-dark.css +4 -0
- package/src/worker/index.ts +175 -0
- package/src/worker/policy.ts +62 -0
- package/src/worker/proxy.ts +101 -0
- package/src/worker/session.ts +111 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { GQLMemorySchemaTemplatesQuery } from "@manta-eu/client";
|
|
2
|
+
import { humanCount } from "@manta-eu/lib/humanize";
|
|
3
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
4
|
+
import { Banner } from "#components/banner/index";
|
|
5
|
+
import { Button } from "#components/button/index";
|
|
6
|
+
import { Loader } from "#components/loader/index";
|
|
7
|
+
import {
|
|
8
|
+
Dialog,
|
|
9
|
+
DialogContent,
|
|
10
|
+
DialogDescription,
|
|
11
|
+
DialogFooter,
|
|
12
|
+
DialogHeader,
|
|
13
|
+
DialogTitle,
|
|
14
|
+
} from "#components/modal/index";
|
|
15
|
+
|
|
16
|
+
export type MemorySchemaTemplate = GQLMemorySchemaTemplatesQuery["memorySchemaTemplates"]["templates"][number];
|
|
17
|
+
|
|
18
|
+
export type SchemaTemplatesDialogProps = {
|
|
19
|
+
open: boolean;
|
|
20
|
+
templates: readonly MemorySchemaTemplate[];
|
|
21
|
+
isLoading: boolean;
|
|
22
|
+
errorMessage?: string | null;
|
|
23
|
+
addingIri: string | null;
|
|
24
|
+
onAdd: (templateIri: string) => void;
|
|
25
|
+
onClose: () => void;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function SchemaTemplatesDialog(props: SchemaTemplatesDialogProps) {
|
|
29
|
+
const { open, templates, isLoading, errorMessage, addingIri, onAdd, onClose } = props;
|
|
30
|
+
const available = templates.filter((template) => !template.live);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Dialog open={open} onOpenChange={(next) => !next && onClose()}>
|
|
34
|
+
<DialogContent className="flex flex-col overflow-hidden">
|
|
35
|
+
<DialogHeader>
|
|
36
|
+
<DialogTitle text="Restore a default schema" />
|
|
37
|
+
<DialogDescription>
|
|
38
|
+
Manta ships these schemas. Restoring one gives this datastore its own copy to edit again.
|
|
39
|
+
</DialogDescription>
|
|
40
|
+
</DialogHeader>
|
|
41
|
+
<div className="-mx-8 flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-8 py-1">
|
|
42
|
+
{errorMessage && <Banner label={errorMessage} className="shrink-0" />}
|
|
43
|
+
{isLoading ? (
|
|
44
|
+
<div className="flex justify-center py-6">
|
|
45
|
+
<Loader className="size-6" />
|
|
46
|
+
</div>
|
|
47
|
+
) : isPresent(available) ? (
|
|
48
|
+
available.map(({ schema }) => (
|
|
49
|
+
<div key={schema.iri} className="flex items-center gap-3 rounded-lg border border-muted-border p-3">
|
|
50
|
+
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
51
|
+
<span className="truncate typography-small-medium">{schema.label}</span>
|
|
52
|
+
<span className="typography-tiny text-muted-foreground">
|
|
53
|
+
{schema.description ?? humanCount(schema.properties.length, "property")}
|
|
54
|
+
</span>
|
|
55
|
+
</div>
|
|
56
|
+
<Button
|
|
57
|
+
size="sm"
|
|
58
|
+
variant="secondary"
|
|
59
|
+
disabled={addingIri !== null}
|
|
60
|
+
aria-label={`Restore ${schema.label}`}
|
|
61
|
+
onClick={() => onAdd(schema.iri)}
|
|
62
|
+
>
|
|
63
|
+
{addingIri === schema.iri ? "Restoring…" : "Restore"}
|
|
64
|
+
</Button>
|
|
65
|
+
</div>
|
|
66
|
+
))
|
|
67
|
+
) : (
|
|
68
|
+
<p className="py-4 typography-small text-muted-foreground">
|
|
69
|
+
Every default schema is already in this datastore.
|
|
70
|
+
</p>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
<DialogFooter>
|
|
74
|
+
<Button variant="tertiary" onClick={onClose}>
|
|
75
|
+
Close
|
|
76
|
+
</Button>
|
|
77
|
+
</DialogFooter>
|
|
78
|
+
</DialogContent>
|
|
79
|
+
</Dialog>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { GQLMemorySchemaValueType } from "@manta-eu/client";
|
|
2
|
+
import { valueTypeLabels } from "./schema-form";
|
|
3
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "#components/select/index";
|
|
4
|
+
|
|
5
|
+
const valueTypes = Object.values(GQLMemorySchemaValueType);
|
|
6
|
+
|
|
7
|
+
export type ValueTypeSelectProps = {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
value: GQLMemorySchemaValueType;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
error?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
onChange: (valueType: GQLMemorySchemaValueType) => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function ValueTypeSelect(props: ValueTypeSelectProps) {
|
|
18
|
+
const { id, label, value, disabled, error, className, onChange } = props;
|
|
19
|
+
return (
|
|
20
|
+
<Select
|
|
21
|
+
value={value}
|
|
22
|
+
disabled={disabled}
|
|
23
|
+
onValueChange={(next) => onChange(valueTypes.find((type) => type === next) ?? value)}
|
|
24
|
+
>
|
|
25
|
+
<SelectTrigger label={label} id={id} hiddenLabel error={error} className={className}>
|
|
26
|
+
<SelectValue />
|
|
27
|
+
</SelectTrigger>
|
|
28
|
+
<SelectContent>
|
|
29
|
+
{valueTypes.map((type) => (
|
|
30
|
+
<SelectItem key={type} value={type}>
|
|
31
|
+
{valueTypeLabels[type]}
|
|
32
|
+
</SelectItem>
|
|
33
|
+
))}
|
|
34
|
+
</SelectContent>
|
|
35
|
+
</Select>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GQLMemoryKind,
|
|
3
|
+
GQLMemorySchemaValueType,
|
|
4
|
+
GQLMemoryScope,
|
|
5
|
+
GQLMemoryVolatility,
|
|
6
|
+
type GQLMemorySchemaFieldsFragment,
|
|
7
|
+
type GQLMemorySchemaDefinitionInput,
|
|
8
|
+
type GQLMemorySchemaPropertyDefinitionInput,
|
|
9
|
+
type GQLMemorySchemaValidationError,
|
|
10
|
+
} from "@manta-eu/client";
|
|
11
|
+
import { memorySchemaLimits } from "@manta-eu/client/shared/memory-schema-limits";
|
|
12
|
+
import {
|
|
13
|
+
checkMemorySchemaProperty,
|
|
14
|
+
deriveMemoryPropertyKey,
|
|
15
|
+
memoryPropertyKeyProblem,
|
|
16
|
+
} from "@manta-eu/client/shared/memory-schema-property";
|
|
17
|
+
import {
|
|
18
|
+
memorySchemaValueTypes,
|
|
19
|
+
parseMemoryValue,
|
|
20
|
+
type CompileMemoryValuePattern,
|
|
21
|
+
} from "@manta-eu/client/shared/memory-schema-values";
|
|
22
|
+
import { humanCount } from "@manta-eu/lib/humanize";
|
|
23
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
24
|
+
|
|
25
|
+
let compilePattern: CompileMemoryValuePattern | null = null;
|
|
26
|
+
|
|
27
|
+
// RE2 is large, so it loads with the schema editor rather than with the app. Until it has, only the server checks a
|
|
28
|
+
// pattern, and it does so again on every save anyway.
|
|
29
|
+
export async function loadPatternCheck(): Promise<void> {
|
|
30
|
+
compilePattern ??= (await import("@manta-eu/client/shared/memory-schema-pattern")).compileMemoryValuePattern;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const memorySchemaPropertyLimit = memorySchemaLimits.properties;
|
|
34
|
+
export const memorySchemaOptionLimit = memorySchemaLimits.options;
|
|
35
|
+
|
|
36
|
+
export type SchemaOptionForm = { id: string; value: string; label: string; description: string };
|
|
37
|
+
|
|
38
|
+
export type SchemaPropertyForm = {
|
|
39
|
+
id: string;
|
|
40
|
+
path: string | null;
|
|
41
|
+
key: string;
|
|
42
|
+
label: string;
|
|
43
|
+
description: string;
|
|
44
|
+
valueType: GQLMemorySchemaValueType;
|
|
45
|
+
entityClass: string;
|
|
46
|
+
required: boolean;
|
|
47
|
+
multiValued: boolean;
|
|
48
|
+
keyProperty: boolean;
|
|
49
|
+
computed: boolean;
|
|
50
|
+
options: SchemaOptionForm[];
|
|
51
|
+
minValue: string;
|
|
52
|
+
maxValue: string;
|
|
53
|
+
maxLength: string;
|
|
54
|
+
pattern: string;
|
|
55
|
+
defaultValue: string;
|
|
56
|
+
unit: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type SchemaForm = {
|
|
60
|
+
key: string;
|
|
61
|
+
label: string;
|
|
62
|
+
description: string;
|
|
63
|
+
defaultMemoryKind: GQLMemoryKind | null;
|
|
64
|
+
defaultVolatility: GQLMemoryVolatility | null;
|
|
65
|
+
defaultImportance: number | null;
|
|
66
|
+
defaultScope: GQLMemoryScope | null;
|
|
67
|
+
extractionEnabled: boolean;
|
|
68
|
+
extractionGuidance: string;
|
|
69
|
+
properties: SchemaPropertyForm[];
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const kindLabels: Record<GQLMemoryKind, string> = {
|
|
73
|
+
[GQLMemoryKind.Fact]: "Fact",
|
|
74
|
+
[GQLMemoryKind.Preference]: "Preference",
|
|
75
|
+
[GQLMemoryKind.Objective]: "Objective",
|
|
76
|
+
[GQLMemoryKind.Context]: "Context",
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const volatilityLabels: Record<GQLMemoryVolatility, string> = {
|
|
80
|
+
[GQLMemoryVolatility.Stable]: "Stable",
|
|
81
|
+
[GQLMemoryVolatility.Slow]: "Changes slowly",
|
|
82
|
+
[GQLMemoryVolatility.Volatile]: "Changes often",
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const scopeLabels: Record<GQLMemoryScope, string> = {
|
|
86
|
+
[GQLMemoryScope.User]: "Personal",
|
|
87
|
+
[GQLMemoryScope.Team]: "Team",
|
|
88
|
+
[GQLMemoryScope.Company]: "Company",
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const valueTypeLabels: Record<GQLMemorySchemaValueType, string> = {
|
|
92
|
+
[GQLMemorySchemaValueType.Text]: "Text",
|
|
93
|
+
[GQLMemorySchemaValueType.LongText]: "Long text",
|
|
94
|
+
[GQLMemorySchemaValueType.Integer]: "Whole number",
|
|
95
|
+
[GQLMemorySchemaValueType.Decimal]: "Decimal number",
|
|
96
|
+
[GQLMemorySchemaValueType.Boolean]: "Yes / no",
|
|
97
|
+
[GQLMemorySchemaValueType.Date]: "Date",
|
|
98
|
+
[GQLMemorySchemaValueType.DateTime]: "Date and time",
|
|
99
|
+
[GQLMemorySchemaValueType.Url]: "Web address",
|
|
100
|
+
[GQLMemorySchemaValueType.Entity]: "Linked record",
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const boundTypes: readonly GQLMemorySchemaValueType[] = [
|
|
104
|
+
GQLMemorySchemaValueType.Integer,
|
|
105
|
+
GQLMemorySchemaValueType.Decimal,
|
|
106
|
+
GQLMemorySchemaValueType.Date,
|
|
107
|
+
GQLMemorySchemaValueType.DateTime,
|
|
108
|
+
];
|
|
109
|
+
const textTypes: readonly GQLMemorySchemaValueType[] = [
|
|
110
|
+
GQLMemorySchemaValueType.Text,
|
|
111
|
+
GQLMemorySchemaValueType.LongText,
|
|
112
|
+
];
|
|
113
|
+
const numberTypes: readonly GQLMemorySchemaValueType[] = [
|
|
114
|
+
GQLMemorySchemaValueType.Integer,
|
|
115
|
+
GQLMemorySchemaValueType.Decimal,
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
// Mirrors which settings the server accepts per type, so switching type never sends one it would refuse.
|
|
119
|
+
export function propertySettings(valueType: GQLMemorySchemaValueType) {
|
|
120
|
+
return {
|
|
121
|
+
options: valueType === GQLMemorySchemaValueType.Text,
|
|
122
|
+
bounds: boundTypes.includes(valueType),
|
|
123
|
+
maxLength: [...textTypes, GQLMemorySchemaValueType.Url].includes(valueType),
|
|
124
|
+
pattern: textTypes.includes(valueType),
|
|
125
|
+
unit: numberTypes.includes(valueType),
|
|
126
|
+
entityClass: valueType === GQLMemorySchemaValueType.Entity,
|
|
127
|
+
keyProperty: valueType !== GQLMemorySchemaValueType.LongText,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Only what the save keeps for this type, so a setting left behind by a type switch is not shown as in effect.
|
|
132
|
+
export function propertyTags(property: SchemaPropertyForm): string[] {
|
|
133
|
+
const settings = propertySettings(property.valueType);
|
|
134
|
+
return [
|
|
135
|
+
property.computed ? "Computed" : property.required ? "Required" : "",
|
|
136
|
+
property.multiValued ? "List" : "",
|
|
137
|
+
settings.keyProperty && property.keyProperty && !property.multiValued && !property.computed ? "Identifies" : "",
|
|
138
|
+
settings.unit ? property.unit.trim() : "",
|
|
139
|
+
settings.options && isPresent(property.options) ? humanCount(property.options.length, "allowed value") : "",
|
|
140
|
+
].filter(isPresent);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function withValueType(property: SchemaPropertyForm, valueType: GQLMemorySchemaValueType): SchemaPropertyForm {
|
|
144
|
+
const type = memorySchemaValueTypes.find((candidate) => candidate === valueType);
|
|
145
|
+
const kept = (raw: string) => (type !== undefined && parseMemoryValue(type, raw) !== null ? raw : "");
|
|
146
|
+
return {
|
|
147
|
+
...property,
|
|
148
|
+
valueType,
|
|
149
|
+
minValue: kept(property.minValue),
|
|
150
|
+
maxValue: kept(property.maxValue),
|
|
151
|
+
defaultValue: kept(property.defaultValue),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function newFormId(): string {
|
|
156
|
+
return crypto.randomUUID();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function emptyPropertyForm(): SchemaPropertyForm {
|
|
160
|
+
return {
|
|
161
|
+
id: newFormId(),
|
|
162
|
+
path: null,
|
|
163
|
+
key: "",
|
|
164
|
+
label: "",
|
|
165
|
+
description: "",
|
|
166
|
+
valueType: GQLMemorySchemaValueType.Text,
|
|
167
|
+
entityClass: "",
|
|
168
|
+
required: false,
|
|
169
|
+
multiValued: false,
|
|
170
|
+
keyProperty: false,
|
|
171
|
+
computed: false,
|
|
172
|
+
options: [],
|
|
173
|
+
minValue: "",
|
|
174
|
+
maxValue: "",
|
|
175
|
+
maxLength: "",
|
|
176
|
+
pattern: "",
|
|
177
|
+
defaultValue: "",
|
|
178
|
+
unit: "",
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function emptySchemaForm(): SchemaForm {
|
|
183
|
+
return {
|
|
184
|
+
key: "",
|
|
185
|
+
label: "",
|
|
186
|
+
description: "",
|
|
187
|
+
defaultMemoryKind: null,
|
|
188
|
+
defaultVolatility: null,
|
|
189
|
+
defaultImportance: null,
|
|
190
|
+
defaultScope: null,
|
|
191
|
+
extractionEnabled: true,
|
|
192
|
+
extractionGuidance: "",
|
|
193
|
+
properties: [],
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function schemaFormFromSchema(schema: GQLMemorySchemaFieldsFragment): SchemaForm {
|
|
198
|
+
return {
|
|
199
|
+
key: "",
|
|
200
|
+
label: schema.label,
|
|
201
|
+
description: schema.description ?? "",
|
|
202
|
+
defaultMemoryKind: schema.defaultMemoryKind ?? null,
|
|
203
|
+
defaultVolatility: schema.defaultVolatility ?? null,
|
|
204
|
+
defaultImportance: schema.defaultImportance ?? null,
|
|
205
|
+
defaultScope: schema.defaultScope ?? null,
|
|
206
|
+
extractionEnabled: schema.extractionEnabled,
|
|
207
|
+
extractionGuidance: schema.extractionGuidance ?? "",
|
|
208
|
+
properties: [...schema.properties]
|
|
209
|
+
.sort((a, b) => a.order - b.order)
|
|
210
|
+
.map((property) => ({
|
|
211
|
+
id: newFormId(),
|
|
212
|
+
path: property.path,
|
|
213
|
+
key: "",
|
|
214
|
+
label: property.label,
|
|
215
|
+
description: property.description ?? "",
|
|
216
|
+
valueType: property.valueType,
|
|
217
|
+
entityClass: property.entityClass ?? "",
|
|
218
|
+
required: property.required,
|
|
219
|
+
multiValued: property.multiValued,
|
|
220
|
+
keyProperty: property.keyProperty,
|
|
221
|
+
computed: property.computed,
|
|
222
|
+
options: property.options.map((option) => ({
|
|
223
|
+
id: newFormId(),
|
|
224
|
+
value: option.value,
|
|
225
|
+
label: option.label ?? "",
|
|
226
|
+
description: option.description ?? "",
|
|
227
|
+
})),
|
|
228
|
+
minValue: property.minValue ?? "",
|
|
229
|
+
maxValue: property.maxValue ?? "",
|
|
230
|
+
maxLength: property.maxLength != null ? String(property.maxLength) : "",
|
|
231
|
+
pattern: property.pattern ?? "",
|
|
232
|
+
defaultValue: property.defaultValue ?? "",
|
|
233
|
+
unit: property.unit ?? "",
|
|
234
|
+
})),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function textOrNull(value: string): string | null {
|
|
239
|
+
const trimmed = value.trim();
|
|
240
|
+
return isPresent(trimmed) ? trimmed : null;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function maxLengthOrNull(value: string): number | null {
|
|
244
|
+
const trimmed = value.trim();
|
|
245
|
+
return isPresent(trimmed) && /^\d+$/.test(trimmed) ? Number(trimmed) : null;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function propertyInput(property: SchemaPropertyForm): GQLMemorySchemaPropertyDefinitionInput {
|
|
249
|
+
const settings = propertySettings(property.valueType);
|
|
250
|
+
const key = textOrNull(property.key);
|
|
251
|
+
return {
|
|
252
|
+
...(property.path !== null ? { path: property.path } : key !== null ? { key } : {}),
|
|
253
|
+
label: property.label.trim(),
|
|
254
|
+
description: textOrNull(property.description),
|
|
255
|
+
valueType: property.valueType,
|
|
256
|
+
entityClass: settings.entityClass ? textOrNull(property.entityClass) : null,
|
|
257
|
+
required: property.required && !property.computed,
|
|
258
|
+
multiValued: property.multiValued,
|
|
259
|
+
keyProperty: settings.keyProperty && property.keyProperty && !property.multiValued && !property.computed,
|
|
260
|
+
computed: property.computed,
|
|
261
|
+
options: settings.options
|
|
262
|
+
? property.options.map((option) => ({
|
|
263
|
+
value: option.value.trim(),
|
|
264
|
+
label: textOrNull(option.label),
|
|
265
|
+
description: textOrNull(option.description),
|
|
266
|
+
}))
|
|
267
|
+
: [],
|
|
268
|
+
minValue: settings.bounds ? textOrNull(property.minValue) : null,
|
|
269
|
+
maxValue: settings.bounds ? textOrNull(property.maxValue) : null,
|
|
270
|
+
maxLength: settings.maxLength ? maxLengthOrNull(property.maxLength) : null,
|
|
271
|
+
pattern: settings.pattern ? textOrNull(property.pattern) : null,
|
|
272
|
+
defaultValue: property.computed ? null : textOrNull(property.defaultValue),
|
|
273
|
+
unit: settings.unit ? textOrNull(property.unit) : null,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export function schemaDefinitionInput(form: SchemaForm, options: { isNew: boolean }): GQLMemorySchemaDefinitionInput {
|
|
278
|
+
const key = textOrNull(form.key);
|
|
279
|
+
return {
|
|
280
|
+
...(options.isNew && key !== null ? { key } : {}),
|
|
281
|
+
label: form.label.trim(),
|
|
282
|
+
description: textOrNull(form.description),
|
|
283
|
+
defaultMemoryKind: form.defaultMemoryKind,
|
|
284
|
+
defaultVolatility: form.defaultVolatility,
|
|
285
|
+
defaultImportance: form.defaultImportance,
|
|
286
|
+
defaultScope: form.defaultScope,
|
|
287
|
+
extractionEnabled: form.extractionEnabled,
|
|
288
|
+
extractionGuidance: form.extractionEnabled ? textOrNull(form.extractionGuidance) : null,
|
|
289
|
+
properties: form.properties.map(propertyInput),
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export type SchemaFormErrors = ReadonlyMap<string, string>;
|
|
294
|
+
|
|
295
|
+
export function propertyFormErrors(
|
|
296
|
+
property: SchemaPropertyForm,
|
|
297
|
+
prefix: string,
|
|
298
|
+
siblings: readonly SchemaPropertyForm[] = [],
|
|
299
|
+
): Map<string, string> {
|
|
300
|
+
const errors = new Map<string, string>();
|
|
301
|
+
function add(field: string, message: string) {
|
|
302
|
+
if (!errors.has(field)) errors.set(field, message);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const maxLength = property.maxLength.trim();
|
|
306
|
+
if (propertySettings(property.valueType).maxLength && isPresent(maxLength) && !/^\d+$/.test(maxLength)) {
|
|
307
|
+
add(`${prefix}.maxLength`, "The maximum length must be a whole number");
|
|
308
|
+
}
|
|
309
|
+
for (const error of checkMemorySchemaProperty(propertyInput(property), prefix, compilePattern).errors)
|
|
310
|
+
add(error.field, error.message);
|
|
311
|
+
|
|
312
|
+
const label = property.label.trim();
|
|
313
|
+
const key = textOrNull(property.key);
|
|
314
|
+
if (property.path === null && (key !== null || isPresent(label))) {
|
|
315
|
+
const problem = memoryPropertyKeyProblem(key ?? deriveMemoryPropertyKey(label));
|
|
316
|
+
if (problem !== null) add(`${prefix}.key`, problem);
|
|
317
|
+
}
|
|
318
|
+
if (isPresent(label)) {
|
|
319
|
+
const clash = siblings.find(
|
|
320
|
+
(other) => other.id !== property.id && other.label.trim().toLowerCase() === label.toLowerCase(),
|
|
321
|
+
);
|
|
322
|
+
if (clash !== undefined) add(`${prefix}.label`, "Another property already uses this label");
|
|
323
|
+
}
|
|
324
|
+
return errors;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export function localSchemaFormErrors(form: SchemaForm): SchemaFormErrors {
|
|
328
|
+
const errors = new Map<string, string>();
|
|
329
|
+
form.properties.forEach((property, index) => {
|
|
330
|
+
for (const [field, message] of propertyFormErrors(property, propertyErrorPrefix(index), form.properties)) {
|
|
331
|
+
errors.set(field, message);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
return errors;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// The server names a field by its place in the submitted definition, e.g. `properties.2.options.0.value`.
|
|
338
|
+
export function schemaFormErrors(errors: readonly GQLMemorySchemaValidationError[]): SchemaFormErrors {
|
|
339
|
+
const byField = new Map<string, string>();
|
|
340
|
+
for (const { field, message } of errors) {
|
|
341
|
+
if (!byField.has(field)) byField.set(field, message);
|
|
342
|
+
}
|
|
343
|
+
return byField;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export function propertyErrorPrefix(index: number): string {
|
|
347
|
+
return `properties.${index}`;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export function hasErrorsUnder(errors: SchemaFormErrors, prefix: string): boolean {
|
|
351
|
+
return [...errors.keys()].some((field) => field === prefix || field.startsWith(`${prefix}.`));
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export function moveItem<T>(items: readonly T[], from: number, to: number): T[] {
|
|
355
|
+
if (to < 0 || to >= items.length || from === to) return [...items];
|
|
356
|
+
const next = [...items];
|
|
357
|
+
const [moved] = next.splice(from, 1);
|
|
358
|
+
if (moved !== undefined) next.splice(to, 0, moved);
|
|
359
|
+
return next;
|
|
360
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
GQLMemorySchemaFieldsFragment,
|
|
3
|
+
GQLMemorySchemaMutationResultFragment,
|
|
4
|
+
GQLMemorySchemaOptionRemapInput,
|
|
5
|
+
} from "@manta-eu/client";
|
|
6
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
7
|
+
import { getRuleDisplayName } from "#routes/rules/components/rules.utils";
|
|
8
|
+
|
|
9
|
+
export type MemorySchemaImpact = NonNullable<GQLMemorySchemaMutationResultFragment["impact"]>;
|
|
10
|
+
|
|
11
|
+
export type RemovedOptionInUse = MemorySchemaImpact["removedOptions"][number];
|
|
12
|
+
|
|
13
|
+
export type OptionRemapChoices = Record<string, string>;
|
|
14
|
+
|
|
15
|
+
export const clearValueChoice = "__clear__";
|
|
16
|
+
|
|
17
|
+
// Longest IRI first, so a rule IRI that is a prefix of another never rewrites part of the longer one.
|
|
18
|
+
export function readableBlockers(impact: Pick<MemorySchemaImpact, "blockers" | "ruleReferences">): string[] {
|
|
19
|
+
const ruleIris = [...new Set(impact.ruleReferences.map((reference) => reference.ruleIri))].sort(
|
|
20
|
+
(a, b) => b.length - a.length,
|
|
21
|
+
);
|
|
22
|
+
return impact.blockers.map((blocker) =>
|
|
23
|
+
ruleIris.reduce((text, ruleIri) => text.split(ruleIri).join(getRuleDisplayName(ruleIri)), blocker),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function remapChoiceKey(option: Pick<RemovedOptionInUse, "path" | "value">): string {
|
|
28
|
+
return `${option.path}\u0000${option.value}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// A change that moves no stored value and names no rule can be saved without a review step.
|
|
32
|
+
export function impactNeedsReview(impact: MemorySchemaImpact): boolean {
|
|
33
|
+
return (
|
|
34
|
+
isPresent(impact.blockers) ||
|
|
35
|
+
isPresent(impact.ruleReferences) ||
|
|
36
|
+
impact.removedProperties.some((property) => property.memoryCount > 0) ||
|
|
37
|
+
impact.typeChanges.some((change) => change.valueCount > 0) ||
|
|
38
|
+
impact.removedOptions.some((option) => option.memoryCount > 0) ||
|
|
39
|
+
isPresent(impact.limitViolations) ||
|
|
40
|
+
isPresent(impact.multiValueConflicts) ||
|
|
41
|
+
impact.clearedValues.some((property) => property.memoryCount > 0)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function removedOptionsInUse(impact: MemorySchemaImpact): RemovedOptionInUse[] {
|
|
46
|
+
return impact.removedOptions.filter((option) => option.memoryCount > 0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function remapTargets(proposed: GQLMemorySchemaFieldsFragment | null | undefined, path: string): string[] {
|
|
50
|
+
return proposed?.properties.find((property) => property.path === path)?.allowedValues ?? [];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function optionRemapsInput(
|
|
54
|
+
impact: MemorySchemaImpact,
|
|
55
|
+
choices: OptionRemapChoices,
|
|
56
|
+
): GQLMemorySchemaOptionRemapInput[] {
|
|
57
|
+
return removedOptionsInUse(impact).flatMap((option) => {
|
|
58
|
+
const choice = choices[remapChoiceKey(option)];
|
|
59
|
+
if (choice === undefined) return [];
|
|
60
|
+
return [{ path: option.path, from: option.value, to: choice === clearValueChoice ? null : choice }];
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function hasInvalidValues(impact: MemorySchemaImpact): boolean {
|
|
65
|
+
return impact.typeChanges.some((change) => change.unconvertibleCount > 0) || isPresent(impact.limitViolations);
|
|
66
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const memorySchemasPath = "/memories?tab=schemas";
|
|
2
|
+
export const newMemorySchemaPath = "/memories/schemas/new";
|
|
3
|
+
|
|
4
|
+
// The whole IRI names the page: IRIs are opaque, so no part of one is a name to route by.
|
|
5
|
+
export function memorySchemaPath(iri: string): string {
|
|
6
|
+
return `/memories/schemas/${encodeURIComponent(iri)}`;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function memorySchemaEditPath(iri: string): string {
|
|
10
|
+
return `${memorySchemaPath(iri)}/edit`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function findMemorySchemaByRouteName<T extends { iri: string }>(
|
|
14
|
+
schemas: readonly T[],
|
|
15
|
+
routeName: string,
|
|
16
|
+
): T | null {
|
|
17
|
+
return schemas.find((schema) => schema.iri === routeName) ?? null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type MemorySchemaView =
|
|
21
|
+
| { kind: "new" }
|
|
22
|
+
| { kind: "detail"; routeName: string }
|
|
23
|
+
| { kind: "edit"; routeName: string };
|
|
24
|
+
|
|
25
|
+
export function memorySchemaView(pathname: string, schemaName: string | undefined): MemorySchemaView | null {
|
|
26
|
+
const path = pathname.replace(/\/+$/, "");
|
|
27
|
+
if (path.endsWith(newMemorySchemaPath)) return { kind: "new" };
|
|
28
|
+
if (schemaName === undefined || !path.includes("/memories/schemas/")) return null;
|
|
29
|
+
return path.endsWith("/edit") ? { kind: "edit", routeName: schemaName } : { kind: "detail", routeName: schemaName };
|
|
30
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GQLMemorySchemaValueType,
|
|
3
|
+
type GQLMemory,
|
|
4
|
+
type GQLMemorySchemaFieldsFragment,
|
|
5
|
+
type GQLMemorySchemaPropertyFieldsFragment,
|
|
6
|
+
} from "@manta-eu/client";
|
|
7
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
8
|
+
import { valueTypeLabels } from "./schema-form";
|
|
9
|
+
import type { CreateRuleChatSubject } from "#routes/rules/components/CreateRuleChatModal";
|
|
10
|
+
|
|
11
|
+
export type RuleDraftRequest = { key: string; subject: CreateRuleChatSubject; suggestions: string[] };
|
|
12
|
+
|
|
13
|
+
type Schema = GQLMemorySchemaFieldsFragment;
|
|
14
|
+
|
|
15
|
+
type Property = GQLMemorySchemaPropertyFieldsFragment;
|
|
16
|
+
|
|
17
|
+
export function memorySchemaRuleContext(schema: Schema): string {
|
|
18
|
+
const fields = [...schema.properties]
|
|
19
|
+
.sort((a, b) => a.order - b.order)
|
|
20
|
+
.map((property) => {
|
|
21
|
+
const traits = [
|
|
22
|
+
valueTypeLabels[property.valueType],
|
|
23
|
+
property.multiValued ? "list" : null,
|
|
24
|
+
property.computed ? "computed by a rule" : null,
|
|
25
|
+
property.unit ? `unit ${property.unit}` : null,
|
|
26
|
+
isPresent(property.allowedValues) ? `allowed values: ${property.allowedValues.join(", ")}` : null,
|
|
27
|
+
].filter(isPresent);
|
|
28
|
+
return `- ${property.label} <${property.path}>: ${traits.join("; ")}`;
|
|
29
|
+
});
|
|
30
|
+
return [
|
|
31
|
+
`The rule is about memories of the "${schema.label}" memory schema <${schema.iri}>.`,
|
|
32
|
+
...(isPresent(fields) ? ["Its fields:", ...fields] : []),
|
|
33
|
+
].join("\n");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const numberTypes: readonly string[] = [GQLMemorySchemaValueType.Integer, GQLMemorySchemaValueType.Decimal];
|
|
37
|
+
const dateTypes: readonly string[] = [GQLMemorySchemaValueType.Date, GQLMemorySchemaValueType.DateTime];
|
|
38
|
+
|
|
39
|
+
export function memorySchemaRuleSuggestions(schema: Schema): string[] {
|
|
40
|
+
const name = schema.label;
|
|
41
|
+
const written = schema.properties.filter((property) => !property.computed);
|
|
42
|
+
const computed = schema.properties.find((property) => property.computed);
|
|
43
|
+
const key = written.find((property) => property.keyProperty);
|
|
44
|
+
const number = written.find((property) => numberTypes.includes(property.valueType));
|
|
45
|
+
const choice = written.find((property) => isPresent(property.options));
|
|
46
|
+
const date = written.find((property) => dateTypes.includes(property.valueType));
|
|
47
|
+
const firstChoice = choice?.options[0];
|
|
48
|
+
|
|
49
|
+
return [
|
|
50
|
+
computed ? `Fill in ${computed.label} on every ${name} memory from its other fields` : null,
|
|
51
|
+
number && key ? `For each ${key.label}, use the latest company ${name}'s ${number.label} as the target` : null,
|
|
52
|
+
number && !key ? `Use the latest company ${name}'s ${number.label} as the target` : null,
|
|
53
|
+
choice && firstChoice
|
|
54
|
+
? `Flag company ${name} memories whose ${choice.label} is "${firstChoice.label ?? firstChoice.value}"`
|
|
55
|
+
: null,
|
|
56
|
+
date ? `Flag company ${name} memories whose ${date.label} is in the next 14 days` : null,
|
|
57
|
+
]
|
|
58
|
+
.filter((suggestion): suggestion is string => suggestion !== null)
|
|
59
|
+
.slice(0, 3);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function schemaRuleDraft(schema: Schema): RuleDraftRequest {
|
|
63
|
+
return {
|
|
64
|
+
key: schema.iri,
|
|
65
|
+
subject: { name: schema.label, context: memorySchemaRuleContext(schema) },
|
|
66
|
+
suggestions: memorySchemaRuleSuggestions(schema),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function computedPropertyRuleDraft(schema: Schema, property: Property): RuleDraftRequest {
|
|
71
|
+
return {
|
|
72
|
+
key: `${schema.iri} ${property.path}`,
|
|
73
|
+
subject: {
|
|
74
|
+
name: `${property.label} on ${schema.label}`,
|
|
75
|
+
context: [
|
|
76
|
+
memorySchemaRuleContext(schema),
|
|
77
|
+
`The rule computes ${property.label} <${property.path}>, writing it onto the same memory it reads.`,
|
|
78
|
+
].join("\n"),
|
|
79
|
+
},
|
|
80
|
+
suggestions: [`Fill in ${property.label} on every ${schema.label} memory from its other fields`],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type ExampleMemory = Pick<GQLMemory, "iri" | "label" | "customPropertyValues">;
|
|
85
|
+
|
|
86
|
+
export function memoryRuleDraft(schema: Schema, memory: ExampleMemory): RuleDraftRequest {
|
|
87
|
+
const labelByPath = new Map(schema.properties.map((property) => [property.path, property.label]));
|
|
88
|
+
const values = memory.customPropertyValues
|
|
89
|
+
.filter(({ path, values: given }) => labelByPath.has(path) && isPresent(given))
|
|
90
|
+
.map(({ path, values: given }) => `- ${labelByPath.get(path)}: ${given.join(", ")}`);
|
|
91
|
+
return {
|
|
92
|
+
key: `${schema.iri} ${memory.iri}`,
|
|
93
|
+
subject: {
|
|
94
|
+
name: schema.label,
|
|
95
|
+
context: [
|
|
96
|
+
memorySchemaRuleContext(schema),
|
|
97
|
+
`An example company memory of this schema, "${memory.label}" <${memory.iri}>, holds:`,
|
|
98
|
+
...(isPresent(values) ? values : ["- no field values yet"]),
|
|
99
|
+
].join("\n"),
|
|
100
|
+
},
|
|
101
|
+
suggestions: memorySchemaRuleSuggestions(schema),
|
|
102
|
+
};
|
|
103
|
+
}
|