[1.x] Publish packages#1006
Open
github-actions[bot] wants to merge 1 commit into
Open
Conversation
7b45cbe to
47d52ab
Compare
47d52ab to
d205e91
Compare
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
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.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@codama/node-types@1.8.0
Minor Changes
#995
2f7c443Thanks @lorisleiva! - Regenerate the entire@codama/node-typessource surface from the encoded@codama/specdescription, via the new private@codama-internal/spec-generatorspackage.The bulk of the surface lives under
src/generated/and is produced by thegen-ts-node-typesgenerator from the spec. The previously hand-maintained interfaces are gone; every node, union, enumeration, and per-spec shared type is rebuilt from the spec on everypnpm generaterun.A small set of static helpers — the brand types, the
Docsalias, and theVersiontemplate-literal type — live as hand-written sibling files at the top ofpackages/node-types/src/, alongside the existingProgramVersiondeprecated alias. They are imported by the generated surface but never regenerated, since their content doesn't depend on the spec. The generator wipes onlysrc/generated/on every run; hand-written content at the top level survives. The per-specCodamaVersionliteral stays generated, in its ownsrc/generated/shared/codamaVersion.tsfile pinned to the spec version at generation time.Most of the rebuild is structural: imports now point at per-file paths (
./linkNodes/PdaLinkNode) instead of subdirectory barrels, every interface and field carries a JSDoc block sourced from the spec, and array fields are emitted asArray<T>rather thanT[]so an inline-union element type doesn't need extra parentheses to preserve precedence. A handful of named API differences also shake out from this:accountNode.sizeis now typed asnumber | undefined(the previous| nullarm had no consumer and is dropped).programNode.originis now typed as the namedProgramOriginunion ('anchor' | 'shank') instead of an inline literal union.instructionAccountNode.isSignerandinstructionRemainingAccountsNode.isSignernow readboolean | 'either'instead oftrue | false | 'either'(a TypeScript-only readability normalisation; the encoded spec keeps the explicittrue | falseform so other codegen targets can still emit a multi-variant enum).numberTypeNode.formatandstringTypeNode.encodingare emitted as namedNumberFormat/BytesEncodingaliases imported from./shared/, with the same generic-narrowing behaviour preserved.programNode.versionis now typed as the unifiedVersiontemplate-literal alias (`${number}.${number}.${number}`) — a tighter shape than the previous plain string, so non-conforming literal strings will now surface as TypeScript errors at the call site. The historicalProgramVersionname is preserved as a hand-written@deprecatedre-export so existing consumers continue to compile;@codama/nodes-from-anchoris updated to importVersiondirectly.docs?fields use aDocs = Array<string>alias mirroring the'docs'TypeExprkind in@codama/spec. The alias is hand-written and lives atpackages/node-types/src/Docs.ts.accountNode.discriminators,instructionNode.discriminators,instructionAccountNode.isSigner,instructionRemainingAccountsNode.isSigner,rootNode, theConditionalValueNodeinterface and itscondition,InstructionInputValueNode,ResolverValueNode,AmountTypeNodeand itsunit,MapTypeNode.size,NestedTypeNode,StringTypeNode.size,EnumValueNode.value, andNumberValueNode.number.Alongside the per-node interfaces, the package now exports seven
Registered<Category>Nodecategory-registry unions (RegisteredContextualValueNode,RegisteredCountNode,RegisteredDiscriminatorNode,RegisteredLinkNode,RegisteredPdaSeedNode,RegisteredTypeNode,RegisteredValueNode) corresponding one-to-one with@codama/spec's category registries, plus aGetNodeFromKind<TKind extends NodeKind>helper that resolves to the concrete interface for a given kind. The registry unions are the recommended extension point for downstream packages that need to introduce custom node kinds.The generator consumes
@codama/spec@1.6.0-rc.4, which reshapes the spec into per-category groups (spec.categories[]) and renames thenestedTypeNodeTypeExprkind tonestedUnion(with an explicitaliasfield). Alldocs?fields throughout the spec are arrays of paragraph strings rather than single newline-separated strings — the renderer accepts the array shape directly. Internally, the generator's renderers are layout-agnostic: they emituse(...)calls keyed by symbolic module strings (e.g.'node:numberTypeNode','enumeration:Endianness','brand:CamelCaseString'), and a single per-specRenderScoperesolves those symbolic keys to concrete file locations at write time. Adding a new file kind to the generator means extending theRenderScopesymbol map; renderers themselves stay free of file-layout knowledge.Patch Changes
#1001
8667174Thanks @lorisleiva! - Bump@codama/specfrom1.6.0-rc.4to1.6.0-rc.6. The encoded surface in@codama/node-typesis functionally unchanged; one docstring paragraph onNestedTypeNodenow readsnestedTypeNode<T>instead ofNestedTypeNode<T>to mirror the spec's new camelCase nested-union alias name.Behind the scenes,
@codama-internal/spec-generatorslearns about the new{ kind: 'address' }TypeExpr(rendered as plainstringon the v1 TS surface — a dedicatedAddressbrand may follow in a future spec major), the camelCase rename of every union and enumeration name on the spec side (the generated PascalCase TS identifiers are unaffected since the generator runs each name throughpascalCase()at render time), and a constructor-signature bug where an attribute that was bothoptionaland supplied with a default would emit invalid TS (param?: T = default). The bug never triggered against the rc.4 v1 spec but would have surfaced once any future attribute combinedoptional: truewith a configured default; the fix is to omit the?mark whenever an initializer is present.@codama/nodes@1.8.0
Minor Changes
#997
0b3a781Thanks @lorisleiva! - Regenerate thexxxNodeInputtypes andxxxNode()constructors of@codama/nodesfrom the encoded@codama/specdescription, via a newnodesgenerator inside@codama-internal/spec-generators. The runtime*_NODE_KINDSarrays (STANDALONE_TYPE_NODE_KINDS,REGISTERED_VALUE_NODE_KINDS,INSTRUCTION_INPUT_VALUE_NODE_KINDS, …, and the top-levelREGISTERED_NODE_KINDS) are now generated from the spec's union definitions instead of being maintained by hand. A new top-levelCODAMA_VERSIONconstant, typed asCodamaVersionand pinned to the spec version at generation time, is the single source of truth for the version@codama/nodeswas built against —rootNode()reads it directly when tagging the document.The bulk of the surface lives under
packages/nodes/src/generated/and is produced on everypnpm generaterun. The previously hand-maintained constructors and kinds-arrays are gone; only hand-written helpers (isNode,assertIsNode,getAllPrograms,getAllInstructions,getAllInstructionsWithSubs,isScalarEnum,isDataEnum,isSignedInteger, theNestedTypeNoderesolvers,parseOptionalAccountStrategy, the legacyconstantValueNodeFromString/constantPdaSeedNodeFromStringflavours, etc.) survive at the top ofpackages/nodes/src/. The package'sindex.tsre-exports the generated tree alongside them.Two intentional behaviour changes shake out of the rebuild:
docsis now omitted entirely from the encoded shape when it would be empty. Constructors that accept adocs?: DocsInputparameter previously emitteddocs: []on the frozen node when the caller said nothing about docs; they now drop thedocskey altogether. This matches the Rust side, keeps absent documentation out of serialised IDLs, and aligns with thedocs?: Docsoptional field already declared by@codama/node-types.removeDocsVisitorin@codama/visitors-coreis updated to delete thedocskey rather than blank it to[], following the same convention.rootNode().versionnow reflects the spec version@codama/nodeswas generated against, not the runtime package version. The constructor previously read the__VERSION__build-time global injected from the package'snpm_package_version; it now reads the generatedCODAMA_VERSIONconstant. In practice the two have always tracked the same release cadence so the change is invisible at HEAD, but it makes the architectural intent explicit: the version pinned in the IDL is the spec version, not the package version. The__VERSION__build-time global and itspackages/nodes/src/types/global.d.tsdeclaration are removed accordingly.The legacy plural-noun constants (
TYPE_NODES,VALUE_NODES,CONTEXTUAL_VALUE_NODES,INSTRUCTION_INPUT_VALUE_NODES,COUNT_NODES,DISCRIMINATOR_NODES,LINK_NODES,PDA_SEED_NODES,ENUM_VARIANT_TYPE_NODES) are preserved as alias re-exports of the new canonical*_NODE_KINDSnames.The generator drives almost entirely from the spec, with a minimal per-node configuration table carrying only the conveniences the spec can't express: which spec attributes appear as bare positional parameters (the rest land in a trailing
optionsbag), and per-attribute overrides for defaulted values, string-coercion patterns on link targets, and the handful of bespoke body expressions (instructionByteDeltaNode.withHeader). The renderer derives signature shapes, generic parameters, return types, theXxxNodeInputdeclarations, thePartial<>wrapping decision, thename: stringrelaxation, thedocs?: DocsInput/ drop-if-empty handling, and the conditional-spread of optional attributes from the spec directly. An auto-import scan walks each rendered file and pulls in any spec or hand-written identifier the source references, so the configuration never declares imports. Generic-parameter lifting and ordering rely on the samenarrowableDataAttributes+genericParamOrdertables thenodeTypesgenerator uses, keeping the constructor's generics in lockstep with the interface's.Patch Changes
2f7c443,8667174]:@codama/visitors-core@1.8.0
Minor Changes
#1000
b1f6a75Thanks @lorisleiva! - RegenerateidentityVisitorandmergeVisitorfrom@codama/specvia the newvisitorsCoregenerator in@codama-internal/spec-generators. Both visitors previously lived as ~1100 lines of hand-written per-node dispatch; the mechanical walk now lives undersrc/generated/.src/identityVisitor.tsis now a thin wrapper layering six semantic overrides (enum-variant empty-downgrade, hidden-prefix/suffix empty-bypass, conditional-value null-collapse, resolver empty-dependsOn collapse) viaextendVisitor;src/mergeVisitor.tsships directly from the generated tree.Three behaviour changes shake out:
enumTypeNode.sizeandpdaValueNode.programIdare now actually walked byidentityVisitor. The hand-written code passed both through unchanged, silently dropping any caller-applied transforms.undefinedat runtime. The hand-written guard previously applied only toprogramNode.eventsandprogramNode.constants. Making it uniform letsidentityVisitorsafely normalise a partial IDL JSON parsed viacreateFromJson. A follow-up PR will promote the affectedprogramNodechildren tooptionalAttribute(...)on the spec side, after which the guard becomes naturally derivable from the spec.enumStructVariantTypeNode.discriminatorandenumTupleVariantTypeNode.discriminatorare now preserved when the variant survives the wrapper's empty-downgrade.Patch Changes
#997
0b3a781Thanks @lorisleiva! - Regenerate thexxxNodeInputtypes andxxxNode()constructors of@codama/nodesfrom the encoded@codama/specdescription, via a newnodesgenerator inside@codama-internal/spec-generators. The runtime*_NODE_KINDSarrays (STANDALONE_TYPE_NODE_KINDS,REGISTERED_VALUE_NODE_KINDS,INSTRUCTION_INPUT_VALUE_NODE_KINDS, …, and the top-levelREGISTERED_NODE_KINDS) are now generated from the spec's union definitions instead of being maintained by hand. A new top-levelCODAMA_VERSIONconstant, typed asCodamaVersionand pinned to the spec version at generation time, is the single source of truth for the version@codama/nodeswas built against —rootNode()reads it directly when tagging the document.The bulk of the surface lives under
packages/nodes/src/generated/and is produced on everypnpm generaterun. The previously hand-maintained constructors and kinds-arrays are gone; only hand-written helpers (isNode,assertIsNode,getAllPrograms,getAllInstructions,getAllInstructionsWithSubs,isScalarEnum,isDataEnum,isSignedInteger, theNestedTypeNoderesolvers,parseOptionalAccountStrategy, the legacyconstantValueNodeFromString/constantPdaSeedNodeFromStringflavours, etc.) survive at the top ofpackages/nodes/src/. The package'sindex.tsre-exports the generated tree alongside them.Two intentional behaviour changes shake out of the rebuild:
docsis now omitted entirely from the encoded shape when it would be empty. Constructors that accept adocs?: DocsInputparameter previously emitteddocs: []on the frozen node when the caller said nothing about docs; they now drop thedocskey altogether. This matches the Rust side, keeps absent documentation out of serialised IDLs, and aligns with thedocs?: Docsoptional field already declared by@codama/node-types.removeDocsVisitorin@codama/visitors-coreis updated to delete thedocskey rather than blank it to[], following the same convention.rootNode().versionnow reflects the spec version@codama/nodeswas generated against, not the runtime package version. The constructor previously read the__VERSION__build-time global injected from the package'snpm_package_version; it now reads the generatedCODAMA_VERSIONconstant. In practice the two have always tracked the same release cadence so the change is invisible at HEAD, but it makes the architectural intent explicit: the version pinned in the IDL is the spec version, not the package version. The__VERSION__build-time global and itspackages/nodes/src/types/global.d.tsdeclaration are removed accordingly.The legacy plural-noun constants (
TYPE_NODES,VALUE_NODES,CONTEXTUAL_VALUE_NODES,INSTRUCTION_INPUT_VALUE_NODES,COUNT_NODES,DISCRIMINATOR_NODES,LINK_NODES,PDA_SEED_NODES,ENUM_VARIANT_TYPE_NODES) are preserved as alias re-exports of the new canonical*_NODE_KINDSnames.The generator drives almost entirely from the spec, with a minimal per-node configuration table carrying only the conveniences the spec can't express: which spec attributes appear as bare positional parameters (the rest land in a trailing
optionsbag), and per-attribute overrides for defaulted values, string-coercion patterns on link targets, and the handful of bespoke body expressions (instructionByteDeltaNode.withHeader). The renderer derives signature shapes, generic parameters, return types, theXxxNodeInputdeclarations, thePartial<>wrapping decision, thename: stringrelaxation, thedocs?: DocsInput/ drop-if-empty handling, and the conditional-spread of optional attributes from the spec directly. An auto-import scan walks each rendered file and pulls in any spec or hand-written identifier the source references, so the configuration never declares imports. Generic-parameter lifting and ordering rely on the samenarrowableDataAttributes+genericParamOrdertables thenodeTypesgenerator uses, keeping the constructor's generics in lockstep with the interface's.Updated dependencies [
0b3a781]:@codama/cli@1.5.3
Patch Changes
0b3a781,b1f6a75]:@codama/dynamic-address-resolution@0.2.1
Patch Changes
@codama/dynamic-client@0.1.2
Patch Changes
@codama/dynamic-codecs@1.2.2
Patch Changes
0b3a781,b1f6a75]:@codama/dynamic-instructions@0.2.1
Patch Changes
@codama/dynamic-parsers@1.2.2
Patch Changes
0b3a781,b1f6a75]:@codama/errors@1.8.0
Patch Changes
2f7c443,8667174]:@codama/fragments@0.1.1
Patch Changes
codama@1.8.0
Patch Changes
0b3a781]:@codama/nodes-from-anchor@1.5.1
Patch Changes
#995
2f7c443Thanks @lorisleiva! - Regenerate the entire@codama/node-typessource surface from the encoded@codama/specdescription, via the new private@codama-internal/spec-generatorspackage.The bulk of the surface lives under
src/generated/and is produced by thegen-ts-node-typesgenerator from the spec. The previously hand-maintained interfaces are gone; every node, union, enumeration, and per-spec shared type is rebuilt from the spec on everypnpm generaterun.A small set of static helpers — the brand types, the
Docsalias, and theVersiontemplate-literal type — live as hand-written sibling files at the top ofpackages/node-types/src/, alongside the existingProgramVersiondeprecated alias. They are imported by the generated surface but never regenerated, since their content doesn't depend on the spec. The generator wipes onlysrc/generated/on every run; hand-written content at the top level survives. The per-specCodamaVersionliteral stays generated, in its ownsrc/generated/shared/codamaVersion.tsfile pinned to the spec version at generation time.Most of the rebuild is structural: imports now point at per-file paths (
./linkNodes/PdaLinkNode) instead of subdirectory barrels, every interface and field carries a JSDoc block sourced from the spec, and array fields are emitted asArray<T>rather thanT[]so an inline-union element type doesn't need extra parentheses to preserve precedence. A handful of named API differences also shake out from this:accountNode.sizeis now typed asnumber | undefined(the previous| nullarm had no consumer and is dropped).programNode.originis now typed as the namedProgramOriginunion ('anchor' | 'shank') instead of an inline literal union.instructionAccountNode.isSignerandinstructionRemainingAccountsNode.isSignernow readboolean | 'either'instead oftrue | false | 'either'(a TypeScript-only readability normalisation; the encoded spec keeps the explicittrue | falseform so other codegen targets can still emit a multi-variant enum).numberTypeNode.formatandstringTypeNode.encodingare emitted as namedNumberFormat/BytesEncodingaliases imported from./shared/, with the same generic-narrowing behaviour preserved.programNode.versionis now typed as the unifiedVersiontemplate-literal alias (`${number}.${number}.${number}`) — a tighter shape than the previous plain string, so non-conforming literal strings will now surface as TypeScript errors at the call site. The historicalProgramVersionname is preserved as a hand-written@deprecatedre-export so existing consumers continue to compile;@codama/nodes-from-anchoris updated to importVersiondirectly.docs?fields use aDocs = Array<string>alias mirroring the'docs'TypeExprkind in@codama/spec. The alias is hand-written and lives atpackages/node-types/src/Docs.ts.accountNode.discriminators,instructionNode.discriminators,instructionAccountNode.isSigner,instructionRemainingAccountsNode.isSigner,rootNode, theConditionalValueNodeinterface and itscondition,InstructionInputValueNode,ResolverValueNode,AmountTypeNodeand itsunit,MapTypeNode.size,NestedTypeNode,StringTypeNode.size,EnumValueNode.value, andNumberValueNode.number.Alongside the per-node interfaces, the package now exports seven
Registered<Category>Nodecategory-registry unions (RegisteredContextualValueNode,RegisteredCountNode,RegisteredDiscriminatorNode,RegisteredLinkNode,RegisteredPdaSeedNode,RegisteredTypeNode,RegisteredValueNode) corresponding one-to-one with@codama/spec's category registries, plus aGetNodeFromKind<TKind extends NodeKind>helper that resolves to the concrete interface for a given kind. The registry unions are the recommended extension point for downstream packages that need to introduce custom node kinds.The generator consumes
@codama/spec@1.6.0-rc.4, which reshapes the spec into per-category groups (spec.categories[]) and renames thenestedTypeNodeTypeExprkind tonestedUnion(with an explicitaliasfield). Alldocs?fields throughout the spec are arrays of paragraph strings rather than single newline-separated strings — the renderer accepts the array shape directly. Internally, the generator's renderers are layout-agnostic: they emituse(...)calls keyed by symbolic module strings (e.g.'node:numberTypeNode','enumeration:Endianness','brand:CamelCaseString'), and a single per-specRenderScoperesolves those symbolic keys to concrete file locations at write time. Adding a new file kind to the generator means extending theRenderScopesymbol map; renderers themselves stay free of file-layout knowledge.Updated dependencies [
0b3a781]:@codama/renderers-core@1.3.9
Patch Changes
0b3a781,b1f6a75]:@codama/validators@1.8.0
Patch Changes
0b3a781,b1f6a75]:@codama/visitors@1.8.0
Patch Changes
0b3a781,b1f6a75]: