{"_id":"@dgtools/udisc-events","_rev":"3-fc12e893fce195e3b33fd84017a07f21","name":"@dgtools/udisc-events","dist-tags":{"latest":"0.2.3"},"versions":{"0.2.1":{"name":"@dgtools/udisc-events","version":"0.2.1","_id":"@dgtools/udisc-events@0.2.1","maintainers":[{"name":"ianmccausland","email":"imccausl@gmail.com"}],"homepage":"https://github.com/imccausl/udisc#readme","bugs":{"url":"https://github.com/imccausl/udisc/issues"},"dist":{"shasum":"42e4e9f850debf5d996bf86310f39216516d79be","tarball":"https://registry.npmjs.org/@dgtools/udisc-events/-/udisc-events-0.2.1.tgz","fileCount":5,"integrity":"sha512-XRoHird1N442mtjvVEO5/7xFBFjE8SpnSo6HuH2yCaAxlXRzg3jL5i0bAsTtYx/AEvGMlM9eg2IOkkUeqQ0HtQ==","signatures":[{"sig":"MEYCIQC6sHNWbXzVxw63AqBocLRk8+rRzTDa7JxO+lRjFumnTAIhAN8n0Ny95FdtEuOXlzlU44ifmKO477MHrkNUBrBdYO0X","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19470},"main":"lib/index.mjs","type":"module","types":"lib/index.d.mts","exports":{".":{"import":{"types":"./lib/index.d.mts","default":"./lib/index.mjs"},"require":{"types":"./lib/index.d.cts","default":"./lib/index.cjs"}},"./package.json":"./package.json"},"gitHead":"8427068dcc0420e392b25997f34244c874828668","scripts":{"lint":"yarn workspace:lint","test":"yarn workspace:test","build":"yarn workspace:build --format cjs,esm","format":"yarn workspace:format","typecheck":"yarn workspace:typecheck"},"_npmUser":{"name":"ianmccausland","email":"imccausl@gmail.com"},"repository":{"url":"git+https://github.com/imccausl/udisc.git","type":"git"},"_npmVersion":"11.6.2","description":"An interface for querying udisc event data","directories":{},"_nodeVersion":"24.11.1","dependencies":{"xlsx":"^0.18.5","luxon":"^3.7.2","cheerio":"^1.1.2"},"publishConfig":{"tag":"latest","access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"msw":"^2.12.2","jsdom":"^27.2.0","vitest":"^4.0.10","@types/xlsx":"^0.0.36","@types/jsdom":"^27","@types/luxon":"^3.7.1","@types/cheerio":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/udisc-events_0.2.1_1764630919527_0.9709852331425628","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@dgtools/udisc-events","version":"0.2.2","_id":"@dgtools/udisc-events@0.2.2","maintainers":[{"name":"ianmccausland","email":"imccausl@gmail.com"}],"homepage":"https://github.com/imccausl/udisc#readme","bugs":{"url":"https://github.com/imccausl/udisc/issues"},"dist":{"shasum":"a28465ff24dce1ae87e4f2be37d863ce9fa9a250","tarball":"https://registry.npmjs.org/@dgtools/udisc-events/-/udisc-events-0.2.2.tgz","fileCount":5,"integrity":"sha512-JVCj9fUK0V5gof+xXvtCB3OIskgS7qpM2UTO1dpJEzo/Be8OrVY+sMqR2aY8X1qZ3URxvALRNqk2KkK5mYXqRQ==","signatures":[{"sig":"MEUCIDctYqHjMprPmaooAn5DRvB0lmuGqudZ3UqHXuvz84XSAiEAlmdYwW8V+1Wiu3eu/r5jZ5Oj372AAUywGmHgSzvjDIM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dgtools%2fudisc-events@0.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":19471},"main":"lib/index.mjs","type":"module","types":"lib/index.d.mts","exports":{".":{"import":{"types":"./lib/index.d.mts","default":"./lib/index.mjs"},"require":{"types":"./lib/index.d.cts","default":"./lib/index.cjs"}},"./package.json":"./package.json"},"gitHead":"c7ca1fa4d9cc71eaf777109d650c5a08bcc7169a","scripts":{"lint":"yarn workspace:lint","test":"yarn workspace:test","build":"yarn workspace:build --format cjs,esm","format":"yarn workspace:format","typecheck":"yarn workspace:typecheck"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6c997882-4cf1-4d0b-a48d-cfb3865f7343"}},"repository":{"url":"git+https://github.com/imccausl/udisc.git","type":"git"},"_npmVersion":"11.6.2","description":"An interface for querying udisc event data","directories":{},"_nodeVersion":"24.11.1","dependencies":{"xlsx":"^0.18.5","luxon":"^3.7.2","cheerio":"^1.1.2"},"publishConfig":{"tag":"latest","access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"msw":"^2.12.2","jsdom":"^27.2.0","vitest":"^4.0.10","@types/xlsx":"^0.0.36","@types/jsdom":"^27","@types/luxon":"^3.7.1","@types/cheerio":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/udisc-events_0.2.2_1764631296059_0.2930934195514936","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@dgtools/udisc-events","description":"An interface for querying udisc event data","version":"0.2.3","type":"module","repository":{"type":"git","url":"git+https://github.com/imccausl/udisc.git"},"types":"lib/index.d.mts","main":"lib/index.mjs","exports":{".":{"import":{"types":"./lib/index.d.mts","default":"./lib/index.mjs"},"require":{"types":"./lib/index.d.cts","default":"./lib/index.cjs"}},"./package.json":"./package.json"},"publishConfig":{"registry":"https://registry.npmjs.org/","tag":"latest","access":"public"},"scripts":{"build":"yarn workspace:build --format cjs,esm","format":"yarn workspace:format","lint":"yarn workspace:lint","typecheck":"yarn workspace:typecheck","test":"yarn workspace:test"},"devDependencies":{"@types/cheerio":"^1.0.0","@types/jsdom":"^27","@types/luxon":"^3.7.1","@types/xlsx":"^0.0.36","jsdom":"^27.2.0","msw":"^2.12.2","vitest":"^4.0.10"},"dependencies":{"cheerio":"^1.1.2","luxon":"^3.7.2","xlsx":"^0.18.5"},"gitHead":"531ca9cf249b010d0405ea28e6eae3ca4824db86","_id":"@dgtools/udisc-events@0.2.3","bugs":{"url":"https://github.com/imccausl/udisc/issues"},"homepage":"https://github.com/imccausl/udisc#readme","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-gKFTog5JPAVzRuwUWR6QmrjY8fFTfiQ7fsXoDMi8qpA7yl6+jpQ7gyLKrxHuAU56jyEuFrrldJ9ckgoPhA49KA==","shasum":"f0735f401e18b93145ccff2759cd66fb0df82ea7","tarball":"https://registry.npmjs.org/@dgtools/udisc-events/-/udisc-events-0.2.3.tgz","fileCount":6,"unpackedSize":23172,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dgtools%2fudisc-events@0.2.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDKjcaAHvRPuDuxabL1dmiLv29fv9SJPl+6dhj7De9gZQIgSMwL4hhSryC/SMQb1O5K0XIIv/gGDBKbu9riV6bHOHk="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6c997882-4cf1-4d0b-a48d-cfb3865f7343"}},"directories":{},"maintainers":[{"name":"ianmccausland","email":"imccausl@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/udisc-events_0.2.3_1764804340628_0.7952521005018192"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-01T23:15:19.427Z","modified":"2025-12-03T23:25:41.234Z","0.2.1":"2025-12-01T23:15:19.736Z","0.2.2":"2025-12-01T23:21:36.257Z","0.2.3":"2025-12-03T23:25:40.792Z"},"bugs":{"url":"https://github.com/imccausl/udisc/issues"},"homepage":"https://github.com/imccausl/udisc#readme","repository":{"type":"git","url":"git+https://github.com/imccausl/udisc.git"},"description":"An interface for querying udisc event data","maintainers":[{"name":"ianmccausland","email":"imccausl@gmail.com"}],"readme":"# @imccausl/udisc-events\n\nServer-side helper for scraping public UDisc event listings and leaderboards. It wraps the event search page and leaderboard export into a small API.\n\n## Requirements\n\n- Run in a Node.js server/runtime (fetching UDisc from the browser will fail due to CORS). Node 18+ is recommended for the built-in `fetch`.\n\n## Installation\n\n```bash\nnpm i @imccausl/udisc-events\n# or\nyarn add @imccausl/udisc-events\n# or\npnpm add @imccausl/udisc-events\n```\n\n## Quick start\n\n```ts\nimport { EventsQuery } from '@imccausl/udisc-events'\n\nconst query = new EventsQuery({\n  query: 'Maple Hill',\n  latitude: 42.3,\n  longitude: -71.8,\n  searchRadius: 80,\n  quickFilter: 'tournament',\n})\n\nconst events = await query.events() // array of events or an error shape\nconst latest = await query.latestEvent()\n\nif (latest?.exportUrl) {\n  const leaderboard = await query.leaderboard(latest.exportUrl)\n  console.log(latest.name, leaderboard.length)\n}\n```\n\n## API\n\n### `new EventsQuery(query)`\n\nCreates a query against `https://udisc.com/events`.\n\n**Query options:**\n\n- `query`: free-text search term.\n- `latitude`, `longitude`, `searchRadius`: narrow results around a location (kilometer radius).\n- `quickFilter`: one of `all`, `my-events`, `trending`, `tournament`, `league`, `pdga`, `course-cleanup`, `glow`, `clinics`, `women`, `charity`.\n- `type`: array of event types (`league`, `clinic`, `clean-up`, `non-dg`).\n- `tag`: array of tags (`glow-round`, `ace-pool`, `charity`, `female-friendly`, `beginner-friendly`, `junior-friendly`, `bag-tags`).\n- `handicapScoring`: `true` to include handicap events.\n- `dates`: `past` or `custom` (absence means upcoming).\n- `dateDuration`: `day` | `week` | `month` (omit when using `custom`).\n- `startsOnOrBefore` / `endsOnOrAfter`: ISO date strings, required when `dates: 'custom'`.\n\n### Methods\n\n- `events(): Promise<Event[] | ErrorResponse>`: Parsed events or `{ error: true, status, message }` when the request fails.\n- `latestEvent(): Promise<Event | null>`: Most recent event from the current result set (null on error or no events).\n- `leaderboard(exportUrl): Promise<Record<string, any>[] | ErrorResponse>`: Downloads the Excel export for the given event and returns rows as JSON.\n- `latestLeaderboard(): Promise<{ event: Event; leaderboard: any[] } | ErrorResponse>`: Fetches the newest event and its leaderboard in one call; returns an error object if nothing is available.\n\n**Event shape**\n\n```ts\n{\n  name: string\n  date: string | null // ISO date\n  day: 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun' | null\n  exportUrl: string | null\n  pageUrl: string | null\n  courseName: string | null\n  location: string | null\n}\n```\n\n## Example server route\n\nUse the library from a server to avoid CORS:\n\n```ts\nimport express from 'express'\nimport { EventsQuery } from '@imccausl/udisc-events'\n\nconst app = express()\n\napp.get('/api/udisc/latest', async (_req, res) => {\n  const query = new EventsQuery({ query: 'league', quickFilter: 'league' })\n  const latest = await query.latestLeaderboard()\n  res.json(latest)\n})\n\napp.listen(3000)\n```\n\n## Notes\n\n- The library scrapes public pages; be respectful of UDisc and avoid unnecessary traffic.\n- Responses that fail network or CORS checks return an error object instead of throwing; check for `error` before using the data.\n","readmeFilename":"README.md"}