@ecosy/core
v0.3.4
Published
A modular, tree-shakable collection of essential utilities, serialization primitives, and event-driven patterns for modern TypeScript applications
Maintainers
Readme
@ecosy/core
A modular, tree-shakable collection of essential utilities, serialization primitives, and event-driven patterns for modern TypeScript applications.
Installation
yarn add @ecosy/coreFeatures
Subpath Imports
| Entry point | Description |
| ------------------------ | --------------------------------------------- |
| @ecosy/core | Re-exports all modules (except syhemo) |
| @ecosy/core/types | TypeScript type utilities |
| @ecosy/core/utilities | Runtime utility functions |
| @ecosy/core/env | getEnv() — safe process.env access |
| @ecosy/core/subscriber | Pub/sub event emitter with state |
| @ecosy/core/http | HTTP client, Endpoint registry, uploads |
| @ecosy/core/logger | Structured logger with log levels |
| @ecosy/core/syhemo | System health monitor (Node-only) |
| @ecosy/core/serialize | Serialization engine (JSON, URL, queryString) |
| @ecosy/core/slugify | Unicode-safe string slugifier |
| @ecosy/core/searchify | Diacritic-insensitive fuzzy search |
Types
Deep utility types for TypeScript — Freezable<T>, PartialLiteral<T>, Promisable<V>, ToString<T>, and more.
Utilities
clone— Deep clone with circular reference handlingfreeze— Deep freeze via clone +Object.freezeisEqual— Structural deep equality (Date, Map, Set, TypedArrays)merge— Deep merge with prototype pollution protectionflatten/flattenToArray— Object flatteningget— Safe deep path resolution ("a.b[0].c")defer/deferAsync— rAF + setTimeout scheduling with cancelsanitizeMime/MIME_REGEX— validate and normalize MIME stringsisFormData/objectToFormData— FormData detection and conversiontoString/ucfirst/pascalToKebab— string helpers- Type guards:
isFunction,isObject,isLiteralObject,isComplexObject,isObjectable,hasOwnProperty
Subscriber
Pub/sub event emitter with built-in state management, async once, and typed wiring.
Http
Configurable HTTP client with request/response interceptors, auth token injection, URL interpolation via Serialize, XHR-based upload with progress tracking, and multipart/related upload for Google-style APIs.
Endpoint— Central registry for grouping service endpoints (Endpoint.register("drive", { … })), also exposed asHttp.EndpointHttpMethod/HttpUpload— Enums covering HTTP verbs and upload modes (UPLOAD,RELATED)http.upload(url, files, options)— XHR upload with progress eventshttp.related(url, bytes, { metadata, contentType })—multipart/relatedupload with JSON metadata + binary bodyHttp.createFactory({ http, endpoint })— Typed endpoint factory keyed by registered service names
Serialize
Centralized serialization engine:
Serialize.Primitive— Type guards and deep normalization (BigInt, Date, undefined stripping)Serialize.JSON— Safe stringify/parse that never throwsSerialize.URL— Robust encode/decode with:paramURL buildingSerialize.queryString— Advanced parse/stringify (bracket, index, comma formats)
Slugify & Searchify
slugify— Unicode-safe slug generation with custom transformer mapsearchify— Diacritic-insensitive fuzzy search using sliding window algorithm
Documentation
Full API reference and guides: docs.ecosy.io
Related Packages
| Package | Description |
| -------------------------------------------------------------------- | --------------------------------------------------------------- |
| @ecosy/datekit | Headless date utilities (Dateify, Dayify, Monthify, Yearify) |
| @ecosy/mailer | Email engine with template formatting, retry, and rate limiting |
| @ecosy/store | State management with slices, reducers, and configureStore |
| @ecosy/react | React hooks for @ecosy/store |
| @ecosy/googleapis | Google Drive / OAuth2 client built on @ecosy/core/http |
License
MIT
