react-obsidian 0.0.21 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +69 -3
  2. package/dist/src/decorators/Graph.d.ts +1 -1
  3. package/dist/src/decorators/Graph.d.ts.map +1 -1
  4. package/dist/src/decorators/Graph.js.map +1 -1
  5. package/dist/src/decorators/Singleton.d.ts +1 -1
  6. package/dist/src/decorators/Singleton.d.ts.map +1 -1
  7. package/dist/src/decorators/inject/Inject.d.ts +1 -1
  8. package/dist/src/decorators/inject/Inject.d.ts.map +1 -1
  9. package/dist/src/graph/registry/GraphRegistry.d.ts +1 -0
  10. package/dist/src/graph/registry/GraphRegistry.d.ts.map +1 -1
  11. package/dist/src/graph/registry/GraphRegistry.js +7 -0
  12. package/dist/src/graph/registry/GraphRegistry.js.map +1 -1
  13. package/dist/src/index.d.ts +2 -5
  14. package/dist/src/index.d.ts.map +1 -1
  15. package/dist/src/index.js +6 -9
  16. package/dist/src/index.js.map +1 -1
  17. package/dist/src/injectors/class/LazyInjector.d.ts.map +1 -1
  18. package/dist/src/injectors/class/LazyInjector.js +2 -0
  19. package/dist/src/injectors/class/LazyInjector.js.map +1 -1
  20. package/dist/src/injectors/components/InjectComponent.d.ts +8 -0
  21. package/dist/src/injectors/components/InjectComponent.d.ts.map +1 -0
  22. package/dist/src/injectors/components/InjectComponent.js +11 -0
  23. package/dist/src/injectors/components/InjectComponent.js.map +1 -0
  24. package/dist/src/injectors/hooks/InjectHook.d.ts +5 -0
  25. package/dist/src/injectors/hooks/InjectHook.d.ts.map +1 -0
  26. package/dist/src/injectors/hooks/InjectHook.js +21 -0
  27. package/dist/src/injectors/hooks/InjectHook.js.map +1 -0
  28. package/dist/src/types/index.d.ts +7 -0
  29. package/dist/src/types/index.d.ts.map +1 -1
  30. package/dist/test/{integration/fixtures → fixtures}/InjectedComponent.d.ts +0 -0
  31. package/dist/test/fixtures/InjectedComponent.d.ts.map +1 -0
  32. package/dist/test/{integration/fixtures → fixtures}/InjectedComponent.js +1 -1
  33. package/dist/test/fixtures/InjectedComponent.js.map +1 -0
  34. package/dist/test/fixtures/MainGraph.d.ts +9 -0
  35. package/dist/test/fixtures/MainGraph.d.ts.map +1 -0
  36. package/dist/test/{integration/fixtures → fixtures}/MainGraph.js +1 -1
  37. package/dist/test/fixtures/MainGraph.js.map +1 -0
  38. package/dist/test/{integration/fixtures → fixtures}/SingletonGraph.d.ts +1 -1
  39. package/dist/test/fixtures/SingletonGraph.d.ts.map +1 -0
  40. package/dist/test/{integration/fixtures → fixtures}/SingletonGraph.js +2 -2
  41. package/dist/test/fixtures/SingletonGraph.js.map +1 -0
  42. package/dist/test/{integration/fixtures → fixtures}/StringProvider.d.ts +0 -0
  43. package/dist/test/fixtures/StringProvider.d.ts.map +1 -0
  44. package/dist/test/{integration/fixtures → fixtures}/StringProvider.js +0 -0
  45. package/dist/test/fixtures/StringProvider.js.map +1 -0
  46. package/dist/test/{integration/fixtures → fixtures}/Subgraph.d.ts +1 -1
  47. package/dist/test/fixtures/Subgraph.d.ts.map +1 -0
  48. package/dist/test/{integration/fixtures → fixtures}/Subgraph.js +1 -1
  49. package/dist/test/fixtures/Subgraph.js.map +1 -0
  50. package/dist/test/{integration/fixtures → fixtures}/ThrowingMainGraph.d.ts +0 -0
  51. package/dist/test/fixtures/ThrowingMainGraph.d.ts.map +1 -0
  52. package/dist/test/{integration/fixtures → fixtures}/ThrowingMainGraph.js +1 -1
  53. package/dist/test/fixtures/ThrowingMainGraph.js.map +1 -0
  54. package/dist/test/{integration/fixtures → fixtures}/UniqueNumberGraph.d.ts +1 -1
  55. package/dist/test/fixtures/UniqueNumberGraph.d.ts.map +1 -0
  56. package/dist/test/{integration/fixtures → fixtures}/UniqueNumberGraph.js +1 -1
  57. package/dist/test/fixtures/UniqueNumberGraph.js.map +1 -0
  58. package/dist/test/{integration/fixtures → fixtures}/injectedValues.d.ts +0 -0
  59. package/dist/test/fixtures/injectedValues.d.ts.map +1 -0
  60. package/dist/test/{integration/fixtures → fixtures}/injectedValues.js +0 -0
  61. package/dist/test/fixtures/injectedValues.js.map +1 -0
  62. package/package.json +4 -5
  63. package/src/decorators/Graph.ts +2 -4
  64. package/src/graph/registry/GraphRegistry.ts +6 -0
  65. package/src/index.ts +3 -16
  66. package/src/injectors/class/LazyInjector.ts +1 -0
  67. package/src/injectors/components/InjectComponent.ts +21 -0
  68. package/src/injectors/hooks/InjectHook.ts +25 -0
  69. package/src/types/index.ts +18 -0
  70. package/dist/test/integration/fixtures/InjectedComponent.d.ts.map +0 -1
  71. package/dist/test/integration/fixtures/InjectedComponent.js.map +0 -1
  72. package/dist/test/integration/fixtures/MainGraph.d.ts +0 -7
  73. package/dist/test/integration/fixtures/MainGraph.d.ts.map +0 -1
  74. package/dist/test/integration/fixtures/MainGraph.js.map +0 -1
  75. package/dist/test/integration/fixtures/SingletonGraph.d.ts.map +0 -1
  76. package/dist/test/integration/fixtures/SingletonGraph.js.map +0 -1
  77. package/dist/test/integration/fixtures/StringProvider.d.ts.map +0 -1
  78. package/dist/test/integration/fixtures/StringProvider.js.map +0 -1
  79. package/dist/test/integration/fixtures/Subgraph.d.ts.map +0 -1
  80. package/dist/test/integration/fixtures/Subgraph.js.map +0 -1
  81. package/dist/test/integration/fixtures/ThrowingMainGraph.d.ts.map +0 -1
  82. package/dist/test/integration/fixtures/ThrowingMainGraph.js.map +0 -1
  83. package/dist/test/integration/fixtures/UniqueNumberGraph.d.ts.map +0 -1
  84. package/dist/test/integration/fixtures/UniqueNumberGraph.js.map +0 -1
  85. package/dist/test/integration/fixtures/injectedValues.d.ts.map +0 -1
  86. package/dist/test/integration/fixtures/injectedValues.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  [![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://vshymanskyy.github.io/StandWithUkraine)
2
2
 
3
- # react-obsidian
3
+ <p align="center">
4
+ </br><img width="300px" src=".github/logo.svg"></br>
5
+ </p>
6
+
7
+ # React Obsidian
4
8
  > Dependency injection framework for React and React Native applications
5
9
 
6
10
  <h5>🏗 <b>This library is still under active development.</b>
@@ -12,6 +16,9 @@ React Obsidian is a dependency injection framework for React and React Native ap
12
16
 
13
17
  React Obsidian is guided by the principles of the Dependency Injection pattern, but does not strictly follow them. We allowed ourselves a degree of freedom when designing the library in order to reduce boilerplate code and library footprint.
14
18
 
19
+ > 📖 Read more about Dependency Injection and Obsidian in [Breaking complexity with Dependency Injection: Introducing Obsidian](https://guyca.medium.com/breaking-complexity-with-dependency-injection-introducing-obsidian-cd452802f076) on Medium.
20
+
21
+
15
22
  * [Installation](https://github.com/wix-incubator/react-obsidian#installation)
16
23
  * [Prerequisites](https://github.com/wix-incubator/react-obsidian#prerequisites)
17
24
  * [Usage](https://github.com/wix-incubator/react-obsidian#usage)
@@ -25,8 +32,10 @@ React Obsidian is guided by the principles of the Dependency Injection pattern,
25
32
  * [Advance usage](https://github.com/wix-incubator/react-obsidian#advance-usage)
26
33
  * [Accessing props in graphs](https://github.com/wix-incubator/react-obsidian#accessing-props-in-graphs)
27
34
  * [Singleton graphs and providers](https://github.com/wix-incubator/react-obsidian#singleton-graphs-and-providers)
35
+ * [Lazy property injection](https://github.com/wix-incubator/react-obsidian#lazy-property-injection)
36
+ * [Typing graphs](https://github.com/wix-incubator/react-obsidian#typing-graphs)
28
37
  * [Graph middleware](https://github.com/wix-incubator/react-obsidian#graph-middleware)
29
- * [Clear graphs](https://github.com/wix-incubator/react-obsidian#clear-graphs)
38
+ * [Clearing graphs](https://github.com/wix-incubator/react-obsidian#clearing-graphs)
30
39
 
31
40
 
32
41
 
@@ -215,6 +224,63 @@ class ApplicationGraph {
215
224
  }
216
225
  ```
217
226
 
227
+ ### Lazy property injection
228
+ Class properties can be injected lazily by using the `@LazyInject()` decorator. This is useful when the injection should be done in a lifecycle method instead of in the class constructor.
229
+
230
+ ```ts
231
+ @Injectable(ApplicationGraph)
232
+ class Foo {
233
+ @LazyInject() private bar!: Bar;
234
+
235
+ constructor() {
236
+ console.log(bar) // undefined
237
+ Obsidian.inject(this);
238
+ console.log(bar) // Bar {}
239
+ }
240
+ }
241
+ ```
242
+
243
+ In the example above, the dependencies are resolved from the graph declared in the `@Injectable()` decorator. Declaring the graph in advance isn't always desirable. When using the `@LazyInject()` decorator, we can omit the `@Injectable()` decorator and specify the graph to inject from in the call to ``Obsidian.inject()`.
244
+
245
+ ```ts
246
+ class Foo {
247
+ @LazyInject() private bar!: Bar;
248
+
249
+ constructor() {
250
+ console.log(bar) // undefined
251
+ Obsidian.inject(this, () => new ApplicationGraph());
252
+ console.log(bar) // Bar {}
253
+ }
254
+ }
255
+ ```
256
+
257
+ ### Typing graphs
258
+ Obsidian exposes a utility `type` that represents the dependencies provided by a graph. This type is useful when typing props passed to components or hooks. It's especially useful when you need to differentiate between "own" props and injected props.
259
+
260
+ ```ts
261
+ type InjectedDependencies = DependenciesOf<ApplicationGraph> // { biLogger: BiLogger, httpClient: HttpClient }
262
+
263
+ // These are props our hook requires from the calling scope
264
+ interface OwnProps {
265
+ someArgs: string
266
+ }
267
+
268
+ // This interface represents the object returned from the hook
269
+ interface Result {
270
+ //
271
+ }
272
+
273
+ // Our hook requires two dependencies:
274
+ // 1. someArg - passed down from the calling scope
275
+ // 2. biLogger - injected from the ApplicationGraph
276
+ const hook = ({someArg, biLogger}: OwnProps & InjectedDependencies): Result => {
277
+ // ...
278
+ }
279
+
280
+ // When invoking the hook, it must be provided with `someArg` since OwnProps aren't optional
281
+ const injectedHook: (props: OwnProps & Partial<InjectedDependencies>) => Result = injectHookWithArguments<InjectedDependencies, OwnProps, Result>(hook, MainApplication);
282
+ ```
283
+
218
284
  ### Graph middleware
219
285
  When working on large scale applications, we often need to to hook into various low level operations. Obsidian lets you hook into the graph creation process by adding middleware(s).
220
286
 
@@ -242,7 +308,7 @@ const loggingMiddleware = new class extends GraphMiddleware {
242
308
  Obsidian.addGraphMiddleware(loggingMiddleware);
243
309
  ```
244
310
 
245
- ### Clear graphs
311
+ ### Clearing graphs
246
312
  Graphs can be cleared by invoking `Obsidian.clearGraphs()`. This is useful in tests or when you need to reset the system to it's original state, for example when a user logs out.
247
313
 
248
314
  #### Clearing graphs automatically during execution of Jest tests
@@ -4,6 +4,6 @@ import { ObjectGraph } from '../graph/ObjectGraph';
4
4
  interface GraphParams {
5
5
  subgraphs: Constructable<ObjectGraph>[];
6
6
  }
7
- export declare function Graph({ subgraphs, }?: Partial<GraphParams>): <T extends ObjectGraph<unknown>>(constructor: Constructable<T>) => Constructable<T>;
7
+ export declare function Graph({ subgraphs }?: Partial<GraphParams>): (constructor: any) => any;
8
8
  export {};
9
9
  //# sourceMappingURL=Graph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../src/decorators/Graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,UAAU,WAAW;IACnB,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;CACzC;AAED,wBAAgB,KAAK,CAAC,EACpB,SAAc,GACf,GAAE,OAAO,CAAC,WAAW,CAAM,uFAK3B"}
1
+ {"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../src/decorators/Graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,UAAU,WAAW;IACnB,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;CACzC;AAED,wBAAgB,KAAK,CAAC,EAAE,SAAc,EAAE,GAAE,OAAO,CAAC,WAAW,CAAM,iBAC5C,GAAG,SAIzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Graph.js","sourceRoot":"","sources":["../../../src/decorators/Graph.ts"],"names":[],"mappings":";;;;;;AACA,4BAA0B;AAC1B,kFAA4D;AAO5D,SAAgB,KAAK,CAAC,EAEM;QAFN,qBAEI,EAAE,KAAA,EAD1B,iBAAc,EAAd,SAAS,mBAAG,EAAE,KAAA;IAEd,OAAO,UAAwB,WAA6B;QAC1D,uBAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAC/C,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC;AAPD,sBAOC"}
1
+ {"version":3,"file":"Graph.js","sourceRoot":"","sources":["../../../src/decorators/Graph.ts"],"names":[],"mappings":";;;;;;AACA,4BAA0B;AAC1B,kFAA4D;AAO5D,SAAgB,KAAK,CAAC,EAA6C;QAA7C,qBAA2C,EAAE,KAAA,EAA3C,iBAAc,EAAd,SAAS,mBAAG,EAAE,KAAA;IACpC,OAAO,UAAC,WAAgB;QACtB,uBAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAC/C,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC;AALD,sBAKC"}
@@ -1,4 +1,4 @@
1
1
  import { Constructable } from '../types';
2
2
  import { ObjectGraph } from '../graph/ObjectGraph';
3
- export declare function Singleton(): (constructorOrGraph: Constructable<ObjectGraph> | ObjectGraph, _property?: string | undefined, descriptor?: PropertyDescriptor | undefined) => any;
3
+ export declare function Singleton(): (constructorOrGraph: Constructable<ObjectGraph> | ObjectGraph, _property?: string, descriptor?: PropertyDescriptor) => any;
4
4
  //# sourceMappingURL=Singleton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Singleton.d.ts","sourceRoot":"","sources":["../../../src/decorators/Singleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,wBAAgB,SAAS,yBAED,cAAc,WAAW,CAAC,GAAG,WAAW,kFAG3D,GAAG,CAKP"}
1
+ {"version":3,"file":"Singleton.d.ts","sourceRoot":"","sources":["../../../src/decorators/Singleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,wBAAgB,SAAS,yBAED,cAAc,WAAW,CAAC,GAAG,WAAW,cAChD,MAAM,eACL,kBAAkB,KAC9B,GAAG,CAKP"}
@@ -1,2 +1,2 @@
1
- export declare function Inject(name?: string): (target: Object | any, _propertyKey?: string | undefined, indexOrPropertyDescriptor?: number | PropertyDescriptor | undefined) => void;
1
+ export declare function Inject(name?: string): (target: Object | any, _propertyKey?: string, indexOrPropertyDescriptor?: number | PropertyDescriptor) => void;
2
2
  //# sourceMappingURL=Inject.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Inject.d.ts","sourceRoot":"","sources":["../../../../src/decorators/inject/Inject.ts"],"names":[],"mappings":"AAGA,wBAAgB,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,YAExB,MAAM,GAAG,GAAG,kHAWvB"}
1
+ {"version":3,"file":"Inject.d.ts","sourceRoot":"","sources":["../../../../src/decorators/inject/Inject.ts"],"names":[],"mappings":"AAGA,wBAAgB,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,YAExB,MAAM,GAAG,GAAG,iBACL,MAAM,8BACO,MAAM,GAAG,kBAAkB,UAS1D"}
@@ -8,6 +8,7 @@ export declare class GraphRegistry {
8
8
  private readonly graphToSubgraphs;
9
9
  private readonly graphMiddlewares;
10
10
  register(constructor: Constructable<Graph>, subgraphs?: Constructable<Graph>[]): void;
11
+ ensureRegistered(graph: Graph): void;
11
12
  getSubgraphs(graph: Graph): Graph[];
12
13
  getGraphInstance(name: string): Graph;
13
14
  resolve<T extends Graph>(Graph: Constructable<T>, props?: any): T;
@@ -1 +1 @@
1
- {"version":3,"file":"GraphRegistry.d.ts","sourceRoot":"","sources":["../../../../src/graph/registry/GraphRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAA+C;IACrF,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAA0C;IAChF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA8D;IAC/F,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA8B;IAE/D,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,SAAS,GAAE,aAAa,CAAC,KAAK,CAAC,EAAO;IAIlF,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,EAAE;IAMnC,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK;IAIrC,OAAO,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,CAAC;IASjE,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,GAAG;IAQX,OAAO,CAAC,WAAW;IAInB,KAAK,CAAC,KAAK,EAAE,KAAK;IAOlB,kBAAkB,CAAC,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC;IAIhD,qBAAqB;IAIrB,QAAQ;CAKT;;AAED,wBAAmC"}
1
+ {"version":3,"file":"GraphRegistry.d.ts","sourceRoot":"","sources":["../../../../src/graph/registry/GraphRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAA+C;IACrF,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAA0C;IAChF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA8D;IAC/F,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA8B;IAE/D,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,SAAS,GAAE,aAAa,CAAC,KAAK,CAAC,EAAO;IAIlF,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAK7B,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,EAAE;IAMnC,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK;IAIrC,OAAO,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,CAAC;IASjE,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,GAAG;IAQX,OAAO,CAAC,WAAW;IAInB,KAAK,CAAC,KAAK,EAAE,KAAK;IAQlB,kBAAkB,CAAC,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC;IAIhD,qBAAqB;IAIrB,QAAQ;CAKT;;AAED,wBAAmC"}
@@ -17,6 +17,11 @@ var GraphRegistry = /** @class */ (function () {
17
17
  if (subgraphs === void 0) { subgraphs = []; }
18
18
  this.graphToSubgraphs.set(constructor, new Set(subgraphs));
19
19
  };
20
+ GraphRegistry.prototype.ensureRegistered = function (graph) {
21
+ if (this.instanceToConstructor.get(graph))
22
+ return;
23
+ this.set(graph.constructor, graph);
24
+ };
20
25
  GraphRegistry.prototype.getSubgraphs = function (graph) {
21
26
  var _this = this;
22
27
  var _a;
@@ -55,6 +60,8 @@ var GraphRegistry = /** @class */ (function () {
55
60
  };
56
61
  GraphRegistry.prototype.clear = function (graph) {
57
62
  var Graph = this.instanceToConstructor.get(graph);
63
+ if (this.isSingleton(Graph))
64
+ return;
58
65
  this.instanceToConstructor.delete(graph);
59
66
  this.constructorToInstance.get(Graph).delete(graph);
60
67
  this.nameToInstance.delete(graph.name);
@@ -1 +1 @@
1
- {"version":3,"file":"GraphRegistry.js","sourceRoot":"","sources":["../../../../src/graph/registry/GraphRegistry.ts"],"names":[],"mappings":";;;;;;AAGA,gFAA0D;AAE1D;IAAA;QACmB,0BAAqB,GAAG,IAAI,GAAG,EAAoC,CAAC;QACpE,0BAAqB,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC/D,mBAAc,GAAG,IAAI,GAAG,EAAiB,CAAC;QAC1C,qBAAgB,GAAG,IAAI,GAAG,EAAmD,CAAC;QAC9E,qBAAgB,GAAG,IAAI,8BAAoB,EAAE,CAAC;IAiEjE,CAAC;IA/DC,gCAAQ,GAAR,UAAS,WAAiC,EAAE,SAAsC;QAAtC,0BAAA,EAAA,cAAsC;QAChF,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,oCAAY,GAAZ,UAAa,KAAY;QAAzB,iBAIC;;QAHC,IAAM,KAAK,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;QACrD,IAAM,SAAS,GAAG,MAAA,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,mCAAI,IAAI,GAAG,EAAE,CAAC;QAChE,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,KAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAf,CAAe,CAAC,CAAC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BAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,0CAAkB,GAAlB,UAAmB,UAA6B;QAC9C,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,6CAAqB,GAArB;QACE,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IAED,gCAAQ,GAAR;QACE,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;IACH,oBAAC;AAAD,CAAC,AA5ED,IA4EC;AA5EY,sCAAa;AA8E1B,kBAAe,IAAI,aAAa,EAAE,CAAC"}
@@ -1,7 +1,4 @@
1
- import React from 'react';
2
- import { ObjectGraph as _ObjectGraph } from './graph/ObjectGraph';
3
1
  import _Obsidian from './Obsidian';
4
- import { Constructable } from './types';
5
2
  export * from './types';
6
3
  export { Graph } from './decorators/Graph';
7
4
  export { Singleton } from './decorators/Singleton';
@@ -14,7 +11,7 @@ export { LazyInject } from './decorators/inject/LazyInject';
14
11
  export { GraphMiddleware } from './graph/registry/GraphMiddleware';
15
12
  export { GraphResolveChain as ResolveChain } from './graph/registry/GraphResolveChain';
16
13
  export declare const Obsidian: _Obsidian;
17
- export declare const injectComponent: <P>(Target: React.FunctionComponent<P>, Graph: Constructable<_ObjectGraph>) => React.FunctionComponent<Partial<P>>;
18
- export declare const injectHook: <Args, Result>(hook: (args: Args) => Result, Graph: Constructable<_ObjectGraph>) => (args?: Partial<Args> | undefined) => Result;
14
+ export { injectComponent } from './injectors/components/InjectComponent';
15
+ export { injectHook, injectHookWithArguments } from './injectors/hooks/InjectHook';
19
16
  export { testKit } from '../testkit';
20
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,iBAAiB,IAAI,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvF,eAAO,MAAM,QAAQ,WAAkB,CAAC;AAGxC,eAAO,MAAM,eAAe,iDAEnB,cAAc,YAAY,CAAC,wCACQ,CAAC;AAG7C,eAAO,MAAM,UAAU,sDAEd,cAAc,YAAY,CAAC,iDACC,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,iBAAiB,IAAI,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvF,eAAO,MAAM,QAAQ,WAAkB,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
package/dist/src/index.js CHANGED
@@ -17,10 +17,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.testKit = exports.injectHook = exports.injectComponent = exports.Obsidian = exports.GraphMiddleware = exports.LazyInject = exports.Inject = exports.Injectable = exports.Provides = exports.ObjectGraph = exports.Singleton = exports.Graph = void 0;
21
- var ComponentInjector_1 = __importDefault(require("./injectors/components/ComponentInjector"));
20
+ exports.testKit = exports.injectHookWithArguments = exports.injectHook = exports.injectComponent = exports.Obsidian = exports.GraphMiddleware = exports.LazyInject = exports.Inject = exports.Injectable = exports.Provides = exports.ObjectGraph = exports.Singleton = exports.Graph = void 0;
22
21
  var Obsidian_1 = __importDefault(require("./Obsidian"));
23
- var HookInjector_1 = __importDefault(require("./injectors/hooks/HookInjector"));
24
22
  __exportStar(require("./types"), exports);
25
23
  var Graph_1 = require("./decorators/Graph");
26
24
  Object.defineProperty(exports, "Graph", { enumerable: true, get: function () { return Graph_1.Graph; } });
@@ -39,12 +37,11 @@ Object.defineProperty(exports, "LazyInject", { enumerable: true, get: function (
39
37
  var GraphMiddleware_1 = require("./graph/registry/GraphMiddleware");
40
38
  Object.defineProperty(exports, "GraphMiddleware", { enumerable: true, get: function () { return GraphMiddleware_1.GraphMiddleware; } });
41
39
  exports.Obsidian = new Obsidian_1.default();
42
- var componentInjector = new ComponentInjector_1.default();
43
- var injectComponent = function (Target, Graph) { return componentInjector.inject(Target, Graph); };
44
- exports.injectComponent = injectComponent;
45
- var hookInjector = new HookInjector_1.default();
46
- var injectHook = function (hook, Graph) { return hookInjector.inject(hook, Graph); };
47
- exports.injectHook = injectHook;
40
+ var InjectComponent_1 = require("./injectors/components/InjectComponent");
41
+ Object.defineProperty(exports, "injectComponent", { enumerable: true, get: function () { return InjectComponent_1.injectComponent; } });
42
+ var InjectHook_1 = require("./injectors/hooks/InjectHook");
43
+ Object.defineProperty(exports, "injectHook", { enumerable: true, get: function () { return InjectHook_1.injectHook; } });
44
+ Object.defineProperty(exports, "injectHookWithArguments", { enumerable: true, get: function () { return InjectHook_1.injectHookWithArguments; } });
48
45
  var testkit_1 = require("../testkit");
49
46
  Object.defineProperty(exports, "testKit", { enumerable: true, get: function () { return testkit_1.testKit; } });
50
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA,+FAAyE;AACzE,wDAAmC;AACnC,gFAA0D;AAG1D,0CAAwB;AAExB,4CAA2C;AAAlC,8FAAA,KAAK,OA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1D,kHAAA,eAAe,OAAA;AAGX,QAAA,QAAQ,GAAG,IAAI,kBAAS,EAAE,CAAC;AAExC,0EAAyE;AAAhE,kHAAA,eAAe,OAAA;AACxB,2DAAmF;AAA1E,wGAAA,UAAU,OAAA;AAAE,qHAAA,uBAAuB,OAAA;AAE5C,sCAAqC;AAA5B,kGAAA,OAAO,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"LazyInjector.d.ts","sourceRoot":"","sources":["../../../../src/injectors/class/LazyInjector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAE7D,cAAM,YAAY,CAAC,CAAC,SAAS,MAAM;IACjC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,CAAC;IAS/C,OAAO,CAAC,gBAAgB;CAIzB;;AAED,wBAAkC"}
1
+ {"version":3,"file":"LazyInjector.d.ts","sourceRoot":"","sources":["../../../../src/injectors/class/LazyInjector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAE7D,cAAM,YAAY,CAAC,CAAC,SAAS,MAAM;IACjC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,CAAC;IAU/C,OAAO,CAAC,gBAAgB;CAIzB;;AAED,wBAAkC"}
@@ -11,6 +11,8 @@ var LazyInjector = /** @class */ (function () {
11
11
  function LazyInjector() {
12
12
  }
13
13
  LazyInjector.prototype.inject = function (target, sourceGraph) {
14
+ if (sourceGraph)
15
+ GraphRegistry_1.default.ensureRegistered(sourceGraph);
14
16
  var injectionMetadata = new InjectionMetadata_1.default();
15
17
  var graph = sourceGraph !== null && sourceGraph !== void 0 ? sourceGraph : this.getGraphInstance(target);
16
18
  injectionMetadata.getLazyPropertiesToInject(target.constructor).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"file":"LazyInjector.js","sourceRoot":"","sources":["../../../../src/injectors/class/LazyInjector.ts"],"names":[],"mappings":";;;;;;AACA,qFAA+D;AAC/D,0EAAoD;AAEvC,QAAA,uBAAuB,GAAG,qBAAqB,CAAC;AAE7D;IAAA;IAcA,CAAC;IAbC,6BAAM,GAAN,UAAO,MAAS,EAAE,WAAyB;QACzC,IAAM,iBAAiB,GAAG,IAAI,2BAAiB,EAAE,CAAC;QAClD,IAAM,KAAK,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC3D,iBAAiB,CAAC,yBAAyB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YAC1E,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,uCAAgB,GAAxB,UAAyB,MAAS;QAChC,IAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,+BAAuB,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC3F,OAAO,uBAAa,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IAC3D,CAAC;IACH,mBAAC;AAAD,CAAC,AAdD,IAcC;AAED,kBAAe,IAAI,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"LazyInjector.js","sourceRoot":"","sources":["../../../../src/injectors/class/LazyInjector.ts"],"names":[],"mappings":";;;;;;AACA,qFAA+D;AAC/D,0EAAoD;AAEvC,QAAA,uBAAuB,GAAG,qBAAqB,CAAC;AAE7D;IAAA;IAeA,CAAC;IAdC,6BAAM,GAAN,UAAO,MAAS,EAAE,WAAyB;QACzC,IAAI,WAAW;YAAE,uBAAa,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAC7D,IAAM,iBAAiB,GAAG,IAAI,2BAAiB,EAAE,CAAC;QAClD,IAAM,KAAK,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC3D,iBAAiB,CAAC,yBAAyB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;YAC1E,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,uCAAgB,GAAxB,UAAyB,MAAS;QAChC,IAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,+BAAuB,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC3F,OAAO,uBAAa,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IAC3D,CAAC;IACH,mBAAC;AAAD,CAAC,AAfD,IAeC;AAED,kBAAe,IAAI,YAAY,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ObjectGraph } from '../../graph/ObjectGraph';
2
+ import { Constructable } from '../../types';
3
+ interface Descriminator {
4
+ obsidianDescriminator: never;
5
+ }
6
+ export declare const injectComponent: <OwnProps = Descriminator, InjectedProps = Descriminator>(Target: import("react").FunctionComponent<(OwnProps extends infer P ? OwnProps extends Descriminator ? P : OwnProps : never) & (InjectedProps extends Descriminator ? any : InjectedProps)>, Graph: Constructable<ObjectGraph>) => import("react").FunctionComponent<InjectedProps extends Descriminator ? OwnProps extends Descriminator ? Partial<OwnProps> : OwnProps : OwnProps extends InjectedProps ? Partial<OwnProps> : OwnProps & Partial<InjectedProps>>;
7
+ export {};
8
+ //# sourceMappingURL=InjectComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InjectComponent.d.ts","sourceRoot":"","sources":["../../../../src/injectors/components/InjectComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,UAAU,aAAa;IACrB,qBAAqB,EAAE,KAAK,CAAC;CAC9B;AAID,eAAO,MAAM,eAAe,gQAKnB,cAAc,WAAW,CAAC,oOAKhC,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.injectComponent = void 0;
7
+ var ComponentInjector_1 = __importDefault(require("./ComponentInjector"));
8
+ var componentInjector = new ComponentInjector_1.default();
9
+ var injectComponent = function (Target, Graph) { return componentInjector.inject(Target, Graph); };
10
+ exports.injectComponent = injectComponent;
11
+ //# sourceMappingURL=InjectComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InjectComponent.js","sourceRoot":"","sources":["../../../../src/injectors/components/InjectComponent.ts"],"names":[],"mappings":";;;;;;AAEA,0EAAoD;AAMpD,IAAM,iBAAiB,GAAG,IAAI,2BAAiB,EAAE,CAAC;AAE3C,IAAM,eAAe,GAAG,UAC7B,MAGC,EACD,KAAiC,IAC9B,OAAA,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAIxC,EAJE,CAIF,CAAC;AAVS,QAAA,eAAe,mBAUxB"}
@@ -0,0 +1,5 @@
1
+ import { ObjectGraph } from '../../graph/ObjectGraph';
2
+ import { Constructable } from '../../types';
3
+ export declare function injectHookWithArguments<Injected, Own, Result = {}>(hook: (args: Injected & Own) => Result, Graph: Constructable<ObjectGraph>): (props: Own & Partial<Injected>) => Result;
4
+ export declare function injectHook<Injected, Result = {}>(hook: (args: Injected) => Result, Graph: Constructable<ObjectGraph>): (props?: Partial<Injected>) => Result;
5
+ //# sourceMappingURL=InjectHook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InjectHook.d.ts","sourceRoot":"","sources":["../../../../src/injectors/hooks/InjectHook.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAU5C,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,EAChE,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,GAAG,KAAK,MAAM,EACtC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,GAChC,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,MAAM,CAE5C;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,EAAE,EAC9C,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,EAChC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,GAChC,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,MAAM,CAEvC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.injectHook = exports.injectHookWithArguments = void 0;
7
+ var HookInjector_1 = __importDefault(require("./HookInjector"));
8
+ var hookInjector = new HookInjector_1.default();
9
+ // TypeScript doesn't infer generics when default types are passed in. - https://github.com/microsoft/TypeScript/issues/14400
10
+ // As a workaround, we provide two injection functions with an almost identical signature.
11
+ // 1. injectHookWithArguments: Should be used when a hook requires parameters in addition to the injected dependencies.
12
+ // 2. injectHook: Should be used when a hook does not require parameters.
13
+ function injectHookWithArguments(hook, Graph) {
14
+ return hookInjector.inject(hook, Graph);
15
+ }
16
+ exports.injectHookWithArguments = injectHookWithArguments;
17
+ function injectHook(hook, Graph) {
18
+ return hookInjector.inject(hook, Graph);
19
+ }
20
+ exports.injectHook = injectHook;
21
+ //# sourceMappingURL=InjectHook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InjectHook.js","sourceRoot":"","sources":["../../../../src/injectors/hooks/InjectHook.ts"],"names":[],"mappings":";;;;;;AAGA,gEAA0C;AAE1C,IAAM,YAAY,GAAG,IAAI,sBAAY,EAAE,CAAC;AAExC,6HAA6H;AAC7H,0FAA0F;AAC1F,uHAAuH;AACvH,yEAAyE;AAEzE,SAAgB,uBAAuB,CACrC,IAAsC,EACtC,KAAiC;IAEjC,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AALD,0DAKC;AAED,SAAgB,UAAU,CACxB,IAAgC,EAChC,KAAiC;IAEjC,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AALD,gCAKC"}
@@ -1,3 +1,4 @@
1
+ import { Graph } from '../graph/Graph';
1
2
  export declare type Constructable<T> = {
2
3
  new (...args: any): T;
3
4
  };
@@ -8,4 +9,10 @@ export declare type ServiceLocator<Clazz> = {
8
9
  [Key in keyof Clazz]: Function;
9
10
  };
10
11
  export declare type GraphInternals = 'retrieve' | 'name' | 'scope';
12
+ export declare type DependenciesOf<G> = G extends Graph ? DependenciesOf1<G> : G extends any[] ? DependenciesOfN<G> : never;
13
+ declare type DependenciesOfN<Graphs extends any[]> = Graphs extends [infer G, ...infer R] ? DependenciesOf1<G> & DependenciesOfN<R> : unknown;
14
+ declare type DependenciesOf1<Graph> = {
15
+ [Key in keyof Omit<Graph, GraphInternals>]: Graph[Key] extends (...args: any[]) => infer R ? R : never;
16
+ };
17
+ export {};
11
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"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AC,KAAK,IAAI;KAC3B,GAAG,IAAI,MAAM,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK;CACvG,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InjectedComponent.d.ts","sourceRoot":"","sources":["../../../test/fixtures/InjectedComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,sBAAsB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;;AAQD,wBAA6D"}
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var react_1 = __importDefault(require("react"));
7
- var src_1 = require("../../../src");
7
+ var src_1 = require("../../src");
8
8
  var MainGraph_1 = __importDefault(require("./MainGraph"));
9
9
  var InjectedComponent = function (_a) {
10
10
  var someString = _a.someString, stringFromSubgraph = _a.stringFromSubgraph;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InjectedComponent.js","sourceRoot":"","sources":["../../../test/fixtures/InjectedComponent.tsx"],"names":[],"mappings":";;;;;AAAA,gDAA0B;AAC1B,iCAA4C;AAC5C,0DAAoC;AAOpC,IAAM,iBAAiB,GAAG,UAAC,EAA0D;QAAxD,UAAU,gBAAA,EAAE,kBAAkB,wBAAA;IAA+B,OAAA,CACxF,8DACG,UAAG,UAAU,SAAG,kBAAkB,CAAE,CACpC,CACJ;AAJyF,CAIzF,CAAC;AAEF,kBAAe,IAAA,qBAAe,EAAC,iBAAiB,EAAE,mBAAS,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ObjectGraph, DependenciesOf } from '../../src';
2
+ import StringProvider from './StringProvider';
3
+ import Subgraph from './Subgraph';
4
+ export declare type Dependencies = DependenciesOf<[MainGraph, Subgraph]>;
5
+ export default class MainGraph extends ObjectGraph {
6
+ someString(stringProvider: StringProvider): string;
7
+ anotherString(): string;
8
+ }
9
+ //# sourceMappingURL=MainGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MainGraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/MainGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAEX,cAAc,EACf,MAAM,WAAW,CAAC;AAEnB,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,oBAAY,YAAY,GAAG,cAAc,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGjE,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW;IAEhD,UAAU,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM;IAKlD,aAAa,IAAI,MAAM;CAGxB"}
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  return (mod && mod.__esModule) ? mod : { "default": mod };
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- var src_1 = require("../../../src");
30
+ var src_1 = require("../../src");
31
31
  var injectedValues_1 = __importDefault(require("./injectedValues"));
32
32
  var StringProvider_1 = __importDefault(require("./StringProvider"));
33
33
  var Subgraph_1 = __importDefault(require("./Subgraph"));
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MainGraph.js","sourceRoot":"","sources":["../../../test/fixtures/MainGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAKmB;AACnB,oEAA8C;AAC9C,oEAA8C;AAC9C,wDAAkC;AAKlC;IAAuC,6BAAW;IAAlD;;IAUA,CAAC;IARC,8BAAU,GAAV,UAAW,cAA8B;QACvC,OAAO,cAAc,CAAC,SAAS,CAAC;IAClC,CAAC;IAGD,iCAAa,GAAb;QACE,OAAO,wBAAc,CAAC,aAAa,CAAC;IACtC,CAAC;IAPD;QADC,IAAA,cAAQ,GAAE;;yCACgB,wBAAc;;+CAExC;IAGD;QADC,IAAA,cAAQ,GAAE;;;;kDAGV;IATkB,SAAS;QAD7B,IAAA,WAAK,EAAC,EAAE,SAAS,EAAE,CAAC,kBAAQ,CAAC,EAAE,CAAC;OACZ,SAAS,CAU7B;IAAD,gBAAC;CAAA,AAVD,CAAuC,iBAAW,GAUjD;kBAVoB,SAAS"}
@@ -1,4 +1,4 @@
1
- import { ObjectGraph } from '../../../src';
1
+ import { ObjectGraph } from '../../src';
2
2
  export default class SingletonGraph extends ObjectGraph {
3
3
  private id;
4
4
  instanceId(): string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SingletonGraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/SingletonGraph.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,WAAW,EAAY,MAAM,WAAW,CAAC;AAGzD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAAW;IACrD,OAAO,CAAC,EAAE,CAAc;IAGxB,UAAU,IAAI,MAAM;CAGrB"}
@@ -25,8 +25,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  var lodash_1 = require("lodash");
28
- var Singleton_1 = require("../../../src/decorators/Singleton");
29
- var src_1 = require("../../../src");
28
+ var Singleton_1 = require("../../src/decorators/Singleton");
29
+ var src_1 = require("../../src");
30
30
  var SingletonGraph = /** @class */ (function (_super) {
31
31
  __extends(SingletonGraph, _super);
32
32
  function SingletonGraph() {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SingletonGraph.js","sourceRoot":"","sources":["../../../test/fixtures/SingletonGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAkC;AAClC,4DAA2D;AAC3D,iCAAyD;AAGzD;IAA4C,kCAAW;IAAvD;QAAA,qEAOC;QANS,QAAE,GAAG,IAAA,iBAAQ,GAAE,CAAC;;IAM1B,CAAC;IAHC,mCAAU,GAAV;QACE,OAAO,eAAQ,IAAI,CAAC,EAAE,CAAE,CAAC;IAC3B,CAAC;IAFD;QADC,IAAA,cAAQ,GAAE;;;;oDAGV;IANkB,cAAc;QADlC,IAAA,qBAAS,GAAE;QAAE,IAAA,WAAK,GAAE;OACA,cAAc,CAOlC;IAAD,qBAAC;CAAA,AAPD,CAA4C,iBAAW,GAOtD;kBAPoB,cAAc"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringProvider.d.ts","sourceRoot":"","sources":["../../../test/fixtures/StringProvider.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,cAAc;aACL,SAAS,EAAE,MAAM;gBAAjB,SAAS,GAAE,MAA0C;CAClF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringProvider.js","sourceRoot":"","sources":["../../../test/fixtures/StringProvider.ts"],"names":[],"mappings":";;;;;AAAA,oEAA8C;AAE9C;IACE,wBAA4B,SAAqD;QAArD,0BAAA,EAAA,YAAoB,wBAAc,CAAC,kBAAkB;QAArD,cAAS,GAAT,SAAS,CAA4C;IAAI,CAAC;IACxF,qBAAC;AAAD,CAAC,AAFD,IAEC"}
@@ -1,4 +1,4 @@
1
- import { ObjectGraph } from '../../../src';
1
+ import { ObjectGraph } from '../../src';
2
2
  import StringProvider from './StringProvider';
3
3
  export default class Subgraph extends ObjectGraph {
4
4
  stringProvider(): StringProvider;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Subgraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/Subgraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,WAAW,EAAY,MAAM,WAAW,CAAC;AAEzD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAG9C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,WAAW;IAE/C,cAAc,IAAI,cAAc;IAKhC,kBAAkB,IAAI,MAAM;IAK5B,gBAAgB,IAAI,MAAM;IAK1B,UAAU,IAAI,MAAM;CAGrB"}
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  var lodash_1 = require("lodash");
31
- var src_1 = require("../../../src");
31
+ var src_1 = require("../../src");
32
32
  var injectedValues_1 = __importDefault(require("./injectedValues"));
33
33
  var StringProvider_1 = __importDefault(require("./StringProvider"));
34
34
  var Subgraph = /** @class */ (function (_super) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Subgraph.js","sourceRoot":"","sources":["../../../test/fixtures/Subgraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAkC;AAClC,iCAAyD;AACzD,oEAA8C;AAC9C,oEAA8C;AAG9C;IAAsC,4BAAW;IAAjD;;IAoBA,CAAC;IAlBC,iCAAc,GAAd;QACE,OAAO,IAAI,wBAAc,EAAE,CAAC;IAC9B,CAAC;IAGD,qCAAkB,GAAlB;QACE,OAAO,wBAAc,CAAC,YAAY,CAAC;IACrC,CAAC;IAGD,mCAAgB,GAAhB;QACE,MAAM,KAAK,CAAC,mFAAmF,CAAC,CAAC;IACnG,CAAC;IAGD,6BAAU,GAAV;QACE,OAAO,IAAA,iBAAQ,EAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAjBD;QADC,IAAA,cAAQ,GAAE;;;wCACO,wBAAc;kDAE/B;IAGD;QADC,IAAA,cAAQ,GAAE;;;;sDAGV;IAGD;QADC,IAAA,cAAQ,GAAE;;;;oDAGV;IAGD;QADC,IAAA,cAAQ,GAAE;;;;8CAGV;IAnBkB,QAAQ;QAD5B,IAAA,WAAK,GAAE;OACa,QAAQ,CAoB5B;IAAD,eAAC;CAAA,AApBD,CAAsC,iBAAW,GAoBhD;kBApBoB,QAAQ"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThrowingMainGraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/ThrowingMainGraph.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,SAAS;IAE7C,UAAU,IAAI,MAAM;CAG9B"}
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  return (mod && mod.__esModule) ? mod : { "default": mod };
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- var src_1 = require("../../../src");
30
+ var src_1 = require("../../src");
31
31
  var MainGraph_1 = __importDefault(require("./MainGraph"));
32
32
  var ThrowingMainGraph = /** @class */ (function (_super) {
33
33
  __extends(ThrowingMainGraph, _super);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThrowingMainGraph.js","sourceRoot":"","sources":["../../../test/fixtures/ThrowingMainGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA4C;AAC5C,0DAAoC;AAGpC;IAA+C,qCAAS;IAAxD;;IAKA,CAAC;IAHU,sCAAU,GAAnB;QACE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAFD;QADC,IAAA,cAAQ,GAAE;;;;uDAGV;IAJkB,iBAAiB;QADrC,IAAA,WAAK,GAAE;OACa,iBAAiB,CAKrC;IAAD,wBAAC;CAAA,AALD,CAA+C,mBAAS,GAKvD;kBALoB,iBAAiB"}
@@ -1,4 +1,4 @@
1
- import { ObjectGraph } from '../../../src';
1
+ import { ObjectGraph } from '../../src';
2
2
  export declare class UniqueNumberGraph extends ObjectGraph {
3
3
  private uniqueNumberGenerator;
4
4
  constructor(uniqueNumberGenerator: () => number);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UniqueNumberGraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/UniqueNumberGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAGZ,MAAM,WAAW,CAAC;AAEnB,qBACa,iBAAkB,SAAQ,WAAW;IACpC,OAAO,CAAC,qBAAqB;gBAArB,qBAAqB,EAAE,MAAM,MAAM;IAKvD,eAAe,IAAI,MAAM;IAKzB,cAAc,IAAI,MAAM;CAGzB"}
@@ -25,7 +25,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.UniqueNumberGraph = void 0;
28
- var src_1 = require("../../../src");
28
+ var src_1 = require("../../src");
29
29
  var UniqueNumberGraph = /** @class */ (function (_super) {
30
30
  __extends(UniqueNumberGraph, _super);
31
31
  function UniqueNumberGraph(uniqueNumberGenerator) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UniqueNumberGraph.js","sourceRoot":"","sources":["../../../test/fixtures/UniqueNumberGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAKmB;AAGnB;IAAuC,qCAAW;IAChD,2BAAoB,qBAAmC;QAAvD,YACE,iBAAO,SACR;QAFmB,2BAAqB,GAArB,qBAAqB,CAAc;;IAEvD,CAAC;IAGD,2CAAe,GAAf;QACE,OAAO,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACtC,CAAC;IAGD,0CAAc,GAAd;QACE,OAAO,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACtC,CAAC;IAPD;QADC,IAAA,cAAQ,GAAE;QAAE,IAAA,eAAS,GAAE;;;;4DAGvB;IAGD;QADC,IAAA,cAAQ,GAAE;;;;2DAGV;IAbU,iBAAiB;QAD7B,IAAA,WAAK,GAAE;;OACK,iBAAiB,CAc7B;IAAD,wBAAC;CAAA,AAdD,CAAuC,iBAAW,GAcjD;AAdY,8CAAiB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectedValues.d.ts","sourceRoot":"","sources":["../../../test/fixtures/injectedValues.ts"],"names":[],"mappings":";;;;;AAAA,wBAIE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectedValues.js","sourceRoot":"","sources":["../../../test/fixtures/injectedValues.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,YAAY,EAAE,cAAc;IAC5B,kBAAkB,EAAE,qBAAqB;IACzC,aAAa,EAAE,6BAA6B;CAC7C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-obsidian",
3
- "version": "0.0.21",
3
+ "version": "0.0.24",
4
4
  "description": "Dependency injection framework for React and React Native applications",
5
5
  "scripts": {
6
6
  "prepack": "npm run lint && tsc --project tsconfig.prod.json",
@@ -24,11 +24,9 @@
24
24
  "@babel/core": "7.16.x",
25
25
  "@babel/plugin-proposal-decorators": "7.16.x",
26
26
  "@babel/preset-env": "7.16.x",
27
- "babel-plugin-parameter-decorator": "1.x.x",
28
27
  "@babel/preset-react": "7.16.x",
29
28
  "@babel/preset-typescript": "7.16.x",
30
29
  "@babel/types": "7.16.x",
31
- "@babel/traverse": "7.16.x",
32
30
  "@johanblumenberg/ts-mockito": "1.x.x",
33
31
  "@testing-library/react": "^12.1.2",
34
32
  "@testing-library/react-hooks": "^7.0.2",
@@ -40,6 +38,7 @@
40
38
  "@types/react-test-renderer": "17.0.1",
41
39
  "@typescript-eslint/eslint-plugin": "^5.3.0",
42
40
  "@typescript-eslint/parser": "^5.3.0",
41
+ "babel-plugin-parameter-decorator": "1.x.x",
43
42
  "eslint": "^7.32.0",
44
43
  "eslint-config-airbnb-typescript": "^16.0.0",
45
44
  "eslint-plugin-import": "^2.25.2",
@@ -52,8 +51,8 @@
52
51
  "lodash": "^4.17.21",
53
52
  "react": "17.0.2",
54
53
  "react-dom": "17.0.2",
55
- "typescript": "^4.5.4",
56
- "setimmediate": "^1.0.5"
54
+ "setimmediate": "^1.0.5",
55
+ "typescript": "^4.5.4"
57
56
  },
58
57
  "repository": {
59
58
  "type": "git",
@@ -7,10 +7,8 @@ interface GraphParams {
7
7
  subgraphs: Constructable<ObjectGraph>[];
8
8
  }
9
9
 
10
- export function Graph({
11
- subgraphs = [],
12
- }: Partial<GraphParams> = {}) {
13
- return <T extends ObjectGraph>(constructor: Constructable<T>) => {
10
+ export function Graph({ subgraphs = [] }: Partial<GraphParams> = {}) {
11
+ return (constructor: any) => {
14
12
  graphRegistry.register(constructor, subgraphs);
15
13
  return constructor;
16
14
  };
@@ -14,6 +14,11 @@ export class GraphRegistry {
14
14
  this.graphToSubgraphs.set(constructor, new Set(subgraphs));
15
15
  }
16
16
 
17
+ ensureRegistered(graph: Graph) {
18
+ if (this.instanceToConstructor.get(graph)) return;
19
+ this.set(graph.constructor as any, graph);
20
+ }
21
+
17
22
  getSubgraphs(graph: Graph): Graph[] {
18
23
  const Graph = this.instanceToConstructor.get(graph)!;
19
24
  const subgraphs = this.graphToSubgraphs.get(Graph) ?? new Set();
@@ -55,6 +60,7 @@ export class GraphRegistry {
55
60
 
56
61
  clear(graph: Graph) {
57
62
  const Graph = this.instanceToConstructor.get(graph)!;
63
+ if (this.isSingleton(Graph)) return;
58
64
  this.instanceToConstructor.delete(graph);
59
65
  this.constructorToInstance.get(Graph)!.delete(graph);
60
66
  this.nameToInstance.delete(graph.name);
package/src/index.ts CHANGED
@@ -1,9 +1,4 @@
1
- import React from 'react';
2
- import { ObjectGraph as _ObjectGraph } from './graph/ObjectGraph';
3
- import ComponentInjector from './injectors/components/ComponentInjector';
4
1
  import _Obsidian from './Obsidian';
5
- import HookInjector from './injectors/hooks/HookInjector';
6
- import { Constructable } from './types';
7
2
 
8
3
  export * from './types';
9
4
 
@@ -17,18 +12,10 @@ export { Inject } from './decorators/inject/Inject';
17
12
  export { LazyInject } from './decorators/inject/LazyInject';
18
13
  export { GraphMiddleware } from './graph/registry/GraphMiddleware';
19
14
  export { GraphResolveChain as ResolveChain } from './graph/registry/GraphResolveChain';
20
- export const Obsidian = new _Obsidian();
21
15
 
22
- const componentInjector = new ComponentInjector();
23
- export const injectComponent = <P> (
24
- Target: React.FunctionComponent<P>,
25
- Graph: Constructable<_ObjectGraph>,
26
- ) => componentInjector.inject(Target, Graph);
16
+ export const Obsidian = new _Obsidian();
27
17
 
28
- const hookInjector = new HookInjector();
29
- export const injectHook = <Args, Result> (
30
- hook: (args: Args) => Result,
31
- Graph: Constructable<_ObjectGraph>,
32
- ) => hookInjector.inject(hook, Graph);
18
+ export { injectComponent } from './injectors/components/InjectComponent';
19
+ export { injectHook, injectHookWithArguments } from './injectors/hooks/InjectHook';
33
20
 
34
21
  export { testKit } from '../testkit';
@@ -6,6 +6,7 @@ export const GRAPH_INSTANCE_NAME_KEY = 'GRAPH_INSTANCE_NAME';
6
6
 
7
7
  class LazyInjector<T extends object> {
8
8
  inject(target: T, sourceGraph?: ObjectGraph): T {
9
+ if (sourceGraph) graphRegistry.ensureRegistered(sourceGraph);
9
10
  const injectionMetadata = new InjectionMetadata();
10
11
  const graph = sourceGraph ?? this.getGraphInstance(target);
11
12
  injectionMetadata.getLazyPropertiesToInject(target.constructor).forEach((key) => {
@@ -0,0 +1,21 @@
1
+ import { ObjectGraph } from '../../graph/ObjectGraph';
2
+ import { Constructable } from '../../types';
3
+ import ComponentInjector from './ComponentInjector';
4
+
5
+ interface Descriminator {
6
+ obsidianDescriminator: never;
7
+ }
8
+
9
+ const componentInjector = new ComponentInjector();
10
+
11
+ export const injectComponent = <OwnProps = Descriminator, InjectedProps = Descriminator> (
12
+ Target: React.FunctionComponent<
13
+ (OwnProps extends infer P ? OwnProps extends Descriminator ? P : OwnProps : never) &
14
+ (InjectedProps extends Descriminator ? any : InjectedProps)
15
+ >,
16
+ Graph: Constructable<ObjectGraph>,
17
+ ) => componentInjector.inject(Target, Graph) as React.FunctionComponent<
18
+ InjectedProps extends Descriminator ?
19
+ OwnProps extends Descriminator ? Partial<OwnProps> : OwnProps :
20
+ OwnProps extends InjectedProps ? Partial<OwnProps> : OwnProps & Partial<InjectedProps>
21
+ >;
@@ -0,0 +1,25 @@
1
+ /* eslint-disable max-len */
2
+ import { ObjectGraph } from '../../graph/ObjectGraph';
3
+ import { Constructable } from '../../types';
4
+ import HookInjector from './HookInjector';
5
+
6
+ const hookInjector = new HookInjector();
7
+
8
+ // TypeScript doesn't infer generics when default types are passed in. - https://github.com/microsoft/TypeScript/issues/14400
9
+ // As a workaround, we provide two injection functions with an almost identical signature.
10
+ // 1. injectHookWithArguments: Should be used when a hook requires parameters in addition to the injected dependencies.
11
+ // 2. injectHook: Should be used when a hook does not require parameters.
12
+
13
+ export function injectHookWithArguments<Injected, Own, Result = {}>(
14
+ hook: (args: Injected & Own) => Result,
15
+ Graph: Constructable<ObjectGraph>,
16
+ ): (props: Own & Partial<Injected>) => Result {
17
+ return hookInjector.inject(hook, Graph);
18
+ }
19
+
20
+ export function injectHook<Injected, Result = {}>(
21
+ hook: (args: Injected) => Result,
22
+ Graph: Constructable<ObjectGraph>,
23
+ ): (props?: Partial<Injected>) => Result {
24
+ return hookInjector.inject(hook, Graph);
25
+ }
@@ -1,3 +1,5 @@
1
+ import { Graph } from '../graph/Graph';
2
+
1
3
  export type Constructable<T> = {
2
4
  new(...args: any): T;
3
5
  };
@@ -9,3 +11,19 @@ export type ServiceLocator<Clazz> = {
9
11
  };
10
12
 
11
13
  export type GraphInternals = 'retrieve' | 'name' | 'scope';
14
+
15
+ export type DependenciesOf<G> =
16
+ G extends Graph ?
17
+ DependenciesOf1<G> :
18
+ G extends any[] ?
19
+ DependenciesOfN<G> :
20
+ never;
21
+
22
+ type DependenciesOfN<Graphs extends any[]> =
23
+ Graphs extends [infer G, ...infer R] ?
24
+ DependenciesOf1<G> & DependenciesOfN<R> :
25
+ unknown;
26
+
27
+ type DependenciesOf1<Graph> = {
28
+ [Key in keyof Omit<Graph, GraphInternals>]: Graph[Key] extends (...args: any[]) => infer R ? R : never;
29
+ };
@@ -1 +0,0 @@
1
- {"version":3,"file":"InjectedComponent.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/InjectedComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,sBAAsB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;;AAQD,wBAA6D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"InjectedComponent.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/InjectedComponent.tsx"],"names":[],"mappings":";;;;;AAAA,gDAA0B;AAC1B,oCAA+C;AAC/C,0DAAoC;AAOpC,IAAM,iBAAiB,GAAG,UAAC,EAA0D;QAAxD,UAAU,gBAAA,EAAE,kBAAkB,wBAAA;IAA+B,OAAA,CACxF,8DACG,UAAG,UAAU,SAAG,kBAAkB,CAAE,CACpC,CACJ;AAJyF,CAIzF,CAAC;AAEF,kBAAe,IAAA,qBAAe,EAAC,iBAAiB,EAAE,mBAAS,CAAC,CAAC"}
@@ -1,7 +0,0 @@
1
- import { ObjectGraph } from '../../../src';
2
- import StringProvider from './StringProvider';
3
- export default class MainGraph extends ObjectGraph {
4
- someString(stringProvider: StringProvider): string;
5
- anotherString(): string;
6
- }
7
- //# sourceMappingURL=MainGraph.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MainGraph.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/MainGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAY,MAAM,cAAc,CAAC;AAE5D,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAI9C,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW;IAEhD,UAAU,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM;IAKlD,aAAa,IAAI,MAAM;CAGxB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MainGraph.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/MainGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA4D;AAC5D,oEAA8C;AAC9C,oEAA8C;AAC9C,wDAAkC;AAGlC;IAAuC,6BAAW;IAAlD;;IAUA,CAAC;IARC,8BAAU,GAAV,UAAW,cAA8B;QACvC,OAAO,cAAc,CAAC,SAAS,CAAC;IAClC,CAAC;IAGD,iCAAa,GAAb;QACE,OAAO,wBAAc,CAAC,aAAa,CAAC;IACtC,CAAC;IAPD;QADC,IAAA,cAAQ,GAAE;;yCACgB,wBAAc;;+CAExC;IAGD;QADC,IAAA,cAAQ,GAAE;;;;kDAGV;IATkB,SAAS;QAD7B,IAAA,WAAK,EAAC,EAAE,SAAS,EAAE,CAAC,kBAAQ,CAAC,EAAE,CAAC;OACZ,SAAS,CAU7B;IAAD,gBAAC;CAAA,AAVD,CAAuC,iBAAW,GAUjD;kBAVoB,SAAS"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SingletonGraph.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/SingletonGraph.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,WAAW,EAAY,MAAM,cAAc,CAAC;AAG5D,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAAW;IACrD,OAAO,CAAC,EAAE,CAAc;IAGxB,UAAU,IAAI,MAAM;CAGrB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SingletonGraph.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/SingletonGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAkC;AAClC,+DAA8D;AAC9D,oCAA4D;AAG5D;IAA4C,kCAAW;IAAvD;QAAA,qEAOC;QANS,QAAE,GAAG,IAAA,iBAAQ,GAAE,CAAC;;IAM1B,CAAC;IAHC,mCAAU,GAAV;QACE,OAAO,eAAQ,IAAI,CAAC,EAAE,CAAE,CAAC;IAC3B,CAAC;IAFD;QADC,IAAA,cAAQ,GAAE;;;;oDAGV;IANkB,cAAc;QADlC,IAAA,qBAAS,GAAE;QAAE,IAAA,WAAK,GAAE;OACA,cAAc,CAOlC;IAAD,qBAAC;CAAA,AAPD,CAA4C,iBAAW,GAOtD;kBAPoB,cAAc"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"StringProvider.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/StringProvider.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,cAAc;aACL,SAAS,EAAE,MAAM;gBAAjB,SAAS,GAAE,MAA0C;CAClF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"StringProvider.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/StringProvider.ts"],"names":[],"mappings":";;;;;AAAA,oEAA8C;AAE9C;IACE,wBAA4B,SAAqD;QAArD,0BAAA,EAAA,YAAoB,wBAAc,CAAC,kBAAkB;QAArD,cAAS,GAAT,SAAS,CAA4C;IAAI,CAAC;IACxF,qBAAC;AAAD,CAAC,AAFD,IAEC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Subgraph.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/Subgraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,WAAW,EAAY,MAAM,cAAc,CAAC;AAE5D,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAG9C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,WAAW;IAE/C,cAAc,IAAI,cAAc;IAKhC,kBAAkB,IAAI,MAAM;IAK5B,gBAAgB,IAAI,MAAM;IAK1B,UAAU,IAAI,MAAM;CAGrB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Subgraph.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/Subgraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAkC;AAClC,oCAA4D;AAC5D,oEAA8C;AAC9C,oEAA8C;AAG9C;IAAsC,4BAAW;IAAjD;;IAoBA,CAAC;IAlBC,iCAAc,GAAd;QACE,OAAO,IAAI,wBAAc,EAAE,CAAC;IAC9B,CAAC;IAGD,qCAAkB,GAAlB;QACE,OAAO,wBAAc,CAAC,YAAY,CAAC;IACrC,CAAC;IAGD,mCAAgB,GAAhB;QACE,MAAM,KAAK,CAAC,mFAAmF,CAAC,CAAC;IACnG,CAAC;IAGD,6BAAU,GAAV;QACE,OAAO,IAAA,iBAAQ,EAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAjBD;QADC,IAAA,cAAQ,GAAE;;;wCACO,wBAAc;kDAE/B;IAGD;QADC,IAAA,cAAQ,GAAE;;;;sDAGV;IAGD;QADC,IAAA,cAAQ,GAAE;;;;oDAGV;IAGD;QADC,IAAA,cAAQ,GAAE;;;;8CAGV;IAnBkB,QAAQ;QAD5B,IAAA,WAAK,GAAE;OACa,QAAQ,CAoB5B;IAAD,eAAC;CAAA,AApBD,CAAsC,iBAAW,GAoBhD;kBApBoB,QAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThrowingMainGraph.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/ThrowingMainGraph.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,SAAS;IAE7C,UAAU,IAAI,MAAM;CAG9B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThrowingMainGraph.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/ThrowingMainGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA+C;AAC/C,0DAAoC;AAGpC;IAA+C,qCAAS;IAAxD;;IAKA,CAAC;IAHU,sCAAU,GAAnB;QACE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAFD;QADC,IAAA,cAAQ,GAAE;;;;uDAGV;IAJkB,iBAAiB;QADrC,IAAA,WAAK,GAAE;OACa,iBAAiB,CAKrC;IAAD,wBAAC;CAAA,AALD,CAA+C,mBAAS,GAKvD;kBALoB,iBAAiB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UniqueNumberGraph.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/UniqueNumberGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAGZ,MAAM,cAAc,CAAC;AAEtB,qBACa,iBAAkB,SAAQ,WAAW;IACpC,OAAO,CAAC,qBAAqB;gBAArB,qBAAqB,EAAE,MAAM,MAAM;IAKvD,eAAe,IAAI,MAAM;IAKzB,cAAc,IAAI,MAAM;CAGzB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UniqueNumberGraph.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/UniqueNumberGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAKsB;AAGtB;IAAuC,qCAAW;IAChD,2BAAoB,qBAAmC;QAAvD,YACE,iBAAO,SACR;QAFmB,2BAAqB,GAArB,qBAAqB,CAAc;;IAEvD,CAAC;IAGD,2CAAe,GAAf;QACE,OAAO,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACtC,CAAC;IAGD,0CAAc,GAAd;QACE,OAAO,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACtC,CAAC;IAPD;QADC,IAAA,cAAQ,GAAE;QAAE,IAAA,eAAS,GAAE;;;;4DAGvB;IAGD;QADC,IAAA,cAAQ,GAAE;;;;2DAGV;IAbU,iBAAiB;QAD7B,IAAA,WAAK,GAAE;;OACK,iBAAiB,CAc7B;IAAD,wBAAC;CAAA,AAdD,CAAuC,iBAAW,GAcjD;AAdY,8CAAiB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"injectedValues.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/injectedValues.ts"],"names":[],"mappings":";;;;;AAAA,wBAIE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"injectedValues.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/injectedValues.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,YAAY,EAAE,cAAc;IAC5B,kBAAkB,EAAE,qBAAqB;IACzC,aAAa,EAAE,6BAA6B;CAC7C,CAAC"}