@wirestate/react 0.6.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.
- package/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +319 -0
- package/cjs/development/index.js +395 -0
- package/cjs/development/index.js.map +1 -0
- package/cjs/development/lib.js +64 -0
- package/cjs/development/lib.js.map +1 -0
- package/cjs/development/test-utils.js +1075 -0
- package/cjs/development/test-utils.js.map +1 -0
- package/cjs/production/index.js +1 -0
- package/cjs/production/index.js.map +1 -0
- package/cjs/production/lib.js +1 -0
- package/cjs/production/lib.js.map +1 -0
- package/cjs/production/test-utils.js +1 -0
- package/cjs/production/test-utils.js.map +1 -0
- package/esm/development/wirestate-core/bind/bind-constant.js +19 -0
- package/esm/development/wirestate-core/bind/bind-constant.js.map +1 -0
- package/esm/development/wirestate-core/bind/bind-dynamic-value.js +28 -0
- package/esm/development/wirestate-core/bind/bind-dynamic-value.js.map +1 -0
- package/esm/development/wirestate-core/bind/bind-entry.js +39 -0
- package/esm/development/wirestate-core/bind/bind-entry.js.map +1 -0
- package/esm/development/wirestate-core/bind/bind-service.js +253 -0
- package/esm/development/wirestate-core/bind/bind-service.js.map +1 -0
- package/esm/development/wirestate-core/bind/get-entry-token.js +14 -0
- package/esm/development/wirestate-core/bind/get-entry-token.js.map +1 -0
- package/esm/development/wirestate-core/commands/command-bus.js +112 -0
- package/esm/development/wirestate-core/commands/command-bus.js.map +1 -0
- package/esm/development/wirestate-core/commands/get-command-handler-metadata.js +27 -0
- package/esm/development/wirestate-core/commands/get-command-handler-metadata.js.map +1 -0
- package/esm/development/wirestate-core/container/create-ioc-container.js +35 -0
- package/esm/development/wirestate-core/container/create-ioc-container.js.map +1 -0
- package/esm/development/wirestate-core/container/wire-scope.js +151 -0
- package/esm/development/wirestate-core/container/wire-scope.js.map +1 -0
- package/esm/development/wirestate-core/error/error-code.js +10 -0
- package/esm/development/wirestate-core/error/error-code.js.map +1 -0
- package/esm/development/wirestate-core/error/wirestate-error.js +29 -0
- package/esm/development/wirestate-core/error/wirestate-error.js.map +1 -0
- package/esm/development/wirestate-core/events/build-event-dispatcher.js +39 -0
- package/esm/development/wirestate-core/events/build-event-dispatcher.js.map +1 -0
- package/esm/development/wirestate-core/events/event-bus.js +52 -0
- package/esm/development/wirestate-core/events/event-bus.js.map +1 -0
- package/esm/development/wirestate-core/events/get-event-handler-metadata.js +27 -0
- package/esm/development/wirestate-core/events/get-event-handler-metadata.js.map +1 -0
- package/esm/development/wirestate-core/queries/get-query-handler-metadata.js +27 -0
- package/esm/development/wirestate-core/queries/get-query-handler-metadata.js.map +1 -0
- package/esm/development/wirestate-core/queries/query-bus.js +99 -0
- package/esm/development/wirestate-core/queries/query-bus.js.map +1 -0
- package/esm/development/wirestate-core/registry.js +56 -0
- package/esm/development/wirestate-core/registry.js.map +1 -0
- package/esm/development/wirestate-core/service/get-activated-handler-metadata.js +27 -0
- package/esm/development/wirestate-core/service/get-activated-handler-metadata.js.map +1 -0
- package/esm/development/wirestate-core/service/get-deactivation-handler-metadata.js +27 -0
- package/esm/development/wirestate-core/service/get-deactivation-handler-metadata.js.map +1 -0
- package/esm/development/wirestate-core/test-utils/mock-bind-entry.js +24 -0
- package/esm/development/wirestate-core/test-utils/mock-bind-entry.js.map +1 -0
- package/esm/development/wirestate-core/test-utils/mock-container.js +52 -0
- package/esm/development/wirestate-core/test-utils/mock-container.js.map +1 -0
- package/esm/development/wirestate-core/types/commands.js +12 -0
- package/esm/development/wirestate-core/types/commands.js.map +1 -0
- package/esm/development/wirestate-react/commands/use-command-caller.js +18 -0
- package/esm/development/wirestate-react/commands/use-command-caller.js.map +1 -0
- package/esm/development/wirestate-react/commands/use-command-handler.js +28 -0
- package/esm/development/wirestate-react/commands/use-command-handler.js.map +1 -0
- package/esm/development/wirestate-react/commands/use-optional-command-caller.js +19 -0
- package/esm/development/wirestate-react/commands/use-optional-command-caller.js.map +1 -0
- package/esm/development/wirestate-react/error/error-code.js +6 -0
- package/esm/development/wirestate-react/error/error-code.js.map +1 -0
- package/esm/development/wirestate-react/events/use-event-emitter.js +22 -0
- package/esm/development/wirestate-react/events/use-event-emitter.js.map +1 -0
- package/esm/development/wirestate-react/events/use-event.js +30 -0
- package/esm/development/wirestate-react/events/use-event.js.map +1 -0
- package/esm/development/wirestate-react/events/use-events-handler.js +25 -0
- package/esm/development/wirestate-react/events/use-events-handler.js.map +1 -0
- package/esm/development/wirestate-react/events/use-events.js +31 -0
- package/esm/development/wirestate-react/events/use-events.js.map +1 -0
- package/esm/development/wirestate-react/index.js +19 -0
- package/esm/development/wirestate-react/index.js.map +1 -0
- package/esm/development/wirestate-react/provision/create-injectables-provider.js +101 -0
- package/esm/development/wirestate-react/provision/create-injectables-provider.js.map +1 -0
- package/esm/development/wirestate-react/provision/ioc-context.js +11 -0
- package/esm/development/wirestate-react/provision/ioc-context.js.map +1 -0
- package/esm/development/wirestate-react/provision/ioc-provider.js +50 -0
- package/esm/development/wirestate-react/provision/ioc-provider.js.map +1 -0
- package/esm/development/wirestate-react/provision/use-container-revision.js +13 -0
- package/esm/development/wirestate-react/provision/use-container-revision.js.map +1 -0
- package/esm/development/wirestate-react/provision/use-container.js +13 -0
- package/esm/development/wirestate-react/provision/use-container.js.map +1 -0
- package/esm/development/wirestate-react/provision/use-injection.js +22 -0
- package/esm/development/wirestate-react/provision/use-injection.js.map +1 -0
- package/esm/development/wirestate-react/provision/use-ioc-context.js +21 -0
- package/esm/development/wirestate-react/provision/use-ioc-context.js.map +1 -0
- package/esm/development/wirestate-react/provision/use-optional-injection.js +29 -0
- package/esm/development/wirestate-react/provision/use-optional-injection.js.map +1 -0
- package/esm/development/wirestate-react/queries/use-optional-query-caller.js +19 -0
- package/esm/development/wirestate-react/queries/use-optional-query-caller.js.map +1 -0
- package/esm/development/wirestate-react/queries/use-optional-sync-query-caller.js +19 -0
- package/esm/development/wirestate-react/queries/use-optional-sync-query-caller.js.map +1 -0
- package/esm/development/wirestate-react/queries/use-query-caller.js +18 -0
- package/esm/development/wirestate-react/queries/use-query-caller.js.map +1 -0
- package/esm/development/wirestate-react/queries/use-query-handler.js +27 -0
- package/esm/development/wirestate-react/queries/use-query-handler.js.map +1 -0
- package/esm/development/wirestate-react/queries/use-sync-query-caller.js +20 -0
- package/esm/development/wirestate-react/queries/use-sync-query-caller.js.map +1 -0
- package/esm/development/wirestate-react/test-utils/with-ioc-provider.js +30 -0
- package/esm/development/wirestate-react/test-utils/with-ioc-provider.js.map +1 -0
- package/esm/development/wirestate-react/test-utils.js +2 -0
- package/esm/development/wirestate-react/test-utils.js.map +1 -0
- package/esm/production/wirestate-core/bind/bind-constant.js +1 -0
- package/esm/production/wirestate-core/bind/bind-constant.js.map +1 -0
- package/esm/production/wirestate-core/bind/bind-dynamic-value.js +1 -0
- package/esm/production/wirestate-core/bind/bind-dynamic-value.js.map +1 -0
- package/esm/production/wirestate-core/bind/bind-entry.js +1 -0
- package/esm/production/wirestate-core/bind/bind-entry.js.map +1 -0
- package/esm/production/wirestate-core/bind/bind-service.js +1 -0
- package/esm/production/wirestate-core/bind/bind-service.js.map +1 -0
- package/esm/production/wirestate-core/bind/get-entry-token.js +1 -0
- package/esm/production/wirestate-core/bind/get-entry-token.js.map +1 -0
- package/esm/production/wirestate-core/commands/command-bus.js +1 -0
- package/esm/production/wirestate-core/commands/command-bus.js.map +1 -0
- package/esm/production/wirestate-core/commands/get-command-handler-metadata.js +1 -0
- package/esm/production/wirestate-core/commands/get-command-handler-metadata.js.map +1 -0
- package/esm/production/wirestate-core/container/create-ioc-container.js +1 -0
- package/esm/production/wirestate-core/container/create-ioc-container.js.map +1 -0
- package/esm/production/wirestate-core/container/wire-scope.js +1 -0
- package/esm/production/wirestate-core/container/wire-scope.js.map +1 -0
- package/esm/production/wirestate-core/error/error-code.js +1 -0
- package/esm/production/wirestate-core/error/error-code.js.map +1 -0
- package/esm/production/wirestate-core/error/wirestate-error.js +1 -0
- package/esm/production/wirestate-core/error/wirestate-error.js.map +1 -0
- package/esm/production/wirestate-core/events/build-event-dispatcher.js +1 -0
- package/esm/production/wirestate-core/events/build-event-dispatcher.js.map +1 -0
- package/esm/production/wirestate-core/events/event-bus.js +1 -0
- package/esm/production/wirestate-core/events/event-bus.js.map +1 -0
- package/esm/production/wirestate-core/events/get-event-handler-metadata.js +1 -0
- package/esm/production/wirestate-core/events/get-event-handler-metadata.js.map +1 -0
- package/esm/production/wirestate-core/queries/get-query-handler-metadata.js +1 -0
- package/esm/production/wirestate-core/queries/get-query-handler-metadata.js.map +1 -0
- package/esm/production/wirestate-core/queries/query-bus.js +1 -0
- package/esm/production/wirestate-core/queries/query-bus.js.map +1 -0
- package/esm/production/wirestate-core/registry.js +1 -0
- package/esm/production/wirestate-core/registry.js.map +1 -0
- package/esm/production/wirestate-core/service/get-activated-handler-metadata.js +1 -0
- package/esm/production/wirestate-core/service/get-activated-handler-metadata.js.map +1 -0
- package/esm/production/wirestate-core/service/get-deactivation-handler-metadata.js +1 -0
- package/esm/production/wirestate-core/service/get-deactivation-handler-metadata.js.map +1 -0
- package/esm/production/wirestate-core/test-utils/mock-bind-entry.js +1 -0
- package/esm/production/wirestate-core/test-utils/mock-bind-entry.js.map +1 -0
- package/esm/production/wirestate-core/test-utils/mock-container.js +1 -0
- package/esm/production/wirestate-core/test-utils/mock-container.js.map +1 -0
- package/esm/production/wirestate-core/types/commands.js +1 -0
- package/esm/production/wirestate-core/types/commands.js.map +1 -0
- package/esm/production/wirestate-react/commands/use-command-caller.js +1 -0
- package/esm/production/wirestate-react/commands/use-command-caller.js.map +1 -0
- package/esm/production/wirestate-react/commands/use-command-handler.js +1 -0
- package/esm/production/wirestate-react/commands/use-command-handler.js.map +1 -0
- package/esm/production/wirestate-react/commands/use-optional-command-caller.js +1 -0
- package/esm/production/wirestate-react/commands/use-optional-command-caller.js.map +1 -0
- package/esm/production/wirestate-react/error/error-code.js +1 -0
- package/esm/production/wirestate-react/error/error-code.js.map +1 -0
- package/esm/production/wirestate-react/events/use-event-emitter.js +1 -0
- package/esm/production/wirestate-react/events/use-event-emitter.js.map +1 -0
- package/esm/production/wirestate-react/events/use-event.js +1 -0
- package/esm/production/wirestate-react/events/use-event.js.map +1 -0
- package/esm/production/wirestate-react/events/use-events-handler.js +1 -0
- package/esm/production/wirestate-react/events/use-events-handler.js.map +1 -0
- package/esm/production/wirestate-react/events/use-events.js +1 -0
- package/esm/production/wirestate-react/events/use-events.js.map +1 -0
- package/esm/production/wirestate-react/index.js +1 -0
- package/esm/production/wirestate-react/index.js.map +1 -0
- package/esm/production/wirestate-react/provision/create-injectables-provider.js +1 -0
- package/esm/production/wirestate-react/provision/create-injectables-provider.js.map +1 -0
- package/esm/production/wirestate-react/provision/ioc-context.js +1 -0
- package/esm/production/wirestate-react/provision/ioc-context.js.map +1 -0
- package/esm/production/wirestate-react/provision/ioc-provider.js +1 -0
- package/esm/production/wirestate-react/provision/ioc-provider.js.map +1 -0
- package/esm/production/wirestate-react/provision/use-container-revision.js +1 -0
- package/esm/production/wirestate-react/provision/use-container-revision.js.map +1 -0
- package/esm/production/wirestate-react/provision/use-container.js +1 -0
- package/esm/production/wirestate-react/provision/use-container.js.map +1 -0
- package/esm/production/wirestate-react/provision/use-injection.js +1 -0
- package/esm/production/wirestate-react/provision/use-injection.js.map +1 -0
- package/esm/production/wirestate-react/provision/use-ioc-context.js +1 -0
- package/esm/production/wirestate-react/provision/use-ioc-context.js.map +1 -0
- package/esm/production/wirestate-react/provision/use-optional-injection.js +1 -0
- package/esm/production/wirestate-react/provision/use-optional-injection.js.map +1 -0
- package/esm/production/wirestate-react/queries/use-optional-query-caller.js +1 -0
- package/esm/production/wirestate-react/queries/use-optional-query-caller.js.map +1 -0
- package/esm/production/wirestate-react/queries/use-optional-sync-query-caller.js +1 -0
- package/esm/production/wirestate-react/queries/use-optional-sync-query-caller.js.map +1 -0
- package/esm/production/wirestate-react/queries/use-query-caller.js +1 -0
- package/esm/production/wirestate-react/queries/use-query-caller.js.map +1 -0
- package/esm/production/wirestate-react/queries/use-query-handler.js +1 -0
- package/esm/production/wirestate-react/queries/use-query-handler.js.map +1 -0
- package/esm/production/wirestate-react/queries/use-sync-query-caller.js +1 -0
- package/esm/production/wirestate-react/queries/use-sync-query-caller.js.map +1 -0
- package/esm/production/wirestate-react/test-utils/with-ioc-provider.js +1 -0
- package/esm/production/wirestate-react/test-utils/with-ioc-provider.js.map +1 -0
- package/esm/production/wirestate-react/test-utils.js +1 -0
- package/esm/production/wirestate-react/test-utils.js.map +1 -0
- package/index.d.ts +218 -0
- package/package.json +62 -0
- package/test-utils.d.ts +18 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-event-dispatcher.js","sources":["../../../../../../../../../src/wirestate-core/events/build-event-dispatcher.ts"],"sourcesContent":[null],"names":["getEventHandlerMetadata","buildEventDispatcher","instance","entries","_i","_a","length","meta","method","methodName","push","types","handler","bind","event","entries_1","entry","includes","type"],"mappings":"kCAOAA,MAAA,kCAOM,SAAUC,EAAuCC,GAMrD,IAHA,IAAMC,EAAsC,GAGzBC,EAAA,EAAAC,EAAAL,EAAwBE,GAAxBE,EAAAC,EAAAC,OAAAF,IAAmC,CAAjD,IAAMG,EAAIF,EAAAD,GACPI,EAAUN,EAAyDK,EAAKE,YAExD,mBAAXD,GACTL,EAAQO,KAAK,CACXC,MAAOJ,EAAKI,MACZC,QAAUJ,EAAyBK,KAAKX,IAG9C,CAEA,OAAIC,EAAQG,OAOH,SAACQ,GAEN,IAAoB,IAAAV,EAAA,EAAAW,EAAAZ,EAAAC,WAAAA,IAAS,CAAxB,IAAMY,EAAKD,EAAAX,IACM,OAAhBY,EAAML,OAAkBK,EAAML,MAAMM,SAASH,EAAMI,QACrDF,EAAMJ,QAAQE,EAElB,CACF,EAQO,IAEX,QAAAb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=function(){function r(){this.handlers=new Set}return r.prototype.emit=function(r){for(var t=0,e=Array.from(this.handlers);t<e.length;t++){var n=e[t];try{n(r)}catch(r){console.error("[wirestate] Event handler threw:",r)}}},r.prototype.subscribe=function(r){var t=this;return this.handlers.add(r),function(){t.handlers.delete(r)}},r.prototype.clear=function(){this.handlers.clear()},r}();export{r as EventBus};//# sourceMappingURL=event-bus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-bus.js","sources":["../../../../../../../../../src/wirestate-core/events/event-bus.ts"],"sourcesContent":[null],"names":["EventBus","this","handlers","Set","prototype","emit","event","_i","snapshot_1","Array","from","handler","error","console","subscribe","_this","add","delete","clear"],"mappings":"AAQA,IAAAA,EAAA,WAAA,SAAAA,IACmBC,KAAAC,SAA+B,IAAIC,GAsDtD,CAAA,OA/CSH,EAAAI,UAAAC,KAAP,SAAyEC,GAIvE,IAFA,IAEsBC,EAAA,EAAAC,EAFiBC,MAAMC,KAAKT,KAAKC,UAEjCK,WAAAA,IAAU,CAA3B,IAAMI,EAAOH,EAAAD,GAChB,IACEI,EAAQL,EACV,CAAE,MAAOM,GAEPC,QAAQD,MAAM,mCAAoCA,EACpD,CACF,CACF,EASOZ,EAAAI,UAAAU,UAAP,SAAiBH,GAAjB,IAAAI,EAAAd,KAQE,OAFAA,KAAKC,SAASc,IAAIL,GAEX,WAMLI,EAAKb,SAASe,OAAON,EACvB,CACF,EAOOX,EAAAI,UAAAc,MAAP,WACEjB,KAAKC,SAASgB,OAChB,EACFlB,CAAA,CAvDA,UAuDCA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EVENT_HANDLER_METADATA as t}from"../registry.js";function r(r){for(var e=r.constructor,o=[];"function"==typeof e&&e!==Object&&e!==Function.prototype;){var n=t.get(e);n&&n.length>0&&o.push(n),e=Object.getPrototypeOf(e)}return o.reverse().flat()}export{r as getEventHandlerMetadata};//# sourceMappingURL=get-event-handler-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-event-handler-metadata.js","sources":["../../../../../../../../../src/wirestate-core/events/get-event-handler-metadata.ts"],"sourcesContent":[null],"names":["EVENT_HANDLER_METADATA","getEventHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","get","length","push","getPrototypeOf","reverse","flat"],"mappings":"iCAOAA,MAAA,iBAQM,SAAUC,EAAwBC,GAQtC,IALA,IAAIC,EAAuBD,EAASC,YAE9BC,EAA6C,GAGrB,mBAAhBD,GAA8BA,IAAgBE,QAAUF,IAAgBG,SAASC,WAAW,CACxG,IAAMC,EAA2CR,EAAuBS,IAAIN,GAExEK,GAAOA,EAAIE,OAAS,GACtBN,EAAMO,KAAKH,GAGbL,EAAcE,OAAOO,eAAeT,EACtC,CASA,OAAOC,EAAMS,UAAUC,MACzB,QAAAb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{QUERY_HANDLER_METADATA as t}from"../registry.js";function r(r){for(var e=r.constructor,o=[];"function"==typeof e&&e!==Object&&e!==Function.prototype;){var n=t.get(e);n&&n.length>0&&o.push(n),e=Object.getPrototypeOf(e)}return o.reverse().flat()}export{r as getQueryHandlerMetadata};//# sourceMappingURL=get-query-handler-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-query-handler-metadata.js","sources":["../../../../../../../../../src/wirestate-core/queries/get-query-handler-metadata.ts"],"sourcesContent":[null],"names":["QUERY_HANDLER_METADATA","getQueryHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","get","length","push","getPrototypeOf","reverse","flat"],"mappings":"iCAOAA,MAAA,iBAQM,SAAUC,EAAwBC,GAQtC,IALA,IAAIC,EAAuBD,EAASC,YAE9BC,EAA6C,GAGrB,mBAAhBD,GAA8BA,IAAgBE,QAAUF,IAAgBG,SAASC,WAAW,CACxG,IAAMC,EAA2CR,EAAuBS,IAAIN,GAExEK,GAAOA,EAAIE,OAAS,GACtBN,EAAMO,KAAKH,GAGbL,EAAcE,OAAOO,eAAeT,EACtC,CASA,OAAOC,EAAMS,UAAUC,MACzB,QAAAb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER as r}from"../error/error-code.js";import{WirestateError as e}from"../error/wirestate-error.js";var t=function(){function t(){this.handlers=new Map}return t.prototype.register=function(r,e){var t=this,n=this.handlers.get(r);return n||(n=[],this.handlers.set(r,n)),n.push(e),function(){var n=t.handlers.get(r);if(n){var o=n.indexOf(e);o>=0&&n.splice(o,1),0===n.length&&t.handlers.delete(r)}}},t.prototype.query=function(t,n){var o=this.handlers.get(t);if(null==o?void 0:o.length)return o[o.length-1](n);throw new e(r,"No query handler registered in container for type: '".concat(String(t),"'."))},t.prototype.queryOptional=function(r,e){var t=this.handlers.get(r);return(null==t?void 0:t.length)?t[t.length-1](e):null},t.prototype.has=function(r){var e=this.handlers.get(r);return Boolean(e&&e.length)},t.prototype.clear=function(){this.handlers.clear()},t}();export{t as QueryBus};//# sourceMappingURL=query-bus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-bus.js","sources":["../../../../../../../../../src/wirestate-core/queries/query-bus.ts"],"sourcesContent":[null],"names":["ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER","WirestateError","QueryBus","this","handlers","Map","prototype","register","type","handler","_this","stack","get","set","push","current","index","indexOf","splice","length","delete","query","data","concat","String","queryOptional","has","Boolean","clear"],"mappings":"qDAQAA,MAAA,kDAAAC,MAAA,8BAGA,IAAAC,EAAA,WAAA,SAAAA,IAKmBC,KAAAC,SAAkD,IAAIC,GAmHzE,CAAA,OAzGSH,EAAAI,UAAAC,SAAP,SAA0CC,EAAkBC,GAA5D,IAAAC,EAAAP,KAOMQ,EAAqCR,KAAKC,SAASQ,IAAIJ,GAS3D,OAPKG,IACHA,EAAQ,GACRR,KAAKC,SAASS,IAAIL,EAAMG,IAG1BA,EAAMG,KAAKL,GAEJ,WAOL,IAAMM,EAAuCL,EAAKN,SAASQ,IAAIJ,GAE/D,GAAKO,EAAL,CAIA,IAAMC,EAAgBD,EAAQE,QAAQR,GAElCO,GAAS,GACXD,EAAQG,OAAOF,EAAO,GAID,IAAnBD,EAAQI,QACVT,EAAKN,SAASgB,OAAOZ,EAVvB,CAYF,CACF,EAWON,EAAAI,UAAAe,MAAP,SAA0Eb,EAASc,GACjF,IAAMX,EAAqCR,KAAKC,SAASQ,IAAIJ,GAG7D,GAAIG,aAAK,EAALA,EAAOQ,OACT,OAAQR,EAAMA,EAAMQ,OAAS,GAA2BG,GAG1D,MAAM,IAAIrB,EACRD,EACA,uDAAAuB,OAAuDC,OAAOhB,GAAK,MAEvE,EASON,EAAAI,UAAAmB,cAAP,SACEjB,EACAc,GAEA,IAAMX,EAAqCR,KAAKC,SAASQ,IAAIJ,GAE7D,OAAIG,aAAK,EAALA,EAAOQ,QACDR,EAAMA,EAAMQ,OAAS,GAA2BG,GAGnD,IACT,EAQOpB,EAAAI,UAAAoB,IAAP,SAAWlB,GACT,IAAMG,EAAqCR,KAAKC,SAASQ,IAAIJ,GAE7D,OAAOmB,QAAQhB,GAASA,EAAMQ,OAChC,EAOOjB,EAAAI,UAAAsB,MAAP,WACEzB,KAAKC,SAASwB,OAChB,EACF1B,CAAA,CAxHA,UAwHCA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Symbol("@wirestate/seeds"),a=Symbol("@wirestate/seed"),w=new WeakMap,p=new WeakMap,k=new WeakMap,n=new WeakMap,M=new WeakMap,W=new WeakMap,s=new WeakMap,t=new WeakMap,r=new WeakMap,o=new WeakMap;export{k as ACTIVATED_HANDLER_METADATA,p as COMMAND_HANDLER_METADATA,o as COMMAND_UNREGISTERS_BY_SERVICE,W as CONTAINER_REFS_BY_SERVICE,n as DEACTIVATION_HANDLER_METADATA,M as EVENT_HANDLER_METADATA,t as EVENT_UNSUBSCRIBERS_BY_SERVICE,w as QUERY_HANDLER_METADATA,r as QUERY_UNREGISTERS_BY_SERVICE,e as SEEDS_TOKEN,a as SEED_TOKEN,s as WIRE_SCOPES_BY_SERVICE};//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sources":["../../../../../../../../src/wirestate-core/registry.ts"],"sourcesContent":[null],"names":["SEEDS_TOKEN","Symbol","SEED_TOKEN","QUERY_HANDLER_METADATA","WeakMap","COMMAND_HANDLER_METADATA","ACTIVATED_HANDLER_METADATA","DEACTIVATION_HANDLER_METADATA","EVENT_HANDLER_METADATA","CONTAINER_REFS_BY_SERVICE","WIRE_SCOPES_BY_SERVICE","EVENT_UNSUBSCRIBERS_BY_SERVICE","QUERY_UNREGISTERS_BY_SERVICE","COMMAND_UNREGISTERS_BY_SERVICE"],"mappings":"IAUaA,EAA6BC,OAAO,oBAKpCC,EAA4BD,OAAO,mBAMnCE,EAAwE,IAAIC,QAM5EC,EAA4E,IAAID,QAMhFE,EAAsE,IAAIF,QAM1EG,EAAyE,IAAIH,QAM7EI,EAAwE,IAAIJ,QAK5EK,EAAwD,IAAIL,QAK5DM,EAA4D,IAAIN,QAKhEO,EAAsE,IAAIP,QAK1EQ,EAAyE,IAAIR,QAK7ES,EAA6E,IAAIT,eAAOE,gCAAAD,8BAAAQ,oCAAAJ,+BAAAF,mCAAAC,4BAAAG,oCAAAR,4BAAAS,kCAAAZ,iBAAAE,gBAAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ACTIVATED_HANDLER_METADATA as t}from"../registry.js";function r(r){for(var e=r.constructor,o=[];"function"==typeof e&&e!==Object&&e!==Function.prototype;){var n=t.get(e);n&&n.length>0&&o.push(n),e=Object.getPrototypeOf(e)}return o.reverse().flat()}export{r as getActivatedHandlerMetadata};//# sourceMappingURL=get-activated-handler-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-activated-handler-metadata.js","sources":["../../../../../../../../../src/wirestate-core/service/get-activated-handler-metadata.ts"],"sourcesContent":[null],"names":["ACTIVATED_HANDLER_METADATA","getActivatedHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","get","length","push","getPrototypeOf","reverse","flat"],"mappings":"qCAMAA,MAAA,iBAQM,SAAUC,EAA4BC,GAQ1C,IALA,IAAIC,EAAuBD,EAASC,YAE9BC,EAAuC,GAGf,mBAAhBD,GAA8BA,IAAgBE,QAAUF,IAAgBG,SAASC,WAAW,CACxG,IAAMC,EAAqCR,EAA2BS,IAAIN,GAEtEK,GAAOA,EAAIE,OAAS,GACtBN,EAAMO,KAAKH,GAGbL,EAAcE,OAAOO,eAAeT,EACtC,CAKA,OAAOC,EAAMS,UAAUC,MACzB,QAAAb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEACTIVATION_HANDLER_METADATA as t}from"../registry.js";function r(r){for(var e=r.constructor,o=[];"function"==typeof e&&e!==Object&&e!==Function.prototype;){var n=t.get(e);n&&n.length>0&&o.push(n),e=Object.getPrototypeOf(e)}return o.reverse().flat()}export{r as getDeactivationHandlerMetadata};//# sourceMappingURL=get-deactivation-handler-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-deactivation-handler-metadata.js","sources":["../../../../../../../../../src/wirestate-core/service/get-deactivation-handler-metadata.ts"],"sourcesContent":[null],"names":["DEACTIVATION_HANDLER_METADATA","getDeactivationHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","get","length","push","getPrototypeOf","reverse","flat"],"mappings":"wCAMAA,MAAA,iBAQM,SAAUC,EAA+BC,GAQ7C,IALA,IAAIC,EAAuBD,EAASC,YAE9BC,EAAuC,GAGf,mBAAhBD,GAA8BA,IAAgBE,QAAUF,IAAgBG,SAASC,WAAW,CACxG,IAAMC,EAAqCR,EAA8BS,IAAIN,GAEzEK,GAAOA,EAAIE,OAAS,GACtBN,EAAMO,KAAKH,GAGbL,EAAcE,OAAOO,eAAeT,EACtC,CASA,OAAOC,EAAMS,UAAUC,MACzB,QAAAb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bindEntry as i}from"../bind/bind-entry.js";function e(e,r,n){void 0===n&&(n={});var o=n.skipLifecycle;return i(e,r,{isWithIgnoreLifecycle:o})}export{e as mockBindEntry};//# sourceMappingURL=mock-bind-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-bind-entry.js","sources":["../../../../../../../../../src/wirestate-core/test-utils/mock-bind-entry.ts"],"sourcesContent":[null],"names":["bindEntry","mockBindEntry","container","entry","options","skipLifecycle","isWithIgnoreLifecycle"],"mappings":"oBAiBAA,MAAA,iCAUgBC,EACdC,EACAC,EACAC,QAAA,IAAAA,IAAAA,EAAA,CAAA,GAEQ,IAAAC,EAAkBD,EAAOC,cAEjC,OAAOL,EAAUE,EAAWC,EAAO,CACjCG,sBAAuBD,GAE3B,QAAAJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getEntryToken as r}from"../bind/get-entry-token.js";import{createIocContainer as e}from"../container/create-ioc-container.js";import{ERROR_CODE_INVALID_ARGUMENTS as o}from"../error/error-code.js";import{WirestateError as t}from"../error/wirestate-error.js";import{mockBindEntry as i}from"./mock-bind-entry.js";function n(n){void 0===n&&(n={});var c=n.activate,a=void 0===c?[]:c,f=n.entries,s=void 0===f?[]:f,v=n.skipLifecycle;if(a.length)for(var m=s.map((function(e){return r(e)})),d=0,p=a;d<p.length;d++){var l=p[d];if(!m.includes(l))throw new t(o,"Provided services for activation not matching list of services to bind.")}for(var g=e(),h=0,j=s;h<j.length;h++){var u=j[h];i(g,u,{skipLifecycle:v})}for(var k=0,y=a;k<y.length;k++){var b=y[k];g.get(b)}return g}export{n as mockContainer};//# sourceMappingURL=mock-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-container.js","sources":["../../../../../../../../../src/wirestate-core/test-utils/mock-container.ts"],"sourcesContent":[null],"names":["getEntryToken","createIocContainer","ERROR_CODE_INVALID_ARGUMENTS","WirestateError","mockBindEntry","mockContainer","options","_a","activate","_b","entries","skipLifecycle","length","serviceTokens","map","s","_i","activate_1","token","includes","container","_c","entries_1","it_1","_d","activate_2","it_2","get"],"mappings":"wBA6BAA,MAAA,0DAAAC,MAAA,8EAAAC,MAAA,kDAAAC,MAAA,sDAAAC,MAAA,uBAUM,SAAUC,EAAcC,QAAA,IAAAA,IAAAA,EAAA,CAAA,GACpB,IAAAC,EAA+CD,EAAOE,SAAtDA,OAAQ,IAAAD,EAAG,GAAEA,EAAEE,EAAgCH,UAAhCI,aAAU,GAAED,EAAEE,EAAkBL,EAAOK,cAE9D,GAAIH,EAASI,OAGX,IAFA,IAAMC,EAA0CH,EAAQI,KAAI,SAACC,GAAM,OAAAf,EAAce,EAAd,IAE/CC,EAAA,EAAAC,EAAAT,EAAAQ,WAAAA,IAAU,CAAzB,IAAME,EAAKD,EAAAD,GACd,IAAKH,EAAcM,SAASD,GAC1B,MAAM,IAAIf,EACRD,EACA,0EAGN,CAKF,IAFA,IAAMkB,EAAuBnB,IAEZoB,EAAA,EAAAC,EAAAZ,EAAAW,WAAAA,IAAS,CAArB,IAAME,EAAED,EAAAD,GACXjB,EAAcgB,EAAWG,EAAI,CAAEZ,cAAeA,GAChD,CAEA,IAAiB,IAAAa,EAAA,EAAAC,EAAAjB,EAAAgB,WAAAA,IAAU,CAAtB,IAAME,EAAED,EAAAD,GACXJ,EAAUO,IAAID,EAChB,CAEA,OAAON,CACT,QAAAf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e;!function(e){e.PENDING="pending",e.SETTLED="settled",e.ERROR="error"}(e||(e={}));export{e as ECommandStatus};//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sources":["../../../../../../../../../src/wirestate-core/types/commands.ts"],"sourcesContent":[null],"names":["ECommandStatus"],"mappings":"IA8CYA,GAAZ,SAAYA,GACVA,EAAA,QAAA,UACAA,EAAA,QAAA,UACAA,EAAA,MAAA,OACD,CAJD,CAAYA,IAAAA,EAAc,CAAA,WAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CommandBus as r}from"@wirestate/core";import{useCallback as o}from"react";import{useContainer as t}from"../provision/use-container.js";function e(){var e=t();return o((function(o,t){return e.get(r).command(o,t)}),[e])}export{e as useCommandCaller};//# sourceMappingURL=use-command-caller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-command-caller.js","sources":["../../../../../../../../../src/wirestate-react/commands/use-command-caller.ts"],"sourcesContent":[null],"names":["CommandBus","useCallback","useContainer","useCommandCaller","container","type","data","get","command"],"mappings":"qBAQAA,MAAA,wCAAAC,MAAA,+BAAAC,MAAA,yCAKgBC,IACd,IAAMC,EAAuBF,IAE7B,OAAOD,GACL,SAAgEI,EAASC,GAMvE,OAAOF,EAAUG,IAAIP,GAAYQ,QAAcH,EAAMC,EACvD,GACA,CAACF,GAEL,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CommandBus as r}from"@wirestate/core";import{useRef as t,useEffect as n}from"react";import{useContainer as o}from"../provision/use-container.js";function e(e,i){var c=o(),u=t(i);n((function(){u.current=i})),n((function(){return c.get(r).register(e,(function(r){return u.current(r)}))}),[c,e])}export{e as useCommandHandler};//# sourceMappingURL=use-command-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-command-handler.js","sources":["../../../../../../../../../src/wirestate-react/commands/use-command-handler.ts"],"sourcesContent":[null],"names":["CommandBus","useRef","useEffect","useContainer","useCommandHandler","type","handler","container","handlerRef","current","get","register","data"],"mappings":"qBAKAA,MAAA,mCAAAC,eAAAC,MAAA,+BAAAC,MAAA,gCAQM,SAAUC,EAA4CC,EAAmBC,GAC7E,IAAMC,EAAuBJ,IACvBK,EAAaP,EAA6BK,GAGhDJ,GAAU,WACRM,EAAWC,QAAUH,CACvB,IAEAJ,GAAU,WACR,OAAOK,EAAUG,IAAIV,GAAYW,SAAeN,GAAM,SAACO,GAAS,OAAAJ,EAAWC,QAAQG,EAAnB,GAClE,GAAG,CAACL,EAAWF,GACjB,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CommandBus as r}from"@wirestate/core";import{useCallback as o}from"react";import{useContainer as t}from"../provision/use-container.js";function n(){var n=t();return o((function(o,t){return n.get(r).commandOptional(o,t)}),[n])}export{n as useOptionalCommandCaller};//# sourceMappingURL=use-optional-command-caller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-optional-command-caller.js","sources":["../../../../../../../../../src/wirestate-react/commands/use-optional-command-caller.ts"],"sourcesContent":[null],"names":["CommandBus","useCallback","useContainer","useOptionalCommandCaller","container","type","data","get","commandOptional"],"mappings":"qBAQAA,MAAA,wCAAAC,MAAA,+BAAAC,MAAA,yCAMgBC,IACd,IAAMC,EAAuBF,IAE7B,OAAOD,GACL,SAAgEI,EAASC,GAMvE,OAAOF,EAAUG,IAAIP,GAAYQ,gBAAsBH,EAAMC,EAC/D,GACA,CAACF,GAEL,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=1050,a=1052,e=1101;export{e as ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER,a as ERROR_CODE_INVALID_CONTEXT,r as ERROR_CODE_VALIDATION_ERROR};//# sourceMappingURL=error-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-code.js","sources":["../../../../../../../../../src/wirestate-react/error/error-code.ts"],"sourcesContent":[null],"names":["ERROR_CODE_VALIDATION_ERROR","ERROR_CODE_INVALID_CONTEXT","ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER"],"mappings":"AAAO,IAAMA,EAAsC,KACtCC,EAAqC,KAErCC,EAAqD,YAAAA,gDAAAD,gCAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EventBus as o}from"@wirestate/core";import{useCallback as r}from"react";import{useIocContext as t}from"../provision/use-ioc-context.js";function e(){var e=t().container;return r((function(r,t,i){e.get(o).emit({type:r,payload:t,from:i})}),[e])}export{e as useEventEmitter};//# sourceMappingURL=use-event-emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-event-emitter.js","sources":["../../../../../../../../../src/wirestate-react/events/use-event-emitter.ts"],"sourcesContent":[null],"names":["EventBus","useCallback","useIocContext","useEventEmitter","container","type","payload","from","get","emit"],"mappings":"mBAQAA,MAAA,wCAAAC,MAAA,gCAAAC,MAAA,2CAKgBC,IACd,IAAMC,EAAuBF,IAAgBE,UAE7C,OAAOH,GACL,SAAyBI,EAASC,EAAaC,GAO7CH,EAAUI,IAAIR,GAAUS,KAAK,CAAEJ,KAAIA,EAAEC,QAAOA,EAAEC,KAAIA,GACpD,GACA,CAACH,GAEL,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EventBus as r}from"@wirestate/core";import{useRef as t,useEffect as n}from"react";import{useContainer as o}from"../provision/use-container.js";function e(e,c){var i=t(e),u=t(c),f=o();n((function(){i.current=e,u.current=c})),n((function(){return f.get(r).subscribe((function(r){var t;r.type===i.current&&(null===(t=u.current)||void 0===t||t.call(u,r))}))}),[f,e])}export{e as useEvent};//# sourceMappingURL=use-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-event.js","sources":["../../../../../../../../../src/wirestate-react/events/use-event.ts"],"sourcesContent":[null],"names":["EventBus","useRef","useEffect","useContainer","useEvent","type","handler","typeRef","handlerRef","container","current","get","subscribe","event","_a","call"],"mappings":"mBAKAA,MAAA,mCAAAC,eAAAC,MAAA,+BAAAC,MAAA,gCAMM,SAAUC,EAASC,EAAiBC,GACxC,IAAMC,EAAuCN,EAAOI,GAC9CG,EAA6CP,EAAOK,GACpDG,EAAuBN,IAE7BD,GAAU,WACRK,EAAQG,QAAUL,EAClBG,EAAWE,QAAUJ,CACvB,IAEAJ,GAAU,WACR,OAAOO,EAAUE,IAAIX,GAAUY,WAAU,SAACC,SACpCA,EAAMR,OAASE,EAAQG,UACP,QAAlBI,EAAAN,EAAWE,eAAO,IAAAI,GAAAA,EAAAC,KAAAP,EAAGK,GAEzB,GACF,GAAG,CAACJ,EAAWJ,GACjB,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EventBus as r}from"@wirestate/core";import{useRef as o,useEffect as t}from"react";import{useContainer as n}from"../provision/use-container.js";function i(i){var e=o(i),c=n();t((function(){e.current=i})),t((function(){return c.get(r).subscribe((function(r){var o;null===(o=e.current)||void 0===o||o.call(e,r)}))}),[c])}export{i as useEventsHandler};//# sourceMappingURL=use-events-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-events-handler.js","sources":["../../../../../../../../../src/wirestate-react/events/use-events-handler.ts"],"sourcesContent":[null],"names":["EventBus","useRef","useEffect","useContainer","useEventsHandler","handler","handlerRef","container","current","get","subscribe","event","_a","call"],"mappings":"mBAMAA,MAAA,mCAAAC,eAAAC,MAAA,+BAAAC,MAAA,gCAKM,SAAUC,EAAiBC,GAC/B,IAAMC,EAAoDL,EAAOI,GAC3DE,EAAuBJ,IAE7BD,GAAU,WACRI,EAAWE,QAAUH,CACvB,IAEAH,GAAU,WACR,OAAOK,EAAUE,IAAIT,GAAUU,WAAU,SAACC,SACtB,QAAlBC,EAAAN,EAAWE,eAAO,IAAAI,GAAAA,EAAAC,KAAAP,EAAGK,EACvB,GACF,GAAG,CAACJ,GACN,QAAAH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EventBus as r}from"@wirestate/core";import{useRef as t,useEffect as o}from"react";import{useContainer as n}from"../provision/use-container.js";import"../provision/ioc-context.js";function i(i,e){var c=t(i),u=t(e),s=n();o((function(){c.current=i,u.current=e})),o((function(){return s.get(r).subscribe((function(r){var t;c.current.includes(r.type)&&(null===(t=u.current)||void 0===t||t.call(u,r))}))}),[s])}export{i as useEvents};//# sourceMappingURL=use-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-events.js","sources":["../../../../../../../../../src/wirestate-react/events/use-events.ts"],"sourcesContent":[null],"names":["EventBus","useRef","useEffect","useContainer","useEvents","types","handler","typesRef","handlerRef","container","current","get","subscribe","event","includes","type","_a","call"],"mappings":"mBAKAA,MAAA,mCAAAC,eAAAC,MAAA,+BAAAC,MAAA,sCAAA,8BAMM,SAAUC,EAAUC,EAAiCC,GACzD,IAAMC,EAAuDN,EAAOI,GAC9DG,EAA6CP,EAAOK,GACpDG,EAAuBN,IAE7BD,GAAU,WACRK,EAASG,QAAUL,EACnBG,EAAWE,QAAUJ,CACvB,IAEAJ,GAAU,WACR,OAAOO,EAAUE,IAAIX,GAAUY,WAAU,SAACC,SACpCN,EAASG,QAAQI,SAASD,EAAME,QAChB,QAAlBC,EAAAR,EAAWE,eAAO,IAAAM,GAAAA,EAAAC,KAAAT,EAAGK,GAEzB,GACF,GAAG,CAACJ,GACN,QAAAL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{useCommandCaller}from"./commands/use-command-caller.js";export{useOptionalCommandCaller}from"./commands/use-optional-command-caller.js";export{useCommandHandler}from"./commands/use-command-handler.js";export{useQueryCaller}from"./queries/use-query-caller.js";export{useOptionalQueryCaller}from"./queries/use-optional-query-caller.js";export{useQueryHandler}from"./queries/use-query-handler.js";export{useSyncQueryCaller}from"./queries/use-sync-query-caller.js";export{useOptionalSyncQueryCaller}from"./queries/use-optional-sync-query-caller.js";export{useInjection}from"./provision/use-injection.js";export{useOptionalInjection}from"./provision/use-optional-injection.js";export{createInjectablesProvider}from"./provision/create-injectables-provider.js";export{IocProvider}from"./provision/ioc-provider.js";export{useContainer}from"./provision/use-container.js";export{useContainerRevision}from"./provision/use-container-revision.js";export{useEvent}from"./events/use-event.js";export{useEvents}from"./events/use-events.js";export{useEventsHandler}from"./events/use-events-handler.js";export{useEventEmitter}from"./events/use-event-emitter.js";//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getEntryToken as e,WirestateError as r,applySeeds as n,bindEntry as t,unapplySeeds as i}from"@wirestate/core";import{useContext as o,useState as a,useMemo as c,useEffect as s}from"react";import{ERROR_CODE_VALIDATION_ERROR as d,ERROR_CODE_INVALID_CONTEXT as v}from"../error/error-code.js";import{IocContext as f}from"./ioc-context.js";function u(u,l){void 0===l&&(l={});var m=l.activate;if(m&&m.length>0)for(var g=u.map(e),h=0,p=m;h<p.length;h++){var b=p[h];if(!g.includes(b))throw new r(d,"createInjectablesProvider: '".concat(String(b),"' is listed in 'activate' but was not provided in 'entries'."))}function w(d){var l=o(f);if(!l)throw new r(v,"<InjectablesProvider> must be rendered inside an <IocProvider> React subtree.");var g=a((function(){return d}))[0];return c((function(){g.seeds&&n(l.container,g.seeds);for(var r=0,i=u;r<i.length;r++){var o=i[r];l.container.isBound(e(o))||t(l.container,o)}if(m)for(var a=0,c=m;a<c.length;a++){var s=c[a];l.container.get(s)}}),u),s((function(){var r=!1;g.seeds&&n(l.container,g.seeds);for(var o=0,a=u;o<a.length;o++){var c=a[o];l.container.isBound(e(c))||(r=!0,t(l.container,c))}if(m)for(var s=0,d=m;s<d.length;s++){var v=d[s];l.container.get(v)}return r&&l.setRevision((function(e){return e+1})),function(){for(var r=0,n=u;r<n.length;r++){var t=n[r],o=e(t);l.container.isBound(o)&&l.container.unbind(o)}g.seeds&&i(l.container,g.seeds)}}),u),d.children}return w.displayName="InjectablesProvider",w}export{u as createInjectablesProvider};//# sourceMappingURL=create-injectables-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-injectables-provider.js","sources":["../../../../../../../../../src/wirestate-react/provision/create-injectables-provider.ts"],"sourcesContent":[null],"names":["getEntryToken","WirestateError","applySeeds","bindEntry","unapplySeeds","useContext","useState","useMemo","useEffect","ERROR_CODE_VALIDATION_ERROR","ERROR_CODE_INVALID_CONTEXT","IocContext","createInjectablesProvider","entries","options","activate","length","entryTokens","map","_i","activate_1","eager","includes","concat","String","InjectablesProviderComponent","props","iocContext","initialPropsSnapshot","seeds","container","entries_1","entry","isBound","_a","activate_2","get","didRebind","entries_2","activate_3","setRevision","r","entries_3","token","unbind","children","displayName"],"mappings":"wBAkDAA,oBAAAC,gBAAAC,eAAAC,kBAAAC,MAAA,uCAAAC,cAAAC,aAAAC,eAAAC,MAAA,8CAAAC,gCAAAC,MAAA,8CAAAC,MAAA,mBAOM,SAAUC,EACdC,EACAC,QAAA,IAAAA,IAAAA,EAAA,CAAA,GAIQ,IAAAC,EAAaD,EAAOC,SAE5B,GAAIA,GAAYA,EAASC,OAAS,EAGhC,IAFA,IAAMC,EAAgDJ,EAAQK,IAAIlB,GAE9CmB,EAAA,EAAAC,EAAAL,EAAAI,WAAAA,IAAU,CAAzB,IAAME,EAAKD,EAAAD,GACd,IAAKF,EAAYK,SAASD,GACxB,MAAM,IAAIpB,EACRQ,EACA,+BAAAc,OAA+BC,OAAOH,GAAM,gEAGlD,CAGF,SAASI,EAA6BC,GACpC,IAAMC,EAAoCtB,EAAWM,GAErD,IAAKgB,EACH,MAAM,IAAI1B,EACRS,EACA,iFAMG,IAAAkB,EAAwBtB,GAAoC,WAAM,OAAAoB,CAAA,IAAM,GAqF/E,OAnFAnB,GAAQ,WAUFqB,EAAqBC,OACvB3B,EAAWyB,EAAWG,UAAWF,EAAqBC,OAGxD,IAAoB,IAAAV,EAAA,EAAAY,EAAAlB,EAAAM,WAAAA,IAAS,CAAxB,IAAMa,EAAKD,EAAAZ,GACTQ,EAAWG,UAAUG,QAAQjC,EAAcgC,KAC9C7B,EAAUwB,EAAWG,UAAWE,EAEpC,CAEA,GAAIjB,EACF,IAAoB,IAAAmB,EAAA,EAAAC,EAAApB,EAAAmB,WAAAA,IAAU,CAAzB,IAAMb,EAAKc,EAAAD,GACdP,EAAWG,UAAUM,IAAIf,EAC3B,CAEJ,GAAGR,GAEHL,GAAU,WAUR,IAAI6B,GAAqB,EAErBT,EAAqBC,OACvB3B,EAAWyB,EAAWG,UAAWF,EAAqBC,OAGxD,IAAoB,IAAAV,EAAA,EAAAmB,EAAAzB,EAAAM,WAAAA,IAAS,CAAxB,IAAMa,EAAKM,EAAAnB,GACTQ,EAAWG,UAAUG,QAAQjC,EAAcgC,MAC9CK,GAAY,EACZlC,EAAUwB,EAAWG,UAAWE,GAEpC,CAEA,GAAIjB,EACF,IAAoB,IAAAmB,EAAA,EAAAK,EAAAxB,EAAAmB,WAAAA,IAAU,CAAzB,IAAMb,EAAKkB,EAAAL,GACdP,EAAWG,UAAUM,IAAIf,EAC3B,CAQF,OAJIgB,GACFV,EAAWa,aAAY,SAACC,GAAM,OAAAA,EAAI,CAAJ,IAGzB,WAOL,IAAoB,IAAAtB,EAAA,EAAAuB,EAAA7B,EAAAM,WAAAA,IAAS,CAAxB,IAAMa,EAAKU,EAAAvB,GACRwB,EAA2B3C,EAAcgC,GAE3CL,EAAWG,UAAUG,QAAQU,IAC/BhB,EAAWG,UAAUc,OAAOD,EAEhC,CAGIf,EAAqBC,OACvBzB,EAAauB,EAAWG,UAAWF,EAAqBC,MAE5D,CACF,GAAGhB,GAEIa,EAAMmB,QACf,CAMA,OAJApB,EAA6BqB,YAAc,sBAIpCrB,CACT,QAAAb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as o}from"react";var r=o(null);r.displayName="IocContext";export{r as IocContext};//# sourceMappingURL=ioc-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ioc-context.js","sources":["../../../../../../../../../src/wirestate-react/provision/ioc-context.ts"],"sourcesContent":[null],"names":["createContext","IocContext","displayName"],"mappings":"wBAuBAA,MAAA,YAIaC,EAA6CD,EAAqC,MAE/FC,EAAWC,YAAc,oBAAYD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createIocContainer as r,WirestateError as o,applySharedSeed as e}from"@wirestate/core";import{useState as n,useMemo as t,useEffect as i,createElement as c}from"react";import{ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER as a}from"../error/error-code.js";import{IocContext as f}from"./ioc-context.js";function u(u){var s=u.container,l=u.seed,m=u.children,v=n(1),d=v[0],p=v[1],w=n((function(){return s?null:r()}))[0],h=null!=s?s:w;if(!h)throw new o(a,"IocProvider failed to resolve a container instance.");var j=t((function(){return{container:h,revision:d,setRevision:p}}),[h,d]);return i((function(){l&&e(h,l)}),[h]),c(f.Provider,{value:j},m)}export{u as IocProvider};//# sourceMappingURL=ioc-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ioc-provider.js","sources":["../../../../../../../../../src/wirestate-react/provision/ioc-provider.ts"],"sourcesContent":[null],"names":["createIocContainer","WirestateError","applySharedSeed","useState","useMemo","useEffect","createElement","ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER","IocContext","IocProvider","_a","externalContainer","seed","children","_b","revision","setRevision","ownedContainer","container","value","Provider"],"mappings":"6BAoBAA,oBAAAC,qBAAAC,MAAA,qCAAAC,aAAAC,eAAAC,mBAAAC,MAAA,6DAAAC,MAAA,8CAAAC,MAAA,mBASM,SAAUC,EAAYC,GAAa,IAAAC,cAAmBC,EAAIF,EAAAE,KAAEC,EAAQH,EAAAG,SAElEC,EAA0BX,EAAiB,GAA1CY,EAAQD,EAAA,GAAEE,EAAWF,EAAA,GAErBG,EAAkBd,GAA2B,WAAM,OAACQ,EAAoB,KAAOX,GAA5B,IAAkD,GAEtGkB,EAAYP,QAAAA,EAAqBM,EAEvC,IAAKC,EACH,MAAM,IAAIjB,EACRM,EACA,uDAKJ,IAAMY,EAAqBf,GAAqB,WAAM,MAAC,CAAEc,UAASA,EAAEH,SAAQA,EAAEC,YAAWA,EAAnC,GAAwC,CAACE,EAAWH,IAQ1G,OANAV,GAAU,WACJO,GACFV,EAAgBgB,EAAWN,EAE/B,GAAG,CAACM,IAEGZ,EAAcE,EAAWY,SAAU,CAAED,MAAKA,GAAIN,EACvD,QAAAJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useIocContext as o}from"./use-ioc-context.js";function r(){return o().revision}export{r as useContainerRevision};//# sourceMappingURL=use-container-revision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-container-revision.js","sources":["../../../../../../../../../src/wirestate-react/provision/use-container-revision.ts"],"sourcesContent":[null],"names":["useIocContext","useContainerRevision","revision"],"mappings":"wBAEAA,MAAA,gCAKgBC,IACd,OAAOD,IAAgBE,QACzB,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useIocContext as o}from"./use-ioc-context.js";function t(){return o().container}export{t as useContainer};//# sourceMappingURL=use-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-container.js","sources":["../../../../../../../../../src/wirestate-react/provision/use-container.ts"],"sourcesContent":[null],"names":["useIocContext","useContainer","container"],"mappings":"wBAIAA,MAAA,gCAKgBC,IACd,OAAOD,IAAgBE,SACzB,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as r}from"react";import{useIocContext as t}from"./use-ioc-context.js";function o(o){var n=t(),e=n.container,i=n.revision;return r((function(){return e.get(o)}),[e,i,o])}export{o as useInjection};//# sourceMappingURL=use-injection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-injection.js","sources":["../../../../../../../../../src/wirestate-react/provision/use-injection.ts"],"sourcesContent":[null],"names":["useMemo","useIocContext","useInjection","injectionId","_a","container","revision","get"],"mappings":"kBASAA,MAAA,gCAAAC,MAAA,uBAOM,SAAUC,EAAgBC,GACxB,IAAAC,EAA0BH,IAAxBI,EAASD,EAAAC,UAAEC,EAAQF,EAAAE,SAG3B,OAAON,GAAQ,WAQb,OAAOK,EAAUE,IAAOJ,EAC1B,GAAG,CAACE,EAAWC,EAAUH,GAC3B,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WirestateError as r}from"@wirestate/core";import{useContext as o}from"react";import{ERROR_CODE_INVALID_CONTEXT as t}from"../error/error-code.js";import{IocContext as e}from"./ioc-context.js";function c(){var c=o(e);if(!c)throw new r(t,"Trying to access IOC context from React subtree not wrapped in <IocProvider>.");return c}export{c as useIocContext};//# sourceMappingURL=use-ioc-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-ioc-context.js","sources":["../../../../../../../../../src/wirestate-react/provision/use-ioc-context.ts"],"sourcesContent":[null],"names":["WirestateError","useContext","ERROR_CODE_INVALID_CONTEXT","IocContext","useIocContext","value"],"mappings":"yBAMAA,MAAA,uCAAAC,MAAA,6CAAAC,MAAA,8CAAAC,MAAA,4BAMgBC,IACd,IAAMC,EAAQJ,EAAWE,GAEzB,IAAKE,EACH,MAAM,IAAIL,EACRE,EACA,iFAIJ,OAAOG,CACT,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as r}from"react";import{useIocContext as n}from"./use-ioc-context.js";function o(o,t){var e=n(),i=e.container,u=e.revision;return r((function(){return i.isBound(o)?i.get(o):t?t(i):null}),[i,u,o])}export{o as useOptionalInjection};//# sourceMappingURL=use-optional-injection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-optional-injection.js","sources":["../../../../../../../../../src/wirestate-react/provision/use-optional-injection.ts"],"sourcesContent":[null],"names":["useMemo","useIocContext","useOptionalInjection","injectionId","onFallback","_a","container","revision","isBound","get"],"mappings":"kBASAA,MAAA,gCAAAC,MAAA,uBAQM,SAAUC,EACdC,EACAC,GAEM,IAAAC,EAA0BJ,IAAxBK,EAASD,EAAAC,UAAEC,EAAQF,EAAAE,SAG3B,OAAOP,GAAQ,WACb,OAAIM,EAAUE,QAAQL,GASbG,EAAUG,IAAON,GACfC,EASFA,EAAWE,GAUX,IAEX,GAAG,CAACA,EAAWC,EAAUJ,GAC3B,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{QueryBus as r}from"@wirestate/core";import{useCallback as o}from"react";import{useContainer as t}from"../provision/use-container.js";function e(){var e=t();return o((function(o,t){return e.get(r).queryOptional(o,t)}),[e])}export{e as useOptionalQueryCaller};//# sourceMappingURL=use-optional-query-caller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-optional-query-caller.js","sources":["../../../../../../../../../src/wirestate-react/queries/use-optional-query-caller.ts"],"sourcesContent":[null],"names":["QueryBus","useCallback","useContainer","useOptionalQueryCaller","container","type","data","get","queryOptional"],"mappings":"mBAQAA,MAAA,wCAAAC,MAAA,+BAAAC,MAAA,yCAMgBC,IACd,IAAMC,EAAuBF,IAE7B,OAAOD,GACL,SAACI,EAAiBC,GAMhB,OAAOF,EAAUG,IAAIP,GAAUQ,cAAcH,EAAMC,EACrD,GACA,CAACF,GAEL,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{QueryBus as r}from"@wirestate/core";import{useCallback as o}from"react";import{useContainer as t}from"../provision/use-container.js";function e(){var e=t();return o((function(o,t){return e.get(r).queryOptional(o,t)}),[e])}export{e as useOptionalSyncQueryCaller};//# sourceMappingURL=use-optional-sync-query-caller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-optional-sync-query-caller.js","sources":["../../../../../../../../../src/wirestate-react/queries/use-optional-sync-query-caller.ts"],"sourcesContent":[null],"names":["QueryBus","useCallback","useContainer","useOptionalSyncQueryCaller","container","type","data","get","queryOptional"],"mappings":"mBAQAA,MAAA,wCAAAC,MAAA,+BAAAC,MAAA,yCAMgBC,IACd,IAAMC,EAAuBF,IAE7B,OAAOD,GACL,SAACI,EAAiBC,GAMhB,OAAOF,EAAUG,IAAIP,GAAUQ,cAAcH,EAAMC,EACrD,GACA,CAACF,GAEL,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{QueryBus as r}from"@wirestate/core";import{useCallback as o}from"react";import{useContainer as t}from"../provision/use-container.js";function e(){var e=t();return o((function(o,t){return e.get(r).query(o,t)}),[e])}export{e as useQueryCaller};//# sourceMappingURL=use-query-caller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-query-caller.js","sources":["../../../../../../../../../src/wirestate-react/queries/use-query-caller.ts"],"sourcesContent":[null],"names":["QueryBus","useCallback","useContainer","useQueryCaller","container","type","data","get","query"],"mappings":"mBAQAA,MAAA,wCAAAC,MAAA,+BAAAC,MAAA,yCAKgBC,IACd,IAAMC,EAAuBF,IAE7B,OAAOD,GACL,SAACI,EAAiBC,GAMhB,OAAOF,EAAUG,IAAIP,GAAUQ,MAAMH,EAAMC,EAC7C,GACA,CAACF,GAEL,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{QueryBus as r}from"@wirestate/core";import{useRef as t,useEffect as n}from"react";import{useContainer as o}from"../provision/use-container.js";function e(e,i){var c=o(),u=t(i);n((function(){u.current=i})),n((function(){return c.get(r).register(e,(function(r){return u.current(r)}))}),[c,e])}export{e as useQueryHandler};//# sourceMappingURL=use-query-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-query-handler.js","sources":["../../../../../../../../../src/wirestate-react/queries/use-query-handler.ts"],"sourcesContent":[null],"names":["QueryBus","useRef","useEffect","useContainer","useQueryHandler","type","handler","container","handlerRef","current","get","register","data"],"mappings":"mBAKAA,MAAA,mCAAAC,eAAAC,MAAA,+BAAAC,MAAA,gCAQM,SAAUC,EACdC,EACAC,GAEA,IAAMC,EAAuBJ,IACvBK,EAAaP,EAA2BK,GAE9CJ,GAAU,WACRM,EAAWC,QAAUH,CACvB,IAEAJ,GAAU,WACR,OAAOK,EAAUG,IAAIV,GAAUW,SAAeN,GAAM,SAACO,GAAS,OAAAJ,EAAWC,QAAQG,EAAnB,GAChE,GAAG,CAACL,EAAWF,GACjB,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{QueryBus as r}from"@wirestate/core";import{useCallback as o}from"react";import{useContainer as t}from"../provision/use-container.js";function e(){var e=t();return o((function(o,t){return e.get(r).query(o,t)}),[e])}export{e as useSyncQueryCaller};//# sourceMappingURL=use-sync-query-caller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sync-query-caller.js","sources":["../../../../../../../../../src/wirestate-react/queries/use-sync-query-caller.ts"],"sourcesContent":[null],"names":["QueryBus","useCallback","useContainer","useSyncQueryCaller","container","type","data","get","query"],"mappings":"mBAQAA,MAAA,wCAAAC,MAAA,+BAAAC,MAAA,yCAMgBC,IACd,IAAMC,EAAuBF,IAE7B,OAAOD,GACL,SAACI,EAAiBC,GAOhB,OAAOF,EAAUG,IAAIP,GAAUQ,MAAMH,EAAMC,EAC7C,GACA,CAACF,GAEL,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../wirestate-core/commands/command-bus.js";import"../../wirestate-core/container/wire-scope.js";import"../../wirestate-core/events/event-bus.js";import"../../wirestate-core/queries/query-bus.js";import"inversify";import"../../wirestate-core/error/wirestate-error.js";import{mockContainer as r}from"../../wirestate-core/test-utils/mock-container.js";import{createElement as e}from"react";import{IocProvider as t}from"../provision/ioc-provider.js";function o(o,i,s){return void 0===i&&(i=r()),e(t,{container:i,seed:s},o)}export{o as withIocProvider};//# sourceMappingURL=with-ioc-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-ioc-provider.js","sources":["../../../../../../../../../src/wirestate-react/test-utils/with-ioc-provider.ts"],"sourcesContent":[null],"names":["mockContainer","createElement","IocProvider","withIocProvider","children","container","seed"],"mappings":"MAMA,qDAAA,qDAAA,iDAAA,kDAAA,kBAAA,wEAAAA,MAAA,4EAAAC,MAAA,8BAAAC,MAAA,wCAQgBC,EACdC,EACAC,EACAC,GAEA,YAHA,IAAAD,IAAAA,EAAuBL,KAGhBC,EAAcC,EAAa,CAAEG,UAASA,EAAEC,KAAIA,GAAIF,EACzD,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{withIocProvider}from"./test-utils/with-ioc-provider.js";//# sourceMappingURL=test-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { CommandType, CommandDescriptor, CommandHandler, QueryCaller, OptionalQueryCaller, QueryType, QueryHandler, SyncQueryCaller, OptionalSyncQueryCaller, ServiceIdentifier, Container, Newable, InjectableDescriptor, SeedEntries, EventType, EventHandler, EventEmitter } from '@wirestate/core';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode, ReactElement, Dispatch, SetStateAction, PropsWithChildren } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns a function to dispatch commands on the active container.
|
|
7
|
+
*
|
|
8
|
+
* @returns command dispatcher
|
|
9
|
+
*/
|
|
10
|
+
declare function useCommandCaller(): <R = unknown, D = unknown, T extends CommandType = CommandType>(type: T, data?: D) => CommandDescriptor<R>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Returns a function to dispatch optional commands on the active container.
|
|
14
|
+
* Returns null instead of throwing when no handler is registered.
|
|
15
|
+
*
|
|
16
|
+
* @returns optional command dispatcher
|
|
17
|
+
*/
|
|
18
|
+
declare function useOptionalCommandCaller(): <R = unknown, D = unknown, T extends CommandType = CommandType>(type: T, data?: D) => CommandDescriptor<R> | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Registers a command handler for the component's lifetime.
|
|
22
|
+
* The handler is stored in a ref to avoid manual memoization.
|
|
23
|
+
* Only one handler is active per type; newer registrations shadow older ones.
|
|
24
|
+
*
|
|
25
|
+
* @param type - command type
|
|
26
|
+
* @param handler - command handler function
|
|
27
|
+
*/
|
|
28
|
+
declare function useCommandHandler<R = unknown, D = unknown>(type: CommandType, handler: CommandHandler<D, R>): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns a function to dispatch queries on the active container.
|
|
32
|
+
*
|
|
33
|
+
* @returns query dispatcher
|
|
34
|
+
*/
|
|
35
|
+
declare function useQueryCaller(): QueryCaller;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns a function to dispatch optional queries on the active container.
|
|
39
|
+
* Returns null instead of throwing when no handler is registered.
|
|
40
|
+
*
|
|
41
|
+
* @returns optional query dispatcher
|
|
42
|
+
*/
|
|
43
|
+
declare function useOptionalQueryCaller(): OptionalQueryCaller;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Registers a query handler for the component's lifetime.
|
|
47
|
+
* The handler is stored in a ref to avoid manual memoization.
|
|
48
|
+
* Only one handler is active per type; newer registrations shadow older ones.
|
|
49
|
+
*
|
|
50
|
+
* @param type - query type
|
|
51
|
+
* @param handler - query handler function
|
|
52
|
+
*/
|
|
53
|
+
declare function useQueryHandler<R = unknown, D = unknown, T extends QueryType = QueryType>(type: T, handler: QueryHandler<D, R>): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Returns a stable function to dispatch synchronous queries.
|
|
57
|
+
* Returns the value directly from the handler.
|
|
58
|
+
*
|
|
59
|
+
* @returns sync query dispatcher
|
|
60
|
+
*/
|
|
61
|
+
declare function useSyncQueryCaller(): SyncQueryCaller;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Returns a stable function to dispatch synchronous optional queries.
|
|
65
|
+
* Returns null instead of throwing when no handler is registered.
|
|
66
|
+
*
|
|
67
|
+
* @returns optional sync query dispatcher
|
|
68
|
+
*/
|
|
69
|
+
declare function useOptionalSyncQueryCaller(): OptionalSyncQueryCaller;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Resolves a value from the container - constant or service.
|
|
73
|
+
* Automatically re-resolves if the container is reset or services are rebound.
|
|
74
|
+
*
|
|
75
|
+
* @param injectionId - injection identifier
|
|
76
|
+
* @returns resolved value
|
|
77
|
+
*/
|
|
78
|
+
declare function useInjection<T>(injectionId: ServiceIdentifier<T>): T;
|
|
79
|
+
|
|
80
|
+
type Optional<T> = T | null;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Resolves a value from the container if bound, returning null otherwise.
|
|
84
|
+
* Unlike {@link useInjection}, this hook does not throw when the token is not bound.
|
|
85
|
+
*
|
|
86
|
+
* @param injectionId - injection identifier
|
|
87
|
+
* @param onFallback - optional callback to handle cases when dependency was not resolved
|
|
88
|
+
* @returns resolved value, result of optional fallback handler or null
|
|
89
|
+
*/
|
|
90
|
+
declare function useOptionalInjection<T>(injectionId: ServiceIdentifier<T>, onFallback?: (container: Container) => T): Optional<T>;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Props for the component returned by {@link createInjectablesProvider}.
|
|
94
|
+
*/
|
|
95
|
+
interface IInjectablesProviderProps {
|
|
96
|
+
/**
|
|
97
|
+
* Targeted seeds bound to specific injectables or tokens.
|
|
98
|
+
* Subsequent prop changes are ignored. Use a React `key` to re-seed the tree.
|
|
99
|
+
*/
|
|
100
|
+
readonly seeds?: SeedEntries;
|
|
101
|
+
/**
|
|
102
|
+
* Subtree that consumes the bound services.
|
|
103
|
+
*/
|
|
104
|
+
readonly children?: ReactNode;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Component returned by {@link createInjectablesProvider}.
|
|
108
|
+
*/
|
|
109
|
+
type InjectablesProvider = ReturnType<typeof createInjectablesProvider>;
|
|
110
|
+
/**
|
|
111
|
+
* Configuration for {@link createInjectablesProvider}.
|
|
112
|
+
*/
|
|
113
|
+
interface ICreateInjectablesProviderOptions {
|
|
114
|
+
/**
|
|
115
|
+
* Services to resolve immediately on mount.
|
|
116
|
+
*/
|
|
117
|
+
readonly activate?: ReadonlyArray<ServiceIdentifier>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Creates a component that manages injectable lifetimes for its subtree.
|
|
121
|
+
*
|
|
122
|
+
* @param entries - service classes or injectable descriptors to bind
|
|
123
|
+
* @param options - provider configuration
|
|
124
|
+
* @returns injectables provider component
|
|
125
|
+
*/
|
|
126
|
+
declare function createInjectablesProvider(entries: ReadonlyArray<Newable<object> | InjectableDescriptor>, options?: ICreateInjectablesProviderOptions): {
|
|
127
|
+
(props: IInjectablesProviderProps): ReactElement;
|
|
128
|
+
displayName: string;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* React context value.
|
|
133
|
+
*/
|
|
134
|
+
interface IIocContext {
|
|
135
|
+
/**
|
|
136
|
+
* Inversify container.
|
|
137
|
+
*/
|
|
138
|
+
readonly container: Container;
|
|
139
|
+
/**
|
|
140
|
+
* Revision counter for cache invalidation.
|
|
141
|
+
*/
|
|
142
|
+
readonly revision: number;
|
|
143
|
+
/**
|
|
144
|
+
* Forces a revision update.
|
|
145
|
+
*/
|
|
146
|
+
readonly setRevision: Dispatch<SetStateAction<number>>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Props for {@link IocProvider}.
|
|
151
|
+
*/
|
|
152
|
+
interface IIocProviderProps extends PropsWithChildren<unknown> {
|
|
153
|
+
/**
|
|
154
|
+
* External container instance. If omitted, a new container is created.
|
|
155
|
+
*/
|
|
156
|
+
readonly container?: Container;
|
|
157
|
+
/**
|
|
158
|
+
* Shared seed for the container.
|
|
159
|
+
*/
|
|
160
|
+
readonly seed?: Record<string, unknown>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Provides an IoC container to the component tree.
|
|
164
|
+
*
|
|
165
|
+
* @param props - component props
|
|
166
|
+
* @param props.container - external container instance
|
|
167
|
+
* @param props.seed - shared seed across the container
|
|
168
|
+
* @param props.children - components to wrap
|
|
169
|
+
* @returns provider element
|
|
170
|
+
*/
|
|
171
|
+
declare function IocProvider({ container: externalContainer, seed, children }: IIocProviderProps): react.FunctionComponentElement<react.ProviderProps<Optional<IIocContext>>>;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Returns the active IoC container.
|
|
175
|
+
*
|
|
176
|
+
* @returns active Inversify container
|
|
177
|
+
*/
|
|
178
|
+
declare function useContainer(): Container;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Returns the current container revision.
|
|
182
|
+
*
|
|
183
|
+
* @returns revision number
|
|
184
|
+
*/
|
|
185
|
+
declare function useContainerRevision(): number;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Subscribes a component to events.
|
|
189
|
+
*
|
|
190
|
+
* @param type - event type to listen to
|
|
191
|
+
* @param handler - event handler to invoke when event is emitted
|
|
192
|
+
*/
|
|
193
|
+
declare function useEvent(type: EventType, handler: EventHandler): void;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Subscribes a component to multiple event types.
|
|
197
|
+
*
|
|
198
|
+
* @param types - event types to filter by
|
|
199
|
+
* @param handler - events handler
|
|
200
|
+
*/
|
|
201
|
+
declare function useEvents(types: ReadonlyArray<EventType>, handler: EventHandler): void;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Subscribes a component to all events without type filtering.
|
|
205
|
+
*
|
|
206
|
+
* @param handler - event handler invoked for every emitted event
|
|
207
|
+
*/
|
|
208
|
+
declare function useEventsHandler(handler: EventHandler): void;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Returns a stable function to emit events.
|
|
212
|
+
*
|
|
213
|
+
* @returns event emitter
|
|
214
|
+
*/
|
|
215
|
+
declare function useEventEmitter<P = unknown, T extends EventType = EventType>(): EventEmitter<P, T>;
|
|
216
|
+
|
|
217
|
+
export { IocProvider, createInjectablesProvider, useCommandCaller, useCommandHandler, useContainer, useContainerRevision, useEvent, useEventEmitter, useEvents, useEventsHandler, useInjection, useOptionalCommandCaller, useOptionalInjection, useOptionalQueryCaller, useOptionalSyncQueryCaller, useQueryCaller, useQueryHandler, useSyncQueryCaller };
|
|
218
|
+
export type { InjectablesProvider, IInjectablesProviderProps as InjectablesProviderProps };
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wirestate/react",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "React alias and adapters for wirestate",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"author": "Syrotenko Igor",
|
|
7
|
+
"homepage": "https://github.com/neloreck/wirestate#readme",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"main": "./cjs/development/index.js",
|
|
10
|
+
"module": "./esm/development/index.js",
|
|
11
|
+
"types": "./index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./index.d.ts",
|
|
15
|
+
"import": {
|
|
16
|
+
"production": "./esm/production/index.js",
|
|
17
|
+
"default": "./esm/development/index.js"
|
|
18
|
+
},
|
|
19
|
+
"require": {
|
|
20
|
+
"production": "./cjs/production/index.js",
|
|
21
|
+
"default": "./cjs/development/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"./test-utils": {
|
|
25
|
+
"types": "./test-utils.d.ts",
|
|
26
|
+
"require": {
|
|
27
|
+
"production": "./cjs/production/test-utils.js",
|
|
28
|
+
"default": "./cjs/development/test-utils.js"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/neloreck/wirestate.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/neloreck/wirestate/issues"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"class-based",
|
|
41
|
+
"context",
|
|
42
|
+
"declarative",
|
|
43
|
+
"management",
|
|
44
|
+
"manager",
|
|
45
|
+
"mobx",
|
|
46
|
+
"react",
|
|
47
|
+
"ioc",
|
|
48
|
+
"di",
|
|
49
|
+
"dependency-injection",
|
|
50
|
+
"state",
|
|
51
|
+
"store",
|
|
52
|
+
"typescript"
|
|
53
|
+
],
|
|
54
|
+
"dependencies": {},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@wirestate/core": ">=0.6.0",
|
|
57
|
+
"react": ">=16.8.0",
|
|
58
|
+
"reflect-metadata": ">=0.2.0",
|
|
59
|
+
"tslib": ">=2.5.0"
|
|
60
|
+
},
|
|
61
|
+
"optionalDependencies": {}
|
|
62
|
+
}
|