lib/nntp (XOVER client, Xref, GROUP), lib/headers (subjects, file keys, segments from overview lines; the yEnc path stays behind for phase 2), lib/release (identity, random names, now in lib), lib/files (aggregator, volume names), lib/rules (posting tools, owner by priority, release verdicts), lib/chunks (release chunk codec). Their unit tests came along; new ones for codec, rules and volumes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
658 B
TypeScript
24 lines
658 B
TypeScript
export interface GroupInfo {
|
|
count: bigint
|
|
first: bigint
|
|
last: bigint
|
|
name: string
|
|
}
|
|
|
|
/**
|
|
* Parses a `211 count first last name` GROUP reply (RFC 3977 §6.1.1).
|
|
*
|
|
* nntp-js's own `group()` destructures this reply without skipping the status
|
|
* code, so its `first`/`last` are off by one field. Pass it `result.resp`.
|
|
*/
|
|
export function parseGroupResponse(resp: string): GroupInfo {
|
|
const match = /^211\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)/.exec(resp.trim())
|
|
if (!match) throw new Error(`Unexpected GROUP response: ${resp}`)
|
|
return {
|
|
count: BigInt(match[1]),
|
|
first: BigInt(match[2]),
|
|
last: BigInt(match[3]),
|
|
name: match[4],
|
|
}
|
|
}
|