@artstesh/postboy 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/lib/index.cjs +2 -0
  2. package/lib/index.cjs.map +1 -0
  3. package/lib/index.d.mts +701 -0
  4. package/lib/index.d.ts +701 -13
  5. package/lib/index.mjs +2 -0
  6. package/lib/index.mjs.map +1 -0
  7. package/package.json +52 -19
  8. package/lib/i-postboy-depending.service.d.ts +0 -5
  9. package/lib/i-postboy-depending.service.d.ts.map +0 -1
  10. package/lib/i-postboy-depending.service.js +0 -3
  11. package/lib/i-postboy-depending.service.js.map +0 -1
  12. package/lib/index.d.ts.map +0 -1
  13. package/lib/index.js +0 -32
  14. package/lib/index.js.map +0 -1
  15. package/lib/locker.store.d.ts +0 -9
  16. package/lib/locker.store.d.ts.map +0 -1
  17. package/lib/locker.store.js +0 -27
  18. package/lib/locker.store.js.map +0 -1
  19. package/lib/messages/add-middleware.executor.d.ts +0 -19
  20. package/lib/messages/add-middleware.executor.d.ts.map +0 -1
  21. package/lib/messages/add-middleware.executor.js +0 -24
  22. package/lib/messages/add-middleware.executor.js.map +0 -1
  23. package/lib/messages/add-namespace.executor.d.ts +0 -19
  24. package/lib/messages/add-namespace.executor.d.ts.map +0 -1
  25. package/lib/messages/add-namespace.executor.js +0 -24
  26. package/lib/messages/add-namespace.executor.js.map +0 -1
  27. package/lib/messages/connect-executor.executor.d.ts +0 -25
  28. package/lib/messages/connect-executor.executor.d.ts.map +0 -1
  29. package/lib/messages/connect-executor.executor.js +0 -30
  30. package/lib/messages/connect-executor.executor.js.map +0 -1
  31. package/lib/messages/connect-handler.executor.d.ts +0 -25
  32. package/lib/messages/connect-handler.executor.d.ts.map +0 -1
  33. package/lib/messages/connect-handler.executor.js +0 -30
  34. package/lib/messages/connect-handler.executor.js.map +0 -1
  35. package/lib/messages/connect-message.executor.d.ts +0 -28
  36. package/lib/messages/connect-message.executor.d.ts.map +0 -1
  37. package/lib/messages/connect-message.executor.js +0 -31
  38. package/lib/messages/connect-message.executor.js.map +0 -1
  39. package/lib/messages/connect.message.executor.d.ts +0 -28
  40. package/lib/messages/connect.message.executor.d.ts.map +0 -1
  41. package/lib/messages/connect.message.executor.js +0 -31
  42. package/lib/messages/connect.message.executor.js.map +0 -1
  43. package/lib/messages/disconnect-message.executor.d.ts +0 -19
  44. package/lib/messages/disconnect-message.executor.d.ts.map +0 -1
  45. package/lib/messages/disconnect-message.executor.js +0 -25
  46. package/lib/messages/disconnect-message.executor.js.map +0 -1
  47. package/lib/messages/eliminate-namespace.executor.d.ts +0 -16
  48. package/lib/messages/eliminate-namespace.executor.d.ts.map +0 -1
  49. package/lib/messages/eliminate-namespace.executor.js +0 -22
  50. package/lib/messages/eliminate-namespace.executor.js.map +0 -1
  51. package/lib/messages/index.d.ts +0 -11
  52. package/lib/messages/index.d.ts.map +0 -1
  53. package/lib/messages/index.js +0 -24
  54. package/lib/messages/index.js.map +0 -1
  55. package/lib/messages/lock-message.executor.d.ts +0 -22
  56. package/lib/messages/lock-message.executor.d.ts.map +0 -1
  57. package/lib/messages/lock-message.executor.js +0 -26
  58. package/lib/messages/lock-message.executor.js.map +0 -1
  59. package/lib/messages/remove-middleware.executor.d.ts +0 -17
  60. package/lib/messages/remove-middleware.executor.d.ts.map +0 -1
  61. package/lib/messages/remove-middleware.executor.js +0 -22
  62. package/lib/messages/remove-middleware.executor.js.map +0 -1
  63. package/lib/messages/unlock-message.executor.d.ts +0 -21
  64. package/lib/messages/unlock-message.executor.d.ts.map +0 -1
  65. package/lib/messages/unlock-message.executor.js +0 -25
  66. package/lib/messages/unlock-message.executor.js.map +0 -1
  67. package/lib/mocks/message-history-item-mock.d.ts +0 -10
  68. package/lib/mocks/message-history-item-mock.d.ts.map +0 -1
  69. package/lib/mocks/message-history-item-mock.js +0 -26
  70. package/lib/mocks/message-history-item-mock.js.map +0 -1
  71. package/lib/mocks/message-history-mock.d.ts +0 -9
  72. package/lib/mocks/message-history-mock.d.ts.map +0 -1
  73. package/lib/mocks/message-history-mock.js +0 -23
  74. package/lib/mocks/message-history-mock.js.map +0 -1
  75. package/lib/mocks/postboy-service-mock.d.ts +0 -22
  76. package/lib/mocks/postboy-service-mock.d.ts.map +0 -1
  77. package/lib/mocks/postboy-service-mock.js +0 -51
  78. package/lib/mocks/postboy-service-mock.js.map +0 -1
  79. package/lib/models/cancel-details.d.ts +0 -9
  80. package/lib/models/cancel-details.d.ts.map +0 -1
  81. package/lib/models/cancel-details.js +0 -3
  82. package/lib/models/cancel-details.js.map +0 -1
  83. package/lib/models/cancel-error.d.ts +0 -7
  84. package/lib/models/cancel-error.d.ts.map +0 -1
  85. package/lib/models/cancel-error.js +0 -18
  86. package/lib/models/cancel-error.js.map +0 -1
  87. package/lib/models/message-queue.model.d.ts +0 -44
  88. package/lib/models/message-queue.model.d.ts.map +0 -1
  89. package/lib/models/message-queue.model.js +0 -66
  90. package/lib/models/middleware-decision.enum.d.ts +0 -5
  91. package/lib/models/middleware-decision.enum.d.ts.map +0 -1
  92. package/lib/models/middleware-decision.enum.js +0 -9
  93. package/lib/models/middleware-decision.enum.js.map +0 -1
  94. package/lib/models/middleware-stage.enum.d.ts +0 -6
  95. package/lib/models/middleware-stage.enum.d.ts.map +0 -1
  96. package/lib/models/middleware-stage.enum.js +0 -10
  97. package/lib/models/middleware-stage.enum.js.map +0 -1
  98. package/lib/models/pipeline-context.d.ts +0 -7
  99. package/lib/models/pipeline-context.d.ts.map +0 -1
  100. package/lib/models/pipeline-context.js +0 -3
  101. package/lib/models/pipeline-context.js.map +0 -1
  102. package/lib/models/pipeline-result.d.ts +0 -6
  103. package/lib/models/pipeline-result.d.ts.map +0 -1
  104. package/lib/models/pipeline-result.js +0 -3
  105. package/lib/models/pipeline-result.js.map +0 -1
  106. package/lib/models/postboy-callback.message.d.ts +0 -48
  107. package/lib/models/postboy-callback.message.d.ts.map +0 -1
  108. package/lib/models/postboy-callback.message.js +0 -60
  109. package/lib/models/postboy-callback.message.js.map +0 -1
  110. package/lib/models/postboy-execution.handler.d.ts +0 -21
  111. package/lib/models/postboy-execution.handler.d.ts.map +0 -1
  112. package/lib/models/postboy-execution.handler.js +0 -17
  113. package/lib/models/postboy-execution.handler.js.map +0 -1
  114. package/lib/models/postboy-executor.d.ts +0 -5
  115. package/lib/models/postboy-executor.d.ts.map +0 -1
  116. package/lib/models/postboy-executor.js +0 -8
  117. package/lib/models/postboy-executor.js.map +0 -1
  118. package/lib/models/postboy-generic-message.d.ts +0 -8
  119. package/lib/models/postboy-generic-message.d.ts.map +0 -1
  120. package/lib/models/postboy-generic-message.js +0 -17
  121. package/lib/models/postboy-generic-message.js.map +0 -1
  122. package/lib/models/postboy-message-metadata.d.ts +0 -26
  123. package/lib/models/postboy-message-metadata.d.ts.map +0 -1
  124. package/lib/models/postboy-message-metadata.js +0 -3
  125. package/lib/models/postboy-message-metadata.js.map +0 -1
  126. package/lib/models/postboy-message.context.d.ts +0 -9
  127. package/lib/models/postboy-message.context.d.ts.map +0 -1
  128. package/lib/models/postboy-message.context.js +0 -3
  129. package/lib/models/postboy-message.context.js.map +0 -1
  130. package/lib/models/postboy-middleware.d.ts +0 -5
  131. package/lib/models/postboy-middleware.d.ts.map +0 -1
  132. package/lib/models/postboy-middleware.js +0 -3
  133. package/lib/models/postboy-middleware.js.map +0 -1
  134. package/lib/models/postboy-subscription.d.ts +0 -39
  135. package/lib/models/postboy-subscription.d.ts.map +0 -1
  136. package/lib/models/postboy-subscription.js +0 -49
  137. package/lib/models/postboy-subscription.js.map +0 -1
  138. package/lib/models/postboy.locker.d.ts +0 -6
  139. package/lib/models/postboy.locker.d.ts.map +0 -1
  140. package/lib/models/postboy.locker.js +0 -3
  141. package/lib/models/postboy.locker.js.map +0 -1
  142. package/lib/models/postboy.message.d.ts +0 -7
  143. package/lib/models/postboy.message.d.ts.map +0 -1
  144. package/lib/models/postboy.message.js +0 -17
  145. package/lib/models/postboy.message.js.map +0 -1
  146. package/lib/models/postboy.settings.d.ts +0 -13
  147. package/lib/models/postboy.settings.d.ts.map +0 -1
  148. package/lib/models/postboy.settings.js +0 -20
  149. package/lib/models/postboy.settings.js.map +0 -1
  150. package/lib/postboy-abstract.registrator.d.ts +0 -97
  151. package/lib/postboy-abstract.registrator.d.ts.map +0 -1
  152. package/lib/postboy-abstract.registrator.js +0 -138
  153. package/lib/postboy-abstract.registrator.js.map +0 -1
  154. package/lib/postboy.service.d.ts +0 -157
  155. package/lib/postboy.service.d.ts.map +0 -1
  156. package/lib/postboy.service.js +0 -242
  157. package/lib/postboy.service.js.map +0 -1
  158. package/lib/services/namespace-registrator.d.ts +0 -14
  159. package/lib/services/namespace-registrator.d.ts.map +0 -1
  160. package/lib/services/namespace-registrator.js +0 -21
  161. package/lib/services/namespace-registrator.js.map +0 -1
  162. package/lib/services/postboy-context.service.d.ts +0 -13
  163. package/lib/services/postboy-context.service.d.ts.map +0 -1
  164. package/lib/services/postboy-context.service.js +0 -50
  165. package/lib/services/postboy-context.service.js.map +0 -1
  166. package/lib/services/postboy-dependency.resolver.d.ts +0 -32
  167. package/lib/services/postboy-dependency.resolver.d.ts.map +0 -1
  168. package/lib/services/postboy-dependency.resolver.js +0 -38
  169. package/lib/services/postboy-dependency.resolver.js.map +0 -1
  170. package/lib/services/postboy-message.store.d.ts +0 -20
  171. package/lib/services/postboy-message.store.d.ts.map +0 -1
  172. package/lib/services/postboy-message.store.js +0 -61
  173. package/lib/services/postboy-message.store.js.map +0 -1
  174. package/lib/services/postboy-middleware.d.ts +0 -35
  175. package/lib/services/postboy-middleware.d.ts.map +0 -1
  176. package/lib/services/postboy-middleware.js +0 -47
  177. package/lib/services/postboy-middleware.js.map +0 -1
  178. package/lib/services/postboy-middleware.service.d.ts +0 -37
  179. package/lib/services/postboy-middleware.service.d.ts.map +0 -1
  180. package/lib/services/postboy-middleware.service.js +0 -50
  181. package/lib/services/postboy-middleware.service.js.map +0 -1
  182. package/lib/services/postboy-namespace.store.d.ts +0 -34
  183. package/lib/services/postboy-namespace.store.d.ts.map +0 -1
  184. package/lib/services/postboy-namespace.store.js +0 -54
  185. package/lib/services/postboy-namespace.store.js.map +0 -1
  186. package/lib/tests/integration/models/test-callback-message.d.ts +0 -6
  187. package/lib/tests/integration/models/test-callback-message.d.ts.map +0 -1
  188. package/lib/tests/integration/models/test-callback-message.js +0 -13
  189. package/lib/tests/integration/models/test-callback-message.js.map +0 -1
  190. package/lib/tests/integration/models/test-executor.d.ts +0 -7
  191. package/lib/tests/integration/models/test-executor.d.ts.map +0 -1
  192. package/lib/tests/integration/models/test-executor.js +0 -13
  193. package/lib/tests/integration/models/test-executor.js.map +0 -1
  194. package/lib/tests/integration/models/test-handler.d.ts +0 -8
  195. package/lib/tests/integration/models/test-handler.d.ts.map +0 -1
  196. package/lib/tests/integration/models/test-handler.js +0 -15
  197. package/lib/tests/integration/models/test-handler.js.map +0 -1
  198. package/lib/tests/integration/models/test-message.d.ts +0 -6
  199. package/lib/tests/integration/models/test-message.d.ts.map +0 -1
  200. package/lib/tests/integration/models/test-message.js +0 -13
  201. package/lib/tests/integration/models/test-message.js.map +0 -1
  202. package/lib/tests/integration/models/test-postboy.d.ts +0 -4
  203. package/lib/tests/integration/models/test-postboy.d.ts.map +0 -1
  204. package/lib/tests/integration/models/test-postboy.js +0 -8
  205. package/lib/tests/integration/models/test-postboy.js.map +0 -1
  206. package/lib/tests/integration/models/test-registry.d.ts +0 -8
  207. package/lib/tests/integration/models/test-registry.d.ts.map +0 -1
  208. package/lib/tests/integration/models/test-registry.js +0 -15
  209. package/lib/tests/integration/models/test-registry.js.map +0 -1
  210. package/lib/utils/id.generator.d.ts +0 -5
  211. package/lib/utils/id.generator.d.ts.map +0 -1
  212. package/lib/utils/id.generator.js +0 -18
  213. package/lib/utils/id.generator.js.map +0 -1
package/lib/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict';var rxjs=require('rxjs');var b=class{constructor(){this.metadata={};}get id(){return this.constructor.ID}setMetadata(e){return this.metadata={...this.metadata,...e},this}};var f=class extends b{};function i(s){if(!s.ID)throw new Error(`${s.name} should have a static ID field`);return s.ID}var l=class{constructor(e,t){this.subscription=e;this._subscription=t?t(e):e.asObservable();}sub(){return this._subscription}fire(e){this.subscription.next(e);}finish(){this.subscription.complete();}};var T=class{constructor(){this.middlewares=[];}addMiddleware(e){this.middlewares.push(e);}removeMiddleware(e){this.middlewares=this.middlewares.filter(t=>t!==e);}manage(e){for(let t of this.middlewares)t.handle(e);}dispose(){this.middlewares=[];}};var v=class{constructor(){this.messages=new Map;this.executors=new Map;this.callbacks=new Map;}registerMessage(e,t){this.messages.has(e)&&console.warn(`Message with id ${e} already registered. Overriding...`),this.messages.set(e,t);}registerExecutor(e,t){this.executors.has(e)&&console.warn(`Executor with id ${e} already registered. Overriding...`),this.executors.set(e,t);}callbackFired(e){let t=this.callbacks.get(e.id);t?t.push(()=>e.complete()):this.callbacks.set(e.id,[()=>e.complete()]);}getMessage(e,t){let r=this.messages.get(e);if(!r)throw new Error(`There is no registered event ${t}`);return r}getExecutor(e){let t=this.executors.get(e);if(!t)throw new Error(`There is no registered executor with id ${e}`);return t}unregister(e){this.messages.get(e)?.finish(),this.messages.delete(e),this.callbacks.get(e)?.forEach(t=>t()),this.callbacks.delete(e),this.executors.delete(e);}dispose(){this.messages.forEach((e,t)=>this.unregister(t)),this.callbacks.forEach(e=>e.forEach(t=>t())),this.messages.clear(),this.executors.clear(),this.callbacks.clear();}};var M=class M{static get(){let e=[];for(let t=0;t<7;t++)e.push(M.collection.sort(()=>.5-Math.random()).slice(0,5).join(""));return e.join("-")}};M.collection="ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789".split("");var P=M;var o=class extends b{};var a=class extends o{constructor(t,r,d){super();this.type=t;this.sub=r;this.pipe=d;}};a.ID="aa03a192-bdc7-402d-9f2f-bf3748229ea2";var c=class extends o{constructor(t){super();this.messageId=t;}};c.ID="94579e43-5bc9-4517-bcda-b595bcda1ae7";var p=class extends o{constructor(t,r){super();this.type=t;this.exec=r;}};p.ID="cb80e8ad-b68c-4b2d-8c44-617ea6017cb3";var n=class extends o{constructor(t,r){super();this.executor=t;this.handler=r;}};n.ID="bf618cea-6f32-417c-9548-8eafe937378b";var w=class{constructor(e,t=null){this.postboy=e;this.ids=[];this.services=[];this._namespace=t??P.get();}get namespace(){return this._namespace}registerServices(e){this.services=e;}up(){this._up?.(),this.services.forEach(e=>e.up());}down(){this.services.forEach(e=>!!e.down&&e.down()),this.services=[],this.ids.forEach(e=>this.postboy.exec(new c(e)));}record(e,t){return this.ids.push(i(e)),this.postboy.exec(new a(e,t)),this}recordWithPipe(e,t,r){return this.ids.push(i(e)),this.postboy.exec(new a(e,t,r)),this}recordExecutor(e,t){return this.ids.push(i(e)),this.postboy.exec(new p(e,t)),this}recordHandler(e,t){return this.ids.push(i(e)),this.postboy.exec(new n(e,t)),this}recordReplay(e,t=1){return this.record(e,new rxjs.ReplaySubject(t)),this}recordBehavior(e,t){return this.record(e,new rxjs.BehaviorSubject(t)),this}recordSubject(e){return this.record(e,new rxjs.Subject),this}};var E=class extends w{constructor(e){super(e);}_up(){}};var S=class{constructor(){this.spaces=new Map;}addSpace(e,t){if(this.spaces.has(e))return this.spaces.get(e);let r=new E(t);return this.spaces.set(e,r),r}eliminateSpace(e){this.spaces.has(e)&&(this.spaces.get(e)?.down(),this.spaces.delete(e));}dispose(){this.spaces.forEach(e=>e.down()),this.spaces.clear();}};var R=class{constructor(){this.getMiddlewareService=()=>new T;this.getMessageStore=()=>new v;this.getNamespaceStore=()=>new S;}};var u=class extends o{constructor(t){super();this.space=t;}};u.ID="6d1a6f7d-6b6e-4c4d-8af8-9cc9a32e850c";var m=class extends o{constructor(t){super();this.space=t;}};m.ID="03bb03bb-53e0-4b74-9aad-64d5c54a8972";var y=class extends o{constructor(t){super();this.middleware=t;}};y.ID="0a8cfe0a-6193-4082-8440-d0793367b21d";var g=class extends o{constructor(t){super();this.middleware=t;}};g.ID="c25c708c-53c9-498d-a28b-936fbaf68b91";var h=class extends o{constructor(t){super();this.type=t;}};h.ID="477df3e2-1f99-4476-9a3b-afd1fa426436";var x=class extends o{constructor(t){super();this.type=t;}};x.ID="d71d25e3-90ac-4009-b972-9e6c6b05611e";var I=class{constructor(e){this.locked=new Set;this.dependencyResolver=e||new R,this.middleware=this.dependencyResolver.getMiddlewareService(),this.store=this.dependencyResolver.getMessageStore(),this.namespaceStore=this.dependencyResolver.getNamespaceStore(),this.registerInfrastructureMessages();}registerInfrastructureMessages(){this.store.registerExecutor(c.ID,e=>this.store.unregister(e.messageId)),this.store.registerExecutor(x.ID,e=>this.locked.delete(i(e.type))),this.store.registerExecutor(h.ID,e=>this.locked.add(i(e.type))),this.store.registerExecutor(y.ID,e=>this.middleware.addMiddleware(e.middleware)),this.store.registerExecutor(g.ID,e=>this.middleware.removeMiddleware(e.middleware)),this.store.registerExecutor(u.ID,e=>this.namespaceStore.addSpace(e.space,this)),this.store.registerExecutor(m.ID,e=>this.namespaceStore.eliminateSpace(e.space)),this.store.registerExecutor(a.ID,e=>{let{type:t,sub:r,pipe:d}=e;this.store.registerMessage(i(t),new l(r,d));}),this.store.registerExecutor(p.ID,e=>{let{type:t,exec:r}=e;this.store.registerExecutor(i(t),r);}),this.store.registerExecutor(n.ID,e=>{let{executor:t,handler:r}=e;this.store.registerExecutor(i(t),d=>r.handle(d));});}lock(e){this.locked.add(i(e));}unlock(e){this.locked.delete(i(e));}addMiddleware(e){return this.middleware.addMiddleware(e)}removeMiddleware(e){return this.middleware.removeMiddleware(e)}unregister(e){return this.store.unregister(e)}fire(e){this.middleware.manage(e),this.locked.has(e.id)||this.store.getMessage(e.id,e.constructor.name).fire(e);}fireCallback(e,t){this.middleware.manage(e),this.store.callbackFired(e);let r=t?e.result.pipe(rxjs.tap(t)):e.result,d=new rxjs.Observable(G=>{let O=r.subscribe(G);return this.locked.has(e.id)||this.store.getMessage(e.id,e.constructor.name).fire(e),()=>O.unsubscribe()});return t&&d.subscribe(),d}exec(e){return this.middleware.manage(e),this.store.getExecutor(e.id)(e)}sub(e){return this.store.getMessage(i(e),e.name).sub()}once(e){return this.sub(e).pipe(rxjs.first())}record(e,t){this.store.registerMessage(i(e),new l(t,r=>r.asObservable()));}recordWithPipe(e,t,r){this.store.registerMessage(i(e),new l(t,r));}recordExecutor(e,t){this.store.registerExecutor(i(e),t);}recordHandler(e,t){this.store.registerExecutor(i(e),r=>t.handle(r));}addNamespace(e){return this.namespaceStore.addSpace(e,this)}eliminateNamespace(e){return this.namespaceStore?.eliminateSpace(e)}dispose(){this.namespaceStore?.dispose(),this.store.dispose(),this.middleware.dispose();}};var D=class extends f{constructor(){super(...arguments);this.result$=new rxjs.Subject;this.result=this.result$.asObservable();this.next=t=>this.result$.next(t);}finish(t){this.result$.next(t),this.result$.complete();}complete(){this.result$.complete();}};var k=class{};exports.AddMiddleware=y;exports.AddNamespace=u;exports.ConnectExecutor=p;exports.ConnectHandler=n;exports.ConnectMessage=a;exports.DisconnectMessage=c;exports.EliminateNamespace=m;exports.LockMessage=h;exports.PostboyAbstractRegistrator=w;exports.PostboyCallbackMessage=D;exports.PostboyExecutionHandler=k;exports.PostboyExecutor=o;exports.PostboyGenericMessage=f;exports.PostboyMessage=b;exports.PostboyMessageStore=v;exports.PostboyMiddlewareService=T;exports.PostboyService=I;exports.RemoveMiddleware=g;exports.UnlockMessage=x;exports.checkId=i;//# sourceMappingURL=index.cjs.map
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/models/postboy.message.ts","../src/models/postboy-generic-message.ts","../src/models/postboy-subscription.ts","../src/services/postboy-middleware.service.ts","../src/services/postboy-message.store.ts","../src/utils/id.generator.ts","../src/models/postboy-executor.ts","../src/messages/connect-message.executor.ts","../src/messages/disconnect-message.executor.ts","../src/messages/connect-executor.executor.ts","../src/messages/connect-handler.executor.ts","../src/postboy-abstract.registrator.ts","../src/services/namespace-registrator.ts","../src/services/postboy-namespace.store.ts","../src/services/postboy-dependency.resolver.ts","../src/messages/add-namespace.executor.ts","../src/messages/eliminate-namespace.executor.ts","../src/messages/add-middleware.executor.ts","../src/messages/remove-middleware.executor.ts","../src/messages/lock-message.executor.ts","../src/messages/unlock-message.executor.ts","../src/postboy.service.ts","../src/models/postboy-callback.message.ts","../src/models/postboy-execution.handler.ts"],"names":["PostboyMessage","metadata","PostboyGenericMessage","checkId","message","PostboySubscription","subscription","pipe","data","PostboyMiddlewareService","middleware","m","msg","item","PostboyMessageStore","id","sub","executor","existingCallbacks","name","executorFunction","c","fs","f","_IdGenerator","result","i","IdGenerator","PostboyExecutor","ConnectMessage","type","DisconnectMessage","messageId","ConnectExecutor","exec","ConnectHandler","handler","PostboyAbstractRegistrator","postboy","namespace","services","s","bufferSize","ReplaySubject","initial","BehaviorSubject","Subject","NamespaceRegistrator","PostboyNamespaceStore","space","registrator","PostboyDependencyResolver","AddNamespace","EliminateNamespace","AddMiddleware","RemoveMiddleware","LockMessage","UnlockMessage","PostboyService","resolver","e","action","result$","tap","observable","Observable","subscriber","first","PostboyCallbackMessage","value","PostboyExecutionHandler"],"mappings":"sCAEO,IAAeA,CAAAA,CAAf,KAA8B,CAA9B,WAAA,EAAA,CACL,KAAO,QAAA,CAAmC,IAC1C,IAAW,EAAA,EAAa,CACtB,OAAQ,IAAA,CAAK,YAAoB,EACnC,CAEA,YAAYC,CAAAA,CAAiD,CAC3D,YAAK,QAAA,CAAW,CAAE,GAAG,IAAA,CAAK,QAAA,CAAU,GAAGA,CAAS,CAAA,CACzC,IACT,CACF,MCPsBC,CAAAA,CAAf,cAA6CF,CAAe,GAC5D,SAASG,CAAAA,CAAQC,CAAAA,CAA8C,CACpE,GAAI,CAAEA,EAAgB,EAAA,CAAI,MAAM,IAAI,KAAA,CAAM,CAAA,EAAGA,EAAQ,IAAI,CAAA,8BAAA,CAAgC,EACzF,OAAQA,CAAAA,CAAgB,EAC1B,CCAO,IAAMC,EAAN,KAA6B,CASlC,YACUC,CAAAA,CAC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BW,EAAKT,CAAI,CAAC,EACjF,CAUO,cAAA,CAAgDuB,EAAsBI,CAAAA,CAAyB,CACpG,KAAK,KAAA,CAAM,gBAAA,CAAiB/B,EAAQ2B,CAAI,CAAA,CAAGI,CAAoC,EACjF,CAUO,cACLjB,CAAAA,CACAmB,CAAAA,CACM,CACN,IAAA,CAAK,KAAA,CAAM,iBAAiBjC,CAAAA,CAAQc,CAAQ,EAAI2C,CAAAA,EAAMxB,CAAAA,CAAQ,OAAOwB,CAAM,CAAC,EAC9E,CASO,YAAA,CAAaX,EAA2C,CAC7D,OAAO,KAAK,cAAA,CAAe,QAAA,CAASA,EAAO,IAAI,CACjD,CASO,kBAAA,CAAmBA,CAAAA,CAAqB,CAC7C,OAAO,IAAA,CAAK,gBAAgB,cAAA,CAAeA,CAAK,CAClD,CAQO,OAAA,EAAgB,CACrB,IAAA,CAAK,cAAA,EAAgB,SAAQ,CAC7B,IAAA,CAAK,MAAM,OAAA,EAAQ,CACnB,KAAK,UAAA,CAAW,OAAA,GAClB,CACF,EClQO,IAAemB,CAAAA,CAAf,cAAiDlE,CAAsB,CAAvE,kCACL,IAAA,CAAU,OAAA,CAAU,IAAI4C,YAAAA,CACxB,IAAA,CAAO,OAAwB,IAAA,CAAK,OAAA,CAAQ,cAAa,CASzD,IAAA,CAAO,KAAQuB,CAAAA,EAAmB,IAAA,CAAK,QAAQ,IAAA,CAAKA,CAAK,GAQlD,MAAA,CAAOA,CAAAA,CAAgB,CAC5B,IAAA,CAAK,OAAA,CAAQ,KAAKA,CAAK,CAAA,CACvB,KAAK,OAAA,CAAQ,QAAA,GACf,CASO,QAAA,EAAiB,CACtB,IAAA,CAAK,OAAA,CAAQ,WACf,CACF,EC3CO,IAAeC,CAAAA,CAAf,KAAwE","file":"index.cjs","sourcesContent":["import { PostboyMessageMetadata } from './postboy-message-metadata';\n\nexport abstract class PostboyMessage {\n public metadata: PostboyMessageMetadata = {};\n public get id(): string {\n return (this.constructor as any).ID;\n }\n\n setMetadata(metadata: Partial<PostboyMessageMetadata>): this {\n this.metadata = { ...this.metadata, ...metadata };\n return this;\n }\n}\n","import { PostboyMessage } from './postboy.message';\n\n/**\n * An inheritor should have a static ID field\n */\nexport abstract class PostboyGenericMessage extends PostboyMessage {}\nexport function checkId(message: new (...args: any[]) => any): string {\n if (!(message as any).ID) throw new Error(`${message.name} should have a static ID field`);\n return (message as any).ID;\n}\n","import { Observable, Subject } from 'rxjs';\n\n/**\n * A class that manages a reactive subscription using a provided Subject and transformation pipe.\n * Offers methods to interact with the subscription, such as emitting data, completing the subscription,\n * and accessing the transformed observable.\n *\n * @template T The type of data managed by the subscription.\n */\nexport class PostboySubscription<T> {\n private readonly _subscription: Observable<T>;\n\n /**\n * Constructs an instance of the class with a given subscription and a transformation pipe.\n *\n * @param {Subject<T>} subscription - The source Subject that will be transformed.\n * @param {(s: Subject<T>) => Observable<T>} pipe - A function that applies a transformation to the subscription.\n */\n constructor(\n private subscription: Subject<T>,\n pipe?: (s: Subject<T>) => Observable<T>,\n ) {\n this._subscription = !!pipe ? pipe(subscription) : subscription.asObservable();\n }\n\n /**\n * Returns an observable subscription.\n *\n * @return {Observable<T>} An observable instance of type T.\n */\n public sub(): Observable<T> {\n return this._subscription;\n }\n\n /**\n * Triggers an event by emitting the provided data to all subscribers.\n *\n * @param {T} data - The data to emit to the subscribers.\n * @return {void} - Does not return any value.\n */\n public fire(data: T): void {\n this.subscription.next(data);\n }\n\n /**\n * Completes the subscription, signaling that no further values will be sent.\n * This is typically used to finalize or clean up resources.\n * @return {void} This method does not return any value.\n */\n public finish(): void {\n this.subscription.complete();\n }\n}\n","import { PostboyMiddleware } from '../models/postboy-middleware';\nimport { PostboyMessage } from '../models/postboy.message';\n\n/**\n * A service class that manages middleware functions for processing PostboyMessage objects.\n * It provides methods to add, remove, and execute middlewares in sequence.\n */\nexport class PostboyMiddlewareService {\n protected middlewares: PostboyMiddleware[] = [];\n\n /**\n * Adds a middleware function to the collection of middlewares.\n *\n * @param {PostboyMiddleware} middleware - The middleware function to be added.\n * @return {void}\n */\n public addMiddleware(middleware: PostboyMiddleware): void {\n this.middlewares.push(middleware);\n }\n\n /**\n * Removes a middleware from the list of registered middlewares.\n *\n * @param {PostboyMiddleware} middleware - The middleware instance to be removed.\n * @return {void} No return value.\n */\n public removeMiddleware(middleware: PostboyMiddleware): void {\n this.middlewares = this.middlewares.filter((m) => m !== middleware);\n }\n\n /**\n * Manages the processing of a PostboyMessage by sequentially applying all middlewares.\n *\n * @param {PostboyMessage} msg - The message object to be processed by the middlewares.\n * @return {void} - This method does not return any value.\n */\n public manage(msg: PostboyMessage): void {\n for (const item of this.middlewares) item.handle(msg);\n }\n\n /**\n * Disposes of the current object by clearing its middlewares array.\n *\n * @return {void} This method does not return a value.\n */\n public dispose(): void {\n this.middlewares = [];\n }\n}\n","import { PostboySubscription } from '../models/postboy-subscription';\nimport { PostboyExecutor } from '../models/postboy-executor';\nimport { PostboyCallbackMessage } from '../models/postboy-callback.message';\n\n/**\n * The PostboyMessageStore is a utility class for managing message subscriptions and executors.\n * It provides functionality to register, retrieve, and unregister subscription-based messages and executors.\n */\nexport class PostboyMessageStore {\n protected messages = new Map<string, PostboySubscription<any>>();\n protected executors = new Map<string, (e: PostboyExecutor<any>) => any>();\n protected callbacks = new Map<string, (() => void)[]>();\n\n public registerMessage(id: string, sub: PostboySubscription<any>): void {\n // tslint:disable-next-line:no-console\n if (this.messages.has(id)) console.warn(`Message with id ${id} already registered. Overriding...`);\n this.messages.set(id, sub);\n }\n\n public registerExecutor(id: string, executor: (e: PostboyExecutor<any>) => any): void {\n // tslint:disable-next-line:no-console\n if (this.executors.has(id)) console.warn(`Executor with id ${id} already registered. Overriding...`);\n this.executors.set(id, executor);\n }\n\n callbackFired(message: PostboyCallbackMessage<any>): void {\n const existingCallbacks = this.callbacks.get(message.id);\n existingCallbacks\n ? existingCallbacks.push(() => message.complete())\n : this.callbacks.set(message.id, [() => message.complete()]);\n }\n\n public getMessage(id: string, name: string): PostboySubscription<any> {\n const msg = this.messages.get(id);\n if (!msg) throw new Error(`There is no registered event ${name}`);\n return msg;\n }\n\n public getExecutor<T>(id: string): (e: PostboyExecutor<T>) => T {\n const executorFunction = this.executors.get(id);\n if (!executorFunction) throw new Error(`There is no registered executor with id ${id}`);\n return executorFunction;\n }\n\n public unregister(id: string): void {\n this.messages.get(id)?.finish();\n this.messages.delete(id);\n this.callbacks.get(id)?.forEach((c) => c());\n this.callbacks.delete(id);\n this.executors.delete(id);\n }\n\n public dispose(): void {\n this.messages.forEach((m, id) => this.unregister(id));\n this.callbacks.forEach((fs) => fs.forEach((f) => f()));\n this.messages.clear();\n this.executors.clear();\n this.callbacks.clear();\n }\n}\n","export class IdGenerator {\n private static collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');\n\n public static get(): string {\n const result: string[] = [];\n for (let i = 0; i < 7; i++) {\n result.push(\n IdGenerator.collection\n .sort(() => 0.5 - Math.random())\n .slice(0, 5)\n .join(''),\n );\n }\n return result.join('-');\n }\n}\n","import { PostboyMessage } from './postboy.message';\n\nexport abstract class PostboyExecutor<T> extends PostboyMessage {\n declare protected readonly _postboyResultType?: T;\n}\n","import { PostboyExecutor } from '../models/postboy-executor';\nimport { PostboyGenericMessage } from '../models/postboy-generic-message';\nimport { MessageType } from '../postboy-abstract.registrator';\nimport { Observable, Subject } from 'rxjs';\n\n/**\n * Represents a message that facilitates connection functionality\n * within the application's messaging system.\n *\n * @template T - A type that extends {@link PostboyGenericMessage}, representing\n * the structure of the message being handled.\n *\n * @extends PostboyExecutor<void>\n */\nexport class ConnectMessage<T extends PostboyGenericMessage> extends PostboyExecutor<void> {\n static readonly ID = 'aa03a192-bdc7-402d-9f2f-bf3748229ea2';\n\n /**\n * Constructs a new instance of the class.\n *\n * @param {MessageType<T>} type - The type of the message.\n * @param {Subject<T>} sub - The subject to be used for message handling.\n * @param {(s: Subject<T>) => Observable<T>} [pipe] - An optional function to transform the subject.\n */\n constructor(\n public type: MessageType<T>,\n public sub: Subject<T>,\n public pipe?: (s: Subject<T>) => Observable<T>,\n ) {\n super();\n }\n}\n","import { PostboyExecutor } from '../models/postboy-executor';\n\n/**\n * Represents a message signaling a disconnection event. This class is used\n * within the framework to manage and process disconnection notifications.\n * Extends the {@link PostboyExecutor} base class.\n *\n * @extends {PostboyExecutor<void>}\n */\nexport class DisconnectMessage extends PostboyExecutor<void> {\n static readonly ID = '94579e43-5bc9-4517-bcda-b595bcda1ae7';\n\n /**\n * Creates an instance of the class with the specified message identifier.\n *\n * @param {string} messageId - The unique identifier for the message.\n */\n constructor(public messageId: string) {\n super();\n }\n}\n","import { PostboyExecutor } from '../models/postboy-executor';\nimport { MessageType } from '../postboy-abstract.registrator';\n\n/**\n * Registers an executor that connects to a specific type of message handler.\n * This class extends the functionality of `PostboyExecutor` and is designed to manage\n * the execution of a handler defined by a specific message type and an execution function.\n *\n * @template E The type of the executor extending {@link PostboyExecutor}.\n * @template T The return type of the execution function.\n *\n * @extends {PostboyExecutor<void>}\n */\nexport class ConnectExecutor<E extends PostboyExecutor<T>, T> extends PostboyExecutor<void> {\n static readonly ID = 'cb80e8ad-b68c-4b2d-8c44-617ea6017cb3';\n\n /**\n * Constructs an instance of the class with the specified type and execution function.\n *\n * @param {MessageType<E>} type - The type of the message.\n * @param {(e: E) => T} exec - The function to be executed with the input of type E that returns a value of type T.\n */\n constructor(\n public type: MessageType<E>,\n public exec: (e: E) => T,\n ) {\n super();\n }\n}\n","import { PostboyExecutor } from '../models/postboy-executor';\nimport { PostboyExecutionHandler } from '../models/postboy-execution.handler';\n\n/**\n * Represents a connection handler that extends the PostboyExecutor class.\n *\n * This class encapsulates logic associated with executing a handler in a structured way.\n * It is generic and operates on the provided executor and handler types.\n *\n * Type Parameters:\n * E - Represents an extension of the PostboyExecutor class with a specific type parameter R.\n * R - Represents the type of the result that the executor is expected to operate on.\n */\nexport class ConnectHandler<E extends PostboyExecutor<R>, R> extends PostboyExecutor<void> {\n static readonly ID = 'bf618cea-6f32-417c-9548-8eafe937378b';\n\n /**\n * Constructs an instance of the class.\n *\n * @param {new (...args: any[]) => E} executor - A constructor function for the executor object.\n * @param {PostboyExecutionHandler<R, E>} handler - A handler that processes the execution logic.\n */\n constructor(\n public executor: new (...args: any[]) => E,\n public handler: PostboyExecutionHandler<R, E>,\n ) {\n super();\n }\n}\n","import { PostboyService } from './postboy.service';\nimport { BehaviorSubject, Observable, pipe, ReplaySubject, Subject } from 'rxjs';\nimport { IPostboyDependingService } from './i-postboy-depending.service';\nimport { PostboyExecutor } from './models/postboy-executor';\nimport { checkId, PostboyGenericMessage } from './models/postboy-generic-message';\nimport { PostboyExecutionHandler } from './models/postboy-execution.handler';\nimport { IdGenerator } from './utils/id.generator';\nimport { ConnectMessage } from './messages/connect-message.executor';\nimport { DisconnectMessage } from './messages/disconnect-message.executor';\nimport { ConnectExecutor } from './messages/connect-executor.executor';\nimport { ConnectHandler } from './messages/connect-handler.executor';\n\nexport type MessageType<T extends PostboyGenericMessage> = new (...args: any[]) => T;\n\nexport abstract class PostboyAbstractRegistrator {\n get namespace(): string {\n return this._namespace;\n }\n private ids: string[] = [];\n private services: IPostboyDependingService[] = [];\n private readonly _namespace: string;\n\n constructor(\n protected postboy: PostboyService,\n namespace: string | null = null,\n ) {\n this._namespace = namespace ?? IdGenerator.get();\n }\n\n /**\n * Registers a list of services to be used by the application.\n *\n * @param {IPostboyDependingService[]} services - An array of services to register.\n * @return {void} This method does not return a value.\n */\n public registerServices(services: IPostboyDependingService[]): void {\n this.services = services;\n }\n\n /**\n * Initiates the 'up' process for the current instance and all associated services.\n *\n * @return {void} Does not return a value.\n */\n public up(): void {\n this._up?.();\n this.services.forEach((s) => s.up());\n }\n\n protected abstract _up(): void;\n\n public down(): void {\n this.services.forEach((s) => !!s.down && s.down());\n this.services = [];\n this.ids.forEach((id) => this.postboy.exec(new DisconnectMessage(id)));\n }\n\n /**\n * Records a type and its corresponding Subject<T> into the Postboy system and updates the internal identifiers.\n *\n * @param {MessageType<T>} type - A constructor for the generic message type T.\n * @param {Subject<T>} sub - The subject associated with the generic message type.\n * @return {this} Returns the current instance for method chaining.\n */\n public record<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>): PostboyAbstractRegistrator {\n this.ids.push(checkId(type));\n this.postboy.exec(new ConnectMessage(type, sub));\n return this;\n }\n\n /**\n * Records a message type with a specific subject and applies a transformation pipe to the subject.\n *\n * @param {MessageType<T>} type - The constructor of the message type to record, which extends PostboyGenericMessage.\n * @param {Subject<T>} sub - The Subject instance to associate with the message type.\n * @param {(s: Subject<T>) => Observable<T>} pipe - A function that takes the subject as input and returns an Observable with transformations applied.\n * @return {this} The current instance of the class for chaining.\n */\n public recordWithPipe<T extends PostboyGenericMessage>(\n type: MessageType<T>,\n sub: Subject<T>,\n pipe: (s: Subject<T>) => Observable<T>,\n ): PostboyAbstractRegistrator {\n this.ids.push(checkId(type));\n this.postboy.exec(new ConnectMessage(type, sub, pipe));\n return this;\n }\n\n /**\n * Records an executor associated with a specific type and execution logic.\n *\n * @param type The class constructor of the executor type to be recorded, which extends PostboyExecutor.\n * @param exec A callback function that executes the logic using an instance of the specified executor type.\n * @return void\n */\n public recordExecutor<E extends PostboyExecutor<T>, T>(\n type: new (...args: any[]) => E,\n exec: (e: E) => T,\n ): PostboyAbstractRegistrator {\n this.ids.push(checkId(type));\n this.postboy.exec(new ConnectExecutor(type, exec));\n return this;\n }\n\n /**\n * Records a handler for a specific executor type.\n *\n * @param executor The constructor of the executor type, which extends `PostboyExecutor`.\n * @param handler The execution handler associated with the given executor type.\n * @return void\n */\n public recordHandler<E extends PostboyExecutor<R>, R>(\n executor: new (...args: any[]) => E,\n handler: PostboyExecutionHandler<R, E>,\n ): PostboyAbstractRegistrator {\n this.ids.push(checkId(executor));\n this.postboy.exec(new ConnectHandler(executor, handler));\n return this;\n }\n\n /**\n * A utility function that facilitates the recording and replaying of messages\n * using a ReplaySubject. This function is designed to handle messages of a\n * specific type and allows specifying a buffer size to determine how many\n * of the most recent messages should be replayed.\n *\n * @template T Extends the PostboyGenericMessage type, representing the type of message\n * to be recorded and replayed.\n * @param {MessageType<T>} type The constructor of the message type to be recorded and replayed.\n * @param {number} [bufferSize=1] The number of recent messages to retain in the ReplaySubject's buffer.\n * Defaults to 1 if not specified.\n * @returns The result of invoking the `record` method with the given message type and configured ReplaySubject.\n */\n public recordReplay<T extends PostboyGenericMessage>(\n type: MessageType<T>,\n bufferSize = 1,\n ): PostboyAbstractRegistrator {\n this.record(type, new ReplaySubject<T>(bufferSize));\n return this;\n }\n\n /**\n * Represents a method that records a specific behavior associated with a message type.\n * It creates a `BehaviorSubject` initialized with the provided initial message\n * and associates it with the given message type using the `record` method.\n *\n * @template T - A type parameter extending `PostboyGenericMessage` that defines the message structure.\n * @param {MessageType<T>} type - The constructor function of the message type to be recorded.\n * @param {T} initial - The initial value of the message that will be set in the `BehaviorSubject`.\n * @returns {void} - This function does not return a value; instead, it modifies the internal state.\n */\n public recordBehavior<T extends PostboyGenericMessage>(type: MessageType<T>, initial: T): PostboyAbstractRegistrator {\n this.record(type, new BehaviorSubject<T>(initial));\n return this;\n }\n\n /**\n * A function that creates and returns a new generic message recorder for a specific message type.\n *\n * @template T - A type parameter extending from `PostboyGenericMessage`.\n * @param {MessageType<T>} type - The constructor for the message type being recorded.\n * @returns {Subject<T>} A new instance of `Subject<T>` bound to the specified message type.\n */\n public recordSubject<T extends PostboyGenericMessage>(type: MessageType<T>) {\n this.record(type, new Subject<T>());\n return this;\n }\n}\n","import { PostboyAbstractRegistrator } from '../postboy-abstract.registrator';\nimport { PostboyService } from '../postboy.service';\n\n/**\n * NamespaceRegistrator is a specialized class that extends PostboyAbstractRegistrator.\n *\n * @class NamespaceRegistrator\n * @extends PostboyAbstractRegistrator\n * @param {PostboyService} postboy - An instance of the PostboyService, used for managing registrations.\n */\nexport class NamespaceRegistrator extends PostboyAbstractRegistrator {\n constructor(postboy: PostboyService) {\n super(postboy);\n }\n\n protected _up(): void {\n // ignore\n }\n}\n","import { PostboyAbstractRegistrator } from '../postboy-abstract.registrator';\nimport { NamespaceRegistrator } from './namespace-registrator';\nimport { PostboyService } from '../postboy.service';\n\n/**\n * Represents a store for managing namespaces in the Postboy system.\n * Provides functionality to add, eliminate, and dispose namespaces.\n */\nexport class PostboyNamespaceStore {\n private spaces: Map<string, PostboyAbstractRegistrator> = new Map();\n\n /**\n * Adds a new space or retrieves an existing one if it already exists.\n *\n * @param {string} space - The name of the space to add or retrieve.\n * @param {PostboyService} postboy - The PostboyService instance used to create a namespace registrator.\n * @return {PostboyAbstractRegistrator} The registrator associated with the specified space.\n */\n public addSpace(space: string, postboy: PostboyService): PostboyAbstractRegistrator {\n if (this.spaces.has(space)) return this.spaces.get(space)!;\n const registrator = new NamespaceRegistrator(postboy);\n this.spaces.set(space, registrator);\n return registrator;\n }\n\n /**\n * Removes a specified space from the spaces collection if it exists.\n * If the space exists, it will be deleted after invoking its down method.\n *\n * @param {string} space - The name of the space to be removed.\n * @return {void} This method does not return a value.\n */\n public eliminateSpace(space: string): void {\n if (!this.spaces.has(space)) return;\n this.spaces.get(space)?.down();\n this.spaces.delete(space);\n }\n\n /**\n * Disposes of the current instance by performing cleanup operations.\n * Iterates through all spaces, performs a \"down\" operation on each,\n * and then clears the collection of spaces.\n *\n * @return {void} No return value.\n */\n public dispose(): void {\n this.spaces.forEach((space) => space.down());\n this.spaces.clear();\n }\n}\n","import { PostboyMiddlewareService } from './postboy-middleware.service';\nimport { PostboyMessageStore } from './postboy-message.store';\nimport { PostboyNamespaceStore } from './postboy-namespace.store';\n\nexport class PostboyDependencyResolver {\n /**\n * Retrieves an instance of the PostboyMiddlewareService.\n *\n * This function initializes and returns a new instance of the\n * PostboyMiddlewareService, which can be used to configure and manage\n * middleware for a specific module or application.\n *\n * @returns {PostboyMiddlewareService} A new instance of PostboyMiddlewareService.\n */\n getMiddlewareService = () => new PostboyMiddlewareService();\n /**\n * A function that instantiates and returns a new instance of PostboyMessageStore.\n *\n * This function serves as a factory method for creating instances\n * of the PostboyMessageStore class.\n *\n * @returns {PostboyMessageStore} A new instance of the PostboyMessageStore class.\n */\n getMessageStore = () => new PostboyMessageStore();\n /**\n * Creates and initializes a new instance of PostboyNamespaceStore using the provided PostboyService instance.\n *\n * @function getNamespaceStore\n * @returns {PostboyNamespaceStore} A new instance of PostboyNamespaceStore associated with the given PostboyService.\n */\n getNamespaceStore = () => new PostboyNamespaceStore();\n}\n","import { PostboyAbstractRegistrator } from '../postboy-abstract.registrator';\nimport { PostboyExecutor } from '../models/postboy-executor';\nimport { PostboyExecutionHandler } from '../models/postboy-execution.handler';\nimport { PostboyNamespaceStore } from '../services/postboy-namespace.store';\nimport { PostboyService } from '../postboy.service';\n\n/**\n * AddNamespace is a class that extends the PostboyExecutor with a specific implementation\n * for adding namespaces to a PostboyService instance.\n *\n * This class is identified uniquely by its static ID property for tracking and referencing purposes.\n */\nexport class AddNamespace extends PostboyExecutor<PostboyAbstractRegistrator> {\n static readonly ID = '6d1a6f7d-6b6e-4c4d-8af8-9cc9a32e850c';\n\n /**\n * Creates an instance of the class with the specified space identifier.\n *\n * @param {string} space - The identifier for the space.\n */\n constructor(public space: string) {\n super();\n }\n}\n","import { PostboyExecutor } from '../models/postboy-executor';\n\n/**\n * Represents an executor that eliminates a specific namespace.\n * This class extends the PostboyExecutor with a void return type.\n */\nexport class EliminateNamespace extends PostboyExecutor<void> {\n static readonly ID = '03bb03bb-53e0-4b74-9aad-64d5c54a8972';\n\n /**\n * Creates an instance of the class with the specified space value.\n *\n * @param {string} space - The string value representing the space configuration.\n */\n constructor(public space: string) {\n super();\n }\n}\n","import { PostboyMiddleware } from '../models/postboy-middleware';\nimport { PostboyExecutor } from '../models/postboy-executor';\n\n/**\n * Represents a {@link PostboyMiddleware} addition operation for Postboy.\n * This class extends the functionality of the PostboyExecutor to add middleware to the processing chain.\n *\n * The middleware to be added is provided during instantiation.\n */\nexport class AddMiddleware extends PostboyExecutor<void> {\n static readonly ID = '0a8cfe0a-6193-4082-8440-d0793367b21d';\n\n /**\n * Initializes a new instance of the class with the specified middleware.\n *\n * @param {PostboyMiddleware} middleware - The {@link PostboyMiddleware} to be used for processing.\n */\n constructor(public middleware: PostboyMiddleware) {\n super();\n }\n}\n","import { PostboyMiddleware } from '../models/postboy-middleware';\nimport { PostboyExecutor } from '../models/postboy-executor';\n\n/**\n * Represents a class responsible for removing {@link PostboyMiddleware} in execution flow.\n * This class extends PostboyExecutor and operates with a void return type.\n */\nexport class RemoveMiddleware extends PostboyExecutor<void> {\n static readonly ID = 'c25c708c-53c9-498d-a28b-936fbaf68b91';\n\n /**\n * Constructs an instance of the class with the specified middleware.\n *\n * @param {PostboyMiddleware} middleware - The {@link PostboyMiddleware} instance to be removed.\n */\n constructor(public middleware: PostboyMiddleware) {\n super();\n }\n}\n","import { PostboyGenericMessage } from '../models/postboy-generic-message';\nimport { MessageType } from '../postboy-abstract.registrator';\nimport { PostboyExecutor } from '../models/postboy-executor';\n\n/**\n * Locks a specific message type to prevent firing of them.\n *\n * This class is used to handle operations associated with locking mechanisms\n * for a specified message type.\n *\n * @template T - A type that extends {@link PostboyGenericMessage}.\n */\nexport class LockMessage<T extends PostboyGenericMessage> extends PostboyExecutor<void> {\n static readonly ID = '477df3e2-1f99-4476-9a3b-afd1fa426436';\n\n /**\n * Constructs an instance of the class with the specified message type.\n *\n * @param {MessageType<T>} type - The type of the message to be used for the instance.\n */\n constructor(public type: MessageType<T>) {\n super();\n }\n}\n","import { PostboyGenericMessage } from '../models/postboy-generic-message';\nimport { PostboyExecutor } from '../models/postboy-executor';\nimport { MessageType } from '../postboy-abstract.registrator';\n\n/**\n * A specialized executor that handles the unlocking process for messages of a specified type.\n * Unlocks a previously locked message, making it available for processing again.\n *\n * @template T - The type parameter extending {@link PostboyGenericMessage}, representing the message type handled by the executor.\n * @extends {PostboyExecutor<void>}\n */\nexport class UnlockMessage<T extends PostboyGenericMessage> extends PostboyExecutor<void> {\n static readonly ID = 'd71d25e3-90ac-4009-b972-9e6c6b05611e';\n\n /**\n * Creates an instance of the class with the specified message type.\n *\n * @param {MessageType<T>} type - The message type for this instance.\n */\n constructor(public type: MessageType<T>) {\n super();\n }\n}\n","import { first, Observable, Subject, tap } from 'rxjs';\nimport { checkId, PostboyGenericMessage } from './models/postboy-generic-message';\nimport { PostboySubscription } from './models/postboy-subscription';\nimport { PostboyExecutor } from './models/postboy-executor';\nimport { PostboyCallbackMessage } from './models/postboy-callback.message';\nimport { MessageType, PostboyAbstractRegistrator } from './postboy-abstract.registrator';\nimport { PostboyExecutionHandler } from './models/postboy-execution.handler';\nimport { PostboyMiddleware } from './models/postboy-middleware';\nimport { PostboyDependencyResolver } from './services/postboy-dependency.resolver';\nimport { PostboyMiddlewareService } from './services/postboy-middleware.service';\nimport { PostboyMessageStore } from './services/postboy-message.store';\nimport { PostboyNamespaceStore } from './services/postboy-namespace.store';\nimport { AddNamespace } from './messages/add-namespace.executor';\nimport { EliminateNamespace } from './messages/eliminate-namespace.executor';\nimport { AddMiddleware } from './messages/add-middleware.executor';\nimport { RemoveMiddleware } from './messages/remove-middleware.executor';\nimport { LockMessage } from './messages/lock-message.executor';\nimport { UnlockMessage } from './messages/unlock-message.executor';\nimport { DisconnectMessage } from './messages/disconnect-message.executor';\nimport { ConnectMessage } from './messages/connect-message.executor';\nimport { ConnectExecutor } from './messages/connect-executor.executor';\nimport { ConnectHandler } from './messages/connect-handler.executor';\n\nexport class PostboyService {\n protected locked = new Set<string>();\n private middleware: PostboyMiddlewareService;\n private store: PostboyMessageStore;\n private namespaceStore: PostboyNamespaceStore;\n private dependencyResolver: PostboyDependencyResolver;\n\n constructor(resolver?: PostboyDependencyResolver) {\n this.dependencyResolver = resolver || new PostboyDependencyResolver();\n this.middleware = this.dependencyResolver.getMiddlewareService();\n this.store = this.dependencyResolver.getMessageStore();\n this.namespaceStore = this.dependencyResolver.getNamespaceStore();\n this.registerInfrastructureMessages();\n }\n\n private registerInfrastructureMessages() {\n this.store.registerExecutor(DisconnectMessage.ID, (e) => this.store.unregister((e as DisconnectMessage).messageId));\n this.store.registerExecutor(UnlockMessage.ID, (e) => this.locked.delete(checkId((e as UnlockMessage<any>).type)));\n this.store.registerExecutor(LockMessage.ID, (e) => this.locked.add(checkId((e as LockMessage<any>).type)));\n this.store.registerExecutor(AddMiddleware.ID, (e) =>\n this.middleware.addMiddleware((e as AddMiddleware).middleware),\n );\n this.store.registerExecutor(RemoveMiddleware.ID, (e) =>\n this.middleware.removeMiddleware((e as RemoveMiddleware).middleware),\n );\n this.store.registerExecutor(AddNamespace.ID, (e) => this.namespaceStore.addSpace((e as AddNamespace).space, this));\n this.store.registerExecutor(EliminateNamespace.ID, (e) =>\n this.namespaceStore.eliminateSpace((e as EliminateNamespace).space),\n );\n this.store.registerExecutor(ConnectMessage.ID, (e) => {\n const { type, sub, pipe } = e as ConnectMessage<any>;\n this.store.registerMessage(checkId(type), new PostboySubscription<any>(sub, pipe));\n });\n this.store.registerExecutor(ConnectExecutor.ID, (e) => {\n const { type, exec } = e as ConnectExecutor<any, any>;\n this.store.registerExecutor(checkId(type), exec);\n });\n this.store.registerExecutor(ConnectHandler.ID, (e) => {\n const { executor, handler } = e as ConnectHandler<any, any>;\n this.store.registerExecutor(checkId(executor), (e) => handler.handle(e));\n });\n }\n\n /**\n * Locks a specific message type to prevent further modifications or actions.\n *\n * @deprecated The method should be replaced with firing {@link LockMessage} message.\n * @param {MessageType<T>} type - The message type to be locked. It must extend from the `PostboyGenericMessage`.\n * @return {void} This method does not return a value.\n */\n public lock<T extends PostboyGenericMessage>(type: MessageType<T>): void {\n this.locked.add(checkId(type));\n }\n\n /**\n * Unlocks a previously locked message type by removing its ID from the locked set.\n *\n * @deprecated The method should be replaced with firing {@link UnlockMessage} message.\n * @param {MessageType<T>} type - The message type to unlock, which is a generic type extending PostboyGenericMessage.\n * @return {void} This method does not return any value.\n */\n public unlock<T extends PostboyGenericMessage>(type: MessageType<T>): void {\n this.locked.delete(checkId(type));\n }\n\n /**\n * Adds a middleware to the middleware stack.\n *\n * @deprecated The method should be replaced with firing {@link AddMiddleware} message.\n * @param {PostboyMiddleware} middleware - The middleware instance to be added.\n * @return {void}\n */\n public addMiddleware(middleware: PostboyMiddleware): void {\n return this.middleware.addMiddleware(middleware);\n }\n\n /**\n * Removes a middleware from the current middleware stack.\n *\n * @deprecated The method should be replaced with firing {@link RemoveMiddleware} message.\n * @param {PostboyMiddleware} middleware - The middleware instance to be removed.\n * @return {void} No return value.\n */\n public removeMiddleware(middleware: PostboyMiddleware): void {\n return this.middleware.removeMiddleware(middleware);\n }\n\n /**\n * Unregisters a message identified by the given ID from the store.\n *\n * @deprecated The method should be replaced with firing {@link DisconnectMessage} message.\n * @param {string} id - The unique identifier of the item to unregister.\n * @return {void} No value is returned.\n */\n public unregister(id: string): void {\n return this.store.unregister(id);\n }\n\n /**\n * Fires a registered event and passes the message to its subscribers.\n *\n * @param {PostboyGenericMessage} message - The message object containing the event data.\n * @return {void} This method does not return a value.\n * @throws {Error} Throws an error if no registered event is found for the provided message ID.\n */\n public fire(message: PostboyGenericMessage): void {\n this.middleware.manage(message);\n if (!this.locked.has(message.id)) this.store.getMessage(message.id, message.constructor.name).fire(message);\n }\n\n /**\n * Triggers a callback function associated with a given message.\n *\n * @param {PostboyCallbackMessage<T>} message - The message object used to trigger the callback.\n * It contains details about the event and result subscription.\n * @param {(e: T) => void} [action] - Optional callback function to execute when the result of the message is emitted.\n * @return {void} This method does not return any value.\n */\n public fireCallback<T>(message: PostboyCallbackMessage<T>, action?: (e: T) => void): Observable<T> {\n this.middleware.manage(message);\n this.store.callbackFired(message);\n const result$ = action ? message.result.pipe(tap(action)) : message.result;\n const observable = new Observable<T>((subscriber) => {\n const subscription = result$.subscribe(subscriber);\n\n if (!this.locked.has(message.id)) {\n this.store.getMessage(message.id, message.constructor.name).fire(message);\n }\n\n return () => subscription.unsubscribe();\n });\n if (!!action) observable.subscribe();\n return observable;\n }\n\n /**\n * Executes the provided executor function and returns its result.\n *\n * @param {PostboyExecutor<T>} executor The executor to be executed, which includes its identifier and logic.\n * @return {T} The resulting output from the executed executor function.\n * @throws {Error} If the specified executor is not registered.\n */\n public exec<T>(executor: PostboyExecutor<T>): T {\n this.middleware.manage(executor);\n return this.store.getExecutor<T>(executor.id)(executor);\n }\n\n /**\n * Subscribes to a specific message type and returns an observable of that type.\n *\n * @param type The constructor function of the type that extends PostboyGenericMessage.\n * @return An Observable of the specified generic message type.\n */\n public sub<T extends PostboyGenericMessage>(type: MessageType<T>): Observable<T> {\n return this.store.getMessage(checkId(type), type.name).sub();\n }\n\n /**\n * Subscribes to a specific message type and automatically unsubscribes after receiving the first message.\n *\n * @param type The type of message to subscribe to.\n * @return An observable that emits the first message of the specified type and then completes.\n */\n public once<T extends PostboyGenericMessage>(type: MessageType<T>): Observable<T> {\n return this.sub(type).pipe(first());\n }\n\n /**\n * Registers a given message type and its associated subject subscription with the system.\n *\n * @deprecated The method should be replaced with firing {@link ConnectMessage} message.\n * @param type The constructor function of the message type that extends the PostboyGenericMessage.\n * @param sub The Subject instance for the provided message type, used for managing subscriptions.\n * @return {void} No return value.\n */\n public record<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>): void {\n this.store.registerMessage(checkId(type), new PostboySubscription<T>(sub, (s) => s.asObservable()));\n }\n\n /**\n * Registers a generic message type with a Subject and a transformation pipe.\n *\n * @deprecated The method should be replaced with firing {@link ConnectMessage} message.\n * @param {MessageType<T>} type - The constructor of the message type being registered.\n * @param {Subject<T>} sub - The Subject instance used to handle incoming messages of the specified type.\n * @param {(s: Subject<T>) => Observable<T>} pipe - A function that applies a transformation or processing logic to the Subject and returns an Observable.\n * @return {void} No return value.\n */\n public recordWithPipe<T extends PostboyGenericMessage>(\n type: MessageType<T>,\n sub: Subject<T>,\n pipe: (s: Subject<T>) => Observable<T>,\n ): void {\n this.store.registerMessage(checkId(type), new PostboySubscription<T>(sub, pipe));\n }\n\n /**\n * Registers an executor for a specified message type.\n *\n * @deprecated The method should be replaced with firing {@link ConnectExecutor} message.\n * @param {MessageType<E>} type - The message type for which the executor is being registered.\n * @param {(e: E) => T} exec - The executor function that will handle messages of the specified type.\n * @return {void} This method does not return any value.\n */\n public recordExecutor<E extends PostboyExecutor<T>, T>(type: MessageType<E>, exec: (e: E) => T): void {\n this.store.registerExecutor(checkId(type), exec as (e: PostboyExecutor<T>) => T);\n }\n\n /**\n * Registers a handler for a specific executor type.\n *\n * @deprecated The method should be replaced with firing {@link ConnectHandler} message.\n * @param executor The constructor of the executor class that extends `PostboyExecutor<R>`.\n * @param handler An instance of `PostboyExecutionHandler<R, E>` that defines the logic for handling the executor.\n * @return void\n */\n public recordHandler<E extends PostboyExecutor<R>, R>(\n executor: new (...args: any[]) => E,\n handler: PostboyExecutionHandler<R, E>,\n ): void {\n this.store.registerExecutor(checkId(executor), (e) => handler.handle(e as E));\n }\n\n /**\n * Adds a namespace to the namespace store.\n *\n * @deprecated The method should be replaced with firing {@link AddNamespace} message.\n * @param {string} space - The name of the namespace to be added.\n * @return {PostboyAbstractRegistrator} The instance of the namespace after adding the specified namespace.\n */\n public addNamespace(space: string): PostboyAbstractRegistrator {\n return this.namespaceStore.addSpace(space, this);\n }\n\n /**\n * Removes the specified namespace from the namespace store.\n *\n * @deprecated The method should be replaced with firing {@link EliminateNamespace} message.\n * @param {string} space - The name of the namespace to be removed.\n * @return {void} This method does not return a value.\n */\n public eliminateNamespace(space: string): void {\n return this.namespaceStore?.eliminateSpace(space);\n }\n\n /**\n * Disposes of resources and cleans up any internal components or stores associated with the instance.\n * This method ensures that all resources are properly released to avoid memory leaks.\n *\n * @return {void} This method does not return a value.\n */\n public dispose(): void {\n this.namespaceStore?.dispose();\n this.store.dispose();\n this.middleware.dispose();\n }\n}\n","import { Observable, Subject } from 'rxjs';\nimport { PostboyGenericMessage } from './postboy-generic-message';\n\n/**\n * An abstract class extending PostboyGenericMessage that provides mechanisms for managing\n * asynchronous data communication using RxJS observables. It is designed to work with\n * callback-based operations that emit a result of type T.\n *\n * @template T - The type of the data emitted by the observables in this class.\n *\n * @extends PostboyGenericMessage\n *\n * @property {Observable<T>} result - An observable that emits the result of the operation\n * and completes once the operation is finished.\n *\n * @method next - Emits the next value for the result observable.\n * @param {T} value - The value to be emitted by the result observable.\n *\n * @method finish - Emits the final value for the result observable and completes it.\n * @param {T} value - The final value for the observable emission.\n */\nexport abstract class PostboyCallbackMessage<T> extends PostboyGenericMessage {\n protected result$ = new Subject<T>();\n public result: Observable<T> = this.result$.asObservable();\n\n /**\n * Emits the provided value.\n *\n * @template T - The type of the value to emit.\n * @param {T} value - The value to emit through the `result$` observable.\n * @returns {void}\n */\n public next = (value: T): void => this.result$.next(value);\n\n /**\n * Marks the operation as complete by emitting the provided value and then completing the result stream.\n *\n * @param {T} value - The value to emit prior to completing the result stream.\n * @return {void} This method does not return a value.\n */\n public finish(value: T): void {\n this.result$.next(value);\n this.result$.complete();\n }\n\n /**\n * Completes the current observable result stream.\n * This method marks the result observable as complete, ensuring no further values\n * or events will be emitted from it.\n *\n * @return {void} No value is returned from this method.\n */\n public complete(): void {\n this.result$.complete();\n }\n}\n","import { PostboyExecutor } from './postboy-executor';\n\n/**\n * Abstract class representing a handler for executing a Postboy task.\n *\n * This class is intended to manage the execution flow of a PostboyExecutor instance.\n * Subclasses must implement the `handle` method, which executes a given PostboyExecutor\n * and returns a result of type R.\n *\n * @template R The type of the result returned by the `handle` method.\n * @template E The type of the executor extending the PostboyExecutor.\n */\nexport abstract class PostboyExecutionHandler<R, E extends PostboyExecutor<R>> {\n /**\n * Abstract method to handle the specified executor and return a result.\n *\n * @param {E} executor - The executor that will be processed by the method.\n * @return {R} The result obtained after handling the executor.\n */\n abstract handle(executor: E): R;\n}\n"]}