Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Feat/runtime schema #12

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Feat/runtime schema #12

wants to merge 21 commits into from

Conversation

pyramation
Copy link
Contributor

No description provided.

- Add RuntimeSchemaGenerator class for extracting NodeSpec schema from protobuf
- Create NodeSpec and FieldSpec interfaces for runtime AST introspection
- Update SPECIAL_TYPES to include both TypeName and RangeVar
- Add runtime schema generation options to parser configuration
- Integrate runtime schema output (JSON/TypeScript) with ProtoStore
- Create comprehensive PROTO.md analysis of SPECIAL_TYPES usage
- Add CLI tool for standalone runtime schema generation
- Include usage examples and validation scripts
- Document all 268 wrapped types from Node.oneof structure
- Provide recommendations for automating type classification

The runtime schema enables powerful AST tooling including deparsers,
validators, and GUI tools by providing complete type metadata at runtime.
- Fix TypeScript compilation issues in store.ts enum processing
- Add comprehensive README for runtime schema module
- Create complete integration test suite
- Add CLI tool for parser with runtime schema support
- Include test generators and validation scripts
- Update SPECIAL_TYPES constant to include both TypeName and RangeVar
- Provide complete documentation in PROTO.md with usage examples

All deliverables completed:
- NodeSpec[] runtime schema generator
- SPECIAL_TYPES analysis and recommendations
- CLI tools and usage examples
- Integration with existing parser system
- Comprehensive documentation and validation
- Complete integration of runtime schema generation with ProtoStore
- Update SPECIAL_TYPES to include both TypeName and RangeVar
- Add runtime schema configuration options to defaults
- Fix import paths for RuntimeSchemaGenerator
- Complete all deliverables for runtime schema and SPECIAL_TYPES analysis
- Remove SPECIAL_TYPES constant from constants.ts
- Add getRuntimeSchema() and isWrappedType() methods to ProtoStore
- Update generateAstHelperMethods to use runtime schema queries
- Update convertTypeToWrappedTsInterface to use runtime schema queries
- Replace all static SPECIAL_TYPES checks with dynamic wrapped type detection
- Maintain backward compatibility for generated TypeScript interfaces
- Fix TypeScript error where RuntimeSchemaGenerator constructor expects Namespace
- Cast this.root as Namespace in both writeRuntimeSchema and getRuntimeSchema methods
- Maintains functionality while resolving type compatibility issue
- Change export to export type for NodeSpec, FieldSpec, RuntimeSchemaOptions
- Resolves TypeScript error: Re-exporting a type when 'isolatedModules' is enabled requires using 'export type'
- Maintains functionality while fixing TypeScript compilation
- Create runtime-schema.test.ts with 8 test cases covering all configuration options
- Test JSON and TypeScript output formats
- Test custom filenames and disabled state
- Test integration with other parser features
- Follow existing parseAndSnap() testing patterns
- Generate outputs in __fixtures__/output subdirectories
- Create 8 test configurations in __fixtures__/output/runtime-schema/
- Test JSON and TypeScript output formats
- Test custom filenames and disabled runtime schema
- Test integration with all parser features (types, enums, utils)
- Include sample NodeSpec objects demonstrating wrapped/unwrapped types
- Add field specifications with isNode, isArray, optional properties
- Follow existing Jest test patterns with parseAndSnap() function
- Generate test summary files for verification
- Update generateNodeSpecs() to navigate to pg_query namespace
- Fix issue where runtime schema generation produced empty arrays
- All Type objects are located in root.nested.pg_query.nestedArray
- Maintains existing API compatibility
- All tests now pass with comprehensive NodeSpec data generation
- Remove all temporary .js test files from root directory
- Remove examples/ folder
- Remove development artifacts and generated files
- Keep only necessary project files for production
- Remove PROTO.md documentation file from root
- Remove sample-runtime-schema.json example file from root
- Keep repository clean and production-ready
- Add runtimeSchema.enabled, runtimeSchema.filename, runtimeSchema.format to options table
- Modify generateRuntimeSchemaTypeScript to inline NodeSpec/FieldSpec interfaces
- Export interfaces for external use while eliminating import dependencies
- Maintain backward compatibility and functionality
- Update snapshots to reflect new inlined interface structure
- Add test output files showing new inlined NodeSpec/FieldSpec interfaces
- Demonstrates complete functionality of generateRuntimeSchemaTypeScript changes
- All TypeScript runtime schema files now self-contained without imports
- Install strfy-js dependency for better JavaScript object formatting
- Replace JSON.stringify with jsStringify in generateRuntimeSchemaTypeScript
- Apply formatting options: space: 2, camelCase: true, quotes: 'single'
- Update snapshots to reflect new single-quote formatting
- Include test output files demonstrating improved formatting
- All tests pass with enhanced TypeScript generation
- Create runtime-schema command following existing CLI patterns
- Add interactive prompts for inFile, outDir, format, and filename
- Integrate command into main CLI dispatcher with autocomplete
- Update CLI package README with runtime-schema documentation
- Remove old CLI file from parser package
- Update runtime-schema README to reference new CLI location
- Remove commander from devDependencies in parser package
- Delete packages/parser/src/cli.ts that used commander
- Legacy CLI functionality is now handled by dedicated CLI package
- Update lock files to reflect dependency removal
- Restore isWrappedTypeFn parameter to generateAstHelperMethods
- Non-wrapped types (ParseResult, ScanResult, ScanToken) need indexed access types
- Non-wrapped types need prefixed field paths (e.g. 'ParseResult.version')
- All tests now pass (7 passed, 26 tests, 21 snapshots)
- Conditional logic is required for proper code generation
- Remove isWrappedTypeFn parameter from generateAstHelperMethods
- Treat all types uniformly as wrapped in codegen
- Simplify type annotations and field path generation
- Update test snapshots to reflect new uniform behavior
- ParseResult, ScanResult, ScanToken now use direct type annotations
- Field paths are now simple (e.g. 'version') instead of prefixed (e.g. 'ParseResult.version')

This completes the elimination of SPECIAL_TYPES pattern by removing
conditional logic from AST helper generation while preserving it
only in convertTypeToWrappedTsInterface where it's still needed.
- Update fixture outputs to reflect new uniform type handling
- Remove deleted CLI type declaration files
- Update lock files after dependency changes
- All generated AST helpers now use consistent wrapped type pattern
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant