handler/imap-compiler.ts

imapflow · src/handler/imap-compiler.ts · typescript · MIT
email

Compiles IMAP protocol responses into buffers, handling quoting, literals, and logging.

// Source: https://github.com/postalsys/imapflow | License: MIT | Copyright 2020-2024 Postal Systems OÜ
// Provided via justclaw.it.com; keep this notice with the code.
/* eslint no-console: 0, new-cap: 0 */

import imapFormalSyntax from './imap-formal-syntax.js';
import { createImapError } from '../errors.js';
import type { CompilerOptions, ImapCompileInput, ImapCompileNode } from './types.js';

// A single element of a sequence-set as defined by the RFC 9051 grammar: a number
// or a range, where "*" stands for the largest number in use. Digit strings are not
// range-checked here (a server rejects "0" or an overlong number on its own); the
// point of the check is that nothing outside this alphabet can reach the wire.
const SEQ_RANGE = /^(\d+|\*)(:(\d+|\*))?$/;

// Validates a full sequ

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key