Skip to content

v0.0.2

Latest

Choose a tag to compare

@abaliy abaliy released this 02 May 06:00

v0.0.2

Breaking

  • POST methods (humanize, detect) no longer retry on 5xx or network errors by default. Set retryOnPost: true to opt in. 429 still retries on every method.
  • Empty or whitespace HUMANTONE_API_KEY is now treated as unset (errorCode: 'missing_api_key') instead of malformed ('invalid_api_key_format'). Same for HUMANTONE_BASE_URL.
  • err.details on JSON parse failures is now an object { rawBody, parseError } instead of a string.

Fixed

  • Error parser now falls back to HTTP status when verbatim message does not match the catalog. Unknown 401/403/404 messages map correctly to AuthenticationError/PermissionError/NotFoundError.
  • Response shape validation: malformed ai_score, content, credits_used, output_format now raise errorCode: 'invalid_response_shape' instead of crashing.
  • request_id resolution: body request_id first, then X-Request-Id header, else null.
  • Retry-After parses both numeric seconds and HTTP-date format.
  • Constructor errors now use distinct errorCode values: missing_api_key and invalid_api_key_format.
  • Custom userAgent config is appended to default with a single space; whitespace-only is ignored.
  • output_format defaults to 'text' (SDK override of API default 'html').

Added

  • 49-test unit suite via node --test, zero external dev dependencies.
  • README sections: Retries, error code groups, API-key safety note.

Compatibility

Node.js 18, 20, 22. Bun. AWS Lambda Node runtime.