parseIsoTimestamp (mailbox/model.ts)

nanoclaw · src/mailbox/model.ts · typescript · MIT
email

Defines mailbox record types and ISO timestamp parsing for a messaging system.

// Source: https://github.com/nanocoai/nanoclaw | License: MIT | Copyright 2026 Gavriel
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Canonical semantic contract for every persisted agent-mailbox record.
 *
 * Edit `src/mailbox/model.ts` only, then run `pnpm mailbox-model:generate`. The runner
 * copy is checked in because the Node host and Bun container are packaged independently
 * and deliberately share no runtime module.
 */

declare const isoTimestampBrand: unique symbol;

/** Exact `Date.prototype.toISOString()` representation, validated at a parser boundary. */
export type IsoTimestamp = string & { readonly [isoTimestampBrand]: true };

export function parseIsoTimestamp(value: unknown): IsoTimestamp {
  if (typeof value !== 'string') throw new Error('invali

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

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

Get a free API key