Skip to content

The open alternative to Salesforce, designed for AI.

1.7 KB
Raw Blame
// Kept free of imports: twenty-server's exemptions spec loads this module.
// Entities that do not fit the scoped wrapper: workspace itself,
// nullable-workspaceId rows (instance-level config / migrations / tokens),
// and global tables with no workspaceId column at all.
export const STRUCTURAL_EXEMPTIONS = [
  'WorkspaceEntity',

  // nullable workspaceId — both rows support instance-level and per-workspace use
  'KeyValuePairEntity',
  'UpgradeMigrationEntity',
  'AppTokenEntity',
  // user-scoped auth sessions; workspaceId is null for workspace-agnostic sessions
  'UserSessionEntity',
  'ApplicationRegistrationEntity',

  'ApplicationRegistrationVariableEntity',
  'ApplicationRegistrationVersionEntity',
  'BillingPriceEntity',
  'BillingProductEntity',
  'BillingSubscriptionItemEntity',
  'SigningKeyEntity',
  'UserEntity',
] as const;

// Workspace-scoped entities the wrapper could technically wrap, but where
// the dominant access patterns are cross-workspace (request routing, auth,
// metadata sync, file storage, transaction-bound channel updates) and the
// payoff doesn't justify dual-injecting every call site or growing the
// wrapper API. Treat as a "deliberately not migrated" list, not a backlog.
export const WORKSPACE_SCOPED_EXEMPTIONS = [
  // Read by user across every workspace they belong to (the "apps you
  // authorized" screen) and from the OAuth token endpoint, which has no
  // request workspace to scope by.
  'ApplicationAuthorizationEntity',
  // 20+ call sites across calendar/messaging modules; staged for a dedicated PR.
  'CalendarChannelEntity',
  'MessageChannelEntity',
  'UserWorkspaceEntity',
  'ConnectedAccountEntity',
  'WorkspaceSsoIdentityProviderEntity',
] as const;