ProxyGenerator: derived types, flags enums, and assembly-to-package mappings#2187
Conversation
Detect types decorated with [DerivedType] and their concrete subtypes. Generated TypeScript now emits @derivedType(id) on derived classes and @field(Base, false, [Derived1, Derived2]) on properties whose base type has registered derivatives, enabling the @cratis/fundamentals JsonSerializer to resolve the correct class from _derivedTypeId on deserialization. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sort type loading so [DerivedType]-decorated classes load before types that reference them, ensuring @field derivatives arrays are fully populated. Rewrite deserialize-query-result.js to instantiate the correct derived class when _derivedTypeId matches, while preserving raw values for special types (TimeSpan, Guid) so C# re-deserialization remains correct. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verify the full data flow from C# (IShape/CircleShape/RectangleShape with [DerivedType] attributes) through the TypeScript proxy to correctly instantiated JavaScript objects. Specs assert both the concrete type (constructor.name) and the type-specific property values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Verifies that a model-bound command with two IShape properties correctly round-trips through the JavaScript proxy: the C# serializer adds _derivedTypeId discriminators, the proxy POSTs them to the server, and DerivedTypeJsonConverterFactory resolves CircleShape and RectangleShape on the receiving end. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/ae058189-02e3-477c-a131-5c0cd4a543da Co-authored-by: einari <134365+einari@users.noreply.github.com>
…ping to AssemblyToPackageMapping Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/ae058189-02e3-477c-a131-5c0cd4a543da Co-authored-by: einari <134365+einari@users.noreply.github.com>
…le multi-project example Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/fd53fd75-bc6a-4d3e-ab26-8c3680af0e37 Co-authored-by: einari <134365+einari@users.noreply.github.com>
…ect' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…in configuration.md Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/560ada5c-342f-4fbc-acc8-1f0bed712c4b Co-authored-by: einari <134365+einari@users.noreply.github.com>
Enums decorated with [Flags] are now generated using a dedicated FlagsEnum.hbs Handlebars template that emits an allXxx constant combining all non-zero members with the bitwise OR operator, e.g. allAnchorEdges = AnchorEdges.top | AnchorEdges.right | ... Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Combines flags enum template support with assembly-to-package mappings. Both regular and flags enum descriptors now respect IsFromMappedAssembly() so types from mapped assemblies are imported from their package rather than generated locally. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| catch | ||
| { | ||
| _typeScriptIsValid = false; | ||
| } |
| catch | ||
| { | ||
| _typeScriptIsValid = false; | ||
| } |
|
@copilot Fix the broken build; https://github.com/Cratis/Arc/actions/runs/25275672739/job/74105139264?pr=2187 |
…ution with assembly mapping tests Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/4e4616c6-ce78-4fbe-9134-28dec756ed85 Co-authored-by: einari <134365+einari@users.noreply.github.com>
Fixed in 0748739. The test The fix adds |
|
@copilot Merge main into this and rebase - fix any conflicts. |
The branch is already fully up to date with |
Added
[Flags]enum support — enums decorated with[Flags]are generated using a dedicated template that emits anallXxxconstant combining all non-zero members with bitwise OR, e.g.export const allAnchorEdges = AnchorEdges.top | AnchorEdges.right | AnchorEdges.bottom | AnchorEdges.left