mirror of
https://github.com/kennethnym/aris.git
synced 2026-02-02 13:11:17 +00:00
Add WeatherKit data source package
Implements @aris/data-source-weatherkit for fetching weather data from Apple WeatherKit REST API. - WeatherKitDataSource class implementing DataSource interface - Feed items: current, hourly, daily, and alerts - Priority adjustment based on weather conditions and alert severity - Unit conversion (metric/imperial) - Response validation with arktype - Test fixtures from real API responses Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
51
packages/aris-data-source-weatherkit/README.md
Normal file
51
packages/aris-data-source-weatherkit/README.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# @aris/data-source-weatherkit
|
||||
|
||||
Weather data source using Apple WeatherKit REST API.
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
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](https://arktype.io) schemas.
|
||||
Reference in New Issue
Block a user