sams-provider-events
v0.4.0
Published
Types, Zod schemas, and constants for SAMS provider events delivered to consumer SQS queues.
Downloads
264
Readme
Types & Schemas for SAMS Provider
Install as sams-provider-events for typed events from the SAMS provider delivered to your club app's SQS queue.
Install
bun add sams-provider-events
pnpm add sams-provider-events
npm install sams-provider-eventsRequires Node.js 25+ (or a recent Bun release).
TypeScript
import {
SamsEventType,
type ClubSeasonTeamsUpdatedEvent,
type SamsEvent,
} from "sams-provider-events";
export function handleEvent(event: SamsEvent): void {
if (event.type === SamsEventType.clubSeasonTeamsUpdated) {
const typed: ClubSeasonTeamsUpdatedEvent = event;
saveTeams(typed.payload.club.uuid, typed.payload.teams);
}
}Zod
import { parseSamsEventFromSqsBody, SamsEventType } from "sams-provider-events";
export function handleSqsRecord(body: string): void {
const event = parseSamsEventFromSqsBody(body);
if (event.type === SamsEventType.clubUpdated) {
saveClub(event.payload);
}
}Event reference
Idempotency
Every envelope includes snapshotVersion, a hash of the payload. Compare that field on incoming events — you do not need to recompute it. Skip writes when the value is unchanged for the same logical key.
