{"_id":"@csalasb86/nestjs-state-machine-v9","_rev":"2-f310eb12404ba5b8cae1900ec1bd2d71","name":"@csalasb86/nestjs-state-machine-v9","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.5":{"name":"@csalasb86/nestjs-state-machine-v9","version":"0.0.5","description":"Finite State Machine for Nestjs framework","author":{"name":"Tomasz Felczyk"},"license":"MIT","url":"https://github.com/csalasb86/nestjs-state-machine-v9","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":"18.x","npm":"9.x"},"scripts":{"build":"rimraf -rf dist && tsc -p tsconfig.json","dev":"tsc -p tsconfig.json -w","lint":"eslint 'lib/**/*.ts' --fix","prepublish:npm":"npm run build","publish:npm":"npm publish --access public","prepublish:next":"npm run build","publish:next":"npm publish --access public --tag next","test:e2e":"jest --config ./tests/jest-e2e.json --runInBand","prerelease":"npm run build","release":"release-it"},"dependencies":{"@nestjs/event-emitter":"1.2.0"},"devDependencies":{"@nestjs/common":"^9.2.1","@nestjs/core":"^9.2.1","@nestjs/platform-express":"^9.2.1","@nestjs/testing":"^9.2.1","@types/jest":"26.0.20","@types/node":"7.10.8","@typescript-eslint/eslint-plugin":"4.12.0","@typescript-eslint/parser":"4.12.0","eslint":"7.17.0","eslint-config-prettier":"7.1.0","eslint-plugin-import":"2.22.1","husky":"4.3.7","jest":"26.6.3","lint-staged":"10.5.3","prettier":"2.2.1","reflect-metadata":"0.1.13","release-it":"14.2.2","rimraf":"3.0.2","rxjs":"^7.1.0","ts-jest":"26.4.4","typescript":"4.1.3"},"peerDependencies":{"@nestjs/common":"^9.2.1","reflect-metadata":"^0.1.12","rxjs":"^7.0.0"},"lint-staged":{"*.ts":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"repository":{"type":"git","url":"git+https://github.com/csalasb86/nestjs-state-machine-v9.git"},"bugs":{"url":"https://github.com/csalasb86/nestjs-state-machine-v9/issues"},"homepage":"https://github.com/csalasb86/nestjs-state-machine-v9#readme","directories":{"lib":"lib","test":"tests"},"keywords":["fsm"],"gitHead":"f0723686aaeda92129501a12f333737c7b737168","_id":"@csalasb86/nestjs-state-machine-v9@0.0.5","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-uB3MrwkoNxwzYas0Eemepo4ZTDS93Pkiy9WfhiopuBbED6jVN7XJLmbzIMO5BRjcxYp8OU0Y7B9JtGjtxKrnRg==","shasum":"7e0cbfbe570c91e6ef8c3041b937840696193dd0","tarball":"https://registry.npmjs.org/@csalasb86/nestjs-state-machine-v9/-/nestjs-state-machine-v9-0.0.5.tgz","fileCount":8,"unpackedSize":58307,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGnvNqnMTPWA3rNnJ4/e9nu241sCsMXrWvqFpgAB7V7EAiA+dU1QztCwCmwzaG3w9PDTG2zU7SK3VwhShLiYbacJIg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkGgNuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmorWQ//WACEei9NNdjgSOdJIaiD7WbFxwbagAMIWvhJoJmGgerLIlhQ\r\nP1VKIrb1iLca74S3TEommLW1XALNcu5kDUjavgfRe9w0f3MeEkxpEkkJHd26\r\nfVN1903GuDrEvx7q8M7rWZQoSCUaDdEZWUopO3OTDxPdNqr+/vXhy6d2TBI6\r\n4NYQF9JVYdA1sGEpV36HY4yT0dDsJkHm+EgRAckhNstVQcHimqimzbDtZdq9\r\nE1RWm0Eie8painGOeKE6HlNBt2w2u0fBtLX6xr5fLXYz32BUbQxdCpJ7cBdr\r\nkEKUyD9qdJ/5ghpMl4rgM6K1aVzv7SdQ6A+LFnRNLqXO3/3Lu4tOnSR4kki/\r\nBzhLBTlxdN1CusWXg3ZZLfrMWyL1nw2HgPw7EBvGWBVXtm63ZYlh2c4+kGal\r\njCrTshsaPX/EcRSq1baZ9E4Tvc56ezVmhRE6hEoyqtc61anUgVyXPjfchhbl\r\nGtOD6sLbDycKXvagNmjBOgZ/KWmbOCq/yUL9RN9F6XBs/1u+8/M5o9Y/YFg3\r\nuYrXHtTh06VBpBxYNkNUTSVM9BOOc5ypoKWhsbLU5mv8sbL9lMUulYbZTiYh\r\nxaWsvg6A3eyNB92i1VEYhFEW4ztU2i825wbRSW4BF7mfa/HAf+kIIG1nSBLw\r\nt7zdR/St2n6MtStj3W8n/B+49AQ1QJkh8EI=\r\n=e99n\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"csalasb86","email":"carlos.salas.bastias@gmail.com"},"maintainers":[{"name":"csalasb86","email":"carlos.salas.bastias@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-state-machine-v9_0.0.5_1679426414045_0.9068186785100363"},"_hasShrinkwrap":false},"0.0.6":{"name":"@csalasb86/nestjs-state-machine-v9","version":"0.0.6","description":"Finite State Machine for Nestjs framework","author":{"name":"Tomasz Felczyk"},"license":"MIT","url":"https://github.com/csalasb86/nestjs-state-machine-v9","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":"18.x","npm":"9.x"},"scripts":{"build":"rimraf -rf dist && tsc -p tsconfig.json","dev":"tsc -p tsconfig.json -w","lint":"eslint 'lib/**/*.ts' --fix","prepublish:npm":"npm run build","publish:npm":"npm publish --access public","prepublish:next":"npm run build","publish:next":"npm publish --access public --tag next","test:e2e":"jest --config ./tests/jest-e2e.json --runInBand","prerelease":"npm run build","release":"release-it"},"dependencies":{"@nestjs/event-emitter":"1.2.0"},"devDependencies":{"@nestjs/common":"^9.2.1","@nestjs/core":"^9.2.1","@nestjs/platform-express":"^9.2.1","@nestjs/testing":"^9.2.1","@types/jest":"26.0.20","@types/node":"7.10.8","@typescript-eslint/eslint-plugin":"4.12.0","@typescript-eslint/parser":"4.12.0","eslint":"7.17.0","eslint-config-prettier":"7.1.0","eslint-plugin-import":"2.22.1","husky":"4.3.7","jest":"26.6.3","lint-staged":"10.5.3","prettier":"2.2.1","reflect-metadata":"0.1.13","release-it":"14.2.2","rimraf":"3.0.2","rxjs":"^7.1.0","ts-jest":"26.4.4","typescript":"4.1.3"},"peerDependencies":{"@nestjs/common":"^9.2.1","reflect-metadata":"^0.1.12","rxjs":"^7.0.0"},"lint-staged":{"*.ts":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"repository":{"type":"git","url":"git+https://github.com/csalasb86/nestjs-state-machine-v9.git"},"bugs":{"url":"https://github.com/csalasb86/nestjs-state-machine-v9/issues"},"homepage":"https://github.com/csalasb86/nestjs-state-machine-v9#readme","directories":{"lib":"lib","test":"tests"},"keywords":["fsm"],"gitHead":"4a78ec257ff408e6f076a8d6e1a715865bd22182","_id":"@csalasb86/nestjs-state-machine-v9@0.0.6","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-v2gexsp5zsAESzgK1ykQDb3bzXQoWjbEC5mBB/FXtTEG1r0ss/T2HHbCN8UACK4MmlbsUq1sFpEPUzbruqwFuA==","shasum":"b106312904bc130232d988422161dd8e8292a370","tarball":"https://registry.npmjs.org/@csalasb86/nestjs-state-machine-v9/-/nestjs-state-machine-v9-0.0.6.tgz","fileCount":8,"unpackedSize":58307,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBTHkCiCHaS3oguOj2RcEexcyrmfF0zyiQDmzhcFWxIjAiEAkRlc/QiBH5iBYKRh2nI6t0wTVkDVgmBcX0AK9NTAOi0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkGxXJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVWA/+Ou1QDHpYfMqYpQDNedsjuPNww7k68xHoUp69WoYZpjGsfD34\r\nFjBLfmhBWTHTtk+VDvYgJx8UxLzXOX4D4JlnVd698vuG4LBbF9IRhLndBpbM\r\ngTzU6JvVuREatdsbYtJTAIjbamRYCzaDivDSA3vX9OdqHjxpMsZhLF93YVBA\r\n2awe5I3K+mBG9j9l2AhIIOADFC9V+KgW00jR9ZJIkPMEYLpuHSHr7uUZ+bn1\r\nUyPeuNz5C5IZsfwCue+tf+QMW///4Dqc9Oju25nwudI4ESASj6uCaOpeDlGg\r\nCvyeJPDQe9C5G1lPB35EccZa5/2KvlTzwVaEIPlWrAIr08TGxssIwDPBp779\r\nVJ0D0WSOI1O/7/AnrQXkBJvBxOMbWvAi06TbZMsWbzzuuK81QzPBGFFHQTWy\r\nKf0Pf95teR+pbmBeDATcb/iqD8Mw59dsLsckezxZnehFODFjbxq8NhMcHj+F\r\njLxc8P4Uu1JyUKkk5gPJvmPxC8aheCUBdUZnQORq7w0ZdnYrQ03IMZlFm6AN\r\nAYT3Fnk1NK41RQ5pn7XxkpAPumqXZh8IqWiLte3p9UNXqFSc729MBjoHwIo+\r\nL3lXQ7Ifz5AVvdrTz4Jq/4+KlYYpYid+RaBPWVOofUM0f44QVDp1PASoxXAE\r\nEBZJw5OjkjV+DzV7WZFoK/3vIgdQmxwGMjE=\r\n=RHf7\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"csalasb86","email":"carlos.salas.bastias@gmail.com"},"maintainers":[{"name":"csalasb86","email":"carlos.salas.bastias@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-state-machine-v9_0.0.6_1679496649669_0.13954230739576512"},"_hasShrinkwrap":false},"0.0.7":{"name":"@csalasb86/nestjs-state-machine-v9","version":"0.0.7","description":"Finite State Machine for Nestjs framework","author":{"name":"Tomasz Felczyk"},"license":"MIT","url":"https://github.com/csalasb86/nestjs-state-machine-v9","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":"18.x","npm":"9.x"},"scripts":{"build":"rimraf -rf dist && tsc -p tsconfig.json","dev":"tsc -p tsconfig.json -w","lint":"eslint 'lib/**/*.ts' --fix","prepublish:npm":"npm run build","publish:npm":"npm publish --access public","prepublish:next":"npm run build","publish:next":"npm publish --access public --tag next","test:e2e":"jest --config ./tests/jest-e2e.json --runInBand","prerelease":"npm run build","release":"release-it"},"dependencies":{"@nestjs/event-emitter":"1.2.0"},"devDependencies":{"@nestjs/common":"^9.2.1","@nestjs/core":"^9.2.1","@nestjs/platform-express":"^9.2.1","@nestjs/testing":"^9.2.1","@types/jest":"26.0.20","@types/node":"7.10.8","@typescript-eslint/eslint-plugin":"4.12.0","@typescript-eslint/parser":"4.12.0","eslint":"7.17.0","eslint-config-prettier":"7.1.0","eslint-plugin-import":"2.22.1","husky":"4.3.7","jest":"26.6.3","lint-staged":"10.5.3","prettier":"2.2.1","reflect-metadata":"0.1.13","release-it":"14.2.2","rimraf":"3.0.2","rxjs":"^7.1.0","ts-jest":"26.4.4","typescript":"4.1.3"},"peerDependencies":{"@nestjs/common":"^9.2.1","reflect-metadata":"^0.1.12","rxjs":"^7.0.0"},"lint-staged":{"*.ts":["prettier --write"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"repository":{"type":"git","url":"git+https://github.com/csalasb86/nestjs-state-machine-v9.git"},"bugs":{"url":"https://github.com/csalasb86/nestjs-state-machine-v9/issues"},"homepage":"https://github.com/csalasb86/nestjs-state-machine-v9#readme","directories":{"lib":"lib","test":"tests"},"keywords":["fsm"],"gitHead":"da8e2d7e0c14a54d3ec3792e18a806a88507deb9","_id":"@csalasb86/nestjs-state-machine-v9@0.0.7","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-ERseJPLYNowOUNGPtb8OLXEvLZbz4zhRrQGRKMZfSU5MxEKqIKYllXfNWatfGwZXUF13eCV2yrzRHkm3Z5FoMA==","shasum":"5768e8e8c0bcc513c5b9deca6859922a69d53030","tarball":"https://registry.npmjs.org/@csalasb86/nestjs-state-machine-v9/-/nestjs-state-machine-v9-0.0.7.tgz","fileCount":68,"unpackedSize":90802,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCwcpTqA2/79mCmg0xGpPHGLO3N9vHefSp0SFR7iYtCEQIgDVgGl9y/m+VHEFy32kGOJWTx+iQnlGsjNunW1sPx3MI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkGylBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVuBAAlBweHKYD9o5hVn61P7H0xGjWVjpW0iq3bmzpT7dWyA+haltt\r\nz4NBxEq8bdClkoiiI2x54JQc4Dzz8AaL3sadC4AO9JHyg/p70UNmpizbLxQk\r\njoJlLCsPB1WiyjNJoZCaOWdBXoCekKoEbXgWb/e5qXMytqcoFItvnQXHvBn/\r\n4OyRNmiuY06GthV1wz7Ppz368T7TC1hmOQ7C0QO4zPg+D8MnxvZm0UX2611b\r\nE56p8PPa4kWMMyc/lyPVtp2BZ5mxvhXZGuHOhA4jaBcnJOGeNFYdsyw2NQ6i\r\nJyyFCSJzqIpQ4EkrcRzqUQvIek8aFX2cztPNn0aDk1vaSebLRGRbJfZnRkPk\r\no+vrfIkEi8oSYqGs0w2E0ONqV1bQy0p2WiBg3TGxsVU91c4kZcZk3hbxPlk3\r\noUsRO1/3MeGclWxlKlb5Wbo6ZxVQLN7t91iheCtVSHmnrK8i+qZ47DiFjV1N\r\nfCMV2xLKsmvaA/thaUmBK5hz5oWlnyATAGxvjh/XQgx8VZTTE2oNkszl3PgN\r\nz38rDLqV7ivtkmbK/ZRjOGqyoETFD87T1Tm9koY0n59N08zQ7iZy4+cGFgw0\r\nYVL7wvdZ3SF86pqc6bTHnnXGUVuhKU6ROknaPOFd49NoMDZffNxxKzPwlNax\r\niKQHBGmozrgM992SxgakdUBH0Y37cpdNyyY=\r\n=eTDl\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"csalasb86","email":"carlos.salas.bastias@gmail.com"},"maintainers":[{"name":"csalasb86","email":"carlos.salas.bastias@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-state-machine-v9_0.0.7_1679501633817_0.16605537804898907"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-21T19:20:13.936Z","0.0.5":"2023-03-21T19:20:14.234Z","modified":"2023-03-22T16:13:54.114Z","0.0.6":"2023-03-22T14:50:49.911Z","0.0.7":"2023-03-22T16:13:53.962Z"},"maintainers":[{"name":"csalasb86","email":"carlos.salas.bastias@gmail.com"}],"description":"Finite State Machine for Nestjs framework","homepage":"https://github.com/csalasb86/nestjs-state-machine-v9#readme","keywords":["fsm"],"repository":{"type":"git","url":"git+https://github.com/csalasb86/nestjs-state-machine-v9.git"},"author":{"name":"Tomasz Felczyk"},"bugs":{"url":"https://github.com/csalasb86/nestjs-state-machine-v9/issues"},"license":"MIT","readme":"## Description\n\nFinite State Machine module for [Nest](https://github.com/nestjs/nest).\n\n## Getting started\n\nInstall package:\n\n```bash\n$ npm i --save @csalasb86/nestjs-state-machine-v9\n```\n\nFor example, we will map the following state machine:\n\n![example state machine](https://github.com/csalasb86/nestjs-state-machine-v9/blob/9513315e4ffc9e838797b053262b1657114206f4/example.jpg?raw=true)\n\nAfter installation, import StateMachineModule into your root module with state machine graph configurations:\n\n```typescript\n// app.module.ts\nimport { StateMachineModule } from '@csalasb86/nestjs-state-machine-v9';\n\n@Module({\n  imports: [\n    // .forRoot takes array of graph configurations\n    StateMachineModule.forRoot([\n      {\n        // Name of graph\n        name: 'project-graph',\n        // Initial state of graph\n        initialState: 'new',\n        // Available states in graph\n        states: ['new', 'in-progress', 'done'],\n        // Available transitions in graph\n        transitions: [\n          {\n            // Name of transistion\n            name: 'start',\n            // Source states\n            from: ['new'],\n            // Target state of transition\n            to: 'in-progress',\n          },\n          {\n            name: 'finish',\n            from: ['in-progress'],\n            to: 'done',\n          },\n        ],\n      },\n    ]),\n  ],\n})\nexport class AppModule {}\n```\n\nIt's good idea to define graph, state and transition names in one place e.g.:\n\n```typescript\n// constants.ts\nexport const PROJECT_GRAPH = 'project-graph';\n\nexport enum ProjectState {\n  NEW = 'new',\n  IN_PROGRESS = 'in-progress',\n  DONE = 'done',\n}\n\nexport enum ProjectTransition {\n  START = 'start',\n  FINISH = 'finish',\n}\n```\n\nand then:\n\n```typescript\nimport { StateMachineModule } from '@csalasb86/nestjs-state-machine-v9';\nimport { PROJECT_GRAPH, ProjectState, ProjectTransition } from './constants';\n\n// ...\n\nStateMachineModule.forRoot([\n  {\n    name: PROJECT_GRAPH,\n    initialState: ProjectState.NEW,\n    states: [ProjectState.NEW, ProjectState.IN_PROGRESS, ProjectState.DONE],\n    transitions: [\n      {\n        name: ProjectTransition.START,\n        from: [ProjectState.NEW],\n        to: ProjectState.IN_PROGRESS,\n      },\n      {\n        name: ProjectTransition.FINISH,\n        from: [ProjectState.IN_PROGRESS],\n        to: ProjectState.DONE,\n      },\n    ],\n  },\n]);\n```\n\nNext, create model or use your exisiting model and decorate property which will be responsible for storing state of model:\n\n```typescript\n// project.model.ts\nimport { StateStore } from '@csalasb86/nestjs-state-machine-v9';\nimport { PROJECT_GRAPH, ProjectState } from './constants';\n\nexport class Project {\n  name: string;\n\n  @StateStore(PROJECT_GRAPH)\n  state: string = ProjectState.NEW;\n}\n```\n\n`@StateStore` takes one argument with graph name (string). Thanks to this one model can handle more then many graphs:\n\n```typescript\n@StateStore(PROJECT_GRAPH)\nstate: string = ProjectState.NEW;\n\n@StateStore(PROJECT_STATUS_GRAPH)\nstatus: string = ProjectStatusState.ACTIVE;\n```\n\nAt this point we can create our state machine. First inject `StateMachineFactory` using standard constructor injection:\n\n```typescript\nimport { StateMachineFactory } from '@csalasb86/nestjs-state-machine-v9';\n\n// ...\n\nconstructor(\n    private readonly stateMachineFactory: StateMachineFactory,\n) {}\n```\n\nCreate state machine with instance of `Project` model as subject in first argument of factory and with graph name in second.\n\n```typescript\nconst projectStateMachine = this.stateMachineFactory.create<Project>(\n  project,\n  PROJECT_GRAPH,\n);\n```\n\n## State Machine methods\n\nApply transition:\n\n```typescript\n// takes transition name in argument\nawait projectStateMachine.apply(ProjectTransition.START);\n// return void but project.state is now equal ProjectState.IN_PROGRESS\n```\n\nCheck if transition is possible:\n\n```typescript\n// takes transition name in argument\nawait projectStateMachine.can(ProjectTransition.START);\n// return true or false, can() don't throw Errors\n```\n\nGet all possible transitions:\n\n```typescript\nawait projectStateMachine.getAvailableTransitions();\n// return TransitionInterface[];\n```\n\n## Guards\n\nYou can create guards to block transitions.  \nTo declare an `Guard`, decorate a method with the `@OnGuard()` decorator:\n\n```typescript\nimport { GuardEvent, OnGuard } from '@csalasb86/nestjs-state-machine-v9';\nimport { ProjectTransition, PROJECT_GRAPH } from '../constance';\nimport { Project } from '../project.model';\n\nexport class ProjectCantBeNamedBlockmeGuard {\n  // Graph name in first argument, transition name in second\n  @OnGuard(PROJECT_GRAPH, ProjectTransition.START)\n  handle(event: GuardEvent<Project>) {\n    // event.subject is our Project instance\n    if (event.subject.name == 'blockme') {\n      // if name isn't allowed for some reasons\n      event.setBlocked('transition-blocked'); // block transition using setBlocked() method\n    }\n  }\n}\n```\n\nThan you need to register `ProjectCantBeNamedBlockmeGuard` in module as provider:\n\n```typescript\n@Module({\n  imports: [\n    StateMachineModule.forRoot([\n      // ...\n    ]),\n  ],\n  providers: [ProjectCantBeNamedBlockmeGuard],\n})\nexport class AppModule {}\n```\n\nNow, if you create `StateMachine` instance and try to apply `START` transition you will get:\n\n```typescript\nconst project = new Project();\nproject.name = 'blockme';\n\nconst projectStateMachine = this.stateMachineFactory.create<Project>(\n  project,\n  PROJECT_GRAPH,\n);\n\nawait projectStateMachine.can(ProjectTransition.START);\n// false\n\nawait projectStateMachine.apply(ProjectTransition.START);\n// Throw TransitionBlockedByGuardException with .blockingReasons property that contain ['transition-blocked']\n\nprojectStateMachine.getAvailableTransitions();\n// [] - empty\n```\n\n## Transition Events\n\nYou can create transition event listeners to do additional actions when a state machine operation happened (e.g. sending emails, recalculate)\n\nWhen a state transition is initiated, the events are dispatched in the following order:\n\n| Order | Event                                                                                                                                          | Decorator             | Decorator second argument |\n| ----- | ---------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------------- |\n| 1     | LeaveState<br><small><small>(The subject is about to leave a place).                                                                           | OnLeaveState          | State name                |\n| 2     | BeginTransition<br><small>(The subject is going through this transition.)</small>                                                              | OnBeginTransition     | Transition name           |\n| 3     | EnterState<br><small>(The subject is about to enter a new place. This event is triggered right before the subject places are updated.)</small> | OnEnterState          | State name                |\n| 4     | -> Change of state                                                                                                                             |\n| 5     | EnteredState<br><small>(The subject has entered in the places and the marking is updated.)</small>                                             | OnEnteredState        | State name                |\n| 6     | CompletedTransition<br><small>(The object has completed this transition.)</small>                                                              | OnCompletedTransition | Transition name           |\n| 7     | AnnounceTransitions<br><small>(Triggered for each transition that now is accessible for the subject.)</small>                                  | OnAnnounceTransitions | State name                |\n\nExample:\n\n```typescript\nimport {\n  OnCompletedTransition,\n  CompletedTransitionEvent,\n} from '@csalasb86/nestjs-state-machine-v9';\nimport { ProjectTransition, PROJECT_GRAPH } from '../constance';\nimport { Project } from '../project.model';\n\nexport class NotifyTeamAboutFinishedTask {\n  // Graph name in first argument, transition name in second. Third if truem method is async.\n  @OnCompletedTransition(PROJECT_GRAPH, ProjectTransition.FINISH, true)\n  async handle(event: CompletedTransitionEvent<Project>) {\n    // Send emails to all users in team\n  }\n}\n```\n\nand of course:\n\n```typescript\n@Module({\n  // ...\n  providers: [NotifyTeamAboutFinishedTask],\n  // ...\n})\nexport class AppModule {}\n```\n\n## License\n\nNestjs State Machine is [MIT licensed](LICENSE).\n","readmeFilename":"README.md"}