Skip to content
Source
Sign inSign up
samwillis/neon-durable-streams
Open History to see the last commit

stream-lifecycle.ts

5 lines430 Bytes

1/** Availability is independent of append closure and retained fork ancestry. */
2export function streamPresence(stream: { readonly deleted_at: Date | null; readonly expired: boolean }): 'available' | 'deleted' | 'expired' {
3 return stream.deleted_at !== null ? 'deleted' : stream.expired ? 'expired' : 'available'
4}
5export function unavailableGenerationStatus(references: number): 404 | 410 { return references > 0 ? 410 : 404 }