Add standard command menu items (#18527)
## Add standard command menu items
### Summary
This PR introduces standard command menu items, migrating hardcoded
command menu actions to the backend command menu item architecture
powered by front components. It adds a new `twenty-standard-application`
package that defines, builds, and registers front components as standard
command menu items, gated behind the `IS_COMMAND_MENU_ITEM_ENABLED`
feature flag.
### Description
- **New `twenty-standard-application` package**: Contains front
component definitions with an esbuild-based build pipeline that
generates minified `.mjs` bundles and a manifest with checksums.
- **Server-side registration**: New constants register all items with
metadata (labels, icons, positions, availability types, conditional
expressions). A `StandardFrontComponentUploadService` uploads built
components to file storage.
- **`FALLBACK` availability type**: New enum value for command menu
items that appear as fallback options (e.g., "Search Records" fallback).
- **`CommandMenuContextApi` refactor**
- **Conditional availability enhancements**: New array-based helper
functions for evaluating multi-record conditions.
- **Frontend wiring** (twenty-front):
`useCommandMenuItemFrontComponentCommands`
## Next steps
Only simple commands have been implemented for now:
- **Navigation (9)** -- `CommandLink`: go-to-companies,
go-to-dashboards, go-to-notes, go-to-opportunities, go-to-people,
go-to-runs, go-to-settings, go-to-tasks, go-to-workflows
- **Side panel (4)** -- `CommandOpenSidePanelPage`: ask-ai,
search-records, search-records-fallback, view-previous-ai-chats
We still have to implement front components for all the following
commands:
All have placeholder `execute` logic (`async () => {}`) with a `// TODO:
implement execute logic` comment:
**Record (22)**
- `add-to-favorites`, `remove-from-favorites`
- `create-new-record`, `create-new-view`
- `delete-single-record`, `delete-multiple-records`
- `destroy-single-record`, `destroy-multiple-records`
- `restore-single-record`, `restore-multiple-records`
- `export-from-record-index`, `export-from-record-show`,
`export-multiple-records`, `export-note-to-pdf`, `export-view`
- `hide-deleted-records`, `see-deleted-records`
- `import-records`, `merge-multiple-records`, `update-multiple-records`
- `navigate-to-next-record`, `navigate-to-previous-record`
**Page layout (3)** -- `cancel-record-page-layout`,
`edit-record-page-layout`, `save-record-page-layout`
**Dashboard (4)** -- `cancel-dashboard-layout`, `duplicate-dashboard`,
`edit-dashboard-layout`, `save-dashboard-layout`
**Workflow (10)** -- `activate-workflow`, `add-node-workflow`,
`deactivate-workflow`, `discard-draft-workflow`, `duplicate-workflow`,
`see-active-version-workflow`, `see-runs-workflow`,
`see-versions-workflow`, `test-workflow`, `tidy-up-workflow`
**Workflow version (4)** -- `see-runs-workflow-version`,
`see-versions-workflow-version`, `see-workflow-workflow-version`,
`use-as-draft-workflow-version`
**Workflow run (3)** -- `see-version-workflow-run`,
`see-workflow-workflow-run`, `stop-workflow-run`
This commit is contained in:
@@ -206,6 +206,7 @@
|
||||
"packages/twenty-e2e-testing",
|
||||
"packages/twenty-shared",
|
||||
"packages/twenty-sdk",
|
||||
"packages/twenty-standard-application",
|
||||
"packages/twenty-apps",
|
||||
"packages/twenty-cli",
|
||||
"packages/create-twenty-app",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { defineLogicFunction, RoutePayload } from "twenty-sdk";
|
||||
import { MetadataApiClient } from 'twenty-sdk/generated';
|
||||
import { MetadataApiClient } from 'twenty-sdk/clients';
|
||||
|
||||
export const OAUTH_TOKEN_PAIRS_PATH = '/oauth/token-pairs';
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import {
|
||||
type DatabaseEventPayload,
|
||||
type ObjectRecordUpdateEvent,
|
||||
} from 'twenty-sdk';
|
||||
import { CoreApiClient } from 'twenty-sdk/generated';
|
||||
import { CoreApiClient } from 'twenty-sdk/clients';
|
||||
|
||||
type CompanyRecord = {
|
||||
id: string;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import {
|
||||
} from 'src/constants/seed-call-recordings-universal-identifiers';
|
||||
import { MOCK_CALL_RECORDINGS } from 'src/data/mock-call-recordings';
|
||||
import { defineFrontComponent } from 'twenty-sdk';
|
||||
import { CoreApiClient } from 'twenty-sdk/generated';
|
||||
import { CoreApiClient } from 'twenty-sdk/clients';
|
||||
|
||||
type SeedStatus = 'seeding' | 'done' | 'error';
|
||||
|
||||
|
||||
+4
-2
@@ -6,7 +6,7 @@ import {
|
||||
SUMMARIZE_PERSON_RECORDINGS_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
|
||||
} from 'src/constants/summarize-person-recordings-universal-identifiers';
|
||||
import { defineFrontComponent, useRecordId } from 'twenty-sdk';
|
||||
import { CoreApiClient } from 'twenty-sdk/generated';
|
||||
import { CoreApiClient } from 'twenty-sdk/clients';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
const SUMMARIZATION_SYSTEM_PROMPT = [
|
||||
@@ -40,7 +40,9 @@ const summarizeAllRecordings = async (
|
||||
const summariesText = recordings
|
||||
.map(
|
||||
(recording, index) =>
|
||||
`### ${index + 1}. ${recording.name ?? 'Untitled'} (${recording.createdAt})\n${recording.summary?.markdown ?? 'No summary available'}`,
|
||||
`### ${index + 1}. ${recording.name ?? 'Untitled'} (${
|
||||
recording.createdAt
|
||||
})\n${recording.summary?.markdown ?? 'No summary available'}`,
|
||||
)
|
||||
.join('\n\n---\n\n');
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useRecordId } from 'twenty-sdk';
|
||||
import { CoreApiClient } from 'twenty-sdk/generated';
|
||||
import { CoreApiClient } from 'twenty-sdk/clients';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
type CallRecording = {
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from 'src/utils/match-participants';
|
||||
import { summarizeTranscript } from 'src/utils/summarize-transcript';
|
||||
import { defineLogicFunction } from 'twenty-sdk';
|
||||
import { CoreApiClient, MetadataApiClient } from 'twenty-sdk/generated';
|
||||
import { CoreApiClient, MetadataApiClient } from 'twenty-sdk/clients';
|
||||
import { z } from 'zod';
|
||||
|
||||
interface LocalTranscriptWord {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CoreApiClient } from 'twenty-sdk/generated';
|
||||
import { CoreApiClient } from 'twenty-sdk/clients';
|
||||
|
||||
export interface Participant {
|
||||
id: string;
|
||||
|
||||
+8
-2
@@ -5,8 +5,14 @@ import {
|
||||
type ObjectRecordUpdateEvent,
|
||||
} from 'twenty-sdk';
|
||||
import { SELF_HOSTING_USER_NAME_SINGULAR } from 'src/objects/selfHostingUser.object';
|
||||
import { type SelfHostingUser } from 'twenty-sdk/generated/core';
|
||||
import { CoreApiClient } from 'twenty-sdk/generated';
|
||||
import { CoreApiClient } from 'twenty-sdk/clients';
|
||||
|
||||
type SelfHostingUser = {
|
||||
id: string;
|
||||
email?: { primaryEmail?: string };
|
||||
name?: { firstName?: string; lastName?: string };
|
||||
personId?: string;
|
||||
};
|
||||
|
||||
const handler = async (
|
||||
params: DatabaseEventPayload<
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { defineLogicFunction, type RoutePayload } from 'twenty-sdk';
|
||||
import { CoreApiClient } from 'twenty-sdk/generated';
|
||||
import { CoreApiClient } from 'twenty-sdk/clients';
|
||||
import { type TelemetryEvent } from 'src/logic-functions/types/telemetry-event.type';
|
||||
|
||||
export const main = async (
|
||||
|
||||
@@ -15,6 +15,7 @@ COPY ./packages/twenty-ui/package.json /app/packages/twenty-ui/
|
||||
COPY ./packages/twenty-shared/package.json /app/packages/twenty-shared/
|
||||
COPY ./packages/twenty-front/package.json /app/packages/twenty-front/
|
||||
COPY ./packages/twenty-sdk/package.json /app/packages/twenty-sdk/
|
||||
COPY ./packages/twenty-standard-application/package.json /app/packages/twenty-standard-application/
|
||||
|
||||
# Install all dependencies
|
||||
RUN yarn && yarn cache clean && npx nx reset
|
||||
@@ -26,11 +27,15 @@ FROM common-deps AS twenty-server-build
|
||||
# Copy sourcecode after installing dependences to accelerate subsequents builds
|
||||
COPY ./packages/twenty-emails /app/packages/twenty-emails
|
||||
COPY ./packages/twenty-shared /app/packages/twenty-shared
|
||||
COPY ./packages/twenty-ui /app/packages/twenty-ui
|
||||
COPY ./packages/twenty-sdk /app/packages/twenty-sdk
|
||||
COPY ./packages/twenty-standard-application /app/packages/twenty-standard-application
|
||||
COPY ./packages/twenty-server /app/packages/twenty-server
|
||||
|
||||
RUN npx nx build twenty-standard-application
|
||||
RUN npx nx run twenty-server:build
|
||||
|
||||
RUN yarn workspaces focus --production twenty-emails twenty-shared twenty-server
|
||||
RUN yarn workspaces focus --production twenty-emails twenty-shared twenty-sdk twenty-standard-application twenty-server
|
||||
|
||||
# Build the front
|
||||
FROM common-deps AS twenty-front-build
|
||||
|
||||
@@ -853,6 +853,7 @@ export type CommandMenuItem = {
|
||||
};
|
||||
|
||||
export enum CommandMenuItemAvailabilityType {
|
||||
FALLBACK = 'FALLBACK',
|
||||
GLOBAL = 'GLOBAL',
|
||||
RECORD_SELECTION = 'RECORD_SELECTION'
|
||||
}
|
||||
|
||||
+18
-11
@@ -1,16 +1,18 @@
|
||||
import { useRunWorkflowRecordCommands } from '@/command-menu-item/record/workflow/hooks/useRunWorkflowRecordCommands';
|
||||
import { useRunWorkflowRecordAgnosticCommands } from '@/command-menu-item/record-agnostic/workflow/hooks/useRunWorkflowRecordAgnosticCommands';
|
||||
import {
|
||||
CommandMenuContext,
|
||||
type CommandMenuContextType,
|
||||
} from '@/command-menu-item/contexts/CommandMenuContext';
|
||||
import { useCommandMenuContextApi } from '@/command-menu-item/hooks/useCommandMenuContextApi';
|
||||
import { useCommandMenuItemFrontComponentCommands } from '@/command-menu-item/hooks/useCommandMenuItemFrontComponentCommands';
|
||||
import { useRegisteredCommandMenuItems } from '@/command-menu-item/hooks/useRegisteredCommandMenuItems';
|
||||
import { useShouldCommandMenuItemBeRegisteredParams } from '@/command-menu-item/hooks/useShouldCommandMenuItemBeRegisteredParams';
|
||||
import { useCommandMenuContextApi } from '@/command-menu-item/hooks/useCommandMenuContextApi';
|
||||
import { useCommandMenuItemFrontComponentActions } from '@/command-menu-item/hooks/useCommandMenuItemFrontComponentActions';
|
||||
import { useRunWorkflowRecordAgnosticCommands } from '@/command-menu-item/record-agnostic/workflow/hooks/useRunWorkflowRecordAgnosticCommands';
|
||||
import { useRunWorkflowRecordCommands } from '@/command-menu-item/record/workflow/hooks/useRunWorkflowRecordCommands';
|
||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
|
||||
export const CommandMenuContextProviderDefault = ({
|
||||
objectMetadataItem,
|
||||
@@ -56,7 +58,11 @@ export const CommandMenuContextProviderDefault = ({
|
||||
const commandMenuContextApi = useCommandMenuContextApi();
|
||||
|
||||
const commandMenuItemFrontComponentActions =
|
||||
useCommandMenuItemFrontComponentActions(commandMenuContextApi);
|
||||
useCommandMenuItemFrontComponentCommands(commandMenuContextApi);
|
||||
|
||||
const isCommandMenuItemEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_COMMAND_MENU_ITEM_ENABLED,
|
||||
);
|
||||
|
||||
return (
|
||||
<CommandMenuContext.Provider
|
||||
@@ -64,12 +70,13 @@ export const CommandMenuContextProviderDefault = ({
|
||||
isInSidePanel,
|
||||
displayType,
|
||||
containerType,
|
||||
commandMenuItems: [
|
||||
...commandMenuItems,
|
||||
...runWorkflowRecordCommands,
|
||||
...runWorkflowRecordAgnosticCommands,
|
||||
...commandMenuItemFrontComponentActions,
|
||||
],
|
||||
commandMenuItems: isCommandMenuItemEnabled
|
||||
? commandMenuItemFrontComponentActions
|
||||
: [
|
||||
...commandMenuItems,
|
||||
...runWorkflowRecordCommands,
|
||||
...runWorkflowRecordAgnosticCommands,
|
||||
],
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
+39
-15
@@ -1,12 +1,12 @@
|
||||
import { useRunWorkflowRecordAgnosticCommands } from '@/command-menu-item/record-agnostic/workflow/hooks/useRunWorkflowRecordAgnosticCommands';
|
||||
import {
|
||||
CommandMenuContext,
|
||||
type CommandMenuContextType,
|
||||
} from '@/command-menu-item/contexts/CommandMenuContext';
|
||||
import { useCommandMenuContextApi } from '@/command-menu-item/hooks/useCommandMenuContextApi';
|
||||
import { useCommandMenuItemFrontComponentCommands } from '@/command-menu-item/hooks/useCommandMenuItemFrontComponentCommands';
|
||||
import { useRegisteredCommandMenuItems } from '@/command-menu-item/hooks/useRegisteredCommandMenuItems';
|
||||
import { useShouldCommandMenuItemBeRegisteredParams } from '@/command-menu-item/hooks/useShouldCommandMenuItemBeRegisteredParams';
|
||||
import { useCommandMenuContextApi } from '@/command-menu-item/hooks/useCommandMenuContextApi';
|
||||
import { useCommandMenuItemFrontComponentActions } from '@/command-menu-item/hooks/useCommandMenuItemFrontComponentActions';
|
||||
import { useRunWorkflowRecordAgnosticCommands } from '@/command-menu-item/record-agnostic/workflow/hooks/useRunWorkflowRecordAgnosticCommands';
|
||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
@@ -14,7 +14,9 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||
import { type WorkflowWithCurrentVersion } from '@/workflow/types/Workflow';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
|
||||
type CommandMenuContextProviderWorkflowObjectsProps = {
|
||||
objectMetadataItem: ObjectMetadataItem;
|
||||
@@ -55,8 +57,30 @@ const CommandMenuContextProviderWorkflowObjectsContent = ({
|
||||
|
||||
const commandMenuContextApi = useCommandMenuContextApi();
|
||||
|
||||
const enrichedSelectedRecords = isDefined(workflowWithCurrentVersion)
|
||||
? commandMenuContextApi.selectedRecords.map((record) =>
|
||||
record.id === workflowWithCurrentVersion.id
|
||||
? {
|
||||
...record,
|
||||
currentVersion: workflowWithCurrentVersion.currentVersion,
|
||||
versions: workflowWithCurrentVersion.versions,
|
||||
statuses: workflowWithCurrentVersion.statuses,
|
||||
}
|
||||
: record,
|
||||
)
|
||||
: commandMenuContextApi.selectedRecords;
|
||||
|
||||
const enrichedCommandMenuContextApi = {
|
||||
...commandMenuContextApi,
|
||||
selectedRecords: enrichedSelectedRecords,
|
||||
};
|
||||
|
||||
const commandMenuItemFrontComponentActions =
|
||||
useCommandMenuItemFrontComponentActions(commandMenuContextApi);
|
||||
useCommandMenuItemFrontComponentCommands(enrichedCommandMenuContextApi);
|
||||
|
||||
const isCommandMenuItemEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_COMMAND_MENU_ITEM_ENABLED,
|
||||
);
|
||||
|
||||
return (
|
||||
<CommandMenuContext.Provider
|
||||
@@ -64,11 +88,9 @@ const CommandMenuContextProviderWorkflowObjectsContent = ({
|
||||
isInSidePanel,
|
||||
displayType,
|
||||
containerType,
|
||||
commandMenuItems: [
|
||||
...commandMenuItems,
|
||||
...runWorkflowRecordAgnosticCommands,
|
||||
...commandMenuItemFrontComponentActions,
|
||||
],
|
||||
commandMenuItems: isCommandMenuItemEnabled
|
||||
? commandMenuItemFrontComponentActions
|
||||
: [...commandMenuItems, ...runWorkflowRecordAgnosticCommands],
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
@@ -104,7 +126,11 @@ const CommandMenuContextProviderWorkflowObjectsWithoutWorkflow = ({
|
||||
const commandMenuContextApi = useCommandMenuContextApi();
|
||||
|
||||
const commandMenuItemFrontComponentActions =
|
||||
useCommandMenuItemFrontComponentActions(commandMenuContextApi);
|
||||
useCommandMenuItemFrontComponentCommands(commandMenuContextApi);
|
||||
|
||||
const isCommandMenuItemEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_COMMAND_MENU_ITEM_ENABLED,
|
||||
);
|
||||
|
||||
return (
|
||||
<CommandMenuContext.Provider
|
||||
@@ -112,11 +138,9 @@ const CommandMenuContextProviderWorkflowObjectsWithoutWorkflow = ({
|
||||
isInSidePanel,
|
||||
displayType,
|
||||
containerType,
|
||||
commandMenuItems: [
|
||||
...commandMenuItems,
|
||||
...runWorkflowRecordAgnosticCommands,
|
||||
...commandMenuItemFrontComponentActions,
|
||||
],
|
||||
commandMenuItems: isCommandMenuItemEnabled
|
||||
? commandMenuItemFrontComponentActions
|
||||
: [...commandMenuItems, ...runWorkflowRecordAgnosticCommands],
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
+42
-30
@@ -1,8 +1,9 @@
|
||||
import { CommandMenuContext } from '@/command-menu-item/contexts/CommandMenuContext';
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { objectPermissionsFamilySelector } from '@/auth/states/objectPermissionsFamilySelector';
|
||||
import { CommandMenuContext } from '@/command-menu-item/contexts/CommandMenuContext';
|
||||
import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState';
|
||||
import { contextStoreCurrentViewTypeComponentState } from '@/context-store/states/contextStoreCurrentViewTypeComponentState';
|
||||
import { contextStoreIsPageInEditModeComponentState } from '@/context-store/states/contextStoreIsPageInEditModeComponentState';
|
||||
import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsComponentState';
|
||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||
import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType';
|
||||
@@ -12,16 +13,17 @@ import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadat
|
||||
import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPermissionsForObject';
|
||||
import { hasAnySoftDeleteFilterOnViewComponentSelector } from '@/object-record/record-filter/states/hasAnySoftDeleteFilterOnView';
|
||||
import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { recordStoreRecordsSelector } from '@/object-record/record-store/states/selectors/recordStoreRecordsSelector';
|
||||
import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
|
||||
import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { isNonEmptyArray } from '@sniptt/guards';
|
||||
import { useStore } from 'jotai';
|
||||
import { useContext } from 'react';
|
||||
import {
|
||||
CoreObjectNameSingular,
|
||||
CommandMenuContextApiPageType,
|
||||
type CommandMenuContextApi,
|
||||
} from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
@@ -53,28 +55,35 @@ export const useCommandMenuContextApi = (): CommandMenuContextApi => {
|
||||
const { sortedFavorites: favorites } = useFavorites();
|
||||
const { navigationMenuItems } = usePrefetchedNavigationMenuItemsData();
|
||||
|
||||
const recordId =
|
||||
const recordIds =
|
||||
contextStoreTargetedRecordsRule.mode === 'selection'
|
||||
? contextStoreTargetedRecordsRule.selectedRecordIds[0]
|
||||
? contextStoreTargetedRecordsRule.selectedRecordIds
|
||||
: undefined;
|
||||
|
||||
const isFavorite = (() => {
|
||||
if (!isDefined(recordId)) return false;
|
||||
const favoriteRecordIds = (() => {
|
||||
if (!isNonEmptyArray(recordIds)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (isNavigationMenuItemEditingEnabled && isDefined(objectMetadataItem)) {
|
||||
return !!navigationMenuItems?.find(
|
||||
(item) =>
|
||||
item.targetRecordId === recordId &&
|
||||
item.targetObjectMetadataId === objectMetadataItem.id,
|
||||
return recordIds.filter((recordId) =>
|
||||
navigationMenuItems?.some(
|
||||
(item) =>
|
||||
item.targetRecordId === recordId &&
|
||||
item.targetObjectMetadataId === objectMetadataItem.id,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return !!favorites?.find((favorite) => favorite.recordId === recordId);
|
||||
return recordIds.filter((recordId) =>
|
||||
favorites?.some((favorite) => favorite.recordId === recordId),
|
||||
);
|
||||
})();
|
||||
|
||||
const selectedRecord =
|
||||
useAtomFamilyStateValue(recordStoreFamilyState, recordId ?? '') ||
|
||||
undefined;
|
||||
const selectedRecords = useAtomFamilySelectorValue(
|
||||
recordStoreRecordsSelector,
|
||||
{ recordIds: recordIds ?? [] },
|
||||
);
|
||||
|
||||
const objectPermissionsFromHook = useObjectPermissionsForObject(
|
||||
objectMetadataItem?.id ?? '',
|
||||
@@ -92,12 +101,6 @@ export const useCommandMenuContextApi = (): CommandMenuContextApi => {
|
||||
rowLevelPermissionPredicateGroups: [],
|
||||
};
|
||||
|
||||
const isNoteOrTask =
|
||||
objectMetadataItem?.nameSingular === CoreObjectNameSingular.Note ||
|
||||
objectMetadataItem?.nameSingular === CoreObjectNameSingular.Task;
|
||||
|
||||
const isRemote = objectMetadataItem?.isRemote ?? false;
|
||||
|
||||
const { recordIndexId } = useRecordIndexIdFromCurrentContextStore();
|
||||
|
||||
const hasAnySoftDeleteFilterOnView = useAtomComponentSelectorValue(
|
||||
@@ -105,9 +108,18 @@ export const useCommandMenuContextApi = (): CommandMenuContextApi => {
|
||||
recordIndexId,
|
||||
);
|
||||
|
||||
const isShowPage =
|
||||
useAtomComponentStateValue(contextStoreCurrentViewTypeComponentState) ===
|
||||
ContextStoreViewType.ShowPage;
|
||||
const contextStoreCurrentViewType = useAtomComponentStateValue(
|
||||
contextStoreCurrentViewTypeComponentState,
|
||||
);
|
||||
|
||||
const contextStoreIsPageInEditMode = useAtomComponentStateValue(
|
||||
contextStoreIsPageInEditModeComponentState,
|
||||
);
|
||||
|
||||
const pageType =
|
||||
contextStoreCurrentViewType === ContextStoreViewType.ShowPage
|
||||
? CommandMenuContextApiPageType.RECORD_PAGE
|
||||
: CommandMenuContextApiPageType.INDEX_PAGE;
|
||||
|
||||
const contextStoreNumberOfSelectedRecords = useAtomComponentStateValue(
|
||||
contextStoreNumberOfSelectedRecordsComponentState,
|
||||
@@ -139,18 +151,18 @@ export const useCommandMenuContextApi = (): CommandMenuContextApi => {
|
||||
}
|
||||
|
||||
return {
|
||||
isShowPage,
|
||||
pageType,
|
||||
isInSidePanel,
|
||||
isFavorite,
|
||||
isRemote,
|
||||
isNoteOrTask,
|
||||
isPageInEditMode: contextStoreIsPageInEditMode,
|
||||
favoriteRecordIds,
|
||||
isSelectAll,
|
||||
hasAnySoftDeleteFilterOnView,
|
||||
numberOfSelectedRecords: contextStoreNumberOfSelectedRecords,
|
||||
objectPermissions,
|
||||
selectedRecord: selectedRecord as CommandMenuContextApi['selectedRecord'],
|
||||
selectedRecords,
|
||||
featureFlags,
|
||||
targetObjectReadPermissions,
|
||||
targetObjectWritePermissions,
|
||||
objectMetadataItem: objectMetadataItem ?? {},
|
||||
};
|
||||
};
|
||||
|
||||
+52
-37
@@ -2,17 +2,15 @@ import { Command } from '@/command-menu-item/display/components/Command';
|
||||
import { HeadlessFrontComponentCommandMenuItem } from '@/command-menu-item/display/components/HeadlessFrontComponentCommandMenuItem';
|
||||
import { CommandMenuItemScope } from '@/command-menu-item/types/CommandMenuItemScope';
|
||||
import { CommandMenuItemType } from '@/command-menu-item/types/CommandMenuItemType';
|
||||
import { CommandMenuContext } from '@/command-menu-item/contexts/CommandMenuContext';
|
||||
import { useOpenFrontComponentInSidePanel } from '@/side-panel/hooks/useOpenFrontComponentInSidePanel';
|
||||
import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState';
|
||||
import { contextStoreIsPageInEditModeComponentState } from '@/context-store/states/contextStoreIsPageInEditModeComponentState';
|
||||
import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
|
||||
import { useMountHeadlessFrontComponent } from '@/front-components/hooks/useMountHeadlessFrontComponent';
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { useOpenFrontComponentInSidePanel } from '@/side-panel/hooks/useOpenFrontComponentInSidePanel';
|
||||
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { useContext } from 'react';
|
||||
import { type CommandMenuContextApi } from 'twenty-shared/types';
|
||||
import {
|
||||
evaluateConditionalAvailabilityExpression,
|
||||
@@ -36,8 +34,8 @@ type CommandMenuItemWithFrontComponent = CommandMenuItemFieldsFragment & {
|
||||
|
||||
type BuildCommandMenuItemFromFrontComponentParams = {
|
||||
item: CommandMenuItemWithFrontComponent;
|
||||
type?: CommandMenuItemType;
|
||||
scope: CommandMenuItemScope;
|
||||
index: number;
|
||||
isPinned: boolean;
|
||||
getIcon: ReturnType<typeof useIcons>['getIcon'];
|
||||
openFrontComponentInSidePanel: (params: {
|
||||
@@ -61,8 +59,8 @@ type BuildCommandMenuItemFromFrontComponentParams = {
|
||||
// once we have migrated all command menu items
|
||||
const buildCommandMenuItemFromFrontComponent = ({
|
||||
item,
|
||||
type = CommandMenuItemType.FrontComponent,
|
||||
scope,
|
||||
index,
|
||||
isPinned,
|
||||
getIcon,
|
||||
openFrontComponentInSidePanel,
|
||||
@@ -95,12 +93,12 @@ const buildCommandMenuItemFromFrontComponent = ({
|
||||
};
|
||||
|
||||
return {
|
||||
type: CommandMenuItemType.FrontComponent,
|
||||
type,
|
||||
key: `command-menu-item-front-component-${item.id}`,
|
||||
scope,
|
||||
label: displayLabel,
|
||||
shortLabel: displayLabel,
|
||||
position: index,
|
||||
shortLabel: item.shortLabel ?? undefined,
|
||||
position: item.position,
|
||||
isPinned,
|
||||
Icon,
|
||||
shouldBeRegistered: () =>
|
||||
@@ -119,7 +117,7 @@ const buildCommandMenuItemFromFrontComponent = ({
|
||||
};
|
||||
};
|
||||
|
||||
export const useCommandMenuItemFrontComponentActions = (
|
||||
export const useCommandMenuItemFrontComponentCommands = (
|
||||
commandMenuContextApi: CommandMenuContextApi,
|
||||
) => {
|
||||
const { getIcon } = useIcons();
|
||||
@@ -130,8 +128,6 @@ export const useCommandMenuItemFrontComponentActions = (
|
||||
contextStoreIsPageInEditModeComponentState,
|
||||
);
|
||||
|
||||
const { containerType } = useContext(CommandMenuContext);
|
||||
|
||||
const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue(
|
||||
contextStoreCurrentObjectMetadataItemIdComponentState,
|
||||
);
|
||||
@@ -151,6 +147,10 @@ export const useCommandMenuItemFrontComponentActions = (
|
||||
? contextStoreTargetedRecordsRule.selectedRecordIds
|
||||
: [];
|
||||
|
||||
const hasRecordSelection =
|
||||
selectedRecordIds.length >= 1 ||
|
||||
contextStoreTargetedRecordsRule.mode === 'exclusion';
|
||||
|
||||
const mountContext: HeadlessFrontComponentMountContext | undefined =
|
||||
selectedRecordIds.length === 1 && isDefined(currentObjectMetadataItem)
|
||||
? {
|
||||
@@ -164,10 +164,7 @@ export const useCommandMenuItemFrontComponentActions = (
|
||||
);
|
||||
|
||||
const { data } = useFindManyCommandMenuItemsQuery({
|
||||
skip:
|
||||
!isCommandMenuItemEnabled ||
|
||||
(containerType !== 'command-menu-list' &&
|
||||
containerType !== 'command-menu-show-page-dropdown'),
|
||||
skip: !isCommandMenuItemEnabled,
|
||||
});
|
||||
|
||||
const frontComponentItems =
|
||||
@@ -176,35 +173,33 @@ export const useCommandMenuItemFrontComponentActions = (
|
||||
isDefined(item.frontComponentId),
|
||||
) ?? [];
|
||||
|
||||
const selectedRecordCount =
|
||||
contextStoreTargetedRecordsRule.mode === 'selection'
|
||||
? contextStoreTargetedRecordsRule.selectedRecordIds.length
|
||||
: 0;
|
||||
|
||||
const objectMatches = (item: CommandMenuItemWithFrontComponent) =>
|
||||
!isDefined(item.availabilityObjectMetadataId) ||
|
||||
item.availabilityObjectMetadataId ===
|
||||
contextStoreCurrentObjectMetadataItemId;
|
||||
|
||||
const globalItems = frontComponentItems.filter(
|
||||
const frontComponentItemsWithObjectMatches =
|
||||
frontComponentItems.filter(objectMatches);
|
||||
|
||||
const globalItems = frontComponentItemsWithObjectMatches.filter(
|
||||
(item) => item.availabilityType === CommandMenuItemAvailabilityType.GLOBAL,
|
||||
);
|
||||
|
||||
const recordScopedItems = frontComponentItems.filter((item) => {
|
||||
if (!objectMatches(item)) return false;
|
||||
|
||||
return (
|
||||
const recordScopedItems = frontComponentItemsWithObjectMatches.filter(
|
||||
(item) =>
|
||||
item.availabilityType ===
|
||||
CommandMenuItemAvailabilityType.RECORD_SELECTION &&
|
||||
selectedRecordCount >= 1
|
||||
);
|
||||
});
|
||||
CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
);
|
||||
|
||||
const globalCommandMenuItems = globalItems.map((item, index) =>
|
||||
const fallbackItems = frontComponentItemsWithObjectMatches.filter(
|
||||
(item) =>
|
||||
item.availabilityType === CommandMenuItemAvailabilityType.FALLBACK,
|
||||
);
|
||||
|
||||
const globalCommandMenuItems = globalItems.map((item) =>
|
||||
buildCommandMenuItemFromFrontComponent({
|
||||
item,
|
||||
scope: CommandMenuItemScope.Global,
|
||||
index,
|
||||
isPinned: !contextStoreIsPageInEditMode && item.isPinned,
|
||||
getIcon,
|
||||
openFrontComponentInSidePanel,
|
||||
@@ -213,19 +208,39 @@ export const useCommandMenuItemFrontComponentActions = (
|
||||
}),
|
||||
);
|
||||
|
||||
const recordScopedCommandMenuItems = recordScopedItems.map((item, index) =>
|
||||
const recordScopedCommandMenuItems = hasRecordSelection
|
||||
? recordScopedItems.map((item) =>
|
||||
buildCommandMenuItemFromFrontComponent({
|
||||
item,
|
||||
scope: CommandMenuItemScope.RecordSelection,
|
||||
isPinned: !contextStoreIsPageInEditMode && item.isPinned,
|
||||
getIcon,
|
||||
openFrontComponentInSidePanel,
|
||||
mountHeadlessFrontComponent,
|
||||
commandMenuContextApi,
|
||||
mountContext,
|
||||
}),
|
||||
)
|
||||
: [];
|
||||
|
||||
const fallbackCommandMenuItems = fallbackItems.map((item) =>
|
||||
buildCommandMenuItemFromFrontComponent({
|
||||
item,
|
||||
scope: CommandMenuItemScope.RecordSelection,
|
||||
index,
|
||||
isPinned: !contextStoreIsPageInEditMode && item.isPinned,
|
||||
type: CommandMenuItemType.Fallback,
|
||||
scope: CommandMenuItemScope.Global,
|
||||
isPinned: false,
|
||||
getIcon,
|
||||
openFrontComponentInSidePanel,
|
||||
mountHeadlessFrontComponent,
|
||||
commandMenuContextApi,
|
||||
mountContext,
|
||||
}),
|
||||
);
|
||||
|
||||
return [...globalCommandMenuItems, ...recordScopedCommandMenuItems];
|
||||
return [
|
||||
...globalCommandMenuItems,
|
||||
...recordScopedCommandMenuItems,
|
||||
...fallbackCommandMenuItems,
|
||||
]
|
||||
.filter((item) => item.shouldBeRegistered())
|
||||
.sort((a, b) => a.position - b.position);
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
export type BaseObjectRecord = {
|
||||
id: string;
|
||||
import { type ObjectRecord as SharedObjectRecord } from 'twenty-shared/types';
|
||||
|
||||
export type BaseObjectRecord = SharedObjectRecord & {
|
||||
__typename: string;
|
||||
};
|
||||
|
||||
@@ -44,6 +44,11 @@
|
||||
"import": "./dist/front-component-renderer/index.mjs",
|
||||
"require": "./dist/front-component-renderer/index.cjs"
|
||||
},
|
||||
"./build": {
|
||||
"types": "./dist/build/index.d.ts",
|
||||
"import": "./dist/build.mjs",
|
||||
"require": "./dist/build.cjs"
|
||||
},
|
||||
"./clients": {
|
||||
"types": "./dist/clients/index.d.ts",
|
||||
"import": "./dist/clients.mjs",
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export { getFrontComponentBuildPlugins } from '@/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins';
|
||||
export { getBaseFrontComponentBuildOptions } from '@/cli/utilities/build/common/front-component-build/utils/get-base-front-component-build-options';
|
||||
export { FRONT_COMPONENT_EXTERNAL_MODULES } from '@/cli/utilities/build/common/front-component-build/constants/front-component-external-modules';
|
||||
export { processEsbuildResult } from '@/cli/utilities/build/common/esbuild-result-processor';
|
||||
export type { ProcessEsbuildResultParams } from '@/cli/utilities/build/common/esbuild-result-processor';
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
LOGIC_FUNCTION_EXTERNAL_MODULES,
|
||||
createSdkClientsResolverPlugin,
|
||||
} from '@/cli/utilities/build/common/esbuild-watcher';
|
||||
import { FRONT_COMPONENT_EXTERNAL_MODULES } from '@/cli/utilities/build/common/front-component-build/constants/front-component-external-modules';
|
||||
import { getBaseFrontComponentBuildOptions } from '@/cli/utilities/build/common/front-component-build/utils/get-base-front-component-build-options';
|
||||
import { getFrontComponentBuildPlugins } from '@/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins';
|
||||
import { type OnFileBuiltCallback } from '@/cli/utilities/build/common/restartable-watcher-interface';
|
||||
import { type EntityFilePaths } from '@/cli/utilities/build/manifest/manifest-extract-config';
|
||||
@@ -90,17 +90,9 @@ export const buildApplication = async (
|
||||
sourcePaths: frontComponents,
|
||||
fileFolder: FileFolder.BuiltFrontComponent,
|
||||
buildOptions: {
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
...getBaseFrontComponentBuildOptions(),
|
||||
outdir: join(options.appPath, OUTPUT_DIR),
|
||||
outExtension: { '.js': '.mjs' },
|
||||
external: FRONT_COMPONENT_EXTERNAL_MODULES,
|
||||
tsconfig: join(options.appPath, 'tsconfig.json'),
|
||||
jsx: 'automatic',
|
||||
sourcemap: true,
|
||||
metafile: true,
|
||||
logLevel: 'silent',
|
||||
plugins: [
|
||||
createSdkClientsResolverPlugin(options.appPath),
|
||||
...getFrontComponentBuildPlugins(),
|
||||
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
import {
|
||||
defineFrontComponent,
|
||||
none,
|
||||
numberOfSelectedRecords,
|
||||
objectPermissions,
|
||||
selectedRecord,
|
||||
selectedRecords,
|
||||
} from '@/sdk';
|
||||
|
||||
const MyComponent = () => null;
|
||||
@@ -15,7 +16,7 @@ export default defineFrontComponent({
|
||||
label: 'Complex Soft Delete',
|
||||
conditionalAvailabilityExpression:
|
||||
objectPermissions.canSoftDeleteObjectRecords &&
|
||||
!selectedRecord.isRemote &&
|
||||
none(selectedRecords, 'isRemote') &&
|
||||
numberOfSelectedRecords > 0,
|
||||
},
|
||||
});
|
||||
|
||||
+5
-2
@@ -1,4 +1,4 @@
|
||||
import { defineFrontComponent, isDefined, selectedRecord } from '@/sdk';
|
||||
import { defineFrontComponent, someDefined, selectedRecords } from '@/sdk';
|
||||
|
||||
const MyComponent = () => null;
|
||||
|
||||
@@ -8,6 +8,9 @@ export default defineFrontComponent({
|
||||
command: {
|
||||
universalIdentifier: 'custom-function-cmd',
|
||||
label: 'Custom Function',
|
||||
conditionalAvailabilityExpression: isDefined(selectedRecord.deletedAt),
|
||||
conditionalAvailabilityExpression: someDefined(
|
||||
selectedRecords,
|
||||
'deletedAt',
|
||||
),
|
||||
},
|
||||
});
|
||||
|
||||
+9
-2
@@ -1,4 +1,9 @@
|
||||
import { defineFrontComponent, isFavorite, isRemote, isShowPage } from '@/sdk';
|
||||
import {
|
||||
defineFrontComponent,
|
||||
favoriteRecordIds,
|
||||
objectMetadataItem,
|
||||
pageType,
|
||||
} from '@/sdk';
|
||||
|
||||
const MyComponent = () => null;
|
||||
|
||||
@@ -8,6 +13,8 @@ export default defineFrontComponent({
|
||||
command: {
|
||||
universalIdentifier: 'parenthesized-expression-cmd',
|
||||
label: 'Parenthesized Expression',
|
||||
conditionalAvailabilityExpression: (isShowPage || isFavorite) && !isRemote,
|
||||
conditionalAvailabilityExpression:
|
||||
(pageType === 'RECORD_PAGE' || favoriteRecordIds.length > 0) &&
|
||||
!objectMetadataItem.isRemote,
|
||||
},
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { defineFrontComponent, isShowPage } from '@/sdk';
|
||||
import { defineFrontComponent, pageType } from '@/sdk';
|
||||
|
||||
const MyComponent = () => null;
|
||||
|
||||
@@ -8,6 +8,6 @@ export default defineFrontComponent({
|
||||
command: {
|
||||
universalIdentifier: 'simple-boolean-cmd',
|
||||
label: 'Simple Boolean',
|
||||
conditionalAvailabilityExpression: isShowPage,
|
||||
conditionalAvailabilityExpression: pageType === 'RECORD_PAGE',
|
||||
},
|
||||
});
|
||||
|
||||
+8
-2
@@ -1,4 +1,9 @@
|
||||
import { defineFrontComponent, isShowPage, selectedRecord } from '@/sdk';
|
||||
import {
|
||||
defineFrontComponent,
|
||||
everyEquals,
|
||||
pageType,
|
||||
selectedRecords,
|
||||
} from '@/sdk';
|
||||
|
||||
const MyComponent = () => null;
|
||||
|
||||
@@ -9,6 +14,7 @@ export default defineFrontComponent({
|
||||
universalIdentifier: 'string-comparison-cmd',
|
||||
label: 'String Comparison',
|
||||
conditionalAvailabilityExpression:
|
||||
isShowPage && selectedRecord.company.name === 'apple',
|
||||
pageType === 'RECORD_PAGE' &&
|
||||
everyEquals(selectedRecords, 'company.name', 'apple'),
|
||||
},
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
defineFrontComponent,
|
||||
isShowPage,
|
||||
pageType,
|
||||
targetObjectWritePermissions,
|
||||
} from '@/sdk';
|
||||
|
||||
@@ -13,6 +13,6 @@ export default defineFrontComponent({
|
||||
universalIdentifier: 'target-permissions-cmd',
|
||||
label: 'Target Permissions',
|
||||
conditionalAvailabilityExpression:
|
||||
isShowPage && targetObjectWritePermissions.person,
|
||||
pageType === 'RECORD_PAGE' && targetObjectWritePermissions.person,
|
||||
},
|
||||
});
|
||||
|
||||
+14
@@ -77,6 +77,20 @@ describe('toExprEval', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('array .length to arrayLength()', () => {
|
||||
it('should convert favoriteRecordIds.length to arrayLength(favoriteRecordIds)', () => {
|
||||
expect(toExprEval('favoriteRecordIds.length > 0')).toBe(
|
||||
'arrayLength(favoriteRecordIds) > 0',
|
||||
);
|
||||
});
|
||||
|
||||
it('should convert selectedRecords.length to arrayLength(selectedRecords)', () => {
|
||||
expect(toExprEval('selectedRecords.length === 1')).toBe(
|
||||
'arrayLength(selectedRecords) == 1',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('edge cases', () => {
|
||||
it('should return an empty string unchanged', () => {
|
||||
expect(toExprEval('')).toBe('');
|
||||
|
||||
+87
-70
@@ -2,7 +2,10 @@ import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import { transformConditionalAvailabilityExpressionsForEsBuildPlugin } from '@/cli/utilities/build/common/conditional-availability/utils/transform-conditional-availability-expressions';
|
||||
import { type CommandMenuContextApi } from 'twenty-shared/types';
|
||||
import {
|
||||
CommandMenuContextApiPageType,
|
||||
type CommandMenuContextApi,
|
||||
} from 'twenty-shared/types';
|
||||
import { evaluateConditionalAvailabilityExpression } from 'twenty-shared/utils';
|
||||
|
||||
const MOCKS_DIR = path.join(__dirname, '__mocks__');
|
||||
@@ -13,11 +16,10 @@ const readMock = (filename: string): string =>
|
||||
const buildMockCommandMenuContextApi = (
|
||||
overrides: Partial<CommandMenuContextApi> = {},
|
||||
): CommandMenuContextApi => ({
|
||||
isShowPage: false,
|
||||
pageType: CommandMenuContextApiPageType.INDEX_PAGE,
|
||||
isInSidePanel: false,
|
||||
isFavorite: false,
|
||||
isRemote: false,
|
||||
isNoteOrTask: false,
|
||||
isPageInEditMode: false,
|
||||
favoriteRecordIds: [],
|
||||
isSelectAll: false,
|
||||
hasAnySoftDeleteFilterOnView: false,
|
||||
numberOfSelectedRecords: 0,
|
||||
@@ -31,10 +33,11 @@ const buildMockCommandMenuContextApi = (
|
||||
rowLevelPermissionPredicates: [],
|
||||
rowLevelPermissionPredicateGroups: [],
|
||||
},
|
||||
selectedRecord: undefined,
|
||||
selectedRecords: [],
|
||||
featureFlags: {},
|
||||
targetObjectReadPermissions: {},
|
||||
targetObjectWritePermissions: {},
|
||||
objectMetadataItem: {},
|
||||
...overrides,
|
||||
});
|
||||
|
||||
@@ -156,35 +159,37 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
|
||||
it('should handle multiple expressions in one source', () => {
|
||||
const source = [
|
||||
'const a = { conditionalAvailabilityExpression: isShowPage };',
|
||||
'const b = { conditionalAvailabilityExpression: isFavorite && !isRemote };',
|
||||
'const a = { conditionalAvailabilityExpression: pageType === "RECORD_PAGE" };',
|
||||
'const b = { conditionalAvailabilityExpression: favoriteRecordIds.length > 0 && !objectMetadataItem.isRemote };',
|
||||
].join('\n');
|
||||
const transformed =
|
||||
transformConditionalAvailabilityExpressionsForEsBuildPlugin(source);
|
||||
|
||||
expect(transformed).toContain(
|
||||
'conditionalAvailabilityExpression: "isShowPage"',
|
||||
'conditionalAvailabilityExpression: "pageType == \\"RECORD_PAGE\\""',
|
||||
);
|
||||
expect(transformed).toContain(
|
||||
'conditionalAvailabilityExpression: "isFavorite and not isRemote"',
|
||||
'conditionalAvailabilityExpression: "arrayLength(favoriteRecordIds) > 0 and not objectMetadataItem.isRemote"',
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle extra spaces around colon', () => {
|
||||
const source =
|
||||
'{ conditionalAvailabilityExpression : isShowPage && isFavorite }';
|
||||
'{ conditionalAvailabilityExpression : pageType === "RECORD_PAGE" && favoriteRecordIds.length > 0 }';
|
||||
const transformed =
|
||||
transformConditionalAvailabilityExpressionsForEsBuildPlugin(source);
|
||||
|
||||
expect(transformed).toContain('"isShowPage and isFavorite"');
|
||||
expect(transformed).toContain(
|
||||
'"pageType == \\"RECORD_PAGE\\" and arrayLength(favoriteRecordIds) > 0"',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('e2e: mock file -> transform -> evaluate', () => {
|
||||
describe('simple-boolean-front-component', () => {
|
||||
it('should evaluate isShowPage when true', () => {
|
||||
it('should evaluate pageType when RECORD_PAGE', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
isShowPage: true,
|
||||
pageType: CommandMenuContextApiPageType.RECORD_PAGE,
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -195,9 +200,9 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should evaluate isShowPage when false', () => {
|
||||
it('should evaluate pageType when INDEX_PAGE', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
isShowPage: false,
|
||||
pageType: CommandMenuContextApiPageType.INDEX_PAGE,
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -297,13 +302,15 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
it('should allow soft delete for local record with selection', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
numberOfSelectedRecords: 2,
|
||||
selectedRecord: {
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: null,
|
||||
isRemote: false,
|
||||
},
|
||||
selectedRecords: [
|
||||
{
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: null,
|
||||
isRemote: false,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -317,13 +324,15 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
it('should deny soft delete when record is remote', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
numberOfSelectedRecords: 1,
|
||||
selectedRecord: {
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: null,
|
||||
isRemote: true,
|
||||
},
|
||||
selectedRecords: [
|
||||
{
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: null,
|
||||
isRemote: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -338,9 +347,9 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
describe('parenthesized-expression-front-component', () => {
|
||||
it('should allow when favorite and not remote', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
isShowPage: false,
|
||||
isFavorite: true,
|
||||
isRemote: false,
|
||||
pageType: CommandMenuContextApiPageType.INDEX_PAGE,
|
||||
favoriteRecordIds: ['rec-1'],
|
||||
objectMetadataItem: { isRemote: false },
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -351,11 +360,11 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should deny when remote even if show page', () => {
|
||||
it('should deny when remote even if record page', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
isShowPage: true,
|
||||
isFavorite: false,
|
||||
isRemote: true,
|
||||
pageType: CommandMenuContextApiPageType.RECORD_PAGE,
|
||||
favoriteRecordIds: [],
|
||||
objectMetadataItem: { isRemote: true },
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -370,12 +379,14 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
describe('custom-function-front-component', () => {
|
||||
it('should return false when deletedAt is null', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
selectedRecord: {
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: null,
|
||||
},
|
||||
selectedRecords: [
|
||||
{
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: null,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -388,12 +399,14 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
|
||||
it('should return true when deletedAt is set', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
selectedRecord: {
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: '2024-06-01',
|
||||
},
|
||||
selectedRecords: [
|
||||
{
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: '2024-06-01',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -406,16 +419,18 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
});
|
||||
|
||||
describe('string-comparison-front-component', () => {
|
||||
it('should match when on show page and company name matches', () => {
|
||||
it('should match when on record page and company name matches', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
isShowPage: true,
|
||||
selectedRecord: {
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: null,
|
||||
company: { name: 'apple' },
|
||||
},
|
||||
pageType: CommandMenuContextApiPageType.RECORD_PAGE,
|
||||
selectedRecords: [
|
||||
{
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: null,
|
||||
company: { name: 'apple' },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -428,14 +443,16 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
|
||||
it('should not match when company name differs', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
isShowPage: true,
|
||||
selectedRecord: {
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: null,
|
||||
company: { name: 'google' },
|
||||
},
|
||||
pageType: CommandMenuContextApiPageType.RECORD_PAGE,
|
||||
selectedRecords: [
|
||||
{
|
||||
id: 'rec-1',
|
||||
createdAt: '2024-01-01',
|
||||
updatedAt: '2024-01-01',
|
||||
deletedAt: null,
|
||||
company: { name: 'google' },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -448,9 +465,9 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
});
|
||||
|
||||
describe('target-permissions-front-component', () => {
|
||||
it('should allow when on show page with write permission', () => {
|
||||
it('should allow when on record page with write permission', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
isShowPage: true,
|
||||
pageType: CommandMenuContextApiPageType.RECORD_PAGE,
|
||||
targetObjectWritePermissions: { person: true },
|
||||
});
|
||||
|
||||
@@ -462,9 +479,9 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should deny when not on show page', () => {
|
||||
it('should deny when not on record page', () => {
|
||||
const context = buildMockCommandMenuContextApi({
|
||||
isShowPage: false,
|
||||
pageType: CommandMenuContextApiPageType.INDEX_PAGE,
|
||||
targetObjectWritePermissions: { person: true },
|
||||
});
|
||||
|
||||
|
||||
+15
-6
@@ -1,7 +1,16 @@
|
||||
const ARRAY_LENGTH_REPLACEMENTS: [RegExp, string][] = [
|
||||
[/\bfavoriteRecordIds\.length\b/g, 'arrayLength(favoriteRecordIds)'],
|
||||
[/\bselectedRecords\.length\b/g, 'arrayLength(selectedRecords)'],
|
||||
];
|
||||
|
||||
export const toExprEval = (raw: string): string =>
|
||||
raw
|
||||
.replace(/!==/g, '!=')
|
||||
.replace(/===/g, '==')
|
||||
.replace(/&&/g, 'and')
|
||||
.replace(/\|\|/g, 'or')
|
||||
.replace(/!(?!=)/g, 'not ');
|
||||
ARRAY_LENGTH_REPLACEMENTS.reduce(
|
||||
(acc, [pattern, replacement]) => acc.replace(pattern, replacement),
|
||||
raw
|
||||
.replace(/!==/g, '!=')
|
||||
.replace(/===/g, '==')
|
||||
.replace(/&&/g, 'and')
|
||||
.replace(/\|\|/g, 'or')
|
||||
.replace(/!(?!=)/g, 'not ')
|
||||
.replace(/,(\s*\))/g, '$1'),
|
||||
);
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { toExprEval } from './to-expr-eval';
|
||||
|
||||
const CONDITIONAL_AVAILABILITY_EXPRESSION_PATTERN =
|
||||
/(conditionalAvailabilityExpression\s*:\s*)(?!['"`])([^,}]+)/g;
|
||||
/(conditionalAvailabilityExpression\s*:\s*)(?!['"`])((?:[^,}()]|\([^()]*\))+)/g;
|
||||
|
||||
export const transformConditionalAvailabilityExpressionsForEsBuildPlugin = (
|
||||
source: string,
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import type * as esbuild from 'esbuild';
|
||||
|
||||
import { FRONT_COMPONENT_EXTERNAL_MODULES } from '../constants/front-component-external-modules';
|
||||
import { getFrontComponentBuildPlugins } from './get-front-component-build-plugins';
|
||||
|
||||
export const getBaseFrontComponentBuildOptions = (): esbuild.BuildOptions => ({
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
format: 'esm',
|
||||
outExtension: { '.js': '.mjs' },
|
||||
external: FRONT_COMPONENT_EXTERNAL_MODULES,
|
||||
jsx: 'automatic',
|
||||
sourcemap: true,
|
||||
metafile: true,
|
||||
logLevel: 'silent',
|
||||
plugins: [...getFrontComponentBuildPlugins()],
|
||||
});
|
||||
@@ -2058,6 +2058,7 @@ type CommandMenuItem {
|
||||
enum CommandMenuItemAvailabilityType {
|
||||
GLOBAL
|
||||
RECORD_SELECTION
|
||||
FALLBACK
|
||||
}
|
||||
|
||||
type AgentChatThread {
|
||||
|
||||
@@ -1791,7 +1791,7 @@ export interface CommandMenuItem {
|
||||
__typename: 'CommandMenuItem'
|
||||
}
|
||||
|
||||
export type CommandMenuItemAvailabilityType = 'GLOBAL' | 'RECORD_SELECTION'
|
||||
export type CommandMenuItemAvailabilityType = 'GLOBAL' | 'RECORD_SELECTION' | 'FALLBACK'
|
||||
|
||||
export interface AgentChatThread {
|
||||
id: Scalars['UUID']
|
||||
@@ -8536,7 +8536,8 @@ export const enumLogicFunctionExecutionStatus = {
|
||||
|
||||
export const enumCommandMenuItemAvailabilityType = {
|
||||
GLOBAL: 'GLOBAL' as const,
|
||||
RECORD_SELECTION: 'RECORD_SELECTION' as const
|
||||
RECORD_SELECTION: 'RECORD_SELECTION' as const,
|
||||
FALLBACK: 'FALLBACK' as const
|
||||
}
|
||||
|
||||
export const enumModelFamily = {
|
||||
|
||||
+60
-10
@@ -1,14 +1,10 @@
|
||||
import { type CommandMenuContextApi } from 'twenty-shared/types';
|
||||
|
||||
export const isShowPage =
|
||||
null as unknown as CommandMenuContextApi['isShowPage'];
|
||||
export const pageType = null as unknown as CommandMenuContextApi['pageType'];
|
||||
export const isInSidePanel =
|
||||
null as unknown as CommandMenuContextApi['isInSidePanel'];
|
||||
export const isFavorite =
|
||||
null as unknown as CommandMenuContextApi['isFavorite'];
|
||||
export const isRemote = null as unknown as CommandMenuContextApi['isRemote'];
|
||||
export const isNoteOrTask =
|
||||
null as unknown as CommandMenuContextApi['isNoteOrTask'];
|
||||
export const favoriteRecordIds =
|
||||
null as unknown as CommandMenuContextApi['favoriteRecordIds'];
|
||||
export const isSelectAll =
|
||||
null as unknown as CommandMenuContextApi['isSelectAll'];
|
||||
export const hasAnySoftDeleteFilterOnView =
|
||||
@@ -17,9 +13,8 @@ export const numberOfSelectedRecords =
|
||||
null as unknown as CommandMenuContextApi['numberOfSelectedRecords'];
|
||||
export const objectPermissions =
|
||||
null as unknown as CommandMenuContextApi['objectPermissions'];
|
||||
export const selectedRecord = null as unknown as NonNullable<
|
||||
CommandMenuContextApi['selectedRecord']
|
||||
>;
|
||||
export const selectedRecords =
|
||||
null as unknown as CommandMenuContextApi['selectedRecords'];
|
||||
export const featureFlags =
|
||||
null as unknown as CommandMenuContextApi['featureFlags'];
|
||||
export const targetObjectReadPermissions =
|
||||
@@ -27,5 +22,60 @@ export const targetObjectReadPermissions =
|
||||
export const targetObjectWritePermissions =
|
||||
null as unknown as CommandMenuContextApi['targetObjectWritePermissions'];
|
||||
|
||||
export const objectMetadataItem =
|
||||
null as unknown as CommandMenuContextApi['objectMetadataItem'];
|
||||
|
||||
export const isDefined = null as unknown as (value: unknown) => boolean;
|
||||
export const isNonEmptyString = null as unknown as (value: unknown) => boolean;
|
||||
export const includes = null as unknown as (
|
||||
array: unknown,
|
||||
value: unknown,
|
||||
) => boolean;
|
||||
export const every = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
) => boolean;
|
||||
export const everyDefined = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
) => boolean;
|
||||
export const everyEquals = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
value: unknown,
|
||||
) => boolean;
|
||||
export const some = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
) => boolean;
|
||||
export const someDefined = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
) => boolean;
|
||||
export const someEquals = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
value: unknown,
|
||||
) => boolean;
|
||||
export const none = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
) => boolean;
|
||||
export const noneDefined = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
) => boolean;
|
||||
export const noneEquals = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
value: unknown,
|
||||
) => boolean;
|
||||
export const someNonEmptyString = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
) => boolean;
|
||||
export const includesEvery = null as unknown as (
|
||||
array: unknown,
|
||||
prop: string,
|
||||
value: unknown,
|
||||
) => boolean;
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
export {
|
||||
isShowPage,
|
||||
pageType,
|
||||
isInSidePanel,
|
||||
isFavorite,
|
||||
isRemote,
|
||||
isNoteOrTask,
|
||||
favoriteRecordIds,
|
||||
isSelectAll,
|
||||
hasAnySoftDeleteFilterOnView,
|
||||
numberOfSelectedRecords,
|
||||
objectPermissions,
|
||||
selectedRecord,
|
||||
selectedRecords,
|
||||
featureFlags,
|
||||
targetObjectReadPermissions,
|
||||
targetObjectWritePermissions,
|
||||
isDefined,
|
||||
isNonEmptyString,
|
||||
includes,
|
||||
every,
|
||||
everyDefined,
|
||||
everyEquals,
|
||||
some,
|
||||
someDefined,
|
||||
someEquals,
|
||||
none,
|
||||
noneDefined,
|
||||
noneEquals,
|
||||
someNonEmptyString,
|
||||
includesEvery,
|
||||
objectMetadataItem,
|
||||
} from './conditional-availability/conditional-availability-variables';
|
||||
export { setFrontComponentExecutionContext } from './context/frontComponentContext';
|
||||
export { closeSidePanel } from './functions/closeSidePanel';
|
||||
|
||||
@@ -90,21 +90,32 @@ export type {
|
||||
|
||||
// Conditional availability typed variables for command menu items
|
||||
export {
|
||||
isShowPage,
|
||||
isInSidePanel,
|
||||
isFavorite,
|
||||
isRemote,
|
||||
isNoteOrTask,
|
||||
isSelectAll,
|
||||
hasAnySoftDeleteFilterOnView,
|
||||
numberOfSelectedRecords,
|
||||
objectPermissions,
|
||||
selectedRecord,
|
||||
every,
|
||||
everyDefined,
|
||||
everyEquals,
|
||||
favoriteRecordIds,
|
||||
featureFlags,
|
||||
hasAnySoftDeleteFilterOnView,
|
||||
includes,
|
||||
includesEvery,
|
||||
isDefined,
|
||||
isInSidePanel,
|
||||
isNonEmptyString,
|
||||
isSelectAll,
|
||||
none,
|
||||
noneDefined,
|
||||
noneEquals,
|
||||
numberOfSelectedRecords,
|
||||
objectMetadataItem,
|
||||
objectPermissions,
|
||||
pageType,
|
||||
selectedRecords,
|
||||
some,
|
||||
someDefined,
|
||||
someEquals,
|
||||
someNonEmptyString,
|
||||
targetObjectReadPermissions,
|
||||
targetObjectWritePermissions,
|
||||
isDefined,
|
||||
isNonEmptyString,
|
||||
} from './front-component-api';
|
||||
|
||||
// Front Component API exports
|
||||
|
||||
@@ -27,6 +27,7 @@ export default defineConfig(() => {
|
||||
index: 'src/sdk/index.ts',
|
||||
cli: 'src/cli/cli.ts',
|
||||
operations: 'src/cli/public-operations/index.ts',
|
||||
build: 'src/build/index.ts',
|
||||
clients: 'src/clients/index.ts',
|
||||
},
|
||||
name: 'twenty-sdk',
|
||||
|
||||
@@ -227,7 +227,8 @@
|
||||
"@yarnpkg/types": "^4.0.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"twenty-emails": "workspace:*",
|
||||
"twenty-shared": "workspace:*"
|
||||
"twenty-shared": "workspace:*",
|
||||
"twenty-standard-application": "workspace:*"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^24.5.0",
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
"start": {
|
||||
"executor": "nx:run-commands",
|
||||
"cache": false,
|
||||
"dependsOn": ["^build"],
|
||||
"dependsOn": ["^build", "twenty-standard-application:build"],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-server",
|
||||
"command": "rimraf dist && NODE_ENV=development nest start --watch"
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddFallbackToCommandMenuItemAvailabilityType1772832588833
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'AddFallbackToCommandMenuItemAvailabilityType1772832588833';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "core"."commandMenuItem_availabilitytype_enum" ADD VALUE IF NOT EXISTS 'FALLBACK' AFTER 'RECORD_SELECTION'`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" DROP DEFAULT`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" TYPE character varying`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`UPDATE "core"."commandMenuItem" SET "availabilityType" = 'GLOBAL' WHERE "availabilityType" = 'FALLBACK'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "core"."commandMenuItem_availabilitytype_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "core"."commandMenuItem_availabilitytype_enum" AS ENUM('GLOBAL', 'RECORD_SELECTION')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" TYPE "core"."commandMenuItem_availabilitytype_enum" USING "availabilityType"::"core"."commandMenuItem_availabilitytype_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."commandMenuItem" ALTER COLUMN "availabilityType" SET DEFAULT 'GLOBAL'`,
|
||||
);
|
||||
}
|
||||
}
|
||||
+1
@@ -9,6 +9,7 @@ const AVAILABILITY_TYPE_MAP: Record<
|
||||
> = {
|
||||
GLOBAL: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
RECORD_SELECTION: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
FALLBACK: CommandMenuItemAvailabilityType.FALLBACK,
|
||||
};
|
||||
|
||||
export const fromCommandMenuItemManifestToUniversalFlatCommandMenuItem = ({
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ export class CommandMenuItemService {
|
||||
|
||||
return Object.values(flatCommandMenuItemMaps.byUniversalIdentifier)
|
||||
.filter(isDefined)
|
||||
.sort((a, b) => a.label.localeCompare(b.label))
|
||||
.sort((a, b) => a.position - b.position)
|
||||
.map(fromFlatCommandMenuItemToCommandMenuItemDto);
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ export class CommandMenuItemService {
|
||||
|
||||
return Object.values(flatCommandMenuItemMaps.byUniversalIdentifier)
|
||||
.filter(isDefined)
|
||||
.sort((a, b) => a.label.localeCompare(b.label));
|
||||
.sort((a, b) => a.position - b.position);
|
||||
}
|
||||
|
||||
async findByWorkflowVersionId(
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ import { SyncableEntity } from 'src/engine/workspace-manager/types/syncable-enti
|
||||
export enum CommandMenuItemAvailabilityType {
|
||||
GLOBAL = 'GLOBAL',
|
||||
RECORD_SELECTION = 'RECORD_SELECTION',
|
||||
FALLBACK = 'FALLBACK',
|
||||
}
|
||||
|
||||
@Entity({ name: 'commandMenuItem', schema: 'core' })
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ export const seedFeatureFlags = async ({
|
||||
{
|
||||
key: FeatureFlagKey.IS_COMMAND_MENU_ITEM_ENABLED,
|
||||
workspaceId: workspaceId,
|
||||
value: true,
|
||||
value: false,
|
||||
},
|
||||
{
|
||||
key: FeatureFlagKey.IS_DATE_TIME_WHOLE_DAY_FILTER_ENABLED,
|
||||
|
||||
+834
@@ -0,0 +1,834 @@
|
||||
import { STANDARD_OBJECTS } from 'twenty-shared/metadata';
|
||||
|
||||
import { CommandMenuItemAvailabilityType } from 'src/engine/metadata-modules/command-menu-item/entities/command-menu-item.entity';
|
||||
|
||||
import { STANDARD_FRONT_COMPONENTS } from './standard-front-component.constant';
|
||||
|
||||
export const STANDARD_COMMAND_MENU_ITEMS = {
|
||||
navigateToNextRecord: {
|
||||
universalIdentifier: '3db2457d-8e96-4b8e-94c9-ed95d3f95738',
|
||||
label: 'Navigate to next record',
|
||||
shortLabel: null,
|
||||
icon: 'IconChevronDown',
|
||||
position: 0,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and not isInSidePanel',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.navigateToNextRecord.universalIdentifier,
|
||||
},
|
||||
navigateToPreviousRecord: {
|
||||
universalIdentifier: 'ec10f871-415b-420b-8150-7e09f6f04833',
|
||||
label: 'Navigate to previous record',
|
||||
shortLabel: null,
|
||||
icon: 'IconChevronUp',
|
||||
position: 1,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and not isInSidePanel',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.navigateToPreviousRecord.universalIdentifier,
|
||||
},
|
||||
createNewRecord: {
|
||||
universalIdentifier: '08d255bf-58cd-47a5-bd82-78c5c58592f1',
|
||||
label: 'Create new record',
|
||||
shortLabel: 'New record',
|
||||
icon: 'IconPlus',
|
||||
position: 2,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "INDEX_PAGE" and objectPermissions.canUpdateObjectRecords and not hasAnySoftDeleteFilterOnView',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.createNewRecord.universalIdentifier,
|
||||
},
|
||||
deleteSingleRecord: {
|
||||
universalIdentifier: '6652773f-b9a9-4fa3-a52c-e2f2e259e430',
|
||||
label: 'Delete',
|
||||
shortLabel: 'Delete',
|
||||
icon: 'IconTrash',
|
||||
position: 3,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'numberOfSelectedRecords == 1 and not hasAnySoftDeleteFilterOnView and objectPermissions.canSoftDeleteObjectRecords and noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.deleteSingleRecord.universalIdentifier,
|
||||
},
|
||||
deleteMultipleRecords: {
|
||||
universalIdentifier: 'cde86f1f-2c13-42b1-812b-f2b2b468cb83',
|
||||
label: 'Delete records',
|
||||
shortLabel: 'Delete',
|
||||
icon: 'IconTrash',
|
||||
position: 4,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'numberOfSelectedRecords >= 2 and objectPermissions.canSoftDeleteObjectRecords and not hasAnySoftDeleteFilterOnView and numberOfSelectedRecords < 10000',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.deleteMultipleRecords.universalIdentifier,
|
||||
},
|
||||
restoreSingleRecord: {
|
||||
universalIdentifier: '8b3a1cae-3e4d-43c1-a71f-48592b2e47ff',
|
||||
label: 'Restore record',
|
||||
shortLabel: 'Restore',
|
||||
icon: 'IconRefresh',
|
||||
position: 5,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'numberOfSelectedRecords == 1 and everyDefined(selectedRecords, "deletedAt") and objectPermissions.canSoftDeleteObjectRecords and (pageType == "RECORD_PAGE" or hasAnySoftDeleteFilterOnView)',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.restoreSingleRecord.universalIdentifier,
|
||||
},
|
||||
restoreMultipleRecords: {
|
||||
universalIdentifier: '8b740c9d-d99a-45a8-812f-809caaf420ac',
|
||||
label: 'Restore records',
|
||||
shortLabel: 'Restore',
|
||||
icon: 'IconRefresh',
|
||||
position: 6,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'numberOfSelectedRecords >= 2 and objectPermissions.canSoftDeleteObjectRecords and hasAnySoftDeleteFilterOnView and numberOfSelectedRecords < 10000',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.restoreMultipleRecords.universalIdentifier,
|
||||
},
|
||||
destroySingleRecord: {
|
||||
universalIdentifier: '44a78417-c394-4bc8-961f-98b503030ddb',
|
||||
label: 'Permanently destroy record',
|
||||
shortLabel: 'Destroy',
|
||||
icon: 'IconTrashX',
|
||||
position: 7,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'numberOfSelectedRecords == 1 and objectPermissions.canDestroyObjectRecords and everyDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.destroySingleRecord.universalIdentifier,
|
||||
},
|
||||
destroyMultipleRecords: {
|
||||
universalIdentifier: 'c630b3fb-7920-40d1-9906-77d0aa797608',
|
||||
label: 'Permanently destroy records',
|
||||
shortLabel: 'Destroy',
|
||||
icon: 'IconTrashX',
|
||||
position: 8,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'numberOfSelectedRecords >= 2 and objectPermissions.canDestroyObjectRecords and hasAnySoftDeleteFilterOnView and numberOfSelectedRecords < 10000',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.destroyMultipleRecords.universalIdentifier,
|
||||
},
|
||||
addToFavorites: {
|
||||
universalIdentifier: '38bf80c3-bd55-4753-80ba-38aa66429a03',
|
||||
label: 'Add to favorites',
|
||||
shortLabel: null,
|
||||
icon: 'IconHeart',
|
||||
position: 9,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'arrayLength(favoriteRecordIds) < numberOfSelectedRecords and noneDefined(selectedRecords, "deletedAt") and not hasAnySoftDeleteFilterOnView',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.addToFavorites.universalIdentifier,
|
||||
},
|
||||
removeFromFavorites: {
|
||||
universalIdentifier: '3ea42507-44fa-4895-a36d-cbfef7355a50',
|
||||
label: 'Remove from favorites',
|
||||
shortLabel: null,
|
||||
icon: 'IconHeartOff',
|
||||
position: 10,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'arrayLength(favoriteRecordIds) == numberOfSelectedRecords and noneDefined(selectedRecords, "deletedAt") and not hasAnySoftDeleteFilterOnView',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.removeFromFavorites.universalIdentifier,
|
||||
},
|
||||
exportNoteToPdf: {
|
||||
universalIdentifier: '86c8f3aa-9276-4c16-8cff-e295e34fbaf0',
|
||||
label: 'Export to PDF',
|
||||
shortLabel: 'Export',
|
||||
icon: 'IconFileExport',
|
||||
position: 11,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and (objectMetadataItem.nameSingular == "note" or objectMetadataItem.nameSingular == "task") and someNonEmptyString(selectedRecords, "bodyV2.blocknote")',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.exportNoteToPdf.universalIdentifier,
|
||||
},
|
||||
exportFromRecordIndex: {
|
||||
universalIdentifier: 'a934ba8a-ac8f-487d-9cd9-06dfdaec1f49',
|
||||
label: 'Export',
|
||||
shortLabel: 'Export',
|
||||
icon: 'IconFileExport',
|
||||
position: 12,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression: 'pageType == "INDEX_PAGE"',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.exportFromRecordIndex.universalIdentifier,
|
||||
},
|
||||
exportFromRecordShow: {
|
||||
universalIdentifier: 'ba339455-f3c2-4ed1-bf77-3e316d7d6a66',
|
||||
label: 'Export',
|
||||
shortLabel: 'Export',
|
||||
icon: 'IconFileExport',
|
||||
position: 13,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression: 'pageType == "RECORD_PAGE"',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.exportFromRecordShow.universalIdentifier,
|
||||
},
|
||||
updateMultipleRecords: {
|
||||
universalIdentifier: '2e080651-f098-4a78-bea9-7a70002dc57c',
|
||||
label: 'Update records',
|
||||
shortLabel: 'Update',
|
||||
icon: 'IconEdit',
|
||||
position: 14,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'numberOfSelectedRecords >= 2 and objectPermissions.canUpdateObjectRecords',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.updateMultipleRecords.universalIdentifier,
|
||||
},
|
||||
mergeMultipleRecords: {
|
||||
universalIdentifier: '6c14eb04-8e7e-4d47-93c0-8ec4834e2e60',
|
||||
label: 'Merge records',
|
||||
shortLabel: 'Merge',
|
||||
icon: 'IconArrowMerge',
|
||||
position: 15,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'numberOfSelectedRecords >= 2 and isDefined(objectMetadataItem.duplicateCriteria) and objectPermissions.canUpdateObjectRecords and objectPermissions.canDestroyObjectRecords and numberOfSelectedRecords <= 9',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.mergeMultipleRecords.universalIdentifier,
|
||||
},
|
||||
exportMultipleRecords: {
|
||||
universalIdentifier: 'f71f68e5-7b6e-4c03-8161-c48434d7777c',
|
||||
label: 'Export records',
|
||||
shortLabel: 'Export',
|
||||
icon: 'IconFileExport',
|
||||
position: 16,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression: 'numberOfSelectedRecords >= 2',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.exportMultipleRecords.universalIdentifier,
|
||||
},
|
||||
importRecords: {
|
||||
universalIdentifier: 'a2dc9de7-4798-422e-bb55-bfad7b9bdbe8',
|
||||
label: 'Import records',
|
||||
shortLabel: 'Import',
|
||||
icon: 'IconFileImport',
|
||||
position: 17,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: 'not hasAnySoftDeleteFilterOnView',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.importRecords.universalIdentifier,
|
||||
},
|
||||
exportView: {
|
||||
universalIdentifier: '80680f2a-c426-48b3-a839-c63a6183dc4b',
|
||||
label: 'Export view',
|
||||
shortLabel: 'Export',
|
||||
icon: 'IconFileExport',
|
||||
position: 18,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: null,
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.exportView.universalIdentifier,
|
||||
},
|
||||
seeDeletedRecords: {
|
||||
universalIdentifier: 'd63c21c3-9785-4750-be87-5f36269b8e0d',
|
||||
label: 'See deleted records',
|
||||
shortLabel: 'Deleted records',
|
||||
icon: 'IconRotate2',
|
||||
position: 19,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: 'not hasAnySoftDeleteFilterOnView',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.seeDeletedRecords.universalIdentifier,
|
||||
},
|
||||
createNewView: {
|
||||
universalIdentifier: '6ec7c339-e167-431d-bec6-d1c737df677c',
|
||||
label: 'Create View',
|
||||
shortLabel: 'Create View',
|
||||
icon: 'IconLayout',
|
||||
position: 20,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: 'not hasAnySoftDeleteFilterOnView',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.createNewView.universalIdentifier,
|
||||
},
|
||||
hideDeletedRecords: {
|
||||
universalIdentifier: '1420db7f-0fba-49e2-b23e-4b7caa0fafa0',
|
||||
label: 'Hide deleted records',
|
||||
shortLabel: 'Hide deleted',
|
||||
icon: 'IconEyeOff',
|
||||
position: 21,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: 'hasAnySoftDeleteFilterOnView',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.hideDeletedRecords.universalIdentifier,
|
||||
},
|
||||
goToPeople: {
|
||||
universalIdentifier: 'dfe5fef8-d42c-40f0-941f-8e3b5eb01daa',
|
||||
label: 'Go to People',
|
||||
shortLabel: 'People',
|
||||
icon: 'IconUser',
|
||||
position: 23,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: 'targetObjectReadPermissions.person',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.goToPeople.universalIdentifier,
|
||||
},
|
||||
goToCompanies: {
|
||||
universalIdentifier: '196e4eec-bfdd-48a6-bcbb-6707ef11951a',
|
||||
label: 'Go to Companies',
|
||||
shortLabel: 'Companies',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
position: 24,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: 'targetObjectReadPermissions.company',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.goToCompanies.universalIdentifier,
|
||||
},
|
||||
goToDashboards: {
|
||||
universalIdentifier: '11dc07d1-21b2-4f86-af8c-6a664c02f00c',
|
||||
label: 'Go to Dashboards',
|
||||
shortLabel: 'Dashboards',
|
||||
icon: 'IconLayoutDashboard',
|
||||
position: 25,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: 'targetObjectReadPermissions.dashboard',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.goToDashboards.universalIdentifier,
|
||||
},
|
||||
goToOpportunities: {
|
||||
universalIdentifier: 'f04f5e00-a208-422f-acf2-ff189769510d',
|
||||
label: 'Go to Opportunities',
|
||||
shortLabel: 'Opportunities',
|
||||
icon: 'IconTargetArrow',
|
||||
position: 26,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression:
|
||||
'targetObjectReadPermissions.opportunity',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.goToOpportunities.universalIdentifier,
|
||||
},
|
||||
goToSettings: {
|
||||
universalIdentifier: 'ef9aba44-0068-453e-930a-f8c182af18ee',
|
||||
label: 'Go to Settings',
|
||||
shortLabel: 'Settings',
|
||||
icon: 'IconSettings',
|
||||
position: 27,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: null,
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.goToSettings.universalIdentifier,
|
||||
},
|
||||
goToTasks: {
|
||||
universalIdentifier: 'e8e3bd0b-5ce9-4577-bb61-588c0b1ad063',
|
||||
label: 'Go to Tasks',
|
||||
shortLabel: 'Tasks',
|
||||
icon: 'IconCheckbox',
|
||||
position: 28,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: 'targetObjectReadPermissions.task',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.goToTasks.universalIdentifier,
|
||||
},
|
||||
goToNotes: {
|
||||
universalIdentifier: '08e0f0cc-ac2d-46cd-9bca-39a409b9addf',
|
||||
label: 'Go to Notes',
|
||||
shortLabel: 'Notes',
|
||||
icon: 'IconCheckbox',
|
||||
position: 29,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: 'targetObjectReadPermissions.note',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.goToNotes.universalIdentifier,
|
||||
},
|
||||
editRecordPageLayout: {
|
||||
universalIdentifier: 'd9794c67-1799-424f-8871-5ea771dd4a6d',
|
||||
label: 'Edit Page Layout',
|
||||
shortLabel: 'Edit Layout',
|
||||
icon: 'IconPencil',
|
||||
position: 30,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and featureFlags.IS_RECORD_PAGE_LAYOUT_EDITING_ENABLED and noneDefined(selectedRecords, "deletedAt") and objectPermissions.canUpdateObjectRecords and objectMetadataItem.nameSingular != "dashboard"',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.editRecordPageLayout.universalIdentifier,
|
||||
},
|
||||
saveRecordPageLayout: {
|
||||
universalIdentifier: 'a3363589-e2a6-4451-a53c-b8c2710785e2',
|
||||
label: 'Save Page Layout',
|
||||
shortLabel: 'Save',
|
||||
icon: 'IconDeviceFloppy',
|
||||
position: 31,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and isPageInEditMode and featureFlags.IS_RECORD_PAGE_LAYOUT_EDITING_ENABLED and noneDefined(selectedRecords, "deletedAt") and objectPermissions.canUpdateObjectRecords',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.saveRecordPageLayout.universalIdentifier,
|
||||
},
|
||||
cancelRecordPageLayout: {
|
||||
universalIdentifier: '0b9b4e93-2b4e-4ab0-908e-83ed1d674df7',
|
||||
label: 'Cancel Edition',
|
||||
shortLabel: 'Cancel',
|
||||
icon: 'IconCancel',
|
||||
position: 32,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and isPageInEditMode and featureFlags.IS_RECORD_PAGE_LAYOUT_EDITING_ENABLED and noneDefined(selectedRecords, "deletedAt") and objectPermissions.canUpdateObjectRecords',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.cancelRecordPageLayout.universalIdentifier,
|
||||
},
|
||||
editDashboardLayout: {
|
||||
universalIdentifier: 'b9b53bbc-3129-4eb9-8344-c3f9628ffa7d',
|
||||
label: 'Edit Dashboard',
|
||||
shortLabel: 'Edit',
|
||||
icon: 'IconPencil',
|
||||
position: 33,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and noneDefined(selectedRecords, "deletedAt") and everyDefined(selectedRecords, "pageLayoutId") and objectPermissions.canUpdateObjectRecords',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.dashboard.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.editDashboardLayout.universalIdentifier,
|
||||
},
|
||||
saveDashboardLayout: {
|
||||
universalIdentifier: '18b23908-f816-42ab-bc0a-eb5fae29c695',
|
||||
label: 'Save Dashboard',
|
||||
shortLabel: 'Save',
|
||||
icon: 'IconDeviceFloppy',
|
||||
position: 34,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and isPageInEditMode and noneDefined(selectedRecords, "deletedAt") and everyDefined(selectedRecords, "pageLayoutId") and objectPermissions.canUpdateObjectRecords',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.dashboard.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.saveDashboardLayout.universalIdentifier,
|
||||
},
|
||||
cancelDashboardLayout: {
|
||||
universalIdentifier: '030ecd01-0aaf-4e6d-8400-105996548887',
|
||||
label: 'Cancel Edition',
|
||||
shortLabel: 'Cancel',
|
||||
icon: 'IconCancel',
|
||||
position: 35,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and isPageInEditMode and noneDefined(selectedRecords, "deletedAt") and everyDefined(selectedRecords, "pageLayoutId") and objectPermissions.canUpdateObjectRecords',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.dashboard.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.cancelDashboardLayout.universalIdentifier,
|
||||
},
|
||||
duplicateDashboard: {
|
||||
universalIdentifier: '2ee07307-60ce-41ef-bfee-7c718f67557e',
|
||||
label: 'Duplicate Dashboard',
|
||||
shortLabel: 'Duplicate',
|
||||
icon: 'IconCopyPlus',
|
||||
position: 36,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'noneDefined(selectedRecords, "deletedAt") and objectPermissions.canUpdateObjectRecords',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.dashboard.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.duplicateDashboard.universalIdentifier,
|
||||
},
|
||||
goToWorkflows: {
|
||||
universalIdentifier: '4fa778f9-7931-4d18-b895-929e1ef9c31f',
|
||||
label: 'Go to Workflows',
|
||||
shortLabel: 'Workflows',
|
||||
icon: 'IconSettingsAutomation',
|
||||
position: 41,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: 'targetObjectReadPermissions.workflow',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.goToWorkflows.universalIdentifier,
|
||||
},
|
||||
activateWorkflow: {
|
||||
universalIdentifier: '44f19c85-0fd0-482f-a14e-da513c60b1b3',
|
||||
label: 'Activate Workflow',
|
||||
shortLabel: 'Activate',
|
||||
icon: 'IconPower',
|
||||
position: 42,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'everyDefined(selectedRecords, "currentVersion.trigger") and everyDefined(selectedRecords, "currentVersion.steps") and every(selectedRecords, "currentVersion.steps.length") and (everyEquals(selectedRecords, "currentVersion.status", "DRAFT") or includesNone(selectedRecords, "statuses", "ACTIVE")) and noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.activateWorkflow.universalIdentifier,
|
||||
},
|
||||
deactivateWorkflow: {
|
||||
universalIdentifier: '57f21a06-a17a-47b1-a123-90d90dbdf0b7',
|
||||
label: 'Deactivate Workflow',
|
||||
shortLabel: 'Deactivate',
|
||||
icon: 'IconPlayerPause',
|
||||
position: 43,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'everyEquals(selectedRecords, "currentVersion.status", "ACTIVE") and noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.deactivateWorkflow.universalIdentifier,
|
||||
},
|
||||
discardDraftWorkflow: {
|
||||
universalIdentifier: '4c227f2e-03bb-4a66-9b13-49f263264f4a',
|
||||
label: 'Discard Draft',
|
||||
shortLabel: 'Discard Draft',
|
||||
icon: 'IconNoteOff',
|
||||
position: 44,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'every(selectedRecords, "versions.length") and everyEquals(selectedRecords, "currentVersion.status", "DRAFT") and noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.discardDraftWorkflow.universalIdentifier,
|
||||
},
|
||||
testWorkflow: {
|
||||
universalIdentifier: 'f85d552a-87a3-4667-99f7-71b47917539c',
|
||||
label: 'Test Workflow',
|
||||
shortLabel: 'Test',
|
||||
icon: 'IconPlayerPlay',
|
||||
position: 45,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'everyDefined(selectedRecords, "currentVersion.trigger") and everyDefined(selectedRecords, "currentVersion.steps") and every(selectedRecords, "currentVersion.steps.length") and ((everyEquals(selectedRecords, "currentVersion.trigger.type", "MANUAL") and noneDefined(selectedRecords, "currentVersion.trigger.settings.objectType")) or everyEquals(selectedRecords, "currentVersion.trigger.type", "WEBHOOK") or everyEquals(selectedRecords, "currentVersion.trigger.type", "CRON")) and noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.testWorkflow.universalIdentifier,
|
||||
},
|
||||
seeActiveVersionWorkflow: {
|
||||
universalIdentifier: '31790508-75ff-4e4c-a768-83bd1b0718e0',
|
||||
label: 'See active version',
|
||||
shortLabel: 'See active version',
|
||||
icon: 'IconVersions',
|
||||
position: 46,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'includesEvery(selectedRecords, "statuses", "ACTIVE") and includesEvery(selectedRecords, "statuses", "DRAFT") and noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.seeActiveVersionWorkflow.universalIdentifier,
|
||||
},
|
||||
seeRunsWorkflow: {
|
||||
universalIdentifier: 'e57efc2d-00a2-493a-b76c-f2dabd23a5eb',
|
||||
label: 'See runs',
|
||||
shortLabel: 'See runs',
|
||||
icon: 'IconHistoryToggle',
|
||||
position: 47,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.seeRunsWorkflow.universalIdentifier,
|
||||
},
|
||||
seeVersionsWorkflow: {
|
||||
universalIdentifier: '92781d24-b875-4282-8cdb-d127f04a5c7d',
|
||||
label: 'See versions history',
|
||||
shortLabel: 'See versions',
|
||||
icon: 'IconVersions',
|
||||
position: 48,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.seeVersionsWorkflow.universalIdentifier,
|
||||
},
|
||||
addNodeWorkflow: {
|
||||
universalIdentifier: '818117fa-6cad-4ebc-83c1-40f4afc28d94',
|
||||
label: 'Add a node',
|
||||
shortLabel: 'Add a node',
|
||||
icon: 'IconPlus',
|
||||
position: 49,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and everyDefined(selectedRecords, "currentVersion.trigger") and everyDefined(selectedRecords, "currentVersion.steps") and every(selectedRecords, "currentVersion.steps.length") and noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.addNodeWorkflow.universalIdentifier,
|
||||
},
|
||||
tidyUpWorkflow: {
|
||||
universalIdentifier: '1f3a3cab-161a-4775-af47-11be4d0bf411',
|
||||
label: 'Tidy up workflow',
|
||||
shortLabel: 'Tidy up',
|
||||
icon: 'IconReorder',
|
||||
position: 50,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'pageType == "RECORD_PAGE" and everyDefined(selectedRecords, "currentVersion.trigger") and everyDefined(selectedRecords, "currentVersion.steps") and every(selectedRecords, "currentVersion.steps.length") and noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.tidyUpWorkflow.universalIdentifier,
|
||||
},
|
||||
duplicateWorkflow: {
|
||||
universalIdentifier: '91094438-b4c2-46ad-a23b-8af4b23ba514',
|
||||
label: 'Duplicate Workflow',
|
||||
shortLabel: 'Duplicate',
|
||||
icon: 'IconCopy',
|
||||
position: 51,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'everyDefined(selectedRecords, "currentVersion") and noneDefined(selectedRecords, "deletedAt")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflow.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.duplicateWorkflow.universalIdentifier,
|
||||
},
|
||||
goToRuns: {
|
||||
universalIdentifier: '1ba959da-ff49-4c1f-a517-2b78ee200508',
|
||||
label: 'Go to runs',
|
||||
shortLabel: 'See runs',
|
||||
icon: 'IconHistoryToggle',
|
||||
position: 52,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression:
|
||||
'not hasAnySoftDeleteFilterOnView and objectMetadataItem.nameSingular != "workflowRun" and objectMetadataItem.nameSingular != "workflowVersion" and objectMetadataItem.nameSingular != "workflow"',
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.goToRuns.universalIdentifier,
|
||||
},
|
||||
seeVersionWorkflowRun: {
|
||||
universalIdentifier: 'cc3a065c-c89e-40ac-9449-4272c55b1bb8',
|
||||
label: 'See version',
|
||||
shortLabel: 'See version',
|
||||
icon: 'IconVersions',
|
||||
position: 53,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression: null,
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflowRun.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.seeVersionWorkflowRun.universalIdentifier,
|
||||
},
|
||||
seeWorkflowWorkflowRun: {
|
||||
universalIdentifier: '9d9cc62d-3543-45c3-93f3-23d2d8979f2b',
|
||||
label: 'See workflow',
|
||||
shortLabel: 'See workflow',
|
||||
icon: 'IconSettingsAutomation',
|
||||
position: 54,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression: null,
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflowRun.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.seeWorkflowWorkflowRun.universalIdentifier,
|
||||
},
|
||||
stopWorkflowRun: {
|
||||
universalIdentifier: '4c186606-9515-4561-a1eb-9a072b4f5e58',
|
||||
label: 'Stop',
|
||||
shortLabel: 'Stop',
|
||||
icon: 'IconPlayerStop',
|
||||
position: 55,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'isSelectAll or someEquals(selectedRecords, "status", "NOT_STARTED") or someEquals(selectedRecords, "status", "ENQUEUED") or someEquals(selectedRecords, "status", "RUNNING")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflowRun.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.stopWorkflowRun.universalIdentifier,
|
||||
},
|
||||
seeRunsWorkflowVersion: {
|
||||
universalIdentifier: '44e305c7-4f0a-45ec-803f-6471b56455cb',
|
||||
label: 'See runs',
|
||||
shortLabel: 'See runs',
|
||||
icon: 'IconHistoryToggle',
|
||||
position: 56,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'everyDefined(selectedRecords, "workflow")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflowVersion.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.seeRunsWorkflowVersion.universalIdentifier,
|
||||
},
|
||||
seeWorkflowWorkflowVersion: {
|
||||
universalIdentifier: 'b43052db-023e-4083-9b63-2c2dfbfd1320',
|
||||
label: 'See workflow',
|
||||
shortLabel: 'See workflow',
|
||||
icon: 'IconSettingsAutomation',
|
||||
position: 57,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'everyDefined(selectedRecords, "workflow.id")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflowVersion.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.seeWorkflowWorkflowVersion.universalIdentifier,
|
||||
},
|
||||
useAsDraftWorkflowVersion: {
|
||||
universalIdentifier: '483c0c1d-ea4d-4a4d-8a59-2dcf9f8e38f6',
|
||||
label: 'Use as draft',
|
||||
shortLabel: 'Use as draft',
|
||||
icon: 'IconPencil',
|
||||
position: 58,
|
||||
isPinned: true,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'noneEquals(selectedRecords, "status", "DRAFT")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflowVersion.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.useAsDraftWorkflowVersion.universalIdentifier,
|
||||
},
|
||||
seeVersionsWorkflowVersion: {
|
||||
universalIdentifier: '1d4abeb7-2750-4af7-9a92-fbadd2a9e4ba',
|
||||
label: 'See versions history',
|
||||
shortLabel: 'See versions',
|
||||
icon: 'IconVersions',
|
||||
position: 59,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.RECORD_SELECTION,
|
||||
conditionalAvailabilityExpression:
|
||||
'everyDefined(selectedRecords, "workflow")',
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECTS.workflowVersion.universalIdentifier,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.seeVersionsWorkflowVersion.universalIdentifier,
|
||||
},
|
||||
searchRecords: {
|
||||
universalIdentifier: 'fa24e25e-68f8-4548-82ff-c7b5168b7c7d',
|
||||
label: 'Search records',
|
||||
shortLabel: 'Search',
|
||||
icon: 'IconSearch',
|
||||
position: 60,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: null,
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.searchRecords.universalIdentifier,
|
||||
},
|
||||
searchRecordsFallback: {
|
||||
universalIdentifier: 'c659890c-7266-46c9-bfe1-75cefff8b6d0',
|
||||
label: 'Search records',
|
||||
shortLabel: 'Search',
|
||||
icon: 'IconSearch',
|
||||
position: 61,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.FALLBACK,
|
||||
conditionalAvailabilityExpression: null,
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.searchRecordsFallback.universalIdentifier,
|
||||
},
|
||||
askAi: {
|
||||
universalIdentifier: 'ce5fb54d-2b19-4dd1-b7b4-9532a1761a41',
|
||||
label: 'Ask AI',
|
||||
shortLabel: 'Ask AI',
|
||||
icon: 'IconSparkles',
|
||||
position: 62,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: null,
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.askAi.universalIdentifier,
|
||||
},
|
||||
viewPreviousAiChats: {
|
||||
universalIdentifier: '3084c3c9-cc23-4dad-9e00-92025f5cba7a',
|
||||
label: 'View Previous AI Chats',
|
||||
shortLabel: 'Previous AI Chats',
|
||||
icon: 'IconHistory',
|
||||
position: 63,
|
||||
isPinned: false,
|
||||
availabilityType: CommandMenuItemAvailabilityType.GLOBAL,
|
||||
conditionalAvailabilityExpression: null,
|
||||
availabilityObjectMetadataUniversalIdentifier: null,
|
||||
frontComponentUniversalIdentifier:
|
||||
STANDARD_FRONT_COMPONENTS.viewPreviousAiChats.universalIdentifier,
|
||||
},
|
||||
} as const;
|
||||
+808
@@ -0,0 +1,808 @@
|
||||
import { STANDARD_FRONT_COMPONENT_BUILD_MANIFEST } from 'twenty-standard-application';
|
||||
|
||||
export const STANDARD_FRONT_COMPONENTS = {
|
||||
navigateToNextRecord: {
|
||||
universalIdentifier: 'aec12b85-29df-465f-a329-1c72c81ed95c',
|
||||
name: 'Navigate to next record',
|
||||
componentName: 'NavigateToNextRecord',
|
||||
sourceComponentPath:
|
||||
'front-components/record/navigate-to-next-record.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.navigateToNextRecord
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.navigateToNextRecord
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
navigateToPreviousRecord: {
|
||||
universalIdentifier: 'b53c54b9-152a-4100-975c-1bc582bfb951',
|
||||
name: 'Navigate to previous record',
|
||||
componentName: 'NavigateToPreviousRecord',
|
||||
sourceComponentPath:
|
||||
'front-components/record/navigate-to-previous-record.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.navigateToPreviousRecord
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.navigateToPreviousRecord
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
createNewRecord: {
|
||||
universalIdentifier: '1e6e57bb-89c4-482e-bf44-d62ad1c05d2f',
|
||||
name: 'Create new record',
|
||||
componentName: 'CreateNewRecord',
|
||||
sourceComponentPath:
|
||||
'front-components/record/create-new-record.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.createNewRecord
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.createNewRecord
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
deleteSingleRecord: {
|
||||
universalIdentifier: 'cbc7e92f-d4fe-4956-ba66-a81b7f9713c6',
|
||||
name: 'Delete single record',
|
||||
componentName: 'DeleteSingleRecord',
|
||||
sourceComponentPath:
|
||||
'front-components/record/delete-single-record.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.deleteSingleRecord
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.deleteSingleRecord
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
deleteMultipleRecords: {
|
||||
universalIdentifier: '35c25fd2-6060-440a-b734-aa3016c11f47',
|
||||
name: 'Delete multiple records',
|
||||
componentName: 'DeleteMultipleRecords',
|
||||
sourceComponentPath:
|
||||
'front-components/record/delete-multiple-records.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.deleteMultipleRecords
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.deleteMultipleRecords
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
restoreSingleRecord: {
|
||||
universalIdentifier: '88262225-1253-4dfe-9bf7-563b73e6d9ea',
|
||||
name: 'Restore single record',
|
||||
componentName: 'RestoreSingleRecord',
|
||||
sourceComponentPath:
|
||||
'front-components/record/restore-single-record.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.restoreSingleRecord
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.restoreSingleRecord
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
restoreMultipleRecords: {
|
||||
universalIdentifier: '105ff959-838c-44bc-8a92-60d61093ebc4',
|
||||
name: 'Restore multiple records',
|
||||
componentName: 'RestoreMultipleRecords',
|
||||
sourceComponentPath:
|
||||
'front-components/record/restore-multiple-records.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.restoreMultipleRecords
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.restoreMultipleRecords
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
destroySingleRecord: {
|
||||
universalIdentifier: '212d9e7d-e149-417b-9a0f-5024835349e6',
|
||||
name: 'Destroy single record',
|
||||
componentName: 'DestroySingleRecord',
|
||||
sourceComponentPath:
|
||||
'front-components/record/destroy-single-record.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.destroySingleRecord
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.destroySingleRecord
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
destroyMultipleRecords: {
|
||||
universalIdentifier: 'f647d17d-b4ae-4a4c-99a9-4e5e4e3068a2',
|
||||
name: 'Destroy multiple records',
|
||||
componentName: 'DestroyMultipleRecords',
|
||||
sourceComponentPath:
|
||||
'front-components/record/destroy-multiple-records.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.destroyMultipleRecords
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.destroyMultipleRecords
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
addToFavorites: {
|
||||
universalIdentifier: '5694b053-1f42-416c-a26a-375f826aa9b3',
|
||||
name: 'Add to favorites',
|
||||
componentName: 'AddToFavorites',
|
||||
sourceComponentPath:
|
||||
'front-components/record/add-to-favorites.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.addToFavorites.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.addToFavorites
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
removeFromFavorites: {
|
||||
universalIdentifier: '21105d6a-33a2-4ae3-8edb-c33c38d2e091',
|
||||
name: 'Remove from favorites',
|
||||
componentName: 'RemoveFromFavorites',
|
||||
sourceComponentPath:
|
||||
'front-components/record/remove-from-favorites.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.removeFromFavorites
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.removeFromFavorites
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
exportNoteToPdf: {
|
||||
universalIdentifier: '980399e9-e530-4430-bf47-7f3f482434b4',
|
||||
name: 'Export note to PDF',
|
||||
componentName: 'ExportNoteToPdf',
|
||||
sourceComponentPath:
|
||||
'front-components/record/export-note-to-pdf.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.exportNoteToPdf
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.exportNoteToPdf
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
exportFromRecordIndex: {
|
||||
universalIdentifier: '6aca9ecc-b419-453d-8243-6d19faa8c8a7',
|
||||
name: 'Export from record index',
|
||||
componentName: 'ExportFromRecordIndex',
|
||||
sourceComponentPath:
|
||||
'front-components/record/export-from-record-index.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.exportFromRecordIndex
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.exportFromRecordIndex
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
exportFromRecordShow: {
|
||||
universalIdentifier: '74d8f880-1be1-432e-b475-8970deed809e',
|
||||
name: 'Export from record show',
|
||||
componentName: 'ExportFromRecordShow',
|
||||
sourceComponentPath:
|
||||
'front-components/record/export-from-record-show.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.exportFromRecordShow
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.exportFromRecordShow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
updateMultipleRecords: {
|
||||
universalIdentifier: 'f89c3e6b-6d96-4103-8cfc-4de6017a75c0',
|
||||
name: 'Update multiple records',
|
||||
componentName: 'UpdateMultipleRecords',
|
||||
sourceComponentPath:
|
||||
'front-components/record/update-multiple-records.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.updateMultipleRecords
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.updateMultipleRecords
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
mergeMultipleRecords: {
|
||||
universalIdentifier: '9c6757aa-ecdd-4b21-8466-fb1e8f0bfcb8',
|
||||
name: 'Merge multiple records',
|
||||
componentName: 'MergeMultipleRecords',
|
||||
sourceComponentPath:
|
||||
'front-components/record/merge-multiple-records.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.mergeMultipleRecords
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.mergeMultipleRecords
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
exportMultipleRecords: {
|
||||
universalIdentifier: '05381918-8c9c-421f-ab89-10e365a463f8',
|
||||
name: 'Export multiple records',
|
||||
componentName: 'ExportMultipleRecords',
|
||||
sourceComponentPath:
|
||||
'front-components/record/export-multiple-records.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.exportMultipleRecords
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.exportMultipleRecords
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
importRecords: {
|
||||
universalIdentifier: 'acfd8025-36d1-4a35-9508-a0422e53d380',
|
||||
name: 'Import records',
|
||||
componentName: 'ImportRecords',
|
||||
sourceComponentPath:
|
||||
'front-components/record/import-records.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.importRecords.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.importRecords
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
exportView: {
|
||||
universalIdentifier: '012dc64f-ad2b-419a-98ea-d0019ff3d56d',
|
||||
name: 'Export view',
|
||||
componentName: 'ExportView',
|
||||
sourceComponentPath:
|
||||
'front-components/record/export-view.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.exportView.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.exportView.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
seeDeletedRecords: {
|
||||
universalIdentifier: 'dad2327b-9020-4d13-a38c-14d1207e66fc',
|
||||
name: 'See deleted records',
|
||||
componentName: 'SeeDeletedRecords',
|
||||
sourceComponentPath:
|
||||
'front-components/record/see-deleted-records.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeDeletedRecords
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeDeletedRecords
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
createNewView: {
|
||||
universalIdentifier: 'd7bf58ad-e716-47c1-8c51-209c755c5f27',
|
||||
name: 'Create view',
|
||||
componentName: 'CreateNewView',
|
||||
sourceComponentPath:
|
||||
'front-components/record/create-new-view.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.createNewView.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.createNewView
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
hideDeletedRecords: {
|
||||
universalIdentifier: '75e93e21-effb-48ef-ba1c-588c358fd56f',
|
||||
name: 'Hide deleted records',
|
||||
componentName: 'HideDeletedRecords',
|
||||
sourceComponentPath:
|
||||
'front-components/record/hide-deleted-records.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.hideDeletedRecords
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.hideDeletedRecords
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
goToPeople: {
|
||||
universalIdentifier: '5a5c1e43-9fb5-49bf-bcde-355973f913b9',
|
||||
name: 'Go to People',
|
||||
componentName: 'GoToPeople',
|
||||
sourceComponentPath:
|
||||
'front-components/navigation/go-to-people.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToPeople.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToPeople.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
goToCompanies: {
|
||||
universalIdentifier: '22ac113b-fe7d-41de-b06f-d863964bc445',
|
||||
name: 'Go to Companies',
|
||||
componentName: 'GoToCompanies',
|
||||
sourceComponentPath:
|
||||
'front-components/navigation/go-to-companies.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToCompanies.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToCompanies
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
goToDashboards: {
|
||||
universalIdentifier: 'c71cc879-50af-4e20-9bdc-52f90c9862ed',
|
||||
name: 'Go to Dashboards',
|
||||
componentName: 'GoToDashboards',
|
||||
sourceComponentPath:
|
||||
'front-components/navigation/go-to-dashboards.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToDashboards.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToDashboards
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
goToOpportunities: {
|
||||
universalIdentifier: 'ebb4c2ca-6b70-4d2e-8919-79475a278273',
|
||||
name: 'Go to Opportunities',
|
||||
componentName: 'GoToOpportunities',
|
||||
sourceComponentPath:
|
||||
'front-components/navigation/go-to-opportunities.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToOpportunities
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToOpportunities
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
goToSettings: {
|
||||
universalIdentifier: '1fb7b785-b79a-42b7-aff2-e57fe1d74e35',
|
||||
name: 'Go to Settings',
|
||||
componentName: 'GoToSettings',
|
||||
sourceComponentPath:
|
||||
'front-components/navigation/go-to-settings.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToSettings.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToSettings
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
goToTasks: {
|
||||
universalIdentifier: 'c08ff958-141d-4892-8737-1faf6b630a2b',
|
||||
name: 'Go to Tasks',
|
||||
componentName: 'GoToTasks',
|
||||
sourceComponentPath:
|
||||
'front-components/navigation/go-to-tasks.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToTasks.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToTasks.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
goToNotes: {
|
||||
universalIdentifier: 'd32f7962-e8e1-46d6-856c-ccc71e71d50c',
|
||||
name: 'Go to Notes',
|
||||
componentName: 'GoToNotes',
|
||||
sourceComponentPath:
|
||||
'front-components/navigation/go-to-notes.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToNotes.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToNotes.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
editRecordPageLayout: {
|
||||
universalIdentifier: 'd1a8a4c5-2644-4d4b-b684-64625a700760',
|
||||
name: 'Edit record page layout',
|
||||
componentName: 'EditRecordPageLayout',
|
||||
sourceComponentPath:
|
||||
'front-components/page-layout/edit-record-page-layout.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.editRecordPageLayout
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.editRecordPageLayout
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
saveRecordPageLayout: {
|
||||
universalIdentifier: '7956ba3a-fd4d-466e-96b5-9e3e8b637c44',
|
||||
name: 'Save record page layout',
|
||||
componentName: 'SaveRecordPageLayout',
|
||||
sourceComponentPath:
|
||||
'front-components/page-layout/save-record-page-layout.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.saveRecordPageLayout
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.saveRecordPageLayout
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
cancelRecordPageLayout: {
|
||||
universalIdentifier: 'd392762b-4c42-4471-9c45-c92e66728380',
|
||||
name: 'Cancel record page layout edition',
|
||||
componentName: 'CancelRecordPageLayout',
|
||||
sourceComponentPath:
|
||||
'front-components/page-layout/cancel-record-page-layout.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.cancelRecordPageLayout
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.cancelRecordPageLayout
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
editDashboardLayout: {
|
||||
universalIdentifier: '8a87b33b-f196-414c-a60a-16402aa0b57f',
|
||||
name: 'Edit dashboard layout',
|
||||
componentName: 'EditDashboardLayout',
|
||||
sourceComponentPath:
|
||||
'front-components/dashboard/edit-dashboard-layout.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.editDashboardLayout
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.editDashboardLayout
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
saveDashboardLayout: {
|
||||
universalIdentifier: '5d7b4510-79e8-440f-8707-21741c00d262',
|
||||
name: 'Save dashboard layout',
|
||||
componentName: 'SaveDashboardLayout',
|
||||
sourceComponentPath:
|
||||
'front-components/dashboard/save-dashboard-layout.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.saveDashboardLayout
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.saveDashboardLayout
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
cancelDashboardLayout: {
|
||||
universalIdentifier: 'dac81512-3890-4ba5-8471-bd94738ab80a',
|
||||
name: 'Cancel dashboard layout edition',
|
||||
componentName: 'CancelDashboardLayout',
|
||||
sourceComponentPath:
|
||||
'front-components/dashboard/cancel-dashboard-layout.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.cancelDashboardLayout
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.cancelDashboardLayout
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
duplicateDashboard: {
|
||||
universalIdentifier: 'e2bec30e-a6b0-47ff-9708-45855ae96fe7',
|
||||
name: 'Duplicate dashboard',
|
||||
componentName: 'DuplicateDashboard',
|
||||
sourceComponentPath:
|
||||
'front-components/dashboard/duplicate-dashboard.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.duplicateDashboard
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.duplicateDashboard
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
goToWorkflows: {
|
||||
universalIdentifier: '9d313f79-170f-47cc-b9c4-a2076a86232f',
|
||||
name: 'Go to Workflows',
|
||||
componentName: 'GoToWorkflows',
|
||||
sourceComponentPath:
|
||||
'front-components/navigation/go-to-workflows.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToWorkflows.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToWorkflows
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
activateWorkflow: {
|
||||
universalIdentifier: '97b89dc4-cef9-4439-9358-35c98616eb1e',
|
||||
name: 'Activate workflow',
|
||||
componentName: 'ActivateWorkflow',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow/activate-workflow.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.activateWorkflow
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.activateWorkflow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
deactivateWorkflow: {
|
||||
universalIdentifier: 'cbf92077-1892-47e0-9435-14ea8f50a510',
|
||||
name: 'Deactivate workflow',
|
||||
componentName: 'DeactivateWorkflow',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow/deactivate-workflow.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.deactivateWorkflow
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.deactivateWorkflow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
discardDraftWorkflow: {
|
||||
universalIdentifier: '972dc871-7f9c-4035-957c-e6662f4df7c5',
|
||||
name: 'Discard draft workflow',
|
||||
componentName: 'DiscardDraftWorkflow',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow/discard-draft-workflow.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.discardDraftWorkflow
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.discardDraftWorkflow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
testWorkflow: {
|
||||
universalIdentifier: '39e9aa5a-cacc-4543-9053-f1fbf923e170',
|
||||
name: 'Test workflow',
|
||||
componentName: 'TestWorkflow',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow/test-workflow.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.testWorkflow.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.testWorkflow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
seeActiveVersionWorkflow: {
|
||||
universalIdentifier: '6259a4a5-428e-41b9-a032-333c2d51e15f',
|
||||
name: 'See active version',
|
||||
componentName: 'SeeActiveVersionWorkflow',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow/see-active-version-workflow.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeActiveVersionWorkflow
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeActiveVersionWorkflow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
seeRunsWorkflow: {
|
||||
universalIdentifier: 'b8fa3327-e5c4-43f4-a3ac-c17d26af0847',
|
||||
name: 'See runs',
|
||||
componentName: 'SeeRunsWorkflow',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow/see-runs-workflow.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeRunsWorkflow
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeRunsWorkflow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
seeVersionsWorkflow: {
|
||||
universalIdentifier: '62f41c00-629f-400d-85f8-d532d76c7879',
|
||||
name: 'See versions history',
|
||||
componentName: 'SeeVersionsWorkflow',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow/see-versions-workflow.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeVersionsWorkflow
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeVersionsWorkflow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
addNodeWorkflow: {
|
||||
universalIdentifier: 'da1e499c-1298-4ec4-9a7b-5f2276075888',
|
||||
name: 'Add a node',
|
||||
componentName: 'AddNodeWorkflow',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow/add-node-workflow.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.addNodeWorkflow
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.addNodeWorkflow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
tidyUpWorkflow: {
|
||||
universalIdentifier: '3dac631e-dfb7-4570-ac27-15d98ee8ec43',
|
||||
name: 'Tidy up workflow',
|
||||
componentName: 'TidyUpWorkflow',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow/tidy-up-workflow.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.tidyUpWorkflow.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.tidyUpWorkflow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
duplicateWorkflow: {
|
||||
universalIdentifier: '566a48c5-5342-446f-a041-9db59bcdab6b',
|
||||
name: 'Duplicate workflow',
|
||||
componentName: 'DuplicateWorkflow',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow/duplicate-workflow.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.duplicateWorkflow
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.duplicateWorkflow
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
goToRuns: {
|
||||
universalIdentifier: '0bd0ccfc-1909-4d19-b694-610878f07a3a',
|
||||
name: 'Go to runs',
|
||||
componentName: 'GoToRuns',
|
||||
sourceComponentPath:
|
||||
'front-components/navigation/go-to-runs.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToRuns.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.goToRuns.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
seeVersionWorkflowRun: {
|
||||
universalIdentifier: '2e09d6b0-60c3-447c-8d5d-1af70a2d037b',
|
||||
name: 'See version (workflow run)',
|
||||
componentName: 'SeeVersionWorkflowRun',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow-run/see-version-workflow-run.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeVersionWorkflowRun
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeVersionWorkflowRun
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
seeWorkflowWorkflowRun: {
|
||||
universalIdentifier: '88a80460-6e2f-4587-8a04-a67d894fdf69',
|
||||
name: 'See workflow (workflow run)',
|
||||
componentName: 'SeeWorkflowWorkflowRun',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow-run/see-workflow-workflow-run.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeWorkflowWorkflowRun
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeWorkflowWorkflowRun
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
stopWorkflowRun: {
|
||||
universalIdentifier: '110fb676-2a09-4ac0-bd19-7261bc588967',
|
||||
name: 'Stop workflow run',
|
||||
componentName: 'StopWorkflowRun',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow-run/stop-workflow-run.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.stopWorkflowRun
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.stopWorkflowRun
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
seeRunsWorkflowVersion: {
|
||||
universalIdentifier: '3d673f94-ecf9-4e38-8eac-684cf4cad617',
|
||||
name: 'See runs (workflow version)',
|
||||
componentName: 'SeeRunsWorkflowVersion',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow-version/see-runs-workflow-version.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeRunsWorkflowVersion
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeRunsWorkflowVersion
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
seeWorkflowWorkflowVersion: {
|
||||
universalIdentifier: 'aec002df-0fc1-45ed-8526-9600623ef5f6',
|
||||
name: 'See workflow (workflow version)',
|
||||
componentName: 'SeeWorkflowWorkflowVersion',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow-version/see-workflow-workflow-version.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeWorkflowWorkflowVersion
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeWorkflowWorkflowVersion
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
useAsDraftWorkflowVersion: {
|
||||
universalIdentifier: 'cb11ab5c-974a-4942-bb8a-77efa6b5bb26',
|
||||
name: 'Use as draft (workflow version)',
|
||||
componentName: 'UseAsDraftWorkflowVersion',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow-version/use-as-draft-workflow-version.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.useAsDraftWorkflowVersion
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.useAsDraftWorkflowVersion
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
seeVersionsWorkflowVersion: {
|
||||
universalIdentifier: 'a93c9f09-7a7f-4665-982a-0709a652c5bd',
|
||||
name: 'See versions history (workflow version)',
|
||||
componentName: 'SeeVersionsWorkflowVersion',
|
||||
sourceComponentPath:
|
||||
'front-components/workflow-version/see-versions-workflow-version.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeVersionsWorkflowVersion
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.seeVersionsWorkflowVersion
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
searchRecords: {
|
||||
universalIdentifier: '7791c67a-e58d-4a2d-9cfd-58110a04cb8f',
|
||||
name: 'Search records',
|
||||
componentName: 'SearchRecords',
|
||||
sourceComponentPath:
|
||||
'front-components/side-panel/search-records.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.searchRecords.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.searchRecords
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
searchRecordsFallback: {
|
||||
universalIdentifier: '7f7fc9f2-0291-4264-a789-d21e8f1c774e',
|
||||
name: 'Search records fallback',
|
||||
componentName: 'SearchRecordsFallback',
|
||||
sourceComponentPath:
|
||||
'front-components/side-panel/search-records-fallback.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.searchRecordsFallback
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.searchRecordsFallback
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
askAi: {
|
||||
universalIdentifier: '75d8fed0-36d9-4798-afa5-1472ecac0884',
|
||||
name: 'Ask AI',
|
||||
componentName: 'AskAi',
|
||||
sourceComponentPath:
|
||||
'front-components/side-panel/ask-ai.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.askAi.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.askAi.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
viewPreviousAiChats: {
|
||||
universalIdentifier: '5e7876fa-7a9b-487f-8e05-1a1c7ce029d9',
|
||||
name: 'View previous AI chats',
|
||||
componentName: 'ViewPreviousAiChats',
|
||||
sourceComponentPath:
|
||||
'front-components/side-panel/view-previous-ai-chats.front-component.tsx',
|
||||
builtComponentPath:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.viewPreviousAiChats
|
||||
.builtComponentPath,
|
||||
builtComponentChecksum:
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST.viewPreviousAiChats
|
||||
.builtComponentChecksum,
|
||||
isHeadless: true,
|
||||
},
|
||||
} as const;
|
||||
+2
@@ -16,4 +16,6 @@ export const TWENTY_STANDARD_ALL_METADATA_NAME = [
|
||||
'pageLayout',
|
||||
'pageLayoutTab',
|
||||
'pageLayoutWidget',
|
||||
'frontComponent',
|
||||
'commandMenuItem',
|
||||
] as const satisfies AllMetadataName[];
|
||||
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import { FileFolder } from 'twenty-shared/types';
|
||||
import { STANDARD_FRONT_COMPONENT_BUILD_MANIFEST } from 'twenty-standard-application';
|
||||
|
||||
import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service';
|
||||
import { TWENTY_STANDARD_APPLICATION } from 'src/engine/workspace-manager/twenty-standard-application/constants/twenty-standard-applications';
|
||||
|
||||
const BUILT_FRONT_COMPONENTS_PATH = path.resolve(
|
||||
path.dirname(require.resolve('twenty-standard-application/package.json')),
|
||||
'src/build',
|
||||
);
|
||||
|
||||
@Injectable()
|
||||
export class StandardFrontComponentUploadService {
|
||||
private readonly logger = new Logger(
|
||||
StandardFrontComponentUploadService.name,
|
||||
);
|
||||
|
||||
constructor(private readonly fileStorageService: FileStorageService) {}
|
||||
|
||||
async uploadBuiltFrontComponents({
|
||||
workspaceId,
|
||||
}: {
|
||||
workspaceId: string;
|
||||
}): Promise<void> {
|
||||
const applicationUniversalIdentifier =
|
||||
TWENTY_STANDARD_APPLICATION.universalIdentifier;
|
||||
|
||||
const manifestEntries = Object.values(
|
||||
STANDARD_FRONT_COMPONENT_BUILD_MANIFEST,
|
||||
);
|
||||
|
||||
for (const entry of manifestEntries) {
|
||||
const localFilePath = path.join(
|
||||
BUILT_FRONT_COMPONENTS_PATH,
|
||||
entry.builtComponentPath,
|
||||
);
|
||||
|
||||
if (!fs.existsSync(localFilePath)) {
|
||||
this.logger.warn(
|
||||
`Built front component file not found: ${localFilePath}`,
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
const fileContent = fs.readFileSync(localFilePath);
|
||||
|
||||
await this.fileStorageService.writeFile({
|
||||
sourceFile: fileContent,
|
||||
mimeType: 'application/javascript',
|
||||
fileFolder: FileFolder.BuiltFrontComponent,
|
||||
applicationUniversalIdentifier,
|
||||
workspaceId,
|
||||
resourcePath: entry.builtComponentPath,
|
||||
settings: { isTemporaryFile: false, toDelete: false },
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -14,6 +14,7 @@ import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspac
|
||||
import { buildSystemAuthContext } from 'src/engine/twenty-orm/utils/build-system-auth-context.util';
|
||||
import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service';
|
||||
import { TWENTY_STANDARD_ALL_METADATA_NAME } from 'src/engine/workspace-manager/twenty-standard-application/constants/twenty-standard-all-metadata-name.constant';
|
||||
import { StandardFrontComponentUploadService } from 'src/engine/workspace-manager/twenty-standard-application/services/standard-front-component-upload.service';
|
||||
import { computeTwentyStandardApplicationAllFlatEntityMaps } from 'src/engine/workspace-manager/twenty-standard-application/utils/twenty-standard-application-all-flat-entity-maps.constant';
|
||||
import { WorkspaceMigrationBuilderException } from 'src/engine/workspace-manager/workspace-migration/exceptions/workspace-migration-builder-exception';
|
||||
import { WorkspaceMigrationValidateBuildAndRunService } from 'src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service';
|
||||
@@ -29,6 +30,7 @@ export class TwentyStandardApplicationService {
|
||||
private readonly workspaceMigrationValidateBuildAndRunService: WorkspaceMigrationValidateBuildAndRunService,
|
||||
private readonly workspaceCacheService: WorkspaceCacheService,
|
||||
private readonly globalWorkspaceOrmManager: GlobalWorkspaceOrmManager,
|
||||
private readonly standardFrontComponentUploadService: StandardFrontComponentUploadService,
|
||||
) {}
|
||||
|
||||
// Note: To remove and handle natively in validateBuildAndRun after favorite migration to metadata
|
||||
@@ -74,6 +76,11 @@ export class TwentyStandardApplicationService {
|
||||
...TWENTY_STANDARD_ALL_METADATA_NAME.map(getMetadataFlatEntityMapsKey),
|
||||
'featureFlagsMap',
|
||||
]);
|
||||
|
||||
await this.standardFrontComponentUploadService.uploadBuiltFrontComponents({
|
||||
workspaceId,
|
||||
});
|
||||
|
||||
const shouldIncludeRecordPageLayouts = this.twentyConfigService.get(
|
||||
'SHOULD_SEED_STANDARD_RECORD_PAGE_LAYOUTS',
|
||||
);
|
||||
|
||||
+5
-1
@@ -7,10 +7,14 @@ import { GlobalWorkspaceDataSourceModule } from 'src/engine/twenty-orm/global-wo
|
||||
import { WorkspaceCacheModule } from 'src/engine/workspace-cache/workspace-cache.module';
|
||||
import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspace-migration/workspace-migration.module';
|
||||
|
||||
import { StandardFrontComponentUploadService } from './services/standard-front-component-upload.service';
|
||||
import { TwentyStandardApplicationService } from './services/twenty-standard-application.service';
|
||||
|
||||
@Module({
|
||||
providers: [TwentyStandardApplicationService],
|
||||
providers: [
|
||||
TwentyStandardApplicationService,
|
||||
StandardFrontComponentUploadService,
|
||||
],
|
||||
imports: [
|
||||
ApplicationModule,
|
||||
TwentyConfigModule,
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { type FlatCommandMenuItemMaps } from 'src/engine/metadata-modules/flat-command-menu-item/types/flat-command-menu-item-maps.type';
|
||||
import { createEmptyFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/constant/create-empty-flat-entity-maps.constant';
|
||||
import { type FlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/types/flat-entity-maps.type';
|
||||
import { type FlatFrontComponent } from 'src/engine/metadata-modules/flat-front-component/types/flat-front-component.type';
|
||||
import { type FlatObjectMetadata } from 'src/engine/metadata-modules/flat-object-metadata/types/flat-object-metadata.type';
|
||||
import { STANDARD_COMMAND_MENU_ITEMS } from 'src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant';
|
||||
import { createStandardCommandMenuItemFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/command-menu-item/create-standard-command-menu-item-flat-metadata.util';
|
||||
import { addFlatEntityToFlatEntityMapsThroughMutationOrThrow } from 'src/engine/workspace-manager/workspace-migration/utils/add-flat-entity-to-flat-entity-maps-through-mutation-or-throw.util';
|
||||
|
||||
const STANDARD_COMMAND_MENU_ITEM_NAMES = Object.keys(
|
||||
STANDARD_COMMAND_MENU_ITEMS,
|
||||
) as Array<keyof typeof STANDARD_COMMAND_MENU_ITEMS>;
|
||||
|
||||
export const buildStandardFlatCommandMenuItemMaps = ({
|
||||
now,
|
||||
workspaceId,
|
||||
twentyStandardApplicationId,
|
||||
dependencyFlatEntityMaps: { flatFrontComponentMaps, flatObjectMetadataMaps },
|
||||
}: {
|
||||
now: string;
|
||||
workspaceId: string;
|
||||
twentyStandardApplicationId: string;
|
||||
dependencyFlatEntityMaps: {
|
||||
flatFrontComponentMaps: FlatEntityMaps<FlatFrontComponent>;
|
||||
flatObjectMetadataMaps: FlatEntityMaps<FlatObjectMetadata>;
|
||||
};
|
||||
}): FlatCommandMenuItemMaps => {
|
||||
const flatCommandMenuItemMaps: FlatCommandMenuItemMaps =
|
||||
createEmptyFlatEntityMaps();
|
||||
|
||||
for (const commandMenuItemName of STANDARD_COMMAND_MENU_ITEM_NAMES) {
|
||||
const flatCommandMenuItem = createStandardCommandMenuItemFlatMetadata({
|
||||
commandMenuItemName,
|
||||
commandMenuItemId: v4(),
|
||||
workspaceId,
|
||||
twentyStandardApplicationId,
|
||||
dependencyFlatEntityMaps: {
|
||||
flatFrontComponentMaps,
|
||||
flatObjectMetadataMaps,
|
||||
},
|
||||
now,
|
||||
});
|
||||
|
||||
addFlatEntityToFlatEntityMapsThroughMutationOrThrow({
|
||||
flatEntity: flatCommandMenuItem,
|
||||
flatEntityMapsToMutate: flatCommandMenuItemMaps,
|
||||
});
|
||||
}
|
||||
|
||||
return flatCommandMenuItemMaps;
|
||||
};
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { type FlatCommandMenuItem } from 'src/engine/metadata-modules/flat-command-menu-item/types/flat-command-menu-item.type';
|
||||
import { type FlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/types/flat-entity-maps.type';
|
||||
import { findFlatEntityByUniversalIdentifier } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-universal-identifier.util';
|
||||
import { type FlatFrontComponent } from 'src/engine/metadata-modules/flat-front-component/types/flat-front-component.type';
|
||||
import { type FlatObjectMetadata } from 'src/engine/metadata-modules/flat-object-metadata/types/flat-object-metadata.type';
|
||||
import { STANDARD_COMMAND_MENU_ITEMS } from 'src/engine/workspace-manager/twenty-standard-application/constants/standard-command-menu-item.constant';
|
||||
import { TWENTY_STANDARD_APPLICATION } from 'src/engine/workspace-manager/twenty-standard-application/constants/twenty-standard-applications';
|
||||
|
||||
export const createStandardCommandMenuItemFlatMetadata = ({
|
||||
commandMenuItemName,
|
||||
commandMenuItemId,
|
||||
workspaceId,
|
||||
twentyStandardApplicationId,
|
||||
dependencyFlatEntityMaps: { flatFrontComponentMaps, flatObjectMetadataMaps },
|
||||
now,
|
||||
}: {
|
||||
commandMenuItemName: keyof typeof STANDARD_COMMAND_MENU_ITEMS;
|
||||
commandMenuItemId: string;
|
||||
workspaceId: string;
|
||||
twentyStandardApplicationId: string;
|
||||
dependencyFlatEntityMaps: {
|
||||
flatFrontComponentMaps: FlatEntityMaps<FlatFrontComponent>;
|
||||
flatObjectMetadataMaps: FlatEntityMaps<FlatObjectMetadata>;
|
||||
};
|
||||
now: string;
|
||||
}): FlatCommandMenuItem => {
|
||||
const definition = STANDARD_COMMAND_MENU_ITEMS[commandMenuItemName];
|
||||
|
||||
const flatFrontComponent = findFlatEntityByUniversalIdentifier({
|
||||
flatEntityMaps: flatFrontComponentMaps,
|
||||
universalIdentifier: definition.frontComponentUniversalIdentifier,
|
||||
});
|
||||
|
||||
if (!isDefined(flatFrontComponent)) {
|
||||
throw new Error(
|
||||
`Front component not found for universal identifier ${definition.frontComponentUniversalIdentifier}`,
|
||||
);
|
||||
}
|
||||
|
||||
let resolvedObjectMetadataId: string | null = null;
|
||||
let resolvedObjectMetadataUniversalIdentifier: string | null = null;
|
||||
|
||||
if (isDefined(definition.availabilityObjectMetadataUniversalIdentifier)) {
|
||||
const flatObjectMetadata = findFlatEntityByUniversalIdentifier({
|
||||
flatEntityMaps: flatObjectMetadataMaps,
|
||||
universalIdentifier:
|
||||
definition.availabilityObjectMetadataUniversalIdentifier,
|
||||
});
|
||||
|
||||
if (!isDefined(flatObjectMetadata)) {
|
||||
throw new Error(
|
||||
`Object metadata not found for universal identifier ${definition.availabilityObjectMetadataUniversalIdentifier}`,
|
||||
);
|
||||
}
|
||||
|
||||
resolvedObjectMetadataId = flatObjectMetadata.id;
|
||||
resolvedObjectMetadataUniversalIdentifier =
|
||||
flatObjectMetadata.universalIdentifier;
|
||||
}
|
||||
|
||||
return {
|
||||
id: commandMenuItemId,
|
||||
universalIdentifier: definition.universalIdentifier,
|
||||
applicationId: twentyStandardApplicationId,
|
||||
applicationUniversalIdentifier:
|
||||
TWENTY_STANDARD_APPLICATION.universalIdentifier,
|
||||
workspaceId,
|
||||
label: definition.label,
|
||||
shortLabel: definition.shortLabel,
|
||||
icon: definition.icon,
|
||||
position: definition.position,
|
||||
isPinned: definition.isPinned,
|
||||
availabilityType: definition.availabilityType,
|
||||
conditionalAvailabilityExpression:
|
||||
definition.conditionalAvailabilityExpression ?? null,
|
||||
frontComponentId: flatFrontComponent.id,
|
||||
frontComponentUniversalIdentifier: flatFrontComponent.universalIdentifier,
|
||||
workflowVersionId: null,
|
||||
availabilityObjectMetadataId: resolvedObjectMetadataId,
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
resolvedObjectMetadataUniversalIdentifier,
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
};
|
||||
};
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { type CommandMenuItemAvailabilityType } from 'src/engine/metadata-modules/command-menu-item/entities/command-menu-item.entity';
|
||||
import { type FlatCommandMenuItem } from 'src/engine/metadata-modules/flat-command-menu-item/types/flat-command-menu-item.type';
|
||||
import { type FlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/types/flat-entity-maps.type';
|
||||
import { findFlatEntityByUniversalIdentifier } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-universal-identifier.util';
|
||||
import { type FlatFrontComponent } from 'src/engine/metadata-modules/flat-front-component/types/flat-front-component.type';
|
||||
import { type FlatObjectMetadata } from 'src/engine/metadata-modules/flat-object-metadata/types/flat-object-metadata.type';
|
||||
import { TWENTY_STANDARD_APPLICATION } from 'src/engine/workspace-manager/twenty-standard-application/constants/twenty-standard-applications';
|
||||
|
||||
export const createStandardCommandMenuItemFolderFlatMetadata = ({
|
||||
universalIdentifier,
|
||||
label,
|
||||
shortLabel,
|
||||
icon,
|
||||
position,
|
||||
isPinned,
|
||||
availabilityType,
|
||||
frontComponentUniversalIdentifier,
|
||||
availabilityObjectMetadataUniversalIdentifier,
|
||||
conditionalAvailabilityExpression = null,
|
||||
commandMenuItemId,
|
||||
workspaceId,
|
||||
twentyStandardApplicationId,
|
||||
dependencyFlatEntityMaps: { flatFrontComponentMaps, flatObjectMetadataMaps },
|
||||
now,
|
||||
}: {
|
||||
universalIdentifier: string;
|
||||
label: string;
|
||||
shortLabel: string | null;
|
||||
icon: string;
|
||||
position: number;
|
||||
isPinned: boolean;
|
||||
availabilityType: CommandMenuItemAvailabilityType;
|
||||
frontComponentUniversalIdentifier: string;
|
||||
availabilityObjectMetadataUniversalIdentifier: string | null;
|
||||
conditionalAvailabilityExpression?: string | null;
|
||||
commandMenuItemId: string;
|
||||
workspaceId: string;
|
||||
twentyStandardApplicationId: string;
|
||||
dependencyFlatEntityMaps: {
|
||||
flatFrontComponentMaps: FlatEntityMaps<FlatFrontComponent>;
|
||||
flatObjectMetadataMaps: FlatEntityMaps<FlatObjectMetadata>;
|
||||
};
|
||||
now: string;
|
||||
}): FlatCommandMenuItem => {
|
||||
const flatFrontComponent = findFlatEntityByUniversalIdentifier({
|
||||
flatEntityMaps: flatFrontComponentMaps,
|
||||
universalIdentifier: frontComponentUniversalIdentifier,
|
||||
});
|
||||
|
||||
if (!isDefined(flatFrontComponent)) {
|
||||
throw new Error(
|
||||
`Front component not found for universal identifier ${frontComponentUniversalIdentifier}`,
|
||||
);
|
||||
}
|
||||
|
||||
let resolvedObjectMetadataId: string | null = null;
|
||||
let resolvedObjectMetadataUniversalIdentifier: string | null = null;
|
||||
|
||||
if (isDefined(availabilityObjectMetadataUniversalIdentifier)) {
|
||||
const flatObjectMetadata = findFlatEntityByUniversalIdentifier({
|
||||
flatEntityMaps: flatObjectMetadataMaps,
|
||||
universalIdentifier: availabilityObjectMetadataUniversalIdentifier,
|
||||
});
|
||||
|
||||
if (!isDefined(flatObjectMetadata)) {
|
||||
throw new Error(
|
||||
`Object metadata not found for universal identifier ${availabilityObjectMetadataUniversalIdentifier}`,
|
||||
);
|
||||
}
|
||||
|
||||
resolvedObjectMetadataId = flatObjectMetadata.id;
|
||||
resolvedObjectMetadataUniversalIdentifier =
|
||||
flatObjectMetadata.universalIdentifier;
|
||||
}
|
||||
|
||||
return {
|
||||
id: commandMenuItemId,
|
||||
universalIdentifier,
|
||||
applicationId: twentyStandardApplicationId,
|
||||
applicationUniversalIdentifier:
|
||||
TWENTY_STANDARD_APPLICATION.universalIdentifier,
|
||||
workspaceId,
|
||||
label,
|
||||
shortLabel,
|
||||
icon,
|
||||
position,
|
||||
isPinned,
|
||||
availabilityType,
|
||||
conditionalAvailabilityExpression:
|
||||
conditionalAvailabilityExpression ?? null,
|
||||
frontComponentId: flatFrontComponent.id,
|
||||
frontComponentUniversalIdentifier: flatFrontComponent.universalIdentifier,
|
||||
workflowVersionId: null,
|
||||
availabilityObjectMetadataId: resolvedObjectMetadataId,
|
||||
availabilityObjectMetadataUniversalIdentifier:
|
||||
resolvedObjectMetadataUniversalIdentifier,
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
};
|
||||
};
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { createEmptyFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/constant/create-empty-flat-entity-maps.constant';
|
||||
import { type FlatFrontComponentMaps } from 'src/engine/metadata-modules/flat-front-component/types/flat-front-component-maps.type';
|
||||
import { addFlatEntityToFlatEntityMapsThroughMutationOrThrow } from 'src/engine/workspace-manager/workspace-migration/utils/add-flat-entity-to-flat-entity-maps-through-mutation-or-throw.util';
|
||||
import { STANDARD_FRONT_COMPONENTS } from 'src/engine/workspace-manager/twenty-standard-application/constants/standard-front-component.constant';
|
||||
import { createStandardFrontComponentFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/front-component/create-standard-front-component-flat-metadata.util';
|
||||
|
||||
const STANDARD_FRONT_COMPONENT_NAMES = Object.keys(
|
||||
STANDARD_FRONT_COMPONENTS,
|
||||
) as Array<keyof typeof STANDARD_FRONT_COMPONENTS>;
|
||||
|
||||
export const buildStandardFlatFrontComponentMaps = ({
|
||||
now,
|
||||
workspaceId,
|
||||
twentyStandardApplicationId,
|
||||
}: {
|
||||
now: string;
|
||||
workspaceId: string;
|
||||
twentyStandardApplicationId: string;
|
||||
dependencyFlatEntityMaps: undefined;
|
||||
}): FlatFrontComponentMaps => {
|
||||
const flatFrontComponentMaps: FlatFrontComponentMaps =
|
||||
createEmptyFlatEntityMaps();
|
||||
|
||||
for (const frontComponentName of STANDARD_FRONT_COMPONENT_NAMES) {
|
||||
const flatFrontComponent = createStandardFrontComponentFlatMetadata({
|
||||
frontComponentName,
|
||||
frontComponentId: v4(),
|
||||
workspaceId,
|
||||
twentyStandardApplicationId,
|
||||
now,
|
||||
});
|
||||
|
||||
addFlatEntityToFlatEntityMapsThroughMutationOrThrow({
|
||||
flatEntity: flatFrontComponent,
|
||||
flatEntityMapsToMutate: flatFrontComponentMaps,
|
||||
});
|
||||
}
|
||||
|
||||
return flatFrontComponentMaps;
|
||||
};
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
import { type FlatFrontComponent } from 'src/engine/metadata-modules/flat-front-component/types/flat-front-component.type';
|
||||
import { STANDARD_FRONT_COMPONENTS } from 'src/engine/workspace-manager/twenty-standard-application/constants/standard-front-component.constant';
|
||||
import { TWENTY_STANDARD_APPLICATION } from 'src/engine/workspace-manager/twenty-standard-application/constants/twenty-standard-applications';
|
||||
|
||||
export const createStandardFrontComponentFlatMetadata = ({
|
||||
frontComponentName,
|
||||
frontComponentId,
|
||||
workspaceId,
|
||||
twentyStandardApplicationId,
|
||||
now,
|
||||
}: {
|
||||
frontComponentName: keyof typeof STANDARD_FRONT_COMPONENTS;
|
||||
frontComponentId: string;
|
||||
workspaceId: string;
|
||||
twentyStandardApplicationId: string;
|
||||
now: string;
|
||||
}): FlatFrontComponent => {
|
||||
const definition = STANDARD_FRONT_COMPONENTS[frontComponentName];
|
||||
|
||||
return {
|
||||
id: frontComponentId,
|
||||
universalIdentifier: definition.universalIdentifier,
|
||||
applicationId: twentyStandardApplicationId,
|
||||
applicationUniversalIdentifier:
|
||||
TWENTY_STANDARD_APPLICATION.universalIdentifier,
|
||||
workspaceId,
|
||||
name: definition.name,
|
||||
description: null,
|
||||
sourceComponentPath: definition.sourceComponentPath,
|
||||
builtComponentPath: definition.builtComponentPath,
|
||||
componentName: definition.componentName,
|
||||
builtComponentChecksum: definition.builtComponentChecksum,
|
||||
isHeadless: definition.isHeadless,
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
};
|
||||
};
|
||||
+21
@@ -9,6 +9,8 @@ import { buildStandardFlatFieldMetadataMaps } from 'src/engine/workspace-manager
|
||||
import { getStandardObjectMetadataRelatedEntityIds } from 'src/engine/workspace-manager/twenty-standard-application/utils/get-standard-object-metadata-related-entity-ids.util';
|
||||
import { getStandardPageLayoutMetadataRelatedEntityIds } from 'src/engine/workspace-manager/twenty-standard-application/utils/get-standard-page-layout-metadata-related-entity-ids.util';
|
||||
import { buildStandardFlatIndexMetadataMaps } from 'src/engine/workspace-manager/twenty-standard-application/utils/index/build-standard-flat-index-metadata-maps.util';
|
||||
import { buildStandardFlatCommandMenuItemMaps } from 'src/engine/workspace-manager/twenty-standard-application/utils/command-menu-item/build-standard-flat-command-menu-item-maps.util';
|
||||
import { buildStandardFlatFrontComponentMaps } from 'src/engine/workspace-manager/twenty-standard-application/utils/front-component/build-standard-flat-front-component-maps.util';
|
||||
import { buildStandardFlatNavigationMenuItemMaps } from 'src/engine/workspace-manager/twenty-standard-application/utils/navigation-menu-item/build-standard-flat-navigation-menu-item-maps.util';
|
||||
import { buildStandardFlatObjectMetadataMaps } from 'src/engine/workspace-manager/twenty-standard-application/utils/object-metadata/build-standard-flat-object-metadata-maps.util';
|
||||
import { buildStandardFlatPageLayoutTabMetadataMaps } from 'src/engine/workspace-manager/twenty-standard-application/utils/page-layout-tab/build-standard-flat-page-layout-tab-metadata-maps.util';
|
||||
@@ -201,6 +203,23 @@ export const computeTwentyStandardApplicationAllFlatEntityMaps = ({
|
||||
},
|
||||
});
|
||||
|
||||
const flatFrontComponentMaps = buildStandardFlatFrontComponentMaps({
|
||||
now,
|
||||
workspaceId,
|
||||
twentyStandardApplicationId,
|
||||
dependencyFlatEntityMaps: undefined,
|
||||
});
|
||||
|
||||
const flatCommandMenuItemMaps = buildStandardFlatCommandMenuItemMaps({
|
||||
now,
|
||||
workspaceId,
|
||||
twentyStandardApplicationId,
|
||||
dependencyFlatEntityMaps: {
|
||||
flatFrontComponentMaps,
|
||||
flatObjectMetadataMaps,
|
||||
},
|
||||
});
|
||||
|
||||
const allFlatEntityMaps: TwentyStandardAllFlatEntityMaps = {
|
||||
flatViewFieldMaps,
|
||||
flatViewFieldGroupMaps,
|
||||
@@ -217,6 +236,8 @@ export const computeTwentyStandardApplicationAllFlatEntityMaps = ({
|
||||
flatPageLayoutMaps,
|
||||
flatPageLayoutTabMaps,
|
||||
flatPageLayoutWidgetMaps,
|
||||
flatFrontComponentMaps,
|
||||
flatCommandMenuItemMaps,
|
||||
};
|
||||
|
||||
const idByUniversalIdentifierByMetadataName: IdByUniversalIdentifierByMetadataName =
|
||||
|
||||
@@ -4,7 +4,7 @@ export type CommandMenuItemManifest = SyncableEntityOptions & {
|
||||
label: string;
|
||||
icon?: string;
|
||||
isPinned?: boolean;
|
||||
availabilityType?: 'GLOBAL' | 'RECORD_SELECTION';
|
||||
availabilityType?: 'GLOBAL' | 'RECORD_SELECTION' | 'FALLBACK';
|
||||
availabilityObjectUniversalIdentifier?: string;
|
||||
frontComponentUniversalIdentifier: string;
|
||||
conditionalAvailabilityExpression?: string;
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
import { type CommandMenuContextApiPageType } from './CommandMenuContextApiPageType';
|
||||
import { type ObjectPermissions } from './ObjectPermissions';
|
||||
import { type ObjectRecord } from './ObjectRecord';
|
||||
|
||||
export type CommandMenuContextApi = {
|
||||
isShowPage: boolean;
|
||||
pageType: CommandMenuContextApiPageType;
|
||||
isInSidePanel: boolean;
|
||||
isFavorite: boolean;
|
||||
isRemote: boolean;
|
||||
isNoteOrTask: boolean;
|
||||
isPageInEditMode: boolean;
|
||||
favoriteRecordIds: string[];
|
||||
isSelectAll: boolean;
|
||||
hasAnySoftDeleteFilterOnView: boolean;
|
||||
numberOfSelectedRecords: number;
|
||||
objectPermissions: ObjectPermissions & { objectMetadataId: string };
|
||||
selectedRecord: ObjectRecord | undefined;
|
||||
selectedRecords: ObjectRecord[];
|
||||
featureFlags: Record<string, boolean>;
|
||||
targetObjectReadPermissions: Record<string, boolean>;
|
||||
targetObjectWritePermissions: Record<string, boolean>;
|
||||
objectMetadataItem: Record<string, unknown>;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export enum CommandMenuContextApiPageType {
|
||||
INDEX_PAGE = 'INDEX_PAGE',
|
||||
RECORD_PAGE = 'RECORD_PAGE',
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
export interface ObjectRecord {
|
||||
id: string;
|
||||
|
||||
[key: string]: any;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
deletedAt: string | null;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ export { AppPath } from './AppPath';
|
||||
export type { Arrayable } from './Arrayable';
|
||||
export type { ArraySortDirection } from './ArraySortDirection';
|
||||
export type { CommandMenuContextApi } from './CommandMenuContextApi';
|
||||
export { CommandMenuContextApiPageType } from './CommandMenuContextApiPageType';
|
||||
export { CommandMenuItemViewType } from './CommandMenuItemViewType';
|
||||
export type { ActorMetadata } from './composite-types/actor.composite-type';
|
||||
export {
|
||||
|
||||
+385
@@ -0,0 +1,385 @@
|
||||
import {
|
||||
CommandMenuContextApiPageType,
|
||||
type CommandMenuContextApi,
|
||||
} from '@/types';
|
||||
import { evaluateConditionalAvailabilityExpression } from '../evaluateConditionalAvailabilityExpression';
|
||||
|
||||
const buildContext = (
|
||||
overrides: Partial<CommandMenuContextApi> = {},
|
||||
): CommandMenuContextApi => ({
|
||||
pageType: CommandMenuContextApiPageType.INDEX_PAGE,
|
||||
isInSidePanel: false,
|
||||
isPageInEditMode: false,
|
||||
favoriteRecordIds: [],
|
||||
isSelectAll: false,
|
||||
hasAnySoftDeleteFilterOnView: false,
|
||||
numberOfSelectedRecords: 0,
|
||||
objectPermissions: {
|
||||
objectMetadataId: '',
|
||||
canReadObjectRecords: true,
|
||||
canUpdateObjectRecords: true,
|
||||
canSoftDeleteObjectRecords: true,
|
||||
canDestroyObjectRecords: false,
|
||||
restrictedFields: {},
|
||||
rowLevelPermissionPredicates: [],
|
||||
rowLevelPermissionPredicateGroups: [],
|
||||
},
|
||||
selectedRecords: [],
|
||||
featureFlags: {},
|
||||
targetObjectReadPermissions: {},
|
||||
targetObjectWritePermissions: {},
|
||||
objectMetadataItem: {},
|
||||
...overrides,
|
||||
});
|
||||
|
||||
describe('evaluateConditionalAvailabilityExpression', () => {
|
||||
describe('arrayLength for favoriteRecordIds', () => {
|
||||
it('should evaluate arrayLength(favoriteRecordIds) < numberOfSelectedRecords when some selected are not favorites', () => {
|
||||
const expression =
|
||||
'arrayLength(favoriteRecordIds) < numberOfSelectedRecords and noneDefined(selectedRecords, "deletedAt") and not hasAnySoftDeleteFilterOnView';
|
||||
|
||||
const context = buildContext({
|
||||
favoriteRecordIds: ['id-1'],
|
||||
numberOfSelectedRecords: 2,
|
||||
selectedRecords: [
|
||||
{ id: 'id-1', createdAt: '', updatedAt: '', deletedAt: null },
|
||||
{ id: 'id-2', createdAt: '', updatedAt: '', deletedAt: null },
|
||||
],
|
||||
hasAnySoftDeleteFilterOnView: false,
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(expression, context),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should deny when all selected are already favorites', () => {
|
||||
const expression =
|
||||
'arrayLength(favoriteRecordIds) < numberOfSelectedRecords and noneDefined(selectedRecords, "deletedAt") and not hasAnySoftDeleteFilterOnView';
|
||||
|
||||
const context = buildContext({
|
||||
favoriteRecordIds: ['id-1', 'id-2'],
|
||||
numberOfSelectedRecords: 2,
|
||||
selectedRecords: [
|
||||
{ id: 'id-1', createdAt: '', updatedAt: '', deletedAt: null },
|
||||
{ id: 'id-2', createdAt: '', updatedAt: '', deletedAt: null },
|
||||
],
|
||||
hasAnySoftDeleteFilterOnView: false,
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(expression, context),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should evaluate arrayLength(favoriteRecordIds) == numberOfSelectedRecords when all selected are favorites', () => {
|
||||
const expression =
|
||||
'arrayLength(favoriteRecordIds) == numberOfSelectedRecords and noneDefined(selectedRecords, "deletedAt") and not hasAnySoftDeleteFilterOnView';
|
||||
|
||||
const context = buildContext({
|
||||
favoriteRecordIds: ['id-1', 'id-2'],
|
||||
numberOfSelectedRecords: 2,
|
||||
selectedRecords: [
|
||||
{ id: 'id-1', createdAt: '', updatedAt: '', deletedAt: null },
|
||||
{ id: 'id-2', createdAt: '', updatedAt: '', deletedAt: null },
|
||||
],
|
||||
hasAnySoftDeleteFilterOnView: false,
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(expression, context),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should reject favoriteRecordIds.length (expr-eval parses "length" as unary op)', () => {
|
||||
const expression = 'favoriteRecordIds.length < numberOfSelectedRecords';
|
||||
const context = buildContext({
|
||||
favoriteRecordIds: ['id-1'],
|
||||
numberOfSelectedRecords: 2,
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(expression, context),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('includesSome', () => {
|
||||
it('should return true when some records include the value in the array prop', () => {
|
||||
const expression = 'includesSome(selectedRecords, "statuses", "ACTIVE")';
|
||||
|
||||
const context = buildContext({
|
||||
selectedRecords: [
|
||||
{ id: 'id-1', statuses: ['ACTIVE'] },
|
||||
{ id: 'id-2', statuses: ['DRAFT'] },
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(expression, context),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false when no record includes the value in the array prop', () => {
|
||||
const expression = 'includesSome(selectedRecords, "statuses", "ACTIVE")';
|
||||
|
||||
const context = buildContext({
|
||||
selectedRecords: [
|
||||
{ id: 'id-1', statuses: ['DRAFT'] },
|
||||
{ id: 'id-2', statuses: ['DRAFT'] },
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(expression, context),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('includesNone', () => {
|
||||
it('should return true when no record includes the value in the array prop', () => {
|
||||
const expression = 'includesNone(selectedRecords, "statuses", "ACTIVE")';
|
||||
|
||||
const context = buildContext({
|
||||
selectedRecords: [
|
||||
{ id: 'id-1', statuses: ['DRAFT'] },
|
||||
{ id: 'id-2', statuses: ['DRAFT'] },
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(expression, context),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false when any record includes the value in the array prop', () => {
|
||||
const expression = 'includesNone(selectedRecords, "statuses", "ACTIVE")';
|
||||
|
||||
const context = buildContext({
|
||||
selectedRecords: [
|
||||
{ id: 'id-1', statuses: ['ACTIVE'] },
|
||||
{ id: 'id-2', statuses: ['DRAFT'] },
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(expression, context),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false when all records include the value in the array prop', () => {
|
||||
const expression = 'includesNone(selectedRecords, "statuses", "ACTIVE")';
|
||||
|
||||
const context = buildContext({
|
||||
selectedRecords: [
|
||||
{ id: 'id-1', statuses: ['ACTIVE', 'DRAFT'] },
|
||||
{ id: 'id-2', statuses: ['ACTIVE'] },
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(expression, context),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('empty array guard against vacuous truth', () => {
|
||||
it('should return false for every() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'every(selectedRecords, "active")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for everyDefined() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'everyDefined(selectedRecords, "name")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for none() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'none(selectedRecords, "deletedAt")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for noneDefined() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'noneDefined(selectedRecords, "deletedAt")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for everyEquals() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'everyEquals(selectedRecords, "status", "DRAFT")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for noneEquals() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'noneEquals(selectedRecords, "status", "ACTIVE")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for includesEvery() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'includesEvery(selectedRecords, "statuses", "ACTIVE")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for includesNone() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'includesNone(selectedRecords, "statuses", "ACTIVE")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for some() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'some(selectedRecords, "active")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for someDefined() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'someDefined(selectedRecords, "name")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for includesSome() on empty selectedRecords', () => {
|
||||
const context = buildContext({ selectedRecords: [] });
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
'includesSome(selectedRecords, "statuses", "ACTIVE")',
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('activateWorkflow expression regression', () => {
|
||||
const activateWorkflowExpression =
|
||||
'everyDefined(selectedRecords, "currentVersion.trigger") and everyDefined(selectedRecords, "currentVersion.steps") and every(selectedRecords, "currentVersion.steps.length") and (everyEquals(selectedRecords, "currentVersion.status", "DRAFT") or includesNone(selectedRecords, "statuses", "ACTIVE")) and noneDefined(selectedRecords, "deletedAt")';
|
||||
|
||||
it('should not show Activate for an already-active workflow', () => {
|
||||
const context = buildContext({
|
||||
selectedRecords: [
|
||||
{
|
||||
id: 'wf-1',
|
||||
deletedAt: null,
|
||||
statuses: ['ACTIVE'],
|
||||
currentVersion: {
|
||||
status: 'ACTIVE',
|
||||
trigger: { type: 'MANUAL' },
|
||||
steps: [{ id: 'step-1' }],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
activateWorkflowExpression,
|
||||
context,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('should show Activate for a draft workflow with no active version', () => {
|
||||
const context = buildContext({
|
||||
selectedRecords: [
|
||||
{
|
||||
id: 'wf-1',
|
||||
deletedAt: null,
|
||||
statuses: ['DRAFT'],
|
||||
currentVersion: {
|
||||
status: 'DRAFT',
|
||||
trigger: { type: 'MANUAL' },
|
||||
steps: [{ id: 'step-1' }],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
activateWorkflowExpression,
|
||||
context,
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('should show Activate for a draft version when another version is active', () => {
|
||||
const context = buildContext({
|
||||
selectedRecords: [
|
||||
{
|
||||
id: 'wf-1',
|
||||
deletedAt: null,
|
||||
statuses: ['ACTIVE', 'DRAFT'],
|
||||
currentVersion: {
|
||||
status: 'DRAFT',
|
||||
trigger: { type: 'MANUAL' },
|
||||
steps: [{ id: 'step-1' }],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(
|
||||
evaluateConditionalAvailabilityExpression(
|
||||
activateWorkflowExpression,
|
||||
context,
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
+118
-1
@@ -1,12 +1,129 @@
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import {
|
||||
isNonEmptyArray,
|
||||
isNonEmptyString,
|
||||
isObject,
|
||||
isString,
|
||||
} from '@sniptt/guards';
|
||||
import { type EvaluationContext, Parser } from 'expr-eval';
|
||||
|
||||
import { isDefined } from '../validation/isDefined';
|
||||
|
||||
const BLOCKED_PROPERTY_NAMES = new Set([
|
||||
'__proto__',
|
||||
'constructor',
|
||||
'prototype',
|
||||
]);
|
||||
|
||||
const safeGetNestedProperty = (
|
||||
objectToEvaluate: unknown,
|
||||
path: string,
|
||||
): unknown => {
|
||||
if (!isString(path)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const parts = path.split('.');
|
||||
|
||||
let currentObject: unknown = objectToEvaluate;
|
||||
|
||||
for (const part of parts) {
|
||||
if (!isDefined(currentObject) || !isObject(currentObject)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (BLOCKED_PROPERTY_NAMES.has(part)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
currentObject = (currentObject as Record<string, unknown>)[part];
|
||||
}
|
||||
|
||||
return currentObject;
|
||||
};
|
||||
|
||||
type ArrayMethod = 'every' | 'some';
|
||||
|
||||
const createArrayPropCheck = (
|
||||
method: ArrayMethod,
|
||||
predicate: (value: unknown) => boolean,
|
||||
) => {
|
||||
return (array: unknown, prop: string) => {
|
||||
if (!isNonEmptyArray(array)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return array[method]((item) =>
|
||||
predicate(safeGetNestedProperty(item, prop)),
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
const createArrayPropValueCheck = (
|
||||
method: ArrayMethod,
|
||||
predicate: (value: unknown, target: unknown) => boolean,
|
||||
) => {
|
||||
return (array: unknown, prop: string, value: unknown) => {
|
||||
if (!isNonEmptyArray(array)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return array[method]((item) =>
|
||||
predicate(safeGetNestedProperty(item, prop), value),
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
const parser = new Parser();
|
||||
|
||||
parser.functions.isDefined = (value: unknown) => isDefined(value);
|
||||
parser.functions.isNonEmptyString = (value: unknown) => isNonEmptyString(value);
|
||||
parser.functions.includes = (array: unknown, value: unknown) =>
|
||||
Array.isArray(array) && array.includes(value);
|
||||
parser.functions.arrayLength = (value: unknown) =>
|
||||
Array.isArray(value) ? value.length : 0;
|
||||
|
||||
parser.functions.every = createArrayPropCheck('every', Boolean);
|
||||
parser.functions.everyDefined = createArrayPropCheck('every', isDefined);
|
||||
parser.functions.some = createArrayPropCheck('some', Boolean);
|
||||
parser.functions.someDefined = createArrayPropCheck('some', isDefined);
|
||||
parser.functions.someNonEmptyString = createArrayPropCheck(
|
||||
'some',
|
||||
isNonEmptyString,
|
||||
);
|
||||
parser.functions.none = createArrayPropCheck(
|
||||
'every',
|
||||
(value) => !Boolean(value),
|
||||
);
|
||||
parser.functions.noneDefined = createArrayPropCheck(
|
||||
'every',
|
||||
(value) => !isDefined(value),
|
||||
);
|
||||
|
||||
parser.functions.everyEquals = createArrayPropValueCheck(
|
||||
'every',
|
||||
(a, b) => a === b,
|
||||
);
|
||||
parser.functions.someEquals = createArrayPropValueCheck(
|
||||
'some',
|
||||
(a, b) => a === b,
|
||||
);
|
||||
parser.functions.noneEquals = createArrayPropValueCheck(
|
||||
'every',
|
||||
(a, b) => a !== b,
|
||||
);
|
||||
|
||||
parser.functions.includesEvery = createArrayPropValueCheck(
|
||||
'every',
|
||||
(array, value) => Array.isArray(array) && array.includes(value),
|
||||
);
|
||||
parser.functions.includesSome = createArrayPropValueCheck(
|
||||
'some',
|
||||
(array, value) => Array.isArray(array) && array.includes(value),
|
||||
);
|
||||
parser.functions.includesNone = createArrayPropValueCheck(
|
||||
'every',
|
||||
(array, value) => Array.isArray(array) && !array.includes(value),
|
||||
);
|
||||
|
||||
export const evaluateConditionalAvailabilityExpression = (
|
||||
expression: string | null | undefined,
|
||||
|
||||
@@ -152,6 +152,7 @@ export { appendCopySuffix } from './strings/appendCopySuffix';
|
||||
export { camelToKebab } from './strings/camelToKebab';
|
||||
export { camelToSnakeCase } from './strings/camelToSnakeCase';
|
||||
export { capitalize } from './strings/capitalize';
|
||||
export { kebabToCamelCase } from './strings/kebabToCamelCase';
|
||||
export { pascalCase } from './strings/pascalCase';
|
||||
export { pascalToKebab } from './strings/pascalToKebab';
|
||||
export { stringifySafely } from './strings/stringifySafely';
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { kebabToCamelCase } from '../kebabToCamelCase';
|
||||
|
||||
describe('kebabToCamelCase', () => {
|
||||
it('should convert kebab-case to camelCase', () => {
|
||||
expect(kebabToCamelCase('user-profile')).toBe('userProfile');
|
||||
});
|
||||
|
||||
it('should convert single word', () => {
|
||||
expect(kebabToCamelCase('button')).toBe('button');
|
||||
});
|
||||
|
||||
it('should handle multi-word kebab-case', () => {
|
||||
expect(kebabToCamelCase('my-component-name')).toBe('myComponentName');
|
||||
});
|
||||
|
||||
it('should handle empty string', () => {
|
||||
expect(kebabToCamelCase('')).toBe('');
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from './appendCopySuffix';
|
||||
export * from './capitalize';
|
||||
export * from './kebabToCamelCase';
|
||||
export * from './pascalCase';
|
||||
export * from './pascalToKebab';
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export const kebabToCamelCase = (str: string): string =>
|
||||
str.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "twenty-standard-application",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"license": "AGPL-3.0",
|
||||
"scripts": {
|
||||
"build": "tsx scripts/build-standard-front-components.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.25.10",
|
||||
"react": "^18.3.1",
|
||||
"tinyglobby": "^0.2.15",
|
||||
"tsx": "^4.19.3",
|
||||
"twenty-sdk": "workspace:*",
|
||||
"twenty-shared": "workspace:*"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^24.5.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "twenty-standard-application",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"projectType": "library",
|
||||
"tags": ["scope:shared"],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "nx:run-commands",
|
||||
"cache": true,
|
||||
"options": {
|
||||
"cwd": "packages/twenty-standard-application",
|
||||
"commands": [
|
||||
"tsx scripts/build-standard-front-components.ts",
|
||||
"tsc -p tsconfig.build.json"
|
||||
],
|
||||
"parallel": false
|
||||
},
|
||||
"dependsOn": ["^build"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import crypto from 'crypto';
|
||||
import esbuild from 'esbuild';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { glob } from 'tinyglobby';
|
||||
import { getBaseFrontComponentBuildOptions } from 'twenty-sdk/build';
|
||||
import { kebabToCamelCase } from 'twenty-shared/utils';
|
||||
|
||||
const FRONT_COMPONENTS_DIR = path.resolve(__dirname, '../src/front-components');
|
||||
|
||||
const BUILT_OUTPUT_DIR = path.resolve(__dirname, '../src/build');
|
||||
|
||||
const MANIFEST_OUTPUT_PATH = path.resolve(
|
||||
__dirname,
|
||||
'../src/standard-front-component-build-manifest.ts',
|
||||
);
|
||||
|
||||
const buildStandardFrontComponents = async () => {
|
||||
const tsxFiles = (
|
||||
await glob(['**/*.front-component.tsx'], {
|
||||
cwd: FRONT_COMPONENTS_DIR,
|
||||
absolute: true,
|
||||
onlyFiles: true,
|
||||
})
|
||||
).sort();
|
||||
|
||||
if (tsxFiles.length === 0) {
|
||||
throw new Error(
|
||||
`No .front-component.tsx files found in ${FRONT_COMPONENTS_DIR}`,
|
||||
);
|
||||
}
|
||||
|
||||
fs.mkdirSync(BUILT_OUTPUT_DIR, { recursive: true });
|
||||
|
||||
await esbuild.build({
|
||||
...getBaseFrontComponentBuildOptions(),
|
||||
entryPoints: tsxFiles,
|
||||
outdir: BUILT_OUTPUT_DIR,
|
||||
outbase: FRONT_COMPONENTS_DIR,
|
||||
minify: true,
|
||||
});
|
||||
|
||||
const manifestEntries: Record<
|
||||
string,
|
||||
{ builtComponentPath: string; builtComponentChecksum: string }
|
||||
> = {};
|
||||
|
||||
for (const tsxFile of tsxFiles) {
|
||||
const relativeTsx = path.relative(FRONT_COMPONENTS_DIR, tsxFile);
|
||||
const relativeMjs = relativeTsx.replace(
|
||||
'.front-component.tsx',
|
||||
'.front-component.mjs',
|
||||
);
|
||||
const mjsFilePath = path.join(BUILT_OUTPUT_DIR, relativeMjs);
|
||||
|
||||
if (!fs.existsSync(mjsFilePath)) {
|
||||
throw new Error(`Expected built file not found: ${mjsFilePath}`);
|
||||
}
|
||||
|
||||
const content = fs.readFileSync(mjsFilePath);
|
||||
const checksum = crypto.createHash('md5').update(content).digest('hex');
|
||||
|
||||
const stem = path.basename(tsxFile, '.front-component.tsx');
|
||||
const camelKey = kebabToCamelCase(stem);
|
||||
|
||||
manifestEntries[camelKey] = {
|
||||
builtComponentPath: relativeMjs,
|
||||
builtComponentChecksum: checksum,
|
||||
};
|
||||
}
|
||||
|
||||
const manifestContent = `/*
|
||||
* _____ _
|
||||
*|_ _|_ _____ _ __ | |_ _ _
|
||||
* | | \\ \\ /\\ / / _ \\ '_ \\| __| | | | Auto-generated file
|
||||
* | | \\ V V / __/ | | | |_| |_| | Any edits to this will be overridden
|
||||
* |_| \\_/\\_/ \\___|_| |_|\\__|\\__, |
|
||||
* |___/
|
||||
*/
|
||||
|
||||
export const STANDARD_FRONT_COMPONENT_BUILD_MANIFEST = ${JSON.stringify(manifestEntries, null, 2)} as const;
|
||||
`;
|
||||
|
||||
fs.writeFileSync(MANIFEST_OUTPUT_PATH, manifestContent);
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
`Built ${tsxFiles.length} standard front components, manifest written to ${MANIFEST_OUTPUT_PATH}`,
|
||||
);
|
||||
};
|
||||
|
||||
buildStandardFrontComponents().catch((error) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Failed to build standard front components:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
+107
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+107
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+107
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+107
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+108
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+108
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+108
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+108
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+108
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+108
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+108
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+108
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+108
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+107
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+107
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user