mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 09:01:19 +00:00
feat(tfl): export TflFeedItemType const
Replace hardcoded "tfl-alert" string with a TflFeedItemType const object, matching the pattern used by google-calendar and weatherkit packages. Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
export { TflSource } from "./tfl-source.ts"
|
export { TflSource } from "./tfl-source.ts"
|
||||||
export { TflApi } from "./tfl-api.ts"
|
export { TflApi } from "./tfl-api.ts"
|
||||||
export type { TflLineId } from "./tfl-api.ts"
|
export type { TflLineId } from "./tfl-api.ts"
|
||||||
export type {
|
export {
|
||||||
ITflApi,
|
TflFeedItemType,
|
||||||
StationLocation,
|
type ITflApi,
|
||||||
TflAlertData,
|
type StationLocation,
|
||||||
TflAlertFeedItem,
|
type TflAlertData,
|
||||||
TflAlertSeverity,
|
type TflAlertFeedItem,
|
||||||
TflLineStatus,
|
type TflAlertSeverity,
|
||||||
TflSourceOptions,
|
type TflLineStatus,
|
||||||
|
type TflSourceOptions,
|
||||||
} from "./types.ts"
|
} from "./types.ts"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import type {
|
|||||||
} from "./types.ts"
|
} from "./types.ts"
|
||||||
|
|
||||||
import { TflApi, lineId } from "./tfl-api.ts"
|
import { TflApi, lineId } from "./tfl-api.ts"
|
||||||
|
import { TflFeedItemType } from "./types.ts"
|
||||||
|
|
||||||
const setLinesInput = lineId.array()
|
const setLinesInput = lineId.array()
|
||||||
|
|
||||||
@@ -150,7 +151,7 @@ export class TflSource implements FeedSource<TflAlertFeedItem> {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
id: `tfl-alert-${status.lineId}-${status.severity}`,
|
id: `tfl-alert-${status.lineId}-${status.severity}`,
|
||||||
type: "tfl-alert",
|
type: TflFeedItemType.Alert,
|
||||||
timestamp: context.time,
|
timestamp: context.time,
|
||||||
data,
|
data,
|
||||||
signals,
|
signals,
|
||||||
|
|||||||
@@ -20,7 +20,13 @@ export interface TflAlertData extends Record<string, unknown> {
|
|||||||
closestStationDistance: number | null
|
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<typeof TflFeedItemType.Alert, TflAlertData>
|
||||||
|
|
||||||
export interface TflSourceOptions {
|
export interface TflSourceOptions {
|
||||||
apiKey?: string
|
apiKey?: string
|
||||||
|
|||||||
Reference in New Issue
Block a user