Api keys and webhook migration to core (#13011)

TODO: check Zapier trigger records work as expected

---------

Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
nitin
2025-07-09 20:33:54 +05:30
committed by GitHub
parent 18792f9f74
commit 484c267aa6
113 changed files with 4563 additions and 1060 deletions
@@ -49,6 +49,7 @@ export class StandardFieldFactory {
isGatedAndNotEnabled(
workspaceEntityMetadataArgs.gate,
context.featureFlags,
'database',
)
) {
return acc;
@@ -37,6 +37,7 @@ export class StandardObjectFactory {
isGatedAndNotEnabled(
workspaceEntityMetadataArgs.gate,
context.featureFlags,
'database',
)
) {
return undefined;
@@ -37,7 +37,6 @@ import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/sta
// TODO: Maybe we should automate this with the DiscoverService of Nest.JS
export const standardObjectMetadataDefinitions = [
ApiKeyWorkspaceEntity,
AttachmentWorkspaceEntity,
BlocklistWorkspaceEntity,
CalendarEventWorkspaceEntity,
@@ -55,7 +54,6 @@ export const standardObjectMetadataDefinitions = [
ViewFilterGroupWorkspaceEntity,
ViewSortWorkspaceEntity,
ViewWorkspaceEntity,
WebhookWorkspaceEntity,
WorkflowWorkspaceEntity,
WorkflowVersionWorkspaceEntity,
WorkflowRunWorkspaceEntity,
@@ -73,4 +71,6 @@ export const standardObjectMetadataDefinitions = [
PersonWorkspaceEntity,
TaskWorkspaceEntity,
TaskTargetWorkspaceEntity,
ApiKeyWorkspaceEntity,
WebhookWorkspaceEntity,
];
@@ -1,11 +1,33 @@
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
export type GateContext = 'database' | 'graphql';
export const isGatedAndNotEnabled = (
gate: Gate | undefined,
workspaceFeatureFlagsMap: Record<string, boolean>,
context?: GateContext,
): boolean => {
const featureFlagValue =
gate?.featureFlag && workspaceFeatureFlagsMap[gate.featureFlag];
// If no gate, not gated
if (!gate?.featureFlag) {
return false;
}
return gate?.featureFlag !== undefined && !featureFlagValue;
// Check if explicitly excluded from the specific context
switch (context) {
case 'database':
if (gate.excludeFromDatabase === false) {
return false; // Not gated for database
}
break;
case 'graphql':
if (gate.excludeFromGraphQL === false) {
return false; // Not gated for GraphQL
}
break;
}
// If context-specific exclusion is true or undefined (default behavior), check the flag
const featureFlagValue = workspaceFeatureFlagsMap[gate.featureFlag];
return !featureFlagValue;
};