Skip to content

Commit e24dec8

Browse files
BRBussyclaude
andauthored
refactor: TypeScript SDK modernization and protobuf enhancements (#110)
* refactor(ts-node): Upgrade to functional options pattern with modular 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 <[email protected]> * refactor(ts-web): Apply functional options pattern to match ts-node - 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 <[email protected]> * feat(typescript): Add Jest type definitions and integration tests for 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 <[email protected]> * feat(ts-node): add client-side validation with buf.validate 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 <[email protected]> * feat(ts-web): add client-side validation with buf.validate 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 <[email protected]> * feat(proto): add owners to each resource * feat(java): standardize api_user OuterClass naming for consistency 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 <[email protected]> * add java outer class to api user --------- Co-authored-by: Claude <[email protected]>
1 parent 56a0806 commit e24dec8

File tree

46 files changed

+2201
-3430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2201
-3430
lines changed

go/compliance/client/v1/client.pb.go

Lines changed: 32 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/iam/api_user/v1/api_user.pb.go

Lines changed: 23 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/iam/group/v1/group.pb.go

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/iam/user/v1/user.pb.go

Lines changed: 17 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)