diff --git a/packages/errors/CHANGELOG.md b/packages/errors/CHANGELOG.md index 4da402de..1a9461da 100644 --- a/packages/errors/CHANGELOG.md +++ b/packages/errors/CHANGELOG.md @@ -1,5 +1,12 @@ # @kinobi-so/errors +## 0.21.4 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/node-types@0.21.4 + ## 0.21.3 ### Patch Changes diff --git a/packages/errors/package.json b/packages/errors/package.json index 850d5f6c..e4c590fc 100644 --- a/packages/errors/package.json +++ b/packages/errors/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/errors", - "version": "0.21.3", + "version": "0.21.4", "description": "Error management for Kinobi", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/library/CHANGELOG.md b/packages/library/CHANGELOG.md index c60b39f1..bb7c2082 100644 --- a/packages/library/CHANGELOG.md +++ b/packages/library/CHANGELOG.md @@ -1,5 +1,17 @@ # kinobi +## 0.21.4 + +### Patch Changes + +- [#181](https://github.com/kinobi-so/kinobi/pull/181) [`28f3d38`](https://github.com/kinobi-so/kinobi/commit/28f3d381f570859cbea1c72b7e352ad3e72db37f) Thanks [@lorisleiva](https://github.com/lorisleiva)! - Fix TS bug on `accept` and `update` Kinobi function + +- Updated dependencies []: + - @kinobi-so/errors@0.21.4 + - @kinobi-so/nodes@0.21.4 + - @kinobi-so/validators@0.21.4 + - @kinobi-so/visitors@0.21.4 + ## 0.21.3 ### Patch Changes diff --git a/packages/library/package.json b/packages/library/package.json index 08611155..8c71712e 100644 --- a/packages/library/package.json +++ b/packages/library/package.json @@ -1,6 +1,6 @@ { "name": "kinobi", - "version": "0.21.3", + "version": "0.21.4", "description": "A Solana framework for building standardised programs", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/library/src/kinobi.ts b/packages/library/src/kinobi.ts index 0c8dce38..c4591708 100644 --- a/packages/library/src/kinobi.ts +++ b/packages/library/src/kinobi.ts @@ -4,18 +4,18 @@ import { assertIsNode, KinobiVersion, Node, RootNode } from '@kinobi-so/nodes'; import { visit, Visitor } from '@kinobi-so/visitors'; export interface Kinobi { - accept(visitor: Visitor): T; + accept(visitor: Visitor): T; clone(): Kinobi; getJson(): string; getRoot(): RootNode; - update(visitor: Visitor): void; + update(visitor: Visitor): void; } export function createFromRoot(root: RootNode): Kinobi { let currentRoot = root; validateKinobiVersion(currentRoot.version); return { - accept(visitor: Visitor): T { + accept(visitor: Visitor): T { return visit(currentRoot, visitor); }, clone(): Kinobi { @@ -27,7 +27,7 @@ export function createFromRoot(root: RootNode): Kinobi { getRoot(): RootNode { return currentRoot; }, - update(visitor: Visitor): void { + update(visitor: Visitor): void { const newRoot = visit(currentRoot, visitor); assertIsNode(newRoot, 'rootNode'); currentRoot = newRoot; diff --git a/packages/library/test/index.test.ts b/packages/library/test/index.test.ts index 26f51028..ae33ab8b 100644 --- a/packages/library/test/index.test.ts +++ b/packages/library/test/index.test.ts @@ -1,6 +1,6 @@ import { expect, test } from 'vitest'; -import { identityVisitor, rootNode } from '../src'; +import { createFromRoot, identityVisitor, programNode, rootNode, rootNodeVisitor, voidVisitor } from '../src'; test('it exports node helpers', () => { expect(typeof rootNode).toBe('function'); @@ -9,3 +9,17 @@ test('it exports node helpers', () => { test('it exports visitors', () => { expect(typeof identityVisitor).toBe('function'); }); + +test('it accepts visitors', () => { + const kinobi = createFromRoot(rootNode(programNode({ name: 'myProgram', publicKey: '1111' }))); + const visitor = voidVisitor(['rootNode']); + const result = kinobi.accept(visitor) satisfies void; + expect(typeof result).toBe('undefined'); +}); + +test('it updates the root node returned by visitors', () => { + const kinobi = createFromRoot(rootNode(programNode({ name: 'myProgram', publicKey: '1111' }))); + const visitor = rootNodeVisitor(node => rootNode(programNode({ ...node.program, name: 'myTransformedProgram' }))); + kinobi.update(visitor) satisfies void; + expect(kinobi.getRoot()).toEqual(rootNode(programNode({ name: 'myTransformedProgram', publicKey: '1111' }))); +}); diff --git a/packages/node-types/CHANGELOG.md b/packages/node-types/CHANGELOG.md index cc9c4526..2860d461 100644 --- a/packages/node-types/CHANGELOG.md +++ b/packages/node-types/CHANGELOG.md @@ -1,5 +1,7 @@ # @kinobi-so/node-types +## 0.21.4 + ## 0.21.3 ## 0.21.2 diff --git a/packages/node-types/package.json b/packages/node-types/package.json index ef870b2d..8daf020b 100644 --- a/packages/node-types/package.json +++ b/packages/node-types/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/node-types", - "version": "0.21.3", + "version": "0.21.4", "description": "Node specifications for the Kinobi standard", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/nodes-from-anchor/CHANGELOG.md b/packages/nodes-from-anchor/CHANGELOG.md index c58a8f86..96a93186 100644 --- a/packages/nodes-from-anchor/CHANGELOG.md +++ b/packages/nodes-from-anchor/CHANGELOG.md @@ -1,5 +1,14 @@ # @kinobi-so/nodes-from-anchor +## 0.21.2 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/errors@0.21.4 + - @kinobi-so/nodes@0.21.4 + - @kinobi-so/visitors@0.21.4 + ## 0.21.1 ### Patch Changes diff --git a/packages/nodes-from-anchor/package.json b/packages/nodes-from-anchor/package.json index 405b9237..b6655140 100644 --- a/packages/nodes-from-anchor/package.json +++ b/packages/nodes-from-anchor/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/nodes-from-anchor", - "version": "0.21.1", + "version": "0.21.2", "description": "Node specifications and helpers for the Kinobi standard", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/nodes/CHANGELOG.md b/packages/nodes/CHANGELOG.md index d29b7400..aadb76e9 100644 --- a/packages/nodes/CHANGELOG.md +++ b/packages/nodes/CHANGELOG.md @@ -1,5 +1,13 @@ # @kinobi-so/nodes +## 0.21.4 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/errors@0.21.4 + - @kinobi-so/node-types@0.21.4 + ## 0.21.3 ### Patch Changes diff --git a/packages/nodes/package.json b/packages/nodes/package.json index f148b417..3a410dcf 100644 --- a/packages/nodes/package.json +++ b/packages/nodes/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/nodes", - "version": "0.21.3", + "version": "0.21.4", "description": "Node specifications and helpers for the Kinobi standard", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/renderers-core/CHANGELOG.md b/packages/renderers-core/CHANGELOG.md index 8b7e424a..46b64168 100644 --- a/packages/renderers-core/CHANGELOG.md +++ b/packages/renderers-core/CHANGELOG.md @@ -1,5 +1,14 @@ # @kinobi-so/renderers-core +## 0.21.2 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/errors@0.21.4 + - @kinobi-so/nodes@0.21.4 + - @kinobi-so/visitors-core@0.21.4 + ## 0.21.1 ### Patch Changes diff --git a/packages/renderers-core/package.json b/packages/renderers-core/package.json index 6b7a3604..7f436f25 100644 --- a/packages/renderers-core/package.json +++ b/packages/renderers-core/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/renderers-core", - "version": "0.21.1", + "version": "0.21.2", "description": "Core types and helpers for Kinobi renderers to use", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/renderers-js-umi/CHANGELOG.md b/packages/renderers-js-umi/CHANGELOG.md index 7c6ceaa1..d1145da4 100644 --- a/packages/renderers-js-umi/CHANGELOG.md +++ b/packages/renderers-js-umi/CHANGELOG.md @@ -1,5 +1,16 @@ # @kinobi-so/renderers-js-umi +## 0.21.6 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/errors@0.21.4 + - @kinobi-so/nodes@0.21.4 + - @kinobi-so/validators@0.21.4 + - @kinobi-so/visitors-core@0.21.4 + - @kinobi-so/renderers-core@0.21.2 + ## 0.21.5 ### Patch Changes diff --git a/packages/renderers-js-umi/package.json b/packages/renderers-js-umi/package.json index 083a5bd6..8da29d23 100644 --- a/packages/renderers-js-umi/package.json +++ b/packages/renderers-js-umi/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/renderers-js-umi", - "version": "0.21.5", + "version": "0.21.6", "description": "JavaScript renderer compatible with the Umi framework", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/renderers-js/CHANGELOG.md b/packages/renderers-js/CHANGELOG.md index c435882c..d1793ea3 100644 --- a/packages/renderers-js/CHANGELOG.md +++ b/packages/renderers-js/CHANGELOG.md @@ -1,5 +1,16 @@ # @kinobi-so/renderers-js +## 0.21.7 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/errors@0.21.4 + - @kinobi-so/nodes@0.21.4 + - @kinobi-so/visitors-core@0.21.4 + - @kinobi-so/nodes-from-anchor@0.21.2 + - @kinobi-so/renderers-core@0.21.2 + ## 0.21.6 ### Patch Changes diff --git a/packages/renderers-js/package.json b/packages/renderers-js/package.json index dd8c1069..ad41a96a 100644 --- a/packages/renderers-js/package.json +++ b/packages/renderers-js/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/renderers-js", - "version": "0.21.6", + "version": "0.21.7", "description": "JavaScript renderer compatible with the Solana web3.js library", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/renderers-rust/CHANGELOG.md b/packages/renderers-rust/CHANGELOG.md index e75b2a5c..1eb7b404 100644 --- a/packages/renderers-rust/CHANGELOG.md +++ b/packages/renderers-rust/CHANGELOG.md @@ -1,5 +1,15 @@ # @kinobi-so/renderers-rust +## 0.21.6 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/errors@0.21.4 + - @kinobi-so/nodes@0.21.4 + - @kinobi-so/visitors-core@0.21.4 + - @kinobi-so/renderers-core@0.21.2 + ## 0.21.5 ### Patch Changes diff --git a/packages/renderers-rust/package.json b/packages/renderers-rust/package.json index c550eaa1..4e125627 100644 --- a/packages/renderers-rust/package.json +++ b/packages/renderers-rust/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/renderers-rust", - "version": "0.21.5", + "version": "0.21.6", "description": "Renders Rust clients for your programs", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/renderers/CHANGELOG.md b/packages/renderers/CHANGELOG.md index 635dc8d7..c2443362 100644 --- a/packages/renderers/CHANGELOG.md +++ b/packages/renderers/CHANGELOG.md @@ -1,5 +1,14 @@ # @kinobi-so/renderers +## 0.21.2 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/renderers-js@0.21.7 + - @kinobi-so/renderers-js-umi@0.21.6 + - @kinobi-so/renderers-rust@0.21.6 + ## 0.21.1 ### Patch Changes diff --git a/packages/renderers/package.json b/packages/renderers/package.json index edd24fdb..55b27d66 100644 --- a/packages/renderers/package.json +++ b/packages/renderers/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/renderers", - "version": "0.21.1", + "version": "0.21.2", "description": "Exports all Kinobi renderers", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/validators/CHANGELOG.md b/packages/validators/CHANGELOG.md index 8f6e7fcd..dbf2c245 100644 --- a/packages/validators/CHANGELOG.md +++ b/packages/validators/CHANGELOG.md @@ -1,5 +1,14 @@ # @kinobi-so/validators +## 0.21.4 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/errors@0.21.4 + - @kinobi-so/nodes@0.21.4 + - @kinobi-so/visitors-core@0.21.4 + ## 0.21.3 ### Patch Changes diff --git a/packages/validators/package.json b/packages/validators/package.json index 420d2c05..f342bb4c 100644 --- a/packages/validators/package.json +++ b/packages/validators/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/validators", - "version": "0.21.3", + "version": "0.21.4", "description": "Validator visitors for the Kinobi framework", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/visitors-core/CHANGELOG.md b/packages/visitors-core/CHANGELOG.md index 02a6c48e..da41870d 100644 --- a/packages/visitors-core/CHANGELOG.md +++ b/packages/visitors-core/CHANGELOG.md @@ -1,5 +1,13 @@ # @kinobi-so/visitors-core +## 0.21.4 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/errors@0.21.4 + - @kinobi-so/nodes@0.21.4 + ## 0.21.3 ### Patch Changes diff --git a/packages/visitors-core/package.json b/packages/visitors-core/package.json index 104c9921..52575949 100644 --- a/packages/visitors-core/package.json +++ b/packages/visitors-core/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/visitors-core", - "version": "0.21.3", + "version": "0.21.4", "description": "Core visitors for the Kinobi framework", "exports": { "types": "./dist/types/index.d.ts", diff --git a/packages/visitors/CHANGELOG.md b/packages/visitors/CHANGELOG.md index ceb12aa7..cadca7e0 100644 --- a/packages/visitors/CHANGELOG.md +++ b/packages/visitors/CHANGELOG.md @@ -1,5 +1,14 @@ # @kinobi-so/visitors +## 0.21.4 + +### Patch Changes + +- Updated dependencies []: + - @kinobi-so/errors@0.21.4 + - @kinobi-so/nodes@0.21.4 + - @kinobi-so/visitors-core@0.21.4 + ## 0.21.3 ### Patch Changes diff --git a/packages/visitors/package.json b/packages/visitors/package.json index 917937bf..d058f623 100644 --- a/packages/visitors/package.json +++ b/packages/visitors/package.json @@ -1,6 +1,6 @@ { "name": "@kinobi-so/visitors", - "version": "0.21.3", + "version": "0.21.4", "description": "All visitors for the Kinobi framework", "exports": { "types": "./dist/types/index.d.ts",