https://github.com/smooai/utils
A collection of shared utilities and tools used across SmooAI projects. This package provides common functionality to standardize and simplify development across all SmooAI repositories.
https://github.com/smooai/utils
utilities
Last synced: about 1 year ago
JSON representation
A collection of shared utilities and tools used across SmooAI projects. This package provides common functionality to standardize and simplify development across all SmooAI repositories.
- Host: GitHub
- URL: https://github.com/smooai/utils
- Owner: SmooAI
- License: mit
- Created: 2025-02-09T16:48:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-10T02:33:02.000Z (over 1 year ago)
- Last Synced: 2025-03-13T09:33:37.797Z (over 1 year ago)
- Topics: utilities
- Language: TypeScript
- Homepage: https://smoo.ai
- Size: 326 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## About SmooAI
SmooAI is an AI-powered platform for helping businesses multiply their customer, employee, and developer experience.
Learn more on [smoo.ai](https://smoo.ai)
## SmooAI Packages
Check out other SmooAI packages at [npmjs.com/org/smooai](https://www.npmjs.com/org/smooai)
## About @smooai/utils
A collection of shared utilities and tools used across SmooAI projects. This package provides common functionality to standardize and simplify development across all SmooAI repositories.






### Installation
```sh
pnpm add @smooai/utils
```
### Available Utilities
#### API Handling
- `ApiError` - Custom error class for handling API-specific errors with status codes
- `apiHandler` - Lambda function wrapper for standardized API error handling and responses
- `createAwsLambdaHonoApp` - Factory for creating Hono apps configured for AWS Lambda
#### Collections
- `CaseInsensitiveMap` - Map implementation with case-insensitive string keys
- `CaseInsensitiveSet` - Set implementation with case-insensitive string values
#### Error Handling
- `errorHandler` - Generic error handler with logging and type-specific error processing
#### File Operations
- `findFile` - Async utility to find files in parent directories
- `findFileSync` - Synchronous version of findFile
#### Environment
- `isRunningLocally` - Check if code is running in local development
- `isRunningInProd` - Check if code is running in production
#### Data Validation
- `validateAndTransformPhoneNumber` - Zod validator for phone numbers with E.164 formatting
#### Utilities
- `sleep` - Promise-based delay function
### Features
- AWS Lambda integration
- Standardized error handling
- Case-insensitive collections
- File system utilities
- Environment detection
- Data validation tools
- HTTP request handling with Hono
### Testing
```sh
pnpm test
```
### Linting
```sh
pnpm lint
```
## Contributing
We're currently developing our contribution processes. If you're interested in contributing to this package or have questions, please reach out to us through the contact information below.
## Contact
Brent Rager - [Email](mailto:brent@smoo.ai)
[Instagram](https://www.instagram.com/brentragertech/)
[LinkedIn](https://www.linkedin.com/in/brentrager/)
[Threads](https://www.threads.net/@brentragertech)
Smoo Github: [https://github.com/SmooAI](https://github.com/SmooAI)
[sst.dev-url]: https://reactjs.org/
[sst]: https://img.shields.io/badge/sst-EDE1DA?style=for-the-badge&logo=sst&logoColor=E27152
[sst-url]: https://sst.dev/
[next]: https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white
[next-url]: https://nextjs.org/
[aws]: https://img.shields.io/badge/aws-232F3E?style=for-the-badge&logo=amazonaws&logoColor=white
[aws-url]: https://tailwindcss.com/
[tailwindcss]: https://img.shields.io/badge/tailwind%20css-0B1120?style=for-the-badge&logo=tailwindcss&logoColor=#06B6D4
[tailwindcss-url]: https://tailwindcss.com/
[zod]: https://img.shields.io/badge/zod-3E67B1?style=for-the-badge&logoColor=3E67B1
[zod-url]: https://zod.dev/
[sanity]: https://img.shields.io/badge/sanity-F36458?style=for-the-badge
[sanity-url]: https://www.sanity.io/
[vitest]: https://img.shields.io/badge/vitest-1E1E20?style=for-the-badge&logo=vitest&logoColor=#6E9F18
[vitest-url]: https://vitest.dev/
[pnpm]: https://img.shields.io/badge/pnpm-F69220?style=for-the-badge&logo=pnpm&logoColor=white
[pnpm-url]: https://pnpm.io/
[turborepo]: https://img.shields.io/badge/turborepo-000000?style=for-the-badge&logo=turborepo&logoColor=#EF4444
[turborepo-url]: https://turbo.build/