{"_id":"@foblex/mediator","_rev":"25-501ed4da30bdf58b80b6597e57917d83","name":"@foblex/mediator","dist-tags":{"latest":"1.1.3"},"versions":{"1.0.4":{"name":"@foblex/mediator","version":"1.0.4","keywords":["Angular","Mediator","CQRS","Command","Query"],"author":{"name":"Siarhei Huzarevich"},"license":"MIT","_id":"@foblex/mediator@1.0.4","maintainers":[{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"}],"homepage":"https://github.com/siarheihuzarevich/f-mediator#readme","bugs":{"url":"https://github.com/siarheihuzarevich/f-mediator/issues"},"dist":{"shasum":"246151bcdc2ef5e6b24ea59115be42d613e3a61a","tarball":"https://registry.npmjs.org/@foblex/mediator/-/mediator-1.0.4.tgz","fileCount":24,"integrity":"sha512-KH9ufesk+xnprZqzI0x45btfM0XCtq2u1OuZD2ffnLEskcvmnW4QH5onTLHA7nqHtpwEBcIG2kiFy+4dv6G8Bg==","signatures":[{"sig":"MEUCIQCVvMu/D+OAna3ao9ZjmcbXwsn7PLk/l9GbAscHMUnh9wIgCGj4GxpY+31QtEpeYLQy42U1Wd7nXZ5OHfGUdpcRVFM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53346},"main":"index.js","types":"index.d.ts","module":"fesm2022/foblex-mediator.mjs","exports":{".":{"esm":"./esm2022/foblex-mediator.mjs","types":"./index.d.ts","default":"./fesm2022/foblex-mediator.mjs","esm2022":"./esm2022/foblex-mediator.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"8c1a3aeb666f54b2719326c5c29916d8a57eac60","private":false,"typings":"index.d.ts","_npmUser":{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"},"repository":{"url":"git+https://github.com/siarheihuzarevich/f-mediator.git","type":"git"},"_npmVersion":"8.19.4","description":"A mediator library for Angular facilitating a clean architecture with a better command-query separation.","directories":{},"sideEffects":false,"_nodeVersion":"16.20.2","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"rxjs":"^7.8.0","@angular/core":">=16.2.0"},"_npmOperationalInternal":{"tmp":"tmp/mediator_1.0.4_1696922825252_0.9661686070303903","host":"s3://npm-registry-packages"}},"1.0.5":{"name":"@foblex/mediator","version":"1.0.5","keywords":["Angular","Mediator","CQRS","Command","Query"],"author":{"name":"Siarhei Huzarevich"},"license":"MIT","_id":"@foblex/mediator@1.0.5","maintainers":[{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"}],"homepage":"https://github.com/siarheihuzarevich/f-mediator#readme","bugs":{"url":"https://github.com/siarheihuzarevich/f-mediator/issues"},"dist":{"shasum":"1c2c9fe5bc778c6c9a04024db250780c854c6a4c","tarball":"https://registry.npmjs.org/@foblex/mediator/-/mediator-1.0.5.tgz","fileCount":24,"integrity":"sha512-3sH8PNMaJscDCcvtP/NDx9NXB3kj0/O54Nfyo1bnphOcmC5L3ZjXzxBJ8l1p2kMCV2+VIUD/wy1as0cmXdCV5g==","signatures":[{"sig":"MEYCIQCUQziNylOsp8SIcD/+8r2FSXpe48H+Fij+P8R/I57Q7gIhALYgduSxwHPA0ahBeFuWNgjIFvCYnh3y8+pvIIdmbR0h","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53346},"main":"index.js","types":"index.d.ts","module":"fesm2022/foblex-mediator.mjs","exports":{".":{"esm":"./esm2022/foblex-mediator.mjs","types":"./index.d.ts","default":"./fesm2022/foblex-mediator.mjs","esm2022":"./esm2022/foblex-mediator.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"e2d1b16dfa75df71ae6cf9cab976c392a831f449","private":false,"typings":"index.d.ts","_npmUser":{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"},"repository":{"url":"git+https://github.com/siarheihuzarevich/f-mediator.git","type":"git"},"_npmVersion":"8.19.4","description":"A mediator library for Angular facilitating a clean architecture with a better command-query separation.","directories":{},"sideEffects":false,"_nodeVersion":"16.20.2","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"rxjs":"^7.8.0","@angular/core":">=16.2.0"},"_npmOperationalInternal":{"tmp":"tmp/mediator_1.0.5_1696943122883_0.6997961819385343","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@foblex/mediator","version":"1.1.0","keywords":["angular","flow","meditor","typescript","foblex"],"author":{"name":"Siarhei Huzarevich"},"license":"MIT","_id":"@foblex/mediator@1.1.0","maintainers":[{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"}],"homepage":"https://flow.foblex.com","bugs":{"url":"https://github.com/foblex/flow/issues"},"dist":{"shasum":"eb360938c76cafc7348465b2788227892adf2f38","tarball":"https://registry.npmjs.org/@foblex/mediator/-/mediator-1.1.0.tgz","fileCount":27,"integrity":"sha512-bWI0E+x1I/2BlgnrlJdStHnG9RGd5+6djaehry7es0AokwAwLnnizjr60+SYLAdVHoBK15eQbW0iCfHcgx2akA==","signatures":[{"sig":"MEQCIHwgUGx6yMdO5F6vXT0onsP4zHotvKUDP1We/9zZXi6NAiBmHivmD5GDyrRi8WY8AGGpLIRDGb3EteJoX1mQHXBUFw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":37886},"main":"bundles/foblex-mediator.umd.js","types":"index.d.ts","es2015":"fesm2015/foblex-mediator.js","module":"fesm2015/foblex-mediator.js","esm2015":"esm2015/foblex-mediator.js","gitHead":"f63e70b0e8749fad9e38f159064fc85020068271","private":false,"typings":"foblex-mediator.d.ts","_npmUser":{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"},"fesm2015":"fesm2015/foblex-mediator.js","repository":{"url":"git+https://github.com/foblex/flow.git","type":"git"},"_npmVersion":"10.2.3","description":"An Angular library that implements the mediator pattern, providing a centralized way to handle requests with optional\nvalidation and execution pipelines.","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"rxjs":">=6.6.0","@angular/core":">=12.0.0","@angular/common":">=12.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mediator_1.1.0_1726255630838_0.8901327284815772","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@foblex/mediator","version":"1.1.1","keywords":["angular","flow","meditor","typescript","foblex"],"author":{"name":"Siarhei Huzarevich"},"license":"MIT","_id":"@foblex/mediator@1.1.1","maintainers":[{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"}],"homepage":"https://flow.foblex.com","bugs":{"url":"https://github.com/foblex/flow/issues"},"dist":{"shasum":"dbc1c1a909c4c7b69e1e903d577362b26130d5de","tarball":"https://registry.npmjs.org/@foblex/mediator/-/mediator-1.1.1.tgz","fileCount":27,"integrity":"sha512-2iqRLTwlavcoRdqN1svCnLHNZiAF3g5+z23C3TNCXchRwFGMCeR6TocoBRNzuCfkGKfA+KLxXOC5gLB4uvSiTQ==","signatures":[{"sig":"MEQCIDVJ7Vi02LseJf3Epnn3VHThC9f7+3Lh8LMUae/lB1tJAiBUKa9rOmgABi2dVTIpKWcjkxCEXHGeJAN1db9FdmTmBg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":41163},"main":"bundles/foblex-mediator.umd.js","types":"index.d.ts","es2015":"fesm2015/foblex-mediator.js","module":"fesm2015/foblex-mediator.js","esm2015":"esm2015/foblex-mediator.js","gitHead":"c5d67b567e18cdb777a91a73ec971f76db372602","private":false,"typings":"foblex-mediator.d.ts","_npmUser":{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"},"fesm2015":"fesm2015/foblex-mediator.js","repository":{"url":"git+https://github.com/foblex/flow.git","type":"git"},"_npmVersion":"10.2.3","description":"An Angular library that implements the mediator pattern, providing a centralized way to handle requests with optional\nvalidation and execution pipelines.","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"rxjs":">=6.6.0","@angular/core":">=12.0.0","@angular/common":">=12.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mediator_1.1.1_1737038906578_0.4213195735259414","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@foblex/mediator","version":"1.1.2","keywords":["angular","flow","meditor","typescript","foblex"],"author":{"name":"Siarhei Huzarevich"},"license":"MIT","_id":"@foblex/mediator@1.1.2","maintainers":[{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"}],"homepage":"https://flow.foblex.com","bugs":{"url":"https://github.com/foblex/flow/issues"},"dist":{"shasum":"0c961850b3991c5d4361074f766e43c0f9ca7ea9","tarball":"https://registry.npmjs.org/@foblex/mediator/-/mediator-1.1.2.tgz","fileCount":27,"integrity":"sha512-lDm3Si0bjRZuenCBlCPpne9eTLaueTQ+ccveUJPuz1LF4zwgKd0yRwx49Z6TWGUWNLuBMkdm+PWx5dOPEeWkNA==","signatures":[{"sig":"MEYCIQCpH35bo167W4R89ZchFImU6i8uTIjiv0AWeiOv52o5nAIhAMVFnx3lSQcHCkYVojbxrl0YS5QXhYaTk0VQzUk02J2a","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":41172},"main":"bundles/foblex-mediator.umd.js","types":"index.d.ts","es2015":"fesm2015/foblex-mediator.js","module":"fesm2015/foblex-mediator.js","esm2015":"esm2015/foblex-mediator.js","gitHead":"c5d67b567e18cdb777a91a73ec971f76db372602","private":false,"typings":"foblex-mediator.d.ts","_npmUser":{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"},"fesm2015":"fesm2015/foblex-mediator.js","repository":{"url":"git+https://github.com/foblex/flow.git","type":"git"},"_npmVersion":"10.2.3","description":"An Angular library that implements the mediator pattern, providing a centralized way to handle requests with optional\nvalidation and execution pipelines.","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"rxjs":">=6.6.0","@angular/core":">=12.0.0","@angular/common":">=12.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mediator_1.1.2_1737038961830_0.4984933765731929","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"name":"@foblex/mediator","version":"1.1.3","description":"An Angular library that implements the mediator pattern, providing a centralized way to handle requests with optional\nvalidation and execution pipelines.","main":"bundles/foblex-mediator.umd.js","types":"index.d.ts","author":{"name":"Siarhei Huzarevich"},"homepage":"https://flow.foblex.com","repository":{"type":"git","url":"git+https://github.com/foblex/flow.git"},"license":"MIT","private":false,"keywords":["angular","flow","meditor","typescript","foblex"],"peerDependencies":{"@angular/common":">=12.0.0","@angular/core":">=12.0.0","rxjs":">=6.6.0"},"dependencies":{"tslib":"^2.3.0"},"sideEffects":false,"module":"fesm2015/foblex-mediator.js","es2015":"fesm2015/foblex-mediator.js","esm2015":"esm2015/foblex-mediator.js","fesm2015":"fesm2015/foblex-mediator.js","typings":"foblex-mediator.d.ts","_id":"@foblex/mediator@1.1.3","gitHead":"755604d5d16f479af396a5a27f447846e635e8f8","bugs":{"url":"https://github.com/foblex/flow/issues"},"_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-Yuvu4lpefFo0N1oo1xDBL7UItUe5KuasPniurcQITY3wvBRITSHZCPIEpB/FEWuaoknyC8t1blxDyOh11U+daA==","shasum":"c1464e14e54a81b0cd0583983b5cd14818818682","tarball":"https://registry.npmjs.org/@foblex/mediator/-/mediator-1.1.3.tgz","fileCount":27,"unpackedSize":42021,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDinExR1SKE320WgycbLl0ewxRo26i5UQnGTz3s13gKXwIhAMtdkitqjZgLUvzQSe8jqOvkXfsysTfRDTwGxh/5rq8j"}]},"_npmUser":{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com","actor":{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com","type":"user"}},"directories":{},"maintainers":[{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mediator_1.1.3_1751492551785_0.9789955406374415"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-10T07:27:05.159Z","modified":"2025-07-02T21:42:32.162Z","1.0.0":"2023-03-27T13:29:56.602Z","1.0.1":"2023-03-27T13:54:14.561Z","0.0.8":"2023-10-08T13:31:56.217Z","0.0.9":"2023-10-08T13:51:15.839Z","0.0.10":"2023-10-08T14:02:59.317Z","0.0.11":"2023-10-08T14:40:12.912Z","0.0.12":"2023-10-08T14:42:14.743Z","0.0.13":"2023-10-08T14:55:30.399Z","0.0.14":"2023-10-08T16:28:20.554Z","0.0.16":"2023-10-08T19:42:49.317Z","0.0.17":"2023-10-09T20:09:53.273Z","0.0.18":"2023-10-09T20:16:27.801Z","0.0.19":"2023-10-10T06:48:44.727Z","0.0.20":"2023-10-10T06:53:08.693Z","1.0.3":"2023-10-10T07:15:23.122Z","1.0.4":"2023-10-10T07:27:05.455Z","1.0.5":"2023-10-10T13:05:23.160Z","1.1.0":"2024-09-13T19:27:11.018Z","1.1.1":"2025-01-16T14:48:26.851Z","1.1.2":"2025-01-16T14:49:22.126Z","1.1.3":"2025-07-02T21:42:31.954Z"},"bugs":{"url":"https://github.com/foblex/flow/issues"},"author":{"name":"Siarhei Huzarevich"},"license":"MIT","homepage":"https://flow.foblex.com","keywords":["angular","flow","meditor","typescript","foblex"],"repository":{"type":"git","url":"git+https://github.com/foblex/flow.git"},"description":"An Angular library that implements the mediator pattern, providing a centralized way to handle requests with optional\nvalidation and execution pipelines.","maintainers":[{"name":"siarheihuzarevich","email":"shuzarevich@gmail.com"}],"readme":"# Angular Mediator\n\nAn Angular library that implements the mediator pattern, providing a centralized way to handle requests with optional\nvalidation and execution pipelines.\n\n## Overview\n\nThe Angular Flow Mediator library allows you to streamline request handling in your Angular applications by:\n\n- Centralizing request processing logic.\n- Separating validation and execution concerns.\n- Simplifying the addition of new request types.\n\nBy using decorators, you can easily register validators and execution handlers for specific request types, promoting\nclean code organization and modularity.\n\n## Installation\n\nInstall the library via npm:\n\n```bash\n  npm install @foblex/mediator\n```\n## Usage\n\n### 1. Define a Request Type\n\nCreate a class representing your request:\n\n```typescript\nexport class MyRequest {\n  static readonly fToken = Symbol('MyRequest');\n  constructor(public payload: any) {}\n}\n```\n\n### 2. Create a Validator (Optional)\n\nImplement a validator by extending IValidator and using the FValidatorRegister decorator:\n\n```typescript\nimport { Injectable } from '@angular/core';\nimport { IValidator, FValidatorRegister } from 'angular-flow-mediator';\nimport { MyRequest } from './my-request';\n\n@Injectable()\n@FValidatorRegister(MyRequest)\nexport class MyRequestValidator implements IValidator<MyRequest> {\n  handle(request: MyRequest): boolean {\n    // Implement validation logic\n    return request.payload !== null; // Return true if valid, false otherwise\n  }\n}\n```\n\n### 3. Create an Execution Handler\n\nImplement an execution handler by extending IExecution and using the FExecutionRegister decorator:\n\n```typescript\nimport { Injectable } from '@angular/core';\nimport { IExecution, FExecutionRegister } from 'angular-flow-mediator';\nimport { MyRequest } from './my-request';\n\n@Injectable()\n@FExecutionRegister(MyRequest)\nexport class MyRequestHandler implements IExecution<MyRequest, any> {\n  handle(request: MyRequest): any {\n    // Implement execution logic\n    return `Processed payload: ${request.payload}`;\n  }\n}\n```\n\n### 4. Provide Handlers in Module\n\nEnsure that you provide your handlers in your Angular module:\n\n```typescript\nimport { NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { AppComponent } from './app.component';\n\nimport { FMediator } from '@foblex/mediator';\nimport { MyRequestValidator } from './my-request.validator';\nimport { MyRequestHandler } from './my-request.handler';\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [BrowserModule],\n  providers: [\n    FMediator,\n    MyRequestValidator,\n    MyRequestHandler\n  ],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n\n### 5. Use the Mediator\nInject FMediator into your component or service, and send requests:\n\n```typescript\nimport { Component } from '@angular/core';\nimport { FMediator } from '@foblex/mediator';\nimport { MyRequest } from './my-request';\n\n@Component({\n  selector: 'app-root',\n  template: `<h1>Angular Mediator Example</h1>`\n})\nexport class AppComponent {\n  constructor(private mediator: FMediator) {\n    const response = this.mediator.send(new MyRequest('Sample Data'));\n    console.log(response);\n  }\n}\n```\n\n## License\n\nThis project is licensed under the MIT License.\n\nBy following this guide, you should be able to integrate the Angular Mediator into your application, enhancing your request handling mechanisms with a clean and efficient mediator pattern.\n","readmeFilename":"README.md"}