Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

631 B
Raw Blame
import type { EntityActivityQuery } from '@service-storage/graphql/generated/graphql';
import type { ActivityEvent } from '../core/event';
import { decodeActivityEvent } from './decode';

export type EntityActivityResult =
  | { kind: 'found'; events: ActivityEvent[] }
  | { kind: 'entity-missing' };

export function selectEntityActivity(
  data: EntityActivityQuery,
  entityId: string
): EntityActivityResult {
  const item = data.user?.soup?.items?.find((entry) => entry.id === entityId);
  if (!item) return { kind: 'entity-missing' };
  return {
    kind: 'found',
    events: item.activity.map(decodeActivityEvent),
  };
}