diff --git a/packages/aris-source-tfl/src/index.ts b/packages/aris-source-tfl/src/index.ts index 2ef5cc2..f445054 100644 --- a/packages/aris-source-tfl/src/index.ts +++ b/packages/aris-source-tfl/src/index.ts @@ -1,12 +1,13 @@ export { TflSource } from "./tfl-source.ts" export { TflApi } from "./tfl-api.ts" export type { TflLineId } from "./tfl-api.ts" -export type { - ITflApi, - StationLocation, - TflAlertData, - TflAlertFeedItem, - TflAlertSeverity, - TflLineStatus, - TflSourceOptions, +export { + TflFeedItemType, + type ITflApi, + type StationLocation, + type TflAlertData, + type TflAlertFeedItem, + type TflAlertSeverity, + type TflLineStatus, + type TflSourceOptions, } from "./types.ts" diff --git a/packages/aris-source-tfl/src/tfl-source.ts b/packages/aris-source-tfl/src/tfl-source.ts index b5546a3..3ac2f7d 100644 --- a/packages/aris-source-tfl/src/tfl-source.ts +++ b/packages/aris-source-tfl/src/tfl-source.ts @@ -15,6 +15,7 @@ import type { } from "./types.ts" import { TflApi, lineId } from "./tfl-api.ts" +import { TflFeedItemType } from "./types.ts" const setLinesInput = lineId.array() @@ -150,7 +151,7 @@ export class TflSource implements FeedSource { return { id: `tfl-alert-${status.lineId}-${status.severity}`, - type: "tfl-alert", + type: TflFeedItemType.Alert, timestamp: context.time, data, signals, diff --git a/packages/aris-source-tfl/src/types.ts b/packages/aris-source-tfl/src/types.ts index 0fa01d7..09f1246 100644 --- a/packages/aris-source-tfl/src/types.ts +++ b/packages/aris-source-tfl/src/types.ts @@ -20,7 +20,13 @@ export interface TflAlertData extends Record { closestStationDistance: number | null } -export type TflAlertFeedItem = FeedItem<"tfl-alert", TflAlertData> +export const TflFeedItemType = { + Alert: "tfl-alert", +} as const + +export type TflFeedItemType = (typeof TflFeedItemType)[keyof typeof TflFeedItemType] + +export type TflAlertFeedItem = FeedItem export interface TflSourceOptions { apiKey?: string