Skip to content

AGENTS.md

47 lines · 1.5 KB · Markdown
Raw

@reng/pollen

Imports

import { getPollen } from 'kody:@reng/pollen'
import { getPollen as getPollenNamed } from 'kody:@reng/pollen/getPollen'

Root export re-exports getPollen and offers a callable default with the same { location?, latitude?, longitude?, hours? } input.

Smoke tests

import { getPollen } from 'kody:@reng/pollen'

const berlin = await getPollen({ location: 'Berlin', hours: 12 })
// expect coverage === 'available' (Europe) and levels keys among alder/birch/grass/mugwort/olive/ragweed

const shanghai = await getPollen({ location: 'Shanghai', hours: 6 })
// expect coverage === 'unavailable' and empty levels (CAMS pollen is Europe-focused)

App smoke:

import { kody } from 'kody:runtime'
await kody.packageAppFetch({ kody_id: 'pollen', path: '/' })
// expect status 200 and HTML body

await kody.packageAppFetch({
  kody_id: 'pollen',
  path: '/api/getPollen',
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ location: 'Berlin', hours: 6 }),
})

Edge cases

  • Missing both location and lat/lon throws.
  • Unknown place name throws (Place not found).
  • Outside Europe (e.g. Shanghai): API returns null pollen series → coverage: "unavailable", empty levels, explanatory summary.
  • Labels (none/low/moderate/high/very_high) are a simple grains/m³ heuristic, not clinical thresholds.
  • Hosted app links must use packageContext.hostedUrl + appBasePath.
  • Zero secrets; plain fetch only.