Repository: directus/directus
File: packages/system-data/src/fields/index.ts (TypeScript)

Code before:
import notificationFields from './notifications.yaml';
import operationFields from './operations.yaml';
import panelFields from './panels.yaml';
import permissionFields from './permissions.yaml';
import policyFields from './policies.yaml';
import presetFields from './presets.yaml';
import relationFields from './relations.yaml';
import revisionFields from './revisions.yaml';
import roleFields from './roles.yaml';
import sessionFields from './sessions.yaml';
import settingsFields from './settings.yaml';
import shareFields from './shares.yaml';
import translationFields from './translations.yaml';
import userFields from './users.yaml';
import versionFields from './versions.yaml';
import webhookFields from './webhooks.yaml';

import type { FieldMeta } from '../types.js';
import { isSystemCollection } from '../collections/index.js';

export const systemFieldRows: FieldMeta[] = [];

export function isSystemField(collection: string, field: string): boolean {
	if (!isSystemCollection(collection)) return false;

	return !!systemFieldRows.find((fieldMeta) => fieldMeta.collection === collection && fieldMeta.field === field);
}

processFields(accessFields);
processFields(activityFields);
processFields(collectionFields);
processFields(commentsFields);
processFields(dashboardFields);
processFields(extensionFields);
processFields(fieldFields);
processFields(fileFields);
processFields(flowFields);
processFields(folderFields);
processFields(migrationFields);
processFields(notificationFields);
processFields(operationFields);
processFields(panelFields);
processFields(permissionFields);
processFields(policyFields);
processFields(presetFields);
processFields(relationFields);
processFields(revisionFields);
processFields(roleFields);
processFields(sessionFields);
processFields(settingsFields);
processFields(shareFields);

Review comment (suggestion):
Personal preference, but I'd prefer `Boolean()` here.

Code after:
import notificationFields from './notifications.yaml';
import operationFields from './operations.yaml';
import panelFields from './panels.yaml';
import permissionFields from './permissions.yaml';
import policyFields from './policies.yaml';
import presetFields from './presets.yaml';
import relationFields from './relations.yaml';
import revisionFields from './revisions.yaml';
import roleFields from './roles.yaml';
import sessionFields from './sessions.yaml';
import settingsFields from './settings.yaml';
import shareFields from './shares.yaml';
import translationFields from './translations.yaml';
import userFields from './users.yaml';
import versionFields from './versions.yaml';
import webhookFields from './webhooks.yaml';

import type { FieldMeta } from '../types.js';

export const systemFieldRows: FieldMeta[] = [];

export function isSystemField(collection: string, field: string): boolean {
	if (!collection.startsWith('directus_')) return false;

	return Boolean(systemFieldRows.find((fieldMeta) => fieldMeta.collection === collection && fieldMeta.field === field));
}

processFields(accessFields);
processFields(activityFields);
processFields(collectionFields);
processFields(commentsFields);
processFields(dashboardFields);
processFields(extensionFields);
processFields(fieldFields);
processFields(fileFields);
processFields(flowFields);
processFields(folderFields);
processFields(migrationFields);
processFields(notificationFields);
processFields(operationFields);
processFields(panelFields);
processFields(permissionFields);
processFields(policyFields);
processFields(presetFields);
processFields(relationFields);
processFields(revisionFields);
processFields(roleFields);
processFields(sessionFields);
processFields(settingsFields);
processFields(shareFields);
processFields(translationFields);