@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,279 @@
|
|
|
1
|
+
import { GQLMemoryKind, GQLMemorySchemaValueType, GQLMemoryScope, GQLMemoryVolatility, } from "@manta-eu/client";
|
|
2
|
+
import { memorySchemaLimits } from "@manta-eu/client/shared/memory-schema-limits";
|
|
3
|
+
import { checkMemorySchemaProperty, deriveMemoryPropertyKey, memoryPropertyKeyProblem, } from "@manta-eu/client/shared/memory-schema-property";
|
|
4
|
+
import { memorySchemaValueTypes, parseMemoryValue, } from "@manta-eu/client/shared/memory-schema-values";
|
|
5
|
+
import { humanCount } from "@manta-eu/lib/humanize";
|
|
6
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
7
|
+
let compilePattern = null;
|
|
8
|
+
// RE2 is large, so it loads with the schema editor rather than with the app. Until it has, only the server checks a
|
|
9
|
+
// pattern, and it does so again on every save anyway.
|
|
10
|
+
export async function loadPatternCheck() {
|
|
11
|
+
compilePattern ??= (await import("@manta-eu/client/shared/memory-schema-pattern")).compileMemoryValuePattern;
|
|
12
|
+
}
|
|
13
|
+
export const memorySchemaPropertyLimit = memorySchemaLimits.properties;
|
|
14
|
+
export const memorySchemaOptionLimit = memorySchemaLimits.options;
|
|
15
|
+
export const kindLabels = {
|
|
16
|
+
[GQLMemoryKind.Fact]: "Fact",
|
|
17
|
+
[GQLMemoryKind.Preference]: "Preference",
|
|
18
|
+
[GQLMemoryKind.Objective]: "Objective",
|
|
19
|
+
[GQLMemoryKind.Context]: "Context",
|
|
20
|
+
};
|
|
21
|
+
export const volatilityLabels = {
|
|
22
|
+
[GQLMemoryVolatility.Stable]: "Stable",
|
|
23
|
+
[GQLMemoryVolatility.Slow]: "Changes slowly",
|
|
24
|
+
[GQLMemoryVolatility.Volatile]: "Changes often",
|
|
25
|
+
};
|
|
26
|
+
export const scopeLabels = {
|
|
27
|
+
[GQLMemoryScope.User]: "Personal",
|
|
28
|
+
[GQLMemoryScope.Team]: "Team",
|
|
29
|
+
[GQLMemoryScope.Company]: "Company",
|
|
30
|
+
};
|
|
31
|
+
export const valueTypeLabels = {
|
|
32
|
+
[GQLMemorySchemaValueType.Text]: "Text",
|
|
33
|
+
[GQLMemorySchemaValueType.LongText]: "Long text",
|
|
34
|
+
[GQLMemorySchemaValueType.Integer]: "Whole number",
|
|
35
|
+
[GQLMemorySchemaValueType.Decimal]: "Decimal number",
|
|
36
|
+
[GQLMemorySchemaValueType.Boolean]: "Yes / no",
|
|
37
|
+
[GQLMemorySchemaValueType.Date]: "Date",
|
|
38
|
+
[GQLMemorySchemaValueType.DateTime]: "Date and time",
|
|
39
|
+
[GQLMemorySchemaValueType.Url]: "Web address",
|
|
40
|
+
[GQLMemorySchemaValueType.Entity]: "Linked record",
|
|
41
|
+
};
|
|
42
|
+
const boundTypes = [
|
|
43
|
+
GQLMemorySchemaValueType.Integer,
|
|
44
|
+
GQLMemorySchemaValueType.Decimal,
|
|
45
|
+
GQLMemorySchemaValueType.Date,
|
|
46
|
+
GQLMemorySchemaValueType.DateTime,
|
|
47
|
+
];
|
|
48
|
+
const textTypes = [
|
|
49
|
+
GQLMemorySchemaValueType.Text,
|
|
50
|
+
GQLMemorySchemaValueType.LongText,
|
|
51
|
+
];
|
|
52
|
+
const numberTypes = [
|
|
53
|
+
GQLMemorySchemaValueType.Integer,
|
|
54
|
+
GQLMemorySchemaValueType.Decimal,
|
|
55
|
+
];
|
|
56
|
+
// Mirrors which settings the server accepts per type, so switching type never sends one it would refuse.
|
|
57
|
+
export function propertySettings(valueType) {
|
|
58
|
+
return {
|
|
59
|
+
options: valueType === GQLMemorySchemaValueType.Text,
|
|
60
|
+
bounds: boundTypes.includes(valueType),
|
|
61
|
+
maxLength: [...textTypes, GQLMemorySchemaValueType.Url].includes(valueType),
|
|
62
|
+
pattern: textTypes.includes(valueType),
|
|
63
|
+
unit: numberTypes.includes(valueType),
|
|
64
|
+
entityClass: valueType === GQLMemorySchemaValueType.Entity,
|
|
65
|
+
keyProperty: valueType !== GQLMemorySchemaValueType.LongText,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// Only what the save keeps for this type, so a setting left behind by a type switch is not shown as in effect.
|
|
69
|
+
export function propertyTags(property) {
|
|
70
|
+
const settings = propertySettings(property.valueType);
|
|
71
|
+
return [
|
|
72
|
+
property.computed ? "Computed" : property.required ? "Required" : "",
|
|
73
|
+
property.multiValued ? "List" : "",
|
|
74
|
+
settings.keyProperty && property.keyProperty && !property.multiValued && !property.computed ? "Identifies" : "",
|
|
75
|
+
settings.unit ? property.unit.trim() : "",
|
|
76
|
+
settings.options && isPresent(property.options) ? humanCount(property.options.length, "allowed value") : "",
|
|
77
|
+
].filter(isPresent);
|
|
78
|
+
}
|
|
79
|
+
export function withValueType(property, valueType) {
|
|
80
|
+
const type = memorySchemaValueTypes.find((candidate) => candidate === valueType);
|
|
81
|
+
const kept = (raw) => (type !== undefined && parseMemoryValue(type, raw) !== null ? raw : "");
|
|
82
|
+
return {
|
|
83
|
+
...property,
|
|
84
|
+
valueType,
|
|
85
|
+
minValue: kept(property.minValue),
|
|
86
|
+
maxValue: kept(property.maxValue),
|
|
87
|
+
defaultValue: kept(property.defaultValue),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export function newFormId() {
|
|
91
|
+
return crypto.randomUUID();
|
|
92
|
+
}
|
|
93
|
+
export function emptyPropertyForm() {
|
|
94
|
+
return {
|
|
95
|
+
id: newFormId(),
|
|
96
|
+
path: null,
|
|
97
|
+
key: "",
|
|
98
|
+
label: "",
|
|
99
|
+
description: "",
|
|
100
|
+
valueType: GQLMemorySchemaValueType.Text,
|
|
101
|
+
entityClass: "",
|
|
102
|
+
required: false,
|
|
103
|
+
multiValued: false,
|
|
104
|
+
keyProperty: false,
|
|
105
|
+
computed: false,
|
|
106
|
+
options: [],
|
|
107
|
+
minValue: "",
|
|
108
|
+
maxValue: "",
|
|
109
|
+
maxLength: "",
|
|
110
|
+
pattern: "",
|
|
111
|
+
defaultValue: "",
|
|
112
|
+
unit: "",
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export function emptySchemaForm() {
|
|
116
|
+
return {
|
|
117
|
+
key: "",
|
|
118
|
+
label: "",
|
|
119
|
+
description: "",
|
|
120
|
+
defaultMemoryKind: null,
|
|
121
|
+
defaultVolatility: null,
|
|
122
|
+
defaultImportance: null,
|
|
123
|
+
defaultScope: null,
|
|
124
|
+
extractionEnabled: true,
|
|
125
|
+
extractionGuidance: "",
|
|
126
|
+
properties: [],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export function schemaFormFromSchema(schema) {
|
|
130
|
+
return {
|
|
131
|
+
key: "",
|
|
132
|
+
label: schema.label,
|
|
133
|
+
description: schema.description ?? "",
|
|
134
|
+
defaultMemoryKind: schema.defaultMemoryKind ?? null,
|
|
135
|
+
defaultVolatility: schema.defaultVolatility ?? null,
|
|
136
|
+
defaultImportance: schema.defaultImportance ?? null,
|
|
137
|
+
defaultScope: schema.defaultScope ?? null,
|
|
138
|
+
extractionEnabled: schema.extractionEnabled,
|
|
139
|
+
extractionGuidance: schema.extractionGuidance ?? "",
|
|
140
|
+
properties: [...schema.properties]
|
|
141
|
+
.sort((a, b) => a.order - b.order)
|
|
142
|
+
.map((property) => ({
|
|
143
|
+
id: newFormId(),
|
|
144
|
+
path: property.path,
|
|
145
|
+
key: "",
|
|
146
|
+
label: property.label,
|
|
147
|
+
description: property.description ?? "",
|
|
148
|
+
valueType: property.valueType,
|
|
149
|
+
entityClass: property.entityClass ?? "",
|
|
150
|
+
required: property.required,
|
|
151
|
+
multiValued: property.multiValued,
|
|
152
|
+
keyProperty: property.keyProperty,
|
|
153
|
+
computed: property.computed,
|
|
154
|
+
options: property.options.map((option) => ({
|
|
155
|
+
id: newFormId(),
|
|
156
|
+
value: option.value,
|
|
157
|
+
label: option.label ?? "",
|
|
158
|
+
description: option.description ?? "",
|
|
159
|
+
})),
|
|
160
|
+
minValue: property.minValue ?? "",
|
|
161
|
+
maxValue: property.maxValue ?? "",
|
|
162
|
+
maxLength: property.maxLength != null ? String(property.maxLength) : "",
|
|
163
|
+
pattern: property.pattern ?? "",
|
|
164
|
+
defaultValue: property.defaultValue ?? "",
|
|
165
|
+
unit: property.unit ?? "",
|
|
166
|
+
})),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function textOrNull(value) {
|
|
170
|
+
const trimmed = value.trim();
|
|
171
|
+
return isPresent(trimmed) ? trimmed : null;
|
|
172
|
+
}
|
|
173
|
+
function maxLengthOrNull(value) {
|
|
174
|
+
const trimmed = value.trim();
|
|
175
|
+
return isPresent(trimmed) && /^\d+$/.test(trimmed) ? Number(trimmed) : null;
|
|
176
|
+
}
|
|
177
|
+
function propertyInput(property) {
|
|
178
|
+
const settings = propertySettings(property.valueType);
|
|
179
|
+
const key = textOrNull(property.key);
|
|
180
|
+
return {
|
|
181
|
+
...(property.path !== null ? { path: property.path } : key !== null ? { key } : {}),
|
|
182
|
+
label: property.label.trim(),
|
|
183
|
+
description: textOrNull(property.description),
|
|
184
|
+
valueType: property.valueType,
|
|
185
|
+
entityClass: settings.entityClass ? textOrNull(property.entityClass) : null,
|
|
186
|
+
required: property.required && !property.computed,
|
|
187
|
+
multiValued: property.multiValued,
|
|
188
|
+
keyProperty: settings.keyProperty && property.keyProperty && !property.multiValued && !property.computed,
|
|
189
|
+
computed: property.computed,
|
|
190
|
+
options: settings.options
|
|
191
|
+
? property.options.map((option) => ({
|
|
192
|
+
value: option.value.trim(),
|
|
193
|
+
label: textOrNull(option.label),
|
|
194
|
+
description: textOrNull(option.description),
|
|
195
|
+
}))
|
|
196
|
+
: [],
|
|
197
|
+
minValue: settings.bounds ? textOrNull(property.minValue) : null,
|
|
198
|
+
maxValue: settings.bounds ? textOrNull(property.maxValue) : null,
|
|
199
|
+
maxLength: settings.maxLength ? maxLengthOrNull(property.maxLength) : null,
|
|
200
|
+
pattern: settings.pattern ? textOrNull(property.pattern) : null,
|
|
201
|
+
defaultValue: property.computed ? null : textOrNull(property.defaultValue),
|
|
202
|
+
unit: settings.unit ? textOrNull(property.unit) : null,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
export function schemaDefinitionInput(form, options) {
|
|
206
|
+
const key = textOrNull(form.key);
|
|
207
|
+
return {
|
|
208
|
+
...(options.isNew && key !== null ? { key } : {}),
|
|
209
|
+
label: form.label.trim(),
|
|
210
|
+
description: textOrNull(form.description),
|
|
211
|
+
defaultMemoryKind: form.defaultMemoryKind,
|
|
212
|
+
defaultVolatility: form.defaultVolatility,
|
|
213
|
+
defaultImportance: form.defaultImportance,
|
|
214
|
+
defaultScope: form.defaultScope,
|
|
215
|
+
extractionEnabled: form.extractionEnabled,
|
|
216
|
+
extractionGuidance: form.extractionEnabled ? textOrNull(form.extractionGuidance) : null,
|
|
217
|
+
properties: form.properties.map(propertyInput),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export function propertyFormErrors(property, prefix, siblings = []) {
|
|
221
|
+
const errors = new Map();
|
|
222
|
+
function add(field, message) {
|
|
223
|
+
if (!errors.has(field))
|
|
224
|
+
errors.set(field, message);
|
|
225
|
+
}
|
|
226
|
+
const maxLength = property.maxLength.trim();
|
|
227
|
+
if (propertySettings(property.valueType).maxLength && isPresent(maxLength) && !/^\d+$/.test(maxLength)) {
|
|
228
|
+
add(`${prefix}.maxLength`, "The maximum length must be a whole number");
|
|
229
|
+
}
|
|
230
|
+
for (const error of checkMemorySchemaProperty(propertyInput(property), prefix, compilePattern).errors)
|
|
231
|
+
add(error.field, error.message);
|
|
232
|
+
const label = property.label.trim();
|
|
233
|
+
const key = textOrNull(property.key);
|
|
234
|
+
if (property.path === null && (key !== null || isPresent(label))) {
|
|
235
|
+
const problem = memoryPropertyKeyProblem(key ?? deriveMemoryPropertyKey(label));
|
|
236
|
+
if (problem !== null)
|
|
237
|
+
add(`${prefix}.key`, problem);
|
|
238
|
+
}
|
|
239
|
+
if (isPresent(label)) {
|
|
240
|
+
const clash = siblings.find((other) => other.id !== property.id && other.label.trim().toLowerCase() === label.toLowerCase());
|
|
241
|
+
if (clash !== undefined)
|
|
242
|
+
add(`${prefix}.label`, "Another property already uses this label");
|
|
243
|
+
}
|
|
244
|
+
return errors;
|
|
245
|
+
}
|
|
246
|
+
export function localSchemaFormErrors(form) {
|
|
247
|
+
const errors = new Map();
|
|
248
|
+
form.properties.forEach((property, index) => {
|
|
249
|
+
for (const [field, message] of propertyFormErrors(property, propertyErrorPrefix(index), form.properties)) {
|
|
250
|
+
errors.set(field, message);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
return errors;
|
|
254
|
+
}
|
|
255
|
+
// The server names a field by its place in the submitted definition, e.g. `properties.2.options.0.value`.
|
|
256
|
+
export function schemaFormErrors(errors) {
|
|
257
|
+
const byField = new Map();
|
|
258
|
+
for (const { field, message } of errors) {
|
|
259
|
+
if (!byField.has(field))
|
|
260
|
+
byField.set(field, message);
|
|
261
|
+
}
|
|
262
|
+
return byField;
|
|
263
|
+
}
|
|
264
|
+
export function propertyErrorPrefix(index) {
|
|
265
|
+
return `properties.${index}`;
|
|
266
|
+
}
|
|
267
|
+
export function hasErrorsUnder(errors, prefix) {
|
|
268
|
+
return [...errors.keys()].some((field) => field === prefix || field.startsWith(`${prefix}.`));
|
|
269
|
+
}
|
|
270
|
+
export function moveItem(items, from, to) {
|
|
271
|
+
if (to < 0 || to >= items.length || from === to)
|
|
272
|
+
return [...items];
|
|
273
|
+
const next = [...items];
|
|
274
|
+
const [moved] = next.splice(from, 1);
|
|
275
|
+
if (moved !== undefined)
|
|
276
|
+
next.splice(to, 0, moved);
|
|
277
|
+
return next;
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=schema-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-form.js","sourceRoot":"","sources":["../../../../src/routes/memories/schemas/schema-form.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,mBAAmB,GAKpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,gBAAgB,GAEjB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,IAAI,cAAc,GAAqC,IAAI,CAAC;AAE5D,oHAAoH;AACpH,sDAAsD;AACtD,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,cAAc,KAAK,CAAC,MAAM,MAAM,CAAC,+CAA+C,CAAC,CAAC,CAAC,yBAAyB,CAAC;AAC/G,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,kBAAkB,CAAC,UAAU,CAAC;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC,OAAO,CAAC;AAsClE,MAAM,CAAC,MAAM,UAAU,GAAkC;IACvD,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM;IAC5B,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,YAAY;IACxC,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,WAAW;IACtC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,SAAS;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAwC;IACnE,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,QAAQ;IACtC,CAAC,mBAAmB,CAAC,IAAI,C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ta-eu/client";
|
|
2
|
+
export type MemorySchemaImpact = NonNullable<GQLMemorySchemaMutationResultFragment["impact"]>;
|
|
3
|
+
export type RemovedOptionInUse = MemorySchemaImpact["removedOptions"][number];
|
|
4
|
+
export type OptionRemapChoices = Record<string, string>;
|
|
5
|
+
export declare const clearValueChoice = "__clear__";
|
|
6
|
+
export declare function readableBlockers(impact: Pick<MemorySchemaImpact, "blockers" | "ruleReferences">): string[];
|
|
7
|
+
export declare function remapChoiceKey(option: Pick<RemovedOptionInUse, "path" | "value">): string;
|
|
8
|
+
export declare function impactNeedsReview(impact: MemorySchemaImpact): boolean;
|
|
9
|
+
export declare function removedOptionsInUse(impact: MemorySchemaImpact): RemovedOptionInUse[];
|
|
10
|
+
export declare function remapTargets(proposed: GQLMemorySchemaFieldsFragment | null | undefined, path: string): string[];
|
|
11
|
+
export declare function optionRemapsInput(impact: MemorySchemaImpact, choices: OptionRemapChoices): GQLMemorySchemaOptionRemapInput[];
|
|
12
|
+
export declare function hasInvalidValues(impact: MemorySchemaImpact): boolean;
|
|
13
|
+
//# sourceMappingURL=schema-impact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-impact.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/schemas/schema-impact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,qCAAqC,EACrC,+BAA+B,EAChC,MAAM,kBAAkB,CAAC;AAI1B,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,qCAAqC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE9F,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAExD,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAG5C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,gBAAgB,CAAC,GAAG,MAAM,EAAE,CAO1G;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM,CAEzF;AAGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAWrE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,EAAE,CAEpF;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,6BAA6B,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAE/G;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,kBAAkB,GAC1B,+BAA+B,EAAE,CAMnC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAEpE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
2
|
+
import { getRuleDisplayName } from "#routes/rules/components/rules.utils";
|
|
3
|
+
export const clearValueChoice = "__clear__";
|
|
4
|
+
// Longest IRI first, so a rule IRI that is a prefix of another never rewrites part of the longer one.
|
|
5
|
+
export function readableBlockers(impact) {
|
|
6
|
+
const ruleIris = [...new Set(impact.ruleReferences.map((reference) => reference.ruleIri))].sort((a, b) => b.length - a.length);
|
|
7
|
+
return impact.blockers.map((blocker) => ruleIris.reduce((text, ruleIri) => text.split(ruleIri).join(getRuleDisplayName(ruleIri)), blocker));
|
|
8
|
+
}
|
|
9
|
+
export function remapChoiceKey(option) {
|
|
10
|
+
return `${option.path}\u0000${option.value}`;
|
|
11
|
+
}
|
|
12
|
+
// A change that moves no stored value and names no rule can be saved without a review step.
|
|
13
|
+
export function impactNeedsReview(impact) {
|
|
14
|
+
return (isPresent(impact.blockers) ||
|
|
15
|
+
isPresent(impact.ruleReferences) ||
|
|
16
|
+
impact.removedProperties.some((property) => property.memoryCount > 0) ||
|
|
17
|
+
impact.typeChanges.some((change) => change.valueCount > 0) ||
|
|
18
|
+
impact.removedOptions.some((option) => option.memoryCount > 0) ||
|
|
19
|
+
isPresent(impact.limitViolations) ||
|
|
20
|
+
isPresent(impact.multiValueConflicts) ||
|
|
21
|
+
impact.clearedValues.some((property) => property.memoryCount > 0));
|
|
22
|
+
}
|
|
23
|
+
export function removedOptionsInUse(impact) {
|
|
24
|
+
return impact.removedOptions.filter((option) => option.memoryCount > 0);
|
|
25
|
+
}
|
|
26
|
+
export function remapTargets(proposed, path) {
|
|
27
|
+
return proposed?.properties.find((property) => property.path === path)?.allowedValues ?? [];
|
|
28
|
+
}
|
|
29
|
+
export function optionRemapsInput(impact, choices) {
|
|
30
|
+
return removedOptionsInUse(impact).flatMap((option) => {
|
|
31
|
+
const choice = choices[remapChoiceKey(option)];
|
|
32
|
+
if (choice === undefined)
|
|
33
|
+
return [];
|
|
34
|
+
return [{ path: option.path, from: option.value, to: choice === clearValueChoice ? null : choice }];
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export function hasInvalidValues(impact) {
|
|
38
|
+
return impact.typeChanges.some((change) => change.unconvertibleCount > 0) || isPresent(impact.limitViolations);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=schema-impact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-impact.js","sourceRoot":"","sources":["../../../../src/routes/memories/schemas/schema-impact.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAQ1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE5C,sGAAsG;AACtG,MAAM,UAAU,gBAAgB,CAAC,MAA+D;IAC9F,MAAM,QAAQ,GAAG,CAAC,GAAG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|
1
|
+
export declare const memorySchemasPath = "/memories?tab=schemas";
|
|
2
|
+
export declare const newMemorySchemaPath = "/memories/schemas/new";
|
|
3
|
+
export declare function memorySchemaPath(iri: string): string;
|
|
4
|
+
export declare function memorySchemaEditPath(iri: string): string;
|
|
5
|
+
export declare function findMemorySchemaByRouteName<T extends {
|
|
6
|
+
iri: string;
|
|
7
|
+
}>(schemas: readonly T[], routeName: string): T | null;
|
|
8
|
+
export type MemorySchemaView = {
|
|
9
|
+
kind: "new";
|
|
10
|
+
} | {
|
|
11
|
+
kind: "detail";
|
|
12
|
+
routeName: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "edit";
|
|
15
|
+
routeName: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function memorySchemaView(pathname: string, schemaName: string | undefined): MemorySchemaView | null;
|
|
18
|
+
//# sourceMappingURL=schema-route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-route.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/schemas/schema-route.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AACzD,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAG3D,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,2BAA2B,CAAC,CAAC,SAAS;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACnE,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,SAAS,EAAE,MAAM,GAChB,CAAC,GAAG,IAAI,CAEV;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACf;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,GAAG,IAAI,CAK1G"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const memorySchemasPath = "/memories?tab=schemas";
|
|
2
|
+
export const newMemorySchemaPath = "/memories/schemas/new";
|
|
3
|
+
// The whole IRI names the page: IRIs are opaque, so no part of one is a name to route by.
|
|
4
|
+
export function memorySchemaPath(iri) {
|
|
5
|
+
return `/memories/schemas/${encodeURIComponent(iri)}`;
|
|
6
|
+
}
|
|
7
|
+
export function memorySchemaEditPath(iri) {
|
|
8
|
+
return `${memorySchemaPath(iri)}/edit`;
|
|
9
|
+
}
|
|
10
|
+
export function findMemorySchemaByRouteName(schemas, routeName) {
|
|
11
|
+
return schemas.find((schema) => schema.iri === routeName) ?? null;
|
|
12
|
+
}
|
|
13
|
+
export function memorySchemaView(pathname, schemaName) {
|
|
14
|
+
const path = pathname.replace(/\/+$/, "");
|
|
15
|
+
if (path.endsWith(newMemorySchemaPath))
|
|
16
|
+
return { kind: "new" };
|
|
17
|
+
if (schemaName === undefined || !path.includes("/memories/schemas/"))
|
|
18
|
+
return null;
|
|
19
|
+
return path.endsWith("/edit") ? { kind: "edit", routeName: schemaName } : { kind: "detail", routeName: schemaName };
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=schema-route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-route.js","sourceRoot":"","sources":["../../../../src/routes/memories/schemas/schema-route.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAE3D,0FAA0F;AAC1F,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,OAAO,qBAAqB,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,OAAO,GAAG,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,OAAqB,EACrB,SAAiB;IAEjB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,SAAS,CAAC,IAAI,IAAI,CAAC;AACpE,CAAC;AAOD,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,UAA8B;IAC/E,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAC/D,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAAE,OAAO,IAAI,CAAC;IAClF,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AACtH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type GQLMemory, type GQLMemorySchemaFieldsFragment, type GQLMemorySchemaPropertyFieldsFragment } from "@manta-eu/client";
|
|
2
|
+
import type { CreateRuleChatSubject } from "#routes/rules/components/CreateRuleChatModal";
|
|
3
|
+
export type RuleDraftRequest = {
|
|
4
|
+
key: string;
|
|
5
|
+
subject: CreateRuleChatSubject;
|
|
6
|
+
suggestions: string[];
|
|
7
|
+
};
|
|
8
|
+
type Schema = GQLMemorySchemaFieldsFragment;
|
|
9
|
+
type Property = GQLMemorySchemaPropertyFieldsFragment;
|
|
10
|
+
export declare function memorySchemaRuleContext(schema: Schema): string;
|
|
11
|
+
export declare function memorySchemaRuleSuggestions(schema: Schema): string[];
|
|
12
|
+
export declare function schemaRuleDraft(schema: Schema): RuleDraftRequest;
|
|
13
|
+
export declare function computedPropertyRuleDraft(schema: Schema, property: Property): RuleDraftRequest;
|
|
14
|
+
type ExampleMemory = Pick<GQLMemory, "iri" | "label" | "customPropertyValues">;
|
|
15
|
+
export declare function memoryRuleDraft(schema: Schema, memory: ExampleMemory): RuleDraftRequest;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=schema-rule-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-rule-context.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/schemas/schema-rule-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,6BAA6B,EAClC,KAAK,qCAAqC,EAC3C,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAE1F,MAAM,MAAM,gBAAgB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEtG,KAAK,MAAM,GAAG,6BAA6B,CAAC;AAE5C,KAAK,QAAQ,GAAG,qCAAqC,CAAC;AAEtD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAiB9D;AAKD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAqBpE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAMhE;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,CAY9F;AAED,KAAK,aAAa,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,OAAO,GAAG,sBAAsB,CAAC,CAAC;AAE/E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAiBvF"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { GQLMemorySchemaValueType, } from "@manta-eu/client";
|
|
2
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
3
|
+
import { valueTypeLabels } from "./schema-form.js";
|
|
4
|
+
export function memorySchemaRuleContext(schema) {
|
|
5
|
+
const fields = [...schema.properties]
|
|
6
|
+
.sort((a, b) => a.order - b.order)
|
|
7
|
+
.map((property) => {
|
|
8
|
+
const traits = [
|
|
9
|
+
valueTypeLabels[property.valueType],
|
|
10
|
+
property.multiValued ? "list" : null,
|
|
11
|
+
property.computed ? "computed by a rule" : null,
|
|
12
|
+
property.unit ? `unit ${property.unit}` : null,
|
|
13
|
+
isPresent(property.allowedValues) ? `allowed values: ${property.allowedValues.join(", ")}` : null,
|
|
14
|
+
].filter(isPresent);
|
|
15
|
+
return `- ${property.label} <${property.path}>: ${traits.join("; ")}`;
|
|
16
|
+
});
|
|
17
|
+
return [
|
|
18
|
+
`The rule is about memories of the "${schema.label}" memory schema <${schema.iri}>.`,
|
|
19
|
+
...(isPresent(fields) ? ["Its fields:", ...fields] : []),
|
|
20
|
+
].join("\n");
|
|
21
|
+
}
|
|
22
|
+
const numberTypes = [GQLMemorySchemaValueType.Integer, GQLMemorySchemaValueType.Decimal];
|
|
23
|
+
const dateTypes = [GQLMemorySchemaValueType.Date, GQLMemorySchemaValueType.DateTime];
|
|
24
|
+
export function memorySchemaRuleSuggestions(schema) {
|
|
25
|
+
const name = schema.label;
|
|
26
|
+
const written = schema.properties.filter((property) => !property.computed);
|
|
27
|
+
const computed = schema.properties.find((property) => property.computed);
|
|
28
|
+
const key = written.find((property) => property.keyProperty);
|
|
29
|
+
const number = written.find((property) => numberTypes.includes(property.valueType));
|
|
30
|
+
const choice = written.find((property) => isPresent(property.options));
|
|
31
|
+
const date = written.find((property) => dateTypes.includes(property.valueType));
|
|
32
|
+
const firstChoice = choice?.options[0];
|
|
33
|
+
return [
|
|
34
|
+
computed ? `Fill in ${computed.label} on every ${name} memory from its other fields` : null,
|
|
35
|
+
number && key ? `For each ${key.label}, use the latest company ${name}'s ${number.label} as the target` : null,
|
|
36
|
+
number && !key ? `Use the latest company ${name}'s ${number.label} as the target` : null,
|
|
37
|
+
choice && firstChoice
|
|
38
|
+
? `Flag company ${name} memories whose ${choice.label} is "${firstChoice.label ?? firstChoice.value}"`
|
|
39
|
+
: null,
|
|
40
|
+
date ? `Flag company ${name} memories whose ${date.label} is in the next 14 days` : null,
|
|
41
|
+
]
|
|
42
|
+
.filter((suggestion) => suggestion !== null)
|
|
43
|
+
.slice(0, 3);
|
|
44
|
+
}
|
|
45
|
+
export function schemaRuleDraft(schema) {
|
|
46
|
+
return {
|
|
47
|
+
key: schema.iri,
|
|
48
|
+
subject: { name: schema.label, context: memorySchemaRuleContext(schema) },
|
|
49
|
+
suggestions: memorySchemaRuleSuggestions(schema),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export function computedPropertyRuleDraft(schema, property) {
|
|
53
|
+
return {
|
|
54
|
+
key: `${schema.iri} ${property.path}`,
|
|
55
|
+
subject: {
|
|
56
|
+
name: `${property.label} on ${schema.label}`,
|
|
57
|
+
context: [
|
|
58
|
+
memorySchemaRuleContext(schema),
|
|
59
|
+
`The rule computes ${property.label} <${property.path}>, writing it onto the same memory it reads.`,
|
|
60
|
+
].join("\n"),
|
|
61
|
+
},
|
|
62
|
+
suggestions: [`Fill in ${property.label} on every ${schema.label} memory from its other fields`],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function memoryRuleDraft(schema, memory) {
|
|
66
|
+
const labelByPath = new Map(schema.properties.map((property) => [property.path, property.label]));
|
|
67
|
+
const values = memory.customPropertyValues
|
|
68
|
+
.filter(({ path, values: given }) => labelByPath.has(path) && isPresent(given))
|
|
69
|
+
.map(({ path, values: given }) => `- ${labelByPath.get(path)}: ${given.join(", ")}`);
|
|
70
|
+
return {
|
|
71
|
+
key: `${schema.iri} ${memory.iri}`,
|
|
72
|
+
subject: {
|
|
73
|
+
name: schema.label,
|
|
74
|
+
context: [
|
|
75
|
+
memorySchemaRuleContext(schema),
|
|
76
|
+
`An example company memory of this schema, "${memory.label}" <${memory.iri}>, holds:`,
|
|
77
|
+
...(isPresent(values) ? values : ["- no field values yet"]),
|
|
78
|
+
].join("\n"),
|
|
79
|
+
},
|
|
80
|
+
suggestions: memorySchemaRuleSuggestions(schema),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=schema-rule-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-rule-context.js","sourceRoot":"","sources":["../../../../src/routes/memories/schemas/schema-rule-context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAIzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAShD,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACpD,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC;SAClC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;SACjC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChB,MAAM,MAAM,GAAG;YACb,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC;YACnC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;YACpC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI;YAC/C,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AC,GAAG,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;SAC9E,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvF,OAAO;QACL,GAAG,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE;QAClC,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAC,KAAK;YAClB,OAAO,EAAE;gBACP,uBAAuB,CAAC,MAAM,CAAC;gBAC/B,8CAA8C,MAAM,CAAC,KAAK,MAAM,MAAM,CAAC,GAAG,WAAW;gBACrF,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC;aAC5D,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD,WAAW,EAAE,2BAA2B,CAAC,MAAM,CAAC;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GQLMemorySchemaFieldsFragment, GQLMemorySchemaRuleCountsQuery } from "@manta-eu/client";
|
|
2
|
+
export declare function ruleCountsFrom(response: GQLMemorySchemaRuleCountsQuery["memorySchemaRuleCounts"] | undefined): ReadonlyMap<string, number> | undefined;
|
|
3
|
+
export type CountFilter = "ANY" | "NONE" | "SOME";
|
|
4
|
+
export type SchemaCountKey = "properties" | "rules" | "memories";
|
|
5
|
+
export type SchemaCountFilters = Record<SchemaCountKey, CountFilter>;
|
|
6
|
+
export declare const anyCount: SchemaCountFilters;
|
|
7
|
+
export type SchemaCounts = Record<SchemaCountKey, number | null>;
|
|
8
|
+
export declare function schemaCounts(schema: GQLMemorySchemaFieldsFragment, ruleCounts: ReadonlyMap<string, number> | undefined): SchemaCounts;
|
|
9
|
+
export declare function countMatches(count: number | null, filter: CountFilter): boolean;
|
|
10
|
+
export declare function filterSchemas(schemas: readonly GQLMemorySchemaFieldsFragment[], search: string, filters: SchemaCountFilters, ruleCounts: ReadonlyMap<string, number> | undefined): GQLMemorySchemaFieldsFragment[];
|
|
11
|
+
//# sourceMappingURL=schema-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-table.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/schemas/schema-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAGtG,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,8BAA8B,CAAC,wBAAwB,CAAC,GAAG,SAAS,GAC7E,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAGzC;AAED,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,OAAO,GAAG,UAAU,CAAC;AAEjE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AAErE,eAAO,MAAM,QAAQ,EAAE,kBAAyE,CAAC;AAEjG,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAEjE,wBAAgB,YAAY,CAC1B,MAAM,EAAE,6BAA6B,EACrC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAClD,YAAY,CAMd;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAI/E;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,SAAS,6BAA6B,EAAE,EACjD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAClD,6BAA6B,EAAE,CAWjC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
2
|
+
export function ruleCountsFrom(response) {
|
|
3
|
+
if (!response || isPresent(response.error))
|
|
4
|
+
return undefined;
|
|
5
|
+
return new Map(response.counts.map(({ iri, ruleCount }) => [iri, ruleCount]));
|
|
6
|
+
}
|
|
7
|
+
export const anyCount = { properties: "ANY", rules: "ANY", memories: "ANY" };
|
|
8
|
+
export function schemaCounts(schema, ruleCounts) {
|
|
9
|
+
return {
|
|
10
|
+
properties: schema.properties.filter((property) => !property.computed).length,
|
|
11
|
+
rules: ruleCounts ? (ruleCounts.get(schema.iri) ?? 0) : null,
|
|
12
|
+
memories: schema.memoryCount ?? null,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function countMatches(count, filter) {
|
|
16
|
+
if (filter === "ANY")
|
|
17
|
+
return true;
|
|
18
|
+
if (count === null)
|
|
19
|
+
return false;
|
|
20
|
+
return filter === "NONE" ? count === 0 : count > 0;
|
|
21
|
+
}
|
|
22
|
+
export function filterSchemas(schemas, search, filters, ruleCounts) {
|
|
23
|
+
const needle = search.trim().toLowerCase();
|
|
24
|
+
return schemas.filter((schema) => {
|
|
25
|
+
const matchesSearch = !isPresent(needle) ||
|
|
26
|
+
schema.label.toLowerCase().includes(needle) ||
|
|
27
|
+
(schema.description ?? "").toLowerCase().includes(needle);
|
|
28
|
+
if (!matchesSearch)
|
|
29
|
+
return false;
|
|
30
|
+
const counts = schemaCounts(schema, ruleCounts);
|
|
31
|
+
return Object.keys(filters).every((key) => countMatches(counts[key], filters[key]));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=schema-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-table.js","sourceRoot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MAAM,UAAU,aAAa,CAC3B,OAAiD,EACjD,MAAc,EACd,OAA2B,EAC3B,UAAmD;IAEnD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;QAC/B,MAAM,aAAa,GACjB,CAAC,SAAS,CAAC,MAAM,CAAC;YAClB,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC3C,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC5D,IAAI,CAAC,aAAa;YAAE,OAAO,KAAK,CAAC;QACjC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAChD,OAAQ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAsB,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare function useMemorySchemaMutations(): {
|
|
2
|
+
refresh: () => Promise<void>;
|
|
3
|
+
create: import("@tanstack/react-query").UseMutationResult<import("@manta-eu/client").GQLCreateMemorySchemaMutation, unknown, import("@manta-eu/client").Exact<{
|
|
4
|
+
input: import("@manta-eu/client").GQLCreateMemorySchemaInput;
|
|
5
|
+
}>, unknown>;
|
|
6
|
+
update: import("@tanstack/react-query").UseMutationResult<import("@manta-eu/client").GQLUpdateMemorySchemaMutation, unknown, import("@manta-eu/client").Exact<{
|
|
7
|
+
input: import("@manta-eu/client").GQLUpdateMemorySchemaInput;
|
|
8
|
+
}>, unknown>;
|
|
9
|
+
archive: import("@tanstack/react-query").UseMutationResult<import("@manta-eu/client").GQLArchiveMemorySchemaMutation, unknown, import("@manta-eu/client").Exact<{
|
|
10
|
+
input: import("@manta-eu/client").GQLMemorySchemaRevisionInput;
|
|
11
|
+
}>, unknown>;
|
|
12
|
+
unarchive: import("@tanstack/react-query").UseMutationResult<import("@manta-eu/client").GQLUnarchiveMemorySchemaMutation, unknown, import("@manta-eu/client").Exact<{
|
|
13
|
+
input: import("@manta-eu/client").GQLMemorySchemaRevisionInput;
|
|
14
|
+
}>, unknown>;
|
|
15
|
+
remove: import("@tanstack/react-query").UseMutationResult<import("@manta-eu/client").GQLDeleteMemorySchemaMutation, unknown, import("@manta-eu/client").Exact<{
|
|
16
|
+
input: import("@manta-eu/client").GQLMemorySchemaRevisionInput;
|
|
17
|
+
}>, unknown>;
|
|
18
|
+
addFromTemplate: import("@tanstack/react-query").UseMutationResult<import("@manta-eu/client").GQLAddMemorySchemaFromTemplateMutation, unknown, import("@manta-eu/client").Exact<{
|
|
19
|
+
templateIri: import("@manta-eu/client").Scalars["IRI"]["input"];
|
|
20
|
+
}>, unknown>;
|
|
21
|
+
resetToTemplate: import("@tanstack/react-query").UseMutationResult<import("@manta-eu/client").GQLResetMemorySchemaToTemplateMutation, unknown, import("@manta-eu/client").Exact<{
|
|
22
|
+
input: import("@manta-eu/client").GQLResetMemorySchemaInput;
|
|
23
|
+
}>, unknown>;
|
|
24
|
+
dismissTemplateUpdate: import("@tanstack/react-query").UseMutationResult<import("@manta-eu/client").GQLDismissMemorySchemaTemplateUpdateMutation, unknown, import("@manta-eu/client").Exact<{
|
|
25
|
+
input: import("@manta-eu/client").GQLMemorySchemaRevisionInput;
|
|
26
|
+
}>, unknown>;
|
|
27
|
+
clearValues: import("@tanstack/react-query").UseMutationResult<import("@manta-eu/client").GQLClearMemorySchemaPropertyValuesMutation, unknown, import("@manta-eu/client").Exact<{
|
|
28
|
+
input: import("@manta-eu/client").GQLClearMemorySchemaPropertyValuesInput;
|
|
29
|
+
}>, unknown>;
|
|
30
|
+
};
|
|
31
|
+
export type MemorySchemaMutations = ReturnType<typeof useMemorySchemaMutations>;
|
|
32
|
+
//# sourceMappingURL=useMemorySchemaMutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMemorySchemaMutations.d.ts","sourceRoot":"","sources":["../../../../src/routes/memories/schemas/useMemorySchemaMutations.ts"],"names":[],"mappings":"AAqBA,wBAAgB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBvC;AAED,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|