2025-06-07 10:19:45 +05:30

101 lines
2.6 KiB
TypeScript

export enum Apps {
LINEAR = "LINEAR",
SLACK = "SLACK",
}
export const AppNames = {
[Apps.LINEAR]: "Linear",
[Apps.SLACK]: "Slack",
} as const;
// General node types that are common across all apps
export const GENERAL_NODE_TYPES = {
PERSON: {
name: "Person",
description: "Represents an individual, like a team member or contact",
},
APP: {
name: "App",
description: "A software application or service that's integrated",
},
PLACE: {
name: "Place",
description: "A physical location like an office, meeting room, or city",
},
ORGANIZATION: {
name: "Organization",
description: "A company, team, or any formal group of people",
},
EVENT: {
name: "Event",
description: "A meeting, deadline, or any time-based occurrence",
},
} as const;
// App-specific node types
export const APP_NODE_TYPES = {
[Apps.LINEAR]: {
ISSUE: {
name: "Linear Issue",
description: "A task, bug report, or feature request tracked in Linear",
},
PROJECT: {
name: "Linear Project",
description: "A collection of related issues and work items in Linear",
},
CYCLE: {
name: "Linear Cycle",
description: "A time-boxed iteration of work in Linear",
},
TEAM: {
name: "Linear Team",
description: "A group of people working together in Linear",
},
LABEL: {
name: "Linear Label",
description: "A tag used to categorize and organize issues in Linear",
},
},
[Apps.SLACK]: {
CHANNEL: {
name: "Slack Channel",
description: "A dedicated space for team communication in Slack",
},
THREAD: {
name: "Slack Thread",
description: "A focused conversation branch within a Slack channel",
},
MESSAGE: {
name: "Slack Message",
description: "A single communication sent in a Slack channel or thread",
},
REACTION: {
name: "Slack Reaction",
description: "An emoji response to a message in Slack",
},
FILE: {
name: "Slack File",
description: "A document, image or other file shared in Slack",
},
},
} as const;
/**
* Returns both general node types and app-specific node types for given apps
* @param apps Array of app names to get node types for
* @returns Object containing general and app-specific node types
*/
export function getNodeTypes(apps: Array<keyof typeof APP_NODE_TYPES>) {
const appSpecificTypes = apps.reduce((acc, appName) => {
return {
...acc,
[appName]: APP_NODE_TYPES[appName],
};
}, {});
return {
general: GENERAL_NODE_TYPES,
appSpecific: appSpecificTypes,
};
}