-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: TypeScript SDK modernization and protobuf enhancements #110
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… packages - Replace object-based config with functional options pattern (WithAPIKey, WithJWTAccessToken, WithGroup, WithServerUrl) - Restructure packages: move config, interceptors, validation to ts-node/src/meshtrade/ - Separate API key and group interceptors for better composability - Update withGroup() to work with all authentication modes (API key, JWT, no auth) - Add package.json exports for config, interceptors, and validation modules - Remove deprecated backward compatibility code - Replace common directory with dedicated package structure Breaking changes: - Remove ConfigOpts, Config types and getConfigFromOpts() function - Constructor now uses ...opts: ClientOption[] instead of config object - API key and group are now separate interceptors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update code generator to match ts-node implementation (gRPC-Web transport) - Replace object-based config with functional options pattern - Restructure packages: move config, interceptors, validation to ts-web/src/meshtrade/ - Separate API key and group interceptors for better composability - Update withGroup() to work with all authentication modes - Add package.json exports for config, interceptors, and validation modules - Remove common directory Functional options: - WithAPIKey(key) - API key authentication - WithJWTAccessToken(token) - JWT authentication - WithGroup(group) - Group context (works with all auth modes) - WithServerUrl(url) - Custom server URL Both ts-node and ts-web SDKs now have identical configuration APIs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
… TypeScript SDKs ## Changes ### Integration Tests - Add comprehensive integration tests for APIUserServiceNode client - 26 tests covering configuration modes (no auth, API key, JWT) - Tests for withGroup() method across all authentication modes - Validation tests for configuration options - Client instance independence tests ### TypeScript Configuration - Fix Jest type definitions not being recognized in editor - Add "types": ["jest"]" to tsconfig.json for all TypeScript packages - Remove test files from tsconfig exclude to enable editor type checking - Create tsconfig.build.json for production builds that excludes test files - Update build scripts to use tsconfig.build.json (--project flag) ### Package Changes - Remove conflicting @types/jest v30 from root package.json dependencies - Consistent @types/jest v29 across all workspace packages (ts-node, ts-web, ts-old) - Update build scripts: tsc → tsc --project tsconfig.build.json ### Files Modified - ts-node/tsconfig.json - Add Jest types, include test files for editor - ts-node/tsconfig.build.json - New build config excluding tests - ts-node/package.json - Update build script - ts-node/src/meshtrade/iam/api_user/v1/service_node_meshts.integration.test.ts - New integration tests - ts-web/tsconfig.json - Add Jest types, include test files for editor - ts-web/tsconfig.build.json - New build config excluding tests - ts-web/package.json - Update build script - ts-old/tsconfig.json - Add Jest types, include test files for editor - ts-old/tsconfig.build.json - New build config excluding tests - ts-old/package.json - Update build script ## Testing - ✅ All 26 integration tests passing - ✅ Builds succeed for ts-node, ts-web, ts-old - ✅ Test files excluded from dist/ output - ✅ Editor TypeScript language server recognizes Jest globals 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Implement comprehensive client-side request validation using @bufbuild/protovalidate to catch invalid inputs before making network calls, improving API client reliability and reducing unnecessary server roundtrips. Changes: - Generate validation code in all TypeScript Node client methods - Import Request Schemas (not Response Schemas) to minimize unused imports - Add validation integration tests with success and failure cases - Remove generic validation module in favor of generated validation - Inline isValidGroupResourceName into interceptors module The generated clients now validate all requests against buf.validate constraints defined in protobuf schemas, throwing detailed error messages for violations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Implement comprehensive client-side request validation using @bufbuild/protovalidate to catch invalid inputs before making network calls, improving API client reliability and reducing unnecessary server roundtrips. Changes: - Generate validation code in all TypeScript Web client methods - Import Request Schemas (not Response Schemas) to minimize unused imports - Add validation integration tests with success and failure cases - Remove generic validation module in favor of generated validation - Inline isValidGroupResourceName into interceptors module The generated clients now validate all requests against buf.validate constraints defined in protobuf schemas, throwing detailed error messages for violations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add java_outer_classname option to api_user.proto to generate ApiUserOuterClass.java, matching the naming convention used by all other resource proto files (ClientOuterClass, GroupOuterClass, etc.). Updates: - Add java_outer_classname option to api_user.proto - Remove special case in protoc-gen-meshjava generator - Update Java imports in source and test files - Regenerate all SDK bindings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces significant improvements to the TypeScript SDKs and protobuf definitions, focusing on modernizing the API surface, enhancing type safety, and standardizing naming conventions across all language SDKs.
Key Changes
🔄 TypeScript SDK Modernization
Functional Options Pattern (ts-node & ts-web)
@meshtrade/configexportsClient-Side Validation
buf.validatefor client-side validation in both TypeScript SDKsTesting Infrastructure
📦 Protobuf Enhancements
Resource Ownership Model
ownersfield to all resource messages (Client, User, Group, APIUser, Account, Instrument, LimitOrder)Java SDK Standardization
api_user.prototo useApiUserOuterClassnaming conventionprotoc-gen-meshjavagenerator🛠️ Generator Improvements
TypeScript Generators
protoc-gen-mesh_ts_nodeto generate functional options APIprotoc-gen-mesh_ts_webto generate functional options APIJava Generator
protoc-gen-meshjavaStatistics
46 files changed: 2,201 insertions(+), 3,430 deletions(-)
By Language:
Testing
✅ All SDK tests passing:
Migration Guide
TypeScript Users
Before (Object-based):
After (Functional options):
Java Users
Update imports from:
To:
Breaking Changes
ApiUser.APIUser→ApiUserOuterClass.APIUserRelated Issues
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com