-
Notifications
You must be signed in to change notification settings - Fork 3.2k
v0.4.10: ts-sdk updates, db updates #1577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This PR implements two key improvements: fixes to the TypeScript SDK publishing pipeline and database connection optimizations for better performance. The changes modernize the ts-sdk package by transitioning it from CommonJS to ES modules, which involves updating the TypeScript configuration, package.json module type, and Vitest configuration to properly handle module resolution. The database performance improvements reduce connection pool sizes across multiple services - the main database pool is reduced from 30 to 20 connections, the socket server's pool from 15 to 5 connections, and the socket manager's pool maintains 3 connections with adjusted timeouts.The ts-sdk changes align the entire build pipeline with ES module standards, fixing module resolution issues that were likely preventing successful SDK publishing. The publishing workflow is updated to install dependencies from the repository root rather than the package directory, supporting monorepo workspace management. For database optimizations, the changes implement a coordinated reduction in maximum connections across services while fine-tuning timeout configurations - increasing idle timeouts to 20 seconds (allowing connections to stay pooled longer) while reducing connect timeouts to 10 seconds (failing faster on connection issues). These changes work together to reduce overall database connection pressure while maintaining responsive real-time operations for the socket server components.
Important Files Changed
Changed Files
| Filename | Score | Overview |
|---|---|---|
| packages/ts-sdk/package.json | 3/5 | Adds ES module type declaration which may break consumers expecting CommonJS |
| packages/ts-sdk/tsconfig.json | 4/5 | Changes module compilation from CommonJS to ES2020 to align with package configuration |
| packages/ts-sdk/vitest.config.ts | 4/5 | Adds module resolution conditions to fix testing with conditional exports |
| .github/workflows/publish-ts-sdk.yml | 4/5 | Removes working directory to install dependencies from monorepo root |
| packages/db/index.ts | 4/5 | Reduces main database pool from 30 to 20 connections and adjusts timeouts |
| apps/sim/socket-server/database/operations.ts | 5/5 | Reduces socket server database pool from 15 to 5 connections with timeout optimization |
| apps/sim/socket-server/rooms/manager.ts | 4/5 | Adjusts socket room manager connection timeouts for better responsiveness |
Confidence score: 4/5
- This PR is generally safe to merge with some potential breaking changes in the ts-sdk package
- Score reflects solid database optimizations but concerns about ES module transition compatibility
- Pay close attention to ts-sdk package.json exports configuration which may not work correctly with dual format support after ES module transition
Sequence Diagram
sequenceDiagram
participant User
participant GitHub
participant CI as "CI/CD System"
participant NPM as "NPM Registry"
participant Docker as "Docker Registry"
participant DB as "Database"
User->>GitHub: "Push to staging branch"
User->>GitHub: "Create PR to main branch"
User->>GitHub: "Merge PR to main"
GitHub->>CI: "Trigger publish workflow"
Note over CI: "Check if ts-sdk files changed"
CI->>CI: "Setup Bun & Node.js"
CI->>CI: "Install dependencies"
CI->>CI: "Run tests"
CI->>CI: "Build package"
CI->>CI: "Get package version"
CI->>NPM: "Check if version exists"
alt Version doesn't exist
CI->>NPM: "Publish package"
CI->>GitHub: "Create GitHub release"
else Version exists
CI->>CI: "Log skipped publish"
end
Note over DB: "Database connections reduced from 20 to 5-3 max connections"
DB-->>Docker: "Improved performance with lower connection limits"
Additional Comments (2)
-
.github/workflows/publish-ts-sdk.yml, line 82 (link)syntax: GitHub repository URL appears incorrect - should be 'simstudioai/sim' not 'simstudio/sim' based on the repository context
-
packages/ts-sdk/package.json, line 13 (link)logic: Both import and require point to the same file. After adding
"type": "module", CommonJS consumers may not be able to require this file. Consider building separate CommonJS and ESM bundles or using a tool liketsupfor dual format publishing.
7 files reviewed, 2 comments
Uh oh!
There was an error while loading. Please reload this page.