Files
aris/packages/aris-data-source-weatherkit
kenneth 699155e0d8 feat: add actions to FeedSource interface
Add listActions() and executeAction() to FeedSource for write
operations back to external services. Actions use arktype schemas
for input validation via StandardSchemaV1.

- ActionDefinition type with optional input schema
- FeedEngine routes actions with existence and ID validation
- Source IDs use reverse-domain format (aris.location, aris.tfl)
- LocationSource: update-location action with schema validation
- TflSource: set-lines-of-interest action with lineId validation
- No-op implementations for sources without actions

Co-authored-by: Ona <no-reply@ona.com>
2026-02-15 12:53:10 +00:00
..

@aris/data-source-weatherkit

Weather data source using Apple WeatherKit REST API.

Usage

import { WeatherKitDataSource, Units } from "@aris/data-source-weatherkit"

const dataSource = new WeatherKitDataSource({
	credentials: {
		privateKey: "-----BEGIN PRIVATE KEY-----\n...",
		keyId: "ABC123",
		teamId: "DEF456",
		serviceId: "com.example.weatherkit",
	},
	hourlyLimit: 12, // optional, default: 12
	dailyLimit: 7, // optional, default: 7
})

const items = await dataSource.query(context, {
	units: Units.metric, // or Units.imperial
})

Feed Items

The data source returns four types of feed items:

Type Description
weather-current Current weather conditions
weather-hourly Hourly forecast
weather-daily Daily forecast
weather-alert Weather alerts

Priority

Base priorities are adjusted based on weather conditions:

  • Severe conditions (tornado, hurricane, blizzard, etc.): +0.3
  • Moderate conditions (thunderstorm, heavy rain, etc.): +0.15
  • Alert severity: extreme=1.0, severe=0.9, moderate=0.75, minor=0.7

Authentication

WeatherKit requires Apple Developer credentials. Generate a private key in the Apple Developer portal under Certificates, Identifiers & Profiles > Keys.

Validation

API responses are validated using arktype schemas.

Generating Test Fixtures

To regenerate fixture data from the real API:

  1. Create a .env file with your credentials (see .env.example)
  2. Run bun run scripts/generate-fixtures.ts