← Public packages
@kentcdodds/audible
Personal Audible library app — browser re-auth, library, wishlist, NAS archive stub.
src/types.ts
80 lines · 2.1 KB · TypeScript/** audible-cli / converted OpenAudible auth JSON shape (secret `audibleAuth`). */
export type AudibleAuth = {
adp_token: string
device_private_key: string
access_token?: string
refresh_token?: string
/** Unix timestamp (seconds) when access_token expires. */
expires?: number
website_cookies?: Record<string, string>
store_authentication_cookie?: Record<string, unknown> | string
device_info?: {
device_serial_number?: string
device_type?: string
device_name?: string
[key: string]: unknown
}
customer_info?: {
user_id?: string
name?: string
[key: string]: unknown
}
locale?: string
}
export type ArchiveEligibility =
| 'downloadable'
| 'plus_stream'
| 'unsupported_format'
export type SlimLibraryItem = {
asin: string
title?: string
authors?: string[]
narrators?: string[]
purchaseDate?: string
runtimeLengthMin?: number
isFinished?: boolean
percentComplete?: number
series?: Array<{ title?: string; sequence?: string }>
/** Best-effort cover image URL from Audible media response groups. */
coverUrl?: string
/** Flat Title.m4b name on the NAS when archive status was enriched. */
nasFilename?: string
/** True when that Title.m4b already exists (home audiobook_exists). */
onNas?: boolean
/** True when onNas came from packageStorage NAS status cache. */
nasCacheHit?: boolean
/** True when cached onNas is past soft TTL (SWR stale). */
nasStale?: boolean
/**
* Whether Adrm Save-to-NAS is available.
* Plus catalog (`is_ayce` / AYCL) stays listenable but is stream-only.
* Shows / odd formats are not audiobook downloads.
*/
archiveEligibility?: ArchiveEligibility
/** Quiet badge copy, e.g. "Plus · stream only" / "Not an audiobook download". */
archiveHint?: string
/** True when `is_ayce` or benefit AYCL (Audible Plus / catalog). */
isAyce?: boolean
benefitId?: string | null
contentType?: string
contentDeliveryType?: string
formatType?: string
}
export type LicenseMetadata = {
asin: string
status?: string
contentUrl?: string
drmType?: string
format?: string
voucher?: {
key?: string
iv?: string
rules?: unknown
}
chapterInfo?: unknown
contentReference?: unknown
message?: string
}