@wirestate/react 0.6.0 → 0.6.1
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 +5 -0
- package/cjs/development/index.js +2 -2
- package/cjs/development/index.js.map +1 -1
- package/cjs/development/lib.js +4 -4
- package/cjs/development/lib.js.map +1 -1
- package/cjs/development/test-utils.js +9 -9
- package/cjs/development/test-utils.js.map +1 -1
- package/cjs/production/index.js.map +1 -1
- package/cjs/production/lib.js.map +1 -1
- package/cjs/production/test-utils.js.map +1 -1
- package/esm/development/wirestate-core/bind/bind-constant.js.map +1 -1
- package/esm/development/wirestate-core/bind/bind-dynamic-value.js.map +1 -1
- package/esm/development/wirestate-core/bind/bind-entry.js.map +1 -1
- package/esm/development/wirestate-core/bind/bind-service.js.map +1 -1
- package/esm/development/wirestate-core/bind/get-entry-token.js.map +1 -1
- package/esm/development/wirestate-core/commands/command-bus.js +4 -4
- package/esm/development/wirestate-core/commands/command-bus.js.map +1 -1
- package/esm/development/wirestate-core/commands/get-command-handler-metadata.js.map +1 -1
- package/esm/development/wirestate-core/container/create-ioc-container.js +1 -1
- package/esm/development/wirestate-core/container/create-ioc-container.js.map +1 -1
- package/esm/development/wirestate-core/container/wire-scope.js.map +1 -1
- package/esm/development/wirestate-core/events/build-event-dispatcher.js.map +1 -1
- package/esm/development/wirestate-core/events/event-bus.js.map +1 -1
- package/esm/development/wirestate-core/events/get-event-handler-metadata.js.map +1 -1
- package/esm/development/wirestate-core/queries/get-query-handler-metadata.js.map +1 -1
- package/esm/development/wirestate-core/queries/query-bus.js.map +1 -1
- package/esm/development/wirestate-core/registry.js.map +1 -1
- package/esm/development/wirestate-core/test-utils/mock-bind-entry.js.map +1 -1
- package/esm/development/wirestate-core/test-utils/mock-container.js.map +1 -1
- package/esm/development/wirestate-core/types/commands.js +7 -7
- package/esm/development/wirestate-core/types/commands.js.map +1 -1
- package/esm/development/wirestate-react/events/use-event-emitter.js.map +1 -1
- package/esm/development/wirestate-react/events/use-events.js +0 -1
- package/esm/development/wirestate-react/events/use-events.js.map +1 -1
- package/esm/development/wirestate-react/provision/create-injectables-provider.js +2 -2
- package/esm/development/wirestate-react/provision/create-injectables-provider.js.map +1 -1
- package/esm/development/wirestate-react/provision/ioc-context.js +3 -3
- package/esm/development/wirestate-react/provision/ioc-context.js.map +1 -1
- package/esm/development/wirestate-react/provision/ioc-provider.js +2 -2
- package/esm/development/wirestate-react/provision/ioc-provider.js.map +1 -1
- package/esm/development/wirestate-react/provision/use-injection.js.map +1 -1
- package/esm/development/wirestate-react/provision/use-ioc-context.js +2 -2
- package/esm/development/wirestate-react/provision/use-ioc-context.js.map +1 -1
- package/esm/development/wirestate-react/provision/use-optional-injection.js.map +1 -1
- package/esm/development/wirestate-react/queries/use-optional-query-caller.js.map +1 -1
- package/esm/development/wirestate-react/queries/use-optional-sync-query-caller.js.map +1 -1
- package/esm/development/wirestate-react/queries/use-query-caller.js.map +1 -1
- package/esm/development/wirestate-react/queries/use-sync-query-caller.js.map +1 -1
- package/esm/production/wirestate-core/bind/bind-entry.js.map +1 -1
- package/esm/production/wirestate-core/bind/bind-service.js.map +1 -1
- package/esm/production/wirestate-core/commands/command-bus.js +1 -1
- package/esm/production/wirestate-core/commands/command-bus.js.map +1 -1
- package/esm/production/wirestate-core/commands/get-command-handler-metadata.js.map +1 -1
- package/esm/production/wirestate-core/container/create-ioc-container.js +1 -1
- package/esm/production/wirestate-core/container/create-ioc-container.js.map +1 -1
- package/esm/production/wirestate-core/container/wire-scope.js.map +1 -1
- package/esm/production/wirestate-core/events/build-event-dispatcher.js.map +1 -1
- package/esm/production/wirestate-core/events/event-bus.js.map +1 -1
- package/esm/production/wirestate-core/events/get-event-handler-metadata.js.map +1 -1
- package/esm/production/wirestate-core/queries/get-query-handler-metadata.js.map +1 -1
- package/esm/production/wirestate-core/queries/query-bus.js.map +1 -1
- package/esm/production/wirestate-core/registry.js.map +1 -1
- package/esm/production/wirestate-core/test-utils/mock-container.js.map +1 -1
- package/esm/production/wirestate-core/types/commands.js +1 -1
- package/esm/production/wirestate-core/types/commands.js.map +1 -1
- package/esm/production/wirestate-react/events/use-event-emitter.js.map +1 -1
- package/esm/production/wirestate-react/events/use-events.js +1 -1
- package/esm/production/wirestate-react/events/use-events.js.map +1 -1
- package/esm/production/wirestate-react/provision/create-injectables-provider.js +1 -1
- package/esm/production/wirestate-react/provision/create-injectables-provider.js.map +1 -1
- package/esm/production/wirestate-react/provision/ioc-context.js +1 -1
- package/esm/production/wirestate-react/provision/ioc-context.js.map +1 -1
- package/esm/production/wirestate-react/provision/ioc-provider.js +1 -1
- package/esm/production/wirestate-react/provision/ioc-provider.js.map +1 -1
- package/esm/production/wirestate-react/provision/use-injection.js.map +1 -1
- package/esm/production/wirestate-react/provision/use-ioc-context.js +1 -1
- package/esm/production/wirestate-react/provision/use-ioc-context.js.map +1 -1
- package/esm/production/wirestate-react/provision/use-optional-injection.js.map +1 -1
- package/esm/production/wirestate-react/queries/use-optional-query-caller.js.map +1 -1
- package/esm/production/wirestate-react/queries/use-optional-sync-query-caller.js.map +1 -1
- package/esm/production/wirestate-react/queries/use-query-caller.js.map +1 -1
- package/esm/production/wirestate-react/queries/use-sync-query-caller.js.map +1 -1
- package/index.d.ts +47 -11
- package/package.json +1 -1
|
@@ -1 +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":"
|
|
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":"mBASAA,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EventBus as r}from"@wirestate/core";import{useRef as t,useEffect as
|
|
1
|
+
import{EventBus as r}from"@wirestate/core";import{useRef as t,useEffect as n}from"react";import{useContainer as e}from"../provision/use-container.js";function o(o,c){var i=t(o),u=t(c),f=e();n((function(){i.current=o,u.current=c})),n((function(){return f.get(r).subscribe((function(r){var t;i.current.includes(r.type)&&(null===(t=u.current)||void 0===t||t.call(u,r))}))}),[f])}export{o as useEvents};//# sourceMappingURL=use-events.js.map
|
|
@@ -1 +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,
|
|
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,gCAMM,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"}
|
|
@@ -1 +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{
|
|
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{IocReactContext 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
|
|
@@ -1 +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","
|
|
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","IocReactContext","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":"wBAmDAA,oBAAAC,gBAAAC,eAAAC,kBAAAC,MAAA,uCAAAC,cAAAC,aAAAC,eAAAC,MAAA,8CAAAC,gCAAAC,MAAA,mDAAAC,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,EAAmCtB,EAAWM,GAEpD,IAAKgB,EACH,MAAM,IAAI1B,EACRS,EACA,iFAMG,IAAAkB,EAAwBtB,GAAmC,WAAM,OAAAoB,CAAA,IAAM,GAqF9E,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext as o}from"react";var r=o(null);r.displayName="IocContext";export{r as
|
|
1
|
+
import{createContext as o}from"react";var r=o(null);r.displayName="IocContext";export{r as IocReactContext};//# sourceMappingURL=ioc-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ioc-context.js","sources":["../../../../../../../../../src/wirestate-react/provision/ioc-context.ts"],"sourcesContent":[null],"names":["createContext","
|
|
1
|
+
{"version":3,"file":"ioc-context.js","sources":["../../../../../../../../../src/wirestate-react/provision/ioc-context.ts"],"sourcesContent":[null],"names":["createContext","IocReactContext","displayName"],"mappings":"wBAuBAA,MAAA,YAIaC,EAAiDD,EAAoC,MAElGC,EAAgBC,YAAc,oBAAYD"}
|
|
@@ -1 +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{
|
|
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{IocReactContext 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
|
|
@@ -1 +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","
|
|
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","IocReactContext","IocProvider","_a","externalContainer","seed","children","_b","revision","setRevision","ownedContainer","container","value","Provider"],"mappings":"6BAqBAA,oBAAAC,qBAAAC,MAAA,qCAAAC,aAAAC,eAAAC,mBAAAC,MAAA,6DAAAC,MAAA,mDAAAC,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,EAAoBf,GAAoB,WAAM,MAAC,CAAEc,UAASA,EAAEH,SAAQA,EAAEC,YAAWA,EAAnC,GAAwC,CAACE,EAAWH,IAQxG,OANAV,GAAU,WACJO,GACFV,EAAgBgB,EAAWN,EAE/B,GAAG,CAACM,IAEGZ,EAAcE,EAAgBY,SAAU,CAAED,MAAKA,GAAIN,EAC5D,QAAAJ"}
|
|
@@ -1 +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":"
|
|
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":"kBAUAA,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"}
|
|
@@ -1 +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{
|
|
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{IocReactContext 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
|
|
@@ -1 +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","
|
|
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","IocReactContext","useIocContext","value"],"mappings":"yBAOAA,MAAA,uCAAAC,MAAA,6CAAAC,MAAA,mDAAAC,MAAA,4BAMgBC,IACd,IAAMC,EAAQJ,EAAWE,GAEzB,IAAKE,EACH,MAAM,IAAIL,EACRE,EACA,iFAIJ,OAAOG,CACT,QAAAD"}
|
|
@@ -1 +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":"
|
|
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":"kBAUAA,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"}
|
|
@@ -1 +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":"
|
|
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":"mBASAA,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"}
|
|
@@ -1 +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":"
|
|
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":"mBASAA,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"}
|
|
@@ -1 +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":"
|
|
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":"mBASAA,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"}
|
|
@@ -1 +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":"
|
|
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":"mBASAA,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"}
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandType, CommandDescriptor, CommandHandler,
|
|
1
|
+
import { CommandType, CommandDescriptor, CommandHandler, QueryType, QueryHandler, ServiceIdentifier, Container, Newable, InjectableDescriptor, SeedEntries, EventType, EventHandler } from '@wirestate/core';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, ReactElement, Dispatch, SetStateAction, PropsWithChildren } from 'react';
|
|
4
4
|
|
|
@@ -27,6 +27,30 @@ declare function useOptionalCommandCaller(): <R = unknown, D = unknown, T extend
|
|
|
27
27
|
*/
|
|
28
28
|
declare function useCommandHandler<R = unknown, D = unknown>(type: CommandType, handler: CommandHandler<D, R>): void;
|
|
29
29
|
|
|
30
|
+
type Optional<T> = T | null;
|
|
31
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Public query responder signature.
|
|
35
|
+
*/
|
|
36
|
+
type QueryResponder<R = unknown, D = unknown> = (data?: D) => MaybePromise<R>;
|
|
37
|
+
/**
|
|
38
|
+
* Dispatches queries and returns their result as a value or promise.
|
|
39
|
+
*/
|
|
40
|
+
type QueryCaller = <R = unknown, D = unknown, T extends QueryType = QueryType>(type: T, data?: D) => MaybePromise<R>;
|
|
41
|
+
/**
|
|
42
|
+
* Dispatches synchronous queries and returns their result directly.
|
|
43
|
+
*/
|
|
44
|
+
type SyncQueryCaller = <R = unknown, D = unknown, T extends QueryType = QueryType>(type: T, data?: D) => R;
|
|
45
|
+
/**
|
|
46
|
+
* Dispatches optional queries. Returns null when no handler is registered.
|
|
47
|
+
*/
|
|
48
|
+
type OptionalQueryCaller = <R = unknown, D = unknown, T extends QueryType = QueryType>(type: T, data?: D) => Optional<MaybePromise<R>>;
|
|
49
|
+
/**
|
|
50
|
+
* Dispatches optional synchronous queries. Returns null when no handler is registered.
|
|
51
|
+
*/
|
|
52
|
+
type OptionalSyncQueryCaller = <R = unknown, D = unknown, T extends QueryType = QueryType>(type: T, data?: D) => Optional<R>;
|
|
53
|
+
|
|
30
54
|
/**
|
|
31
55
|
* Returns a function to dispatch queries on the active container.
|
|
32
56
|
*
|
|
@@ -77,8 +101,6 @@ declare function useOptionalSyncQueryCaller(): OptionalSyncQueryCaller;
|
|
|
77
101
|
*/
|
|
78
102
|
declare function useInjection<T>(injectionId: ServiceIdentifier<T>): T;
|
|
79
103
|
|
|
80
|
-
type Optional<T> = T | null;
|
|
81
|
-
|
|
82
104
|
/**
|
|
83
105
|
* Resolves a value from the container if bound, returning null otherwise.
|
|
84
106
|
* Unlike {@link useInjection}, this hook does not throw when the token is not bound.
|
|
@@ -92,7 +114,7 @@ declare function useOptionalInjection<T>(injectionId: ServiceIdentifier<T>, onFa
|
|
|
92
114
|
/**
|
|
93
115
|
* Props for the component returned by {@link createInjectablesProvider}.
|
|
94
116
|
*/
|
|
95
|
-
interface
|
|
117
|
+
interface InjectablesProviderProps {
|
|
96
118
|
/**
|
|
97
119
|
* Targeted seeds bound to specific injectables or tokens.
|
|
98
120
|
* Subsequent prop changes are ignored. Use a React `key` to re-seed the tree.
|
|
@@ -110,7 +132,7 @@ type InjectablesProvider = ReturnType<typeof createInjectablesProvider>;
|
|
|
110
132
|
/**
|
|
111
133
|
* Configuration for {@link createInjectablesProvider}.
|
|
112
134
|
*/
|
|
113
|
-
interface
|
|
135
|
+
interface CreateInjectablesProviderOptions {
|
|
114
136
|
/**
|
|
115
137
|
* Services to resolve immediately on mount.
|
|
116
138
|
*/
|
|
@@ -123,15 +145,15 @@ interface ICreateInjectablesProviderOptions {
|
|
|
123
145
|
* @param options - provider configuration
|
|
124
146
|
* @returns injectables provider component
|
|
125
147
|
*/
|
|
126
|
-
declare function createInjectablesProvider(entries: ReadonlyArray<Newable<object> | InjectableDescriptor>, options?:
|
|
127
|
-
(props:
|
|
148
|
+
declare function createInjectablesProvider(entries: ReadonlyArray<Newable<object> | InjectableDescriptor>, options?: CreateInjectablesProviderOptions): {
|
|
149
|
+
(props: InjectablesProviderProps): ReactElement;
|
|
128
150
|
displayName: string;
|
|
129
151
|
};
|
|
130
152
|
|
|
131
153
|
/**
|
|
132
154
|
* React context value.
|
|
133
155
|
*/
|
|
134
|
-
interface
|
|
156
|
+
interface IocContext {
|
|
135
157
|
/**
|
|
136
158
|
* Inversify container.
|
|
137
159
|
*/
|
|
@@ -149,7 +171,7 @@ interface IIocContext {
|
|
|
149
171
|
/**
|
|
150
172
|
* Props for {@link IocProvider}.
|
|
151
173
|
*/
|
|
152
|
-
interface
|
|
174
|
+
interface IocProviderProps extends PropsWithChildren<unknown> {
|
|
153
175
|
/**
|
|
154
176
|
* External container instance. If omitted, a new container is created.
|
|
155
177
|
*/
|
|
@@ -168,7 +190,7 @@ interface IIocProviderProps extends PropsWithChildren<unknown> {
|
|
|
168
190
|
* @param props.children - components to wrap
|
|
169
191
|
* @returns provider element
|
|
170
192
|
*/
|
|
171
|
-
declare function IocProvider({ container: externalContainer, seed, children }:
|
|
193
|
+
declare function IocProvider({ container: externalContainer, seed, children }: IocProviderProps): react.FunctionComponentElement<react.ProviderProps<Optional<IocContext>>>;
|
|
172
194
|
|
|
173
195
|
/**
|
|
174
196
|
* Returns the active IoC container.
|
|
@@ -207,6 +229,11 @@ declare function useEvents(types: ReadonlyArray<EventType>, handler: EventHandle
|
|
|
207
229
|
*/
|
|
208
230
|
declare function useEventsHandler(handler: EventHandler): void;
|
|
209
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Event emitter signature.
|
|
234
|
+
*/
|
|
235
|
+
type EventEmitter<P = unknown, T extends EventType = EventType, F = unknown> = (type: T, payload?: P, from?: F) => void;
|
|
236
|
+
|
|
210
237
|
/**
|
|
211
238
|
* Returns a stable function to emit events.
|
|
212
239
|
*
|
|
@@ -214,5 +241,14 @@ declare function useEventsHandler(handler: EventHandler): void;
|
|
|
214
241
|
*/
|
|
215
242
|
declare function useEventEmitter<P = unknown, T extends EventType = EventType>(): EventEmitter<P, T>;
|
|
216
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Command calling function signature.
|
|
246
|
+
*/
|
|
247
|
+
type CommandCaller<R = unknown, D = unknown, T extends CommandType = CommandType> = (type: T, data?: D) => CommandDescriptor<R>;
|
|
248
|
+
/**
|
|
249
|
+
* Command calling function signature.
|
|
250
|
+
*/
|
|
251
|
+
type OptionalCommandCaller<R = unknown, D = unknown, T extends CommandType = CommandType> = (type: T, data?: D) => Optional<CommandDescriptor<R>>;
|
|
252
|
+
|
|
217
253
|
export { IocProvider, createInjectablesProvider, useCommandCaller, useCommandHandler, useContainer, useContainerRevision, useEvent, useEventEmitter, useEvents, useEventsHandler, useInjection, useOptionalCommandCaller, useOptionalInjection, useOptionalQueryCaller, useOptionalSyncQueryCaller, useQueryCaller, useQueryHandler, useSyncQueryCaller };
|
|
218
|
-
export type {
|
|
254
|
+
export type { CommandCaller, EventEmitter, InjectablesProvider, InjectablesProviderProps, OptionalCommandCaller, OptionalQueryCaller, OptionalSyncQueryCaller, QueryCaller, QueryResponder, SyncQueryCaller };
|