|
1 | 1 | # @evolution-sdk/evolution |
2 | 2 |
|
| 3 | +## 0.3.30 |
| 4 | + |
| 5 | +### Patch Changes |
| 6 | + |
| 7 | +- [#215](https://github.com/IntersectMBO/evolution-sdk/pull/215) [`19829c7`](https://github.com/IntersectMBO/evolution-sdk/commit/19829c7c6e1cd1ac3a33fb180e4482016791dcd5) Thanks [@solidsnakedev](https://github.com/solidsnakedev)! - Blueprint codegen now supports recursive type schemas — Plutus types that reference themselves |
| 8 | + directly or through an intermediate type (e.g. `MultiSig` containing a `List<MultiSig>` field). |
| 9 | + Cyclic references are emitted as typed `Schema.suspend` thunks where the encoded type `I` is |
| 10 | + inferred by recursively walking the blueprint definition graph rather than hardcoded to `Data.Constr`: |
| 11 | + `list` → `readonly ItemEncoded[]`, `map` → `globalThis.Map<Data.Data, Data.Data>`, |
| 12 | + `bytes` → `Uint8Array`, `integer` → `bigint`, `constructor` and union → `Data.Constr`, |
| 13 | + `$ref` followed transitively up to depth 10. The previous hardcoded `Data.Constr` caused a |
| 14 | + TypeScript invariance error for any recursive field referencing a list type. |
| 15 | + |
| 16 | + Several other codegen correctness and API improvements ship in the same release: |
| 17 | + - **Namespace emission ordering** — the group-by-namespace emitter is replaced by a streaming emitter |
| 18 | + that walks a global topological sort and opens/closes namespace blocks on demand. TypeScript namespace |
| 19 | + merging handles split declarations transparently. This fixes cases where a type was emitted before |
| 20 | + its cross-namespace dependency (e.g. `Option.OfStakeCredential` appearing before `Cardano.Address.StakeCredential`). |
| 21 | + - **Cyclic type emit pattern** — cyclic types now emit a `export type X = ...` / `export const X = ...` |
| 22 | + pair with no outer `Schema.suspend` wrapper and no `as` cast. Only the inner field references that |
| 23 | + close the cycle use typed thunks: `Schema.suspend((): Schema.Schema<T, I> => T)`. |
| 24 | + - **`unionStyle` config** — `CodegenConfig` gains `unionStyle: "Variant" | "Struct" | "TaggedStruct"` |
| 25 | + in place of the removed `forceVariant` and `useSuspend` fields. `Struct` emits |
| 26 | + `TSchema.Struct({ Tag: TSchema.Struct({...}, { flatFields: true }) }, { flatInUnion: true })`, |
| 27 | + `TaggedStruct` emits `TSchema.TaggedStruct("Tag", {...}, { flatInUnion: true })`, |
| 28 | + and `Variant` emits `TSchema.Variant({ Tag: {...} })`. |
| 29 | + - **Import hygiene** — generated files emit `import { Schema } from "@evolution-sdk/evolution"` |
| 30 | + only when cyclic types are present, rather than always importing from `effect` directly. |
| 31 | + `CodegenConfig.imports.effect` is replaced by `imports.schema`. |
| 32 | + |
3 | 33 | ## 0.3.29 |
4 | 34 |
|
5 | 35 | ### Patch Changes |
|
0 commit comments