atomic-di 1.2.0 → 2.0.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/dist/index.d.mts CHANGED
@@ -1,50 +1,75 @@
1
+ type PromiseAwarePartial<T> = T extends Promise<infer U> ? Promise<Partial<U>> : Partial<T>;
2
+ type Mock<T> = {
3
+ isPartial: false;
4
+ resolver: Resolver<T>;
5
+ } | {
6
+ isPartial: true;
7
+ resolver: Resolver<PromiseAwarePartial<T>>;
8
+ };
1
9
  /**
2
- * A `Map` of providers to providers of the same type
3
- * which is then passed to a provider call in a resolution context object
4
- * in order to replace providers with their mocks.
10
+ * Immutable map that registers and provides mocks.
11
+ * Is passed in a resolution context and used by resolvers
12
+ * to replace or partially replace themselves with a mock if one is defined.
5
13
  */
6
- type MockMap = Omit<Map<Resolver<any>, Resolver<any>>, "set" | "get"> & {
14
+ type MockMap = {
15
+ /**
16
+ * Registers a mock for a resolver,
17
+ * creating a new `MockMap` with this registration.
18
+ *
19
+ * @param original - The original resolver.
20
+ * @param mock - The mock resolver.
21
+ */
22
+ mock<T>(original: Resolver<T>, mock: Resolver<T>): MockMap;
7
23
  /**
8
- * Sets a mock for a provider.
24
+ * Registers a partial mock for a resolver,
25
+ * creating a new `MockMap` with this registration.
26
+ * In this case, the mock resolver's resolution object will be
27
+ * merged with the original resolver's resolution object,
28
+ * overwriting certain fields.
9
29
  *
10
- * @param provider - The original provider.
11
- * @param mock - The mock provider.
30
+ * @param original - The original resolver.
31
+ * @param mock - The mock resolver.
12
32
  */
13
- set<T>(provider: Resolver<T>, mock: Resolver<T>): MockMap;
33
+ mockPartially<T extends object>(original: Resolver<T>, mock: Resolver<PromiseAwarePartial<T>>): MockMap;
14
34
  /**
15
- * Retrieves a mock of a provider. Returns undefined if there's none.
35
+ * Returns a mock of a resolver
36
+ * or `undefined` if one is not registered.
16
37
  *
17
- * @param provider - The provider.
38
+ * @param original - The original resolver.
18
39
  */
19
- get<T>(provider: Resolver<T>): Resolver<T> | undefined;
40
+ get<T>(original: Resolver<T>): Mock<T> | undefined;
20
41
  };
21
42
  /**
22
- * Creates a `Map` of providers to providers of the same type
23
- * which is then passed to a provider call in a resolution context object
24
- * in order to replace providers with their mocks.
43
+ * Creates a mock map, an immutable map that registers and provides mocks.
44
+ * Is passed in a resolution context and used by resolvers
45
+ * to replace or partially replace themselves with a mock if one is defined.
25
46
  *
26
47
  * @example
27
48
  * ```ts
28
49
  * const mocks = createMockMap()
29
- * .set(getConfig, getTestConfig)
50
+ * .mock(getDependency, getDependencyMock)
51
+ * .mockPartially(
52
+ * getOtherDepedency,
53
+ * transient(() => ({ someField: "mock" }))
54
+ * )
30
55
  *
31
- * getThing({ mocks })
56
+ * const entityWithMocks = getEntity({ mocks })
32
57
  * ```
33
58
  *
34
- * @returns The map instance.
59
+ * @returns The mock map.
35
60
  */
36
61
  declare const createMockMap: () => MockMap;
37
62
 
38
63
  /**
39
- * A `Map` of providers to their instances
40
- * that is then passed to a provider call in a resolution context object
41
- * to resolve instances of scoped providers within it.
64
+ * A `Map` of resolvers to their resolutions.
65
+ * Is passed in a resolution context and used by scoped resolvers
66
+ * to retrieve or save resolution within it.
42
67
  */
43
68
  type Scope = Map<Resolver<any>, any>;
44
69
  /**
45
- * Creates a `Map` of providers to their instances
46
- * that is then passed to a provider call in a resolution context object
47
- * to resolve instances of scoped providers within it.
70
+ * Creates a `Map` of providers to their instances.
71
+ * Is passed in a resolution context and used by scoped resolvers
72
+ * to retrieve or save resolution within it.
48
73
  *
49
74
  * @example
50
75
  * ```ts
@@ -52,97 +77,95 @@ type Scope = Map<Resolver<any>, any>;
52
77
  *
53
78
  * app.use(() => {
54
79
  * const db = getDb({ scope: requestScope })
55
- * // ...
56
80
  * })
57
81
  * ```
58
82
  *
59
- * @returns The map instance.
83
+ * @returns The map.
60
84
  */
61
85
  declare const createScope: () => Scope;
62
86
 
63
87
  /**
64
- * A function that returns a value of a particular type
65
- * with a resolution context being passed to it.
88
+ * A function that takes a resolution context
89
+ * and returns a value of some type.
66
90
  */
67
- type Resolver<T> = (context?: ResolutionContext) => T;
91
+ type ResolverFn<T> = (context?: ResolutionContext) => T;
68
92
  /**
69
- * A function that resolves an instance or a `Promise` of a particular type
70
- * based on a resolution context passed to it.
93
+ * A function that returns a value of some type
94
+ * based on a resolution context.
71
95
  */
72
- type Provider<T> = Resolver<T> & {
73
- __brand: "provider";
74
- };
96
+ type Resolver<T> = ResolverFn<T>;
75
97
  /**
76
- * A context used by providers to resolve instances
77
- * based on current scope and mocks.
98
+ * A context used by resolvers that defines the behaviour of the resolver
99
+ * with the passed mocks and scope.
78
100
  */
79
101
  type ResolutionContext = {
80
102
  scope?: Scope;
81
103
  mocks?: MockMap;
82
104
  };
83
105
  /**
84
- * Creates a transient provider that will resolve a new instance on each call.
106
+ * Creates a resolver that creates a new resolution on each call.
85
107
  *
86
108
  * @example
87
109
  * ```ts
88
- * const getThing = transient(() => createThing())
89
- * getThing() !== getThing()
110
+ * const getEntity = transient(() => createEntity())
111
+ * getEntity() !== getEntity()
90
112
  * ```
91
113
  *
92
114
  * @param resolver
93
- * A function that returns a value of a particular type
94
- * with a resolution context being passed to it.
115
+ * A function that takes a resolution context
116
+ * and returns a value of some type.
95
117
  *
96
- * @returns The transient provider.
118
+ * @returns The transient resolver.
97
119
  */
98
- declare const transient: <T>(resolver: Resolver<T>) => Provider<T>;
120
+ declare const transient: <T>(fn: ResolverFn<T>) => Resolver<T>;
99
121
  /**
100
- * Creates a singleton provider that will resolve an instance once
101
- * and return it on every call.
122
+ * Creates a resolver that creates
123
+ * a resolution once and return it on each call.
102
124
  *
103
125
  * @example
104
126
  * ```ts
105
- * const getThing = singleton(() => createThing())
106
- * getThing() === getThing()
127
+ * const getEntity = singleton(() => createEntity())
128
+ * getEntity() === getEntity()
107
129
  * ```
108
130
  *
109
- * @param resolver
110
- * A function that returns a value of a particular type
111
- * with a resolution context being passed to it.
131
+ * @param fn
132
+ * A function that takes a resolution context
133
+ * and returns a value of some type.
112
134
  *
113
- * @returns The singleton provider.
135
+ * @returns The singleton resolver.
114
136
  */
115
- declare const singleton: <T>(resolver: Resolver<T>) => Provider<T>;
137
+ declare const singleton: <T>(fn: ResolverFn<T>) => Resolver<T>;
116
138
  /**
117
- * Creates a scoped provider that will take its resolution from a passed scope
118
- * or create a new one and save it if there is none.
119
- * If no scope is passed, it will act as a singleton.
139
+ * Creates a resolver that takes its resolution
140
+ * from a scope or create a new one and save it if there is none.
141
+ * If no scope was passed in a resolution context,
142
+ * it will act as a singleton.
120
143
  *
121
144
  * @example
122
145
  * ```ts
123
- * const getThing = scoped(() => createThing())
124
- * getThing() === getThing()
146
+ * const getEntity = scoped(() => createEntity())
147
+ * getEntity() === getEntity()
125
148
  * ```
126
149
  *
127
150
  * @example
128
151
  * ```ts
129
- * const getThing = scoped(() => createThing())
152
+ * const getEntity = scoped(() => createEntity())
130
153
  * const scope = createScope()
131
- * getThing({ scope }) === getThing({ scope }) !== getThing()
154
+ * getEntity({ scope }) === getEntity({ scope }) !== getEntity()
132
155
  * ```
133
156
  *
134
- * @param resolver
135
- * A function that returns a value of a particular type
136
- * with a resolution context being passed to it.
157
+ * @param fn
158
+ * A function that takes a resolution context
159
+ * and returns a value of some type.
137
160
  *
138
- * @returns The scoped provider.
161
+ * @returns The scoped resolver.
139
162
  */
140
- declare const scoped: <T>(resolver: Resolver<T>) => Provider<T>;
163
+ declare const scoped: <T>(fn: ResolverFn<T>) => Resolver<T>;
141
164
 
142
- type ProviderList = Provider<any>[];
143
- type ProviderRecord = Record<string, Provider<any>>;
144
- type InferProviderCollectionResolutions<Providers extends ProviderList | ProviderRecord> = {
145
- [K in keyof Providers]: Providers[K] extends Provider<infer T> ? T : never;
165
+ type ResolverList = Resolver<any>[];
166
+ type ResolverRecord = Record<string, Resolver<any>>;
167
+ type InferResolverCollectionResolutions<Resolvers extends ResolverList | ResolverRecord> = {
168
+ [K in keyof Resolvers]: Resolvers[K] extends Resolver<infer T> ? T : never;
146
169
  };
147
170
  /**
148
171
  * Awaits all promises and wraps the collection in a promise
@@ -153,12 +176,12 @@ type AwaitValuesInCollection<T extends any[] | Record<any, any>> = Promise<any>
153
176
  [I in keyof T]: T[I] extends Promise<infer T> ? T : T[I];
154
177
  }> : T;
155
178
  /**
156
- * Calls every provider in a list with a provided resolution context
179
+ * Calls every resolver in a list with a provided resolution context
157
180
  * and returns a list of resolutions. Returns a `Promise` of a list
158
181
  * of awaited resolutions if there's at least one `Promise` in the resolutions.
159
182
  *
160
183
  * @example
161
- * Only sync providers:
184
+ * Only sync resolvers:
162
185
  * ```ts
163
186
  * const getA = scoped(() => createA())
164
187
  * const getB = scoped(() => createB())
@@ -178,7 +201,7 @@ type AwaitValuesInCollection<T extends any[] | Record<any, any>> = Promise<any>
178
201
  * ```
179
202
  *
180
203
  * @example
181
- * Some provider is async:
204
+ * Some resolver is async:
182
205
  * ```ts
183
206
  * const getA = scoped(() => createA())
184
207
  * const getB = scoped(async () => await createB())
@@ -197,20 +220,20 @@ type AwaitValuesInCollection<T extends any[] | Record<any, any>> = Promise<any>
197
220
  * ]
198
221
  * ```
199
222
  *
200
- * @param providers - The list of providers.
223
+ * @param resolvers - The list of resolvers.
201
224
  * @param context - The resolution context.
202
225
  *
203
226
  * @returns The list of resolutions.
204
227
  */
205
- declare const resolveList: <const Providers extends ProviderList>(providers: Providers, context?: ResolutionContext) => AwaitValuesInCollection<InferProviderCollectionResolutions<Providers>>;
228
+ declare const resolveList: <const Resolvers extends ResolverList>(resolvers: Resolvers, context?: ResolutionContext) => AwaitValuesInCollection<InferResolverCollectionResolutions<Resolvers>>;
206
229
  /**
207
- * Calls every provider in a map with a provided resolution context
230
+ * Calls every resolver in a map with a provided resolution context
208
231
  * and returns a map with identical keys but with resolutions in values instead.
209
232
  * Returns a `Promise` of a map of awaited resolutions if there's at least one
210
233
  * `Promise` in the resolutions.
211
234
  *
212
235
  * @example
213
- * Only sync providers:
236
+ * Only sync resolvers:
214
237
  * ```ts
215
238
  * const getA = scoped(() => createA())
216
239
  * const getB = scoped(() => createB())
@@ -230,7 +253,7 @@ declare const resolveList: <const Providers extends ProviderList>(providers: Pro
230
253
  * ```
231
254
  *
232
255
  * @example
233
- * Some provider is async:
256
+ * Some resolver is async:
234
257
  * ```ts
235
258
  * const getA = scoped(() => createA())
236
259
  * const getB = scoped(async () => await createB())
@@ -249,11 +272,11 @@ declare const resolveList: <const Providers extends ProviderList>(providers: Pro
249
272
  * }
250
273
  * ```
251
274
  *
252
- * @param providers - The map of providers.
275
+ * @param resolvers - The map of resolvers.
253
276
  * @param context - The resolution context.
254
277
  *
255
278
  * @returns The map of resolutions.
256
279
  */
257
- declare const resolveMap: <const Providers extends ProviderRecord>(providers: Providers, context?: ResolutionContext) => AwaitValuesInCollection<InferProviderCollectionResolutions<Providers>>;
280
+ declare const resolveMap: <const Resolvers extends ResolverRecord>(resolvers: Resolvers, context?: ResolutionContext) => AwaitValuesInCollection<InferResolverCollectionResolutions<Resolvers>>;
258
281
 
259
- export { type MockMap, type Provider, type ResolutionContext, type Resolver, type Scope, createMockMap, createScope, resolveList, resolveMap, scoped, singleton, transient };
282
+ export { type MockMap, type ResolutionContext, type Resolver, type ResolverFn, type Scope, createMockMap, createScope, resolveList, resolveMap, scoped, singleton, transient };
package/dist/index.d.ts CHANGED
@@ -1,50 +1,75 @@
1
+ type PromiseAwarePartial<T> = T extends Promise<infer U> ? Promise<Partial<U>> : Partial<T>;
2
+ type Mock<T> = {
3
+ isPartial: false;
4
+ resolver: Resolver<T>;
5
+ } | {
6
+ isPartial: true;
7
+ resolver: Resolver<PromiseAwarePartial<T>>;
8
+ };
1
9
  /**
2
- * A `Map` of providers to providers of the same type
3
- * which is then passed to a provider call in a resolution context object
4
- * in order to replace providers with their mocks.
10
+ * Immutable map that registers and provides mocks.
11
+ * Is passed in a resolution context and used by resolvers
12
+ * to replace or partially replace themselves with a mock if one is defined.
5
13
  */
6
- type MockMap = Omit<Map<Resolver<any>, Resolver<any>>, "set" | "get"> & {
14
+ type MockMap = {
15
+ /**
16
+ * Registers a mock for a resolver,
17
+ * creating a new `MockMap` with this registration.
18
+ *
19
+ * @param original - The original resolver.
20
+ * @param mock - The mock resolver.
21
+ */
22
+ mock<T>(original: Resolver<T>, mock: Resolver<T>): MockMap;
7
23
  /**
8
- * Sets a mock for a provider.
24
+ * Registers a partial mock for a resolver,
25
+ * creating a new `MockMap` with this registration.
26
+ * In this case, the mock resolver's resolution object will be
27
+ * merged with the original resolver's resolution object,
28
+ * overwriting certain fields.
9
29
  *
10
- * @param provider - The original provider.
11
- * @param mock - The mock provider.
30
+ * @param original - The original resolver.
31
+ * @param mock - The mock resolver.
12
32
  */
13
- set<T>(provider: Resolver<T>, mock: Resolver<T>): MockMap;
33
+ mockPartially<T extends object>(original: Resolver<T>, mock: Resolver<PromiseAwarePartial<T>>): MockMap;
14
34
  /**
15
- * Retrieves a mock of a provider. Returns undefined if there's none.
35
+ * Returns a mock of a resolver
36
+ * or `undefined` if one is not registered.
16
37
  *
17
- * @param provider - The provider.
38
+ * @param original - The original resolver.
18
39
  */
19
- get<T>(provider: Resolver<T>): Resolver<T> | undefined;
40
+ get<T>(original: Resolver<T>): Mock<T> | undefined;
20
41
  };
21
42
  /**
22
- * Creates a `Map` of providers to providers of the same type
23
- * which is then passed to a provider call in a resolution context object
24
- * in order to replace providers with their mocks.
43
+ * Creates a mock map, an immutable map that registers and provides mocks.
44
+ * Is passed in a resolution context and used by resolvers
45
+ * to replace or partially replace themselves with a mock if one is defined.
25
46
  *
26
47
  * @example
27
48
  * ```ts
28
49
  * const mocks = createMockMap()
29
- * .set(getConfig, getTestConfig)
50
+ * .mock(getDependency, getDependencyMock)
51
+ * .mockPartially(
52
+ * getOtherDepedency,
53
+ * transient(() => ({ someField: "mock" }))
54
+ * )
30
55
  *
31
- * getThing({ mocks })
56
+ * const entityWithMocks = getEntity({ mocks })
32
57
  * ```
33
58
  *
34
- * @returns The map instance.
59
+ * @returns The mock map.
35
60
  */
36
61
  declare const createMockMap: () => MockMap;
37
62
 
38
63
  /**
39
- * A `Map` of providers to their instances
40
- * that is then passed to a provider call in a resolution context object
41
- * to resolve instances of scoped providers within it.
64
+ * A `Map` of resolvers to their resolutions.
65
+ * Is passed in a resolution context and used by scoped resolvers
66
+ * to retrieve or save resolution within it.
42
67
  */
43
68
  type Scope = Map<Resolver<any>, any>;
44
69
  /**
45
- * Creates a `Map` of providers to their instances
46
- * that is then passed to a provider call in a resolution context object
47
- * to resolve instances of scoped providers within it.
70
+ * Creates a `Map` of providers to their instances.
71
+ * Is passed in a resolution context and used by scoped resolvers
72
+ * to retrieve or save resolution within it.
48
73
  *
49
74
  * @example
50
75
  * ```ts
@@ -52,97 +77,95 @@ type Scope = Map<Resolver<any>, any>;
52
77
  *
53
78
  * app.use(() => {
54
79
  * const db = getDb({ scope: requestScope })
55
- * // ...
56
80
  * })
57
81
  * ```
58
82
  *
59
- * @returns The map instance.
83
+ * @returns The map.
60
84
  */
61
85
  declare const createScope: () => Scope;
62
86
 
63
87
  /**
64
- * A function that returns a value of a particular type
65
- * with a resolution context being passed to it.
88
+ * A function that takes a resolution context
89
+ * and returns a value of some type.
66
90
  */
67
- type Resolver<T> = (context?: ResolutionContext) => T;
91
+ type ResolverFn<T> = (context?: ResolutionContext) => T;
68
92
  /**
69
- * A function that resolves an instance or a `Promise` of a particular type
70
- * based on a resolution context passed to it.
93
+ * A function that returns a value of some type
94
+ * based on a resolution context.
71
95
  */
72
- type Provider<T> = Resolver<T> & {
73
- __brand: "provider";
74
- };
96
+ type Resolver<T> = ResolverFn<T>;
75
97
  /**
76
- * A context used by providers to resolve instances
77
- * based on current scope and mocks.
98
+ * A context used by resolvers that defines the behaviour of the resolver
99
+ * with the passed mocks and scope.
78
100
  */
79
101
  type ResolutionContext = {
80
102
  scope?: Scope;
81
103
  mocks?: MockMap;
82
104
  };
83
105
  /**
84
- * Creates a transient provider that will resolve a new instance on each call.
106
+ * Creates a resolver that creates a new resolution on each call.
85
107
  *
86
108
  * @example
87
109
  * ```ts
88
- * const getThing = transient(() => createThing())
89
- * getThing() !== getThing()
110
+ * const getEntity = transient(() => createEntity())
111
+ * getEntity() !== getEntity()
90
112
  * ```
91
113
  *
92
114
  * @param resolver
93
- * A function that returns a value of a particular type
94
- * with a resolution context being passed to it.
115
+ * A function that takes a resolution context
116
+ * and returns a value of some type.
95
117
  *
96
- * @returns The transient provider.
118
+ * @returns The transient resolver.
97
119
  */
98
- declare const transient: <T>(resolver: Resolver<T>) => Provider<T>;
120
+ declare const transient: <T>(fn: ResolverFn<T>) => Resolver<T>;
99
121
  /**
100
- * Creates a singleton provider that will resolve an instance once
101
- * and return it on every call.
122
+ * Creates a resolver that creates
123
+ * a resolution once and return it on each call.
102
124
  *
103
125
  * @example
104
126
  * ```ts
105
- * const getThing = singleton(() => createThing())
106
- * getThing() === getThing()
127
+ * const getEntity = singleton(() => createEntity())
128
+ * getEntity() === getEntity()
107
129
  * ```
108
130
  *
109
- * @param resolver
110
- * A function that returns a value of a particular type
111
- * with a resolution context being passed to it.
131
+ * @param fn
132
+ * A function that takes a resolution context
133
+ * and returns a value of some type.
112
134
  *
113
- * @returns The singleton provider.
135
+ * @returns The singleton resolver.
114
136
  */
115
- declare const singleton: <T>(resolver: Resolver<T>) => Provider<T>;
137
+ declare const singleton: <T>(fn: ResolverFn<T>) => Resolver<T>;
116
138
  /**
117
- * Creates a scoped provider that will take its resolution from a passed scope
118
- * or create a new one and save it if there is none.
119
- * If no scope is passed, it will act as a singleton.
139
+ * Creates a resolver that takes its resolution
140
+ * from a scope or create a new one and save it if there is none.
141
+ * If no scope was passed in a resolution context,
142
+ * it will act as a singleton.
120
143
  *
121
144
  * @example
122
145
  * ```ts
123
- * const getThing = scoped(() => createThing())
124
- * getThing() === getThing()
146
+ * const getEntity = scoped(() => createEntity())
147
+ * getEntity() === getEntity()
125
148
  * ```
126
149
  *
127
150
  * @example
128
151
  * ```ts
129
- * const getThing = scoped(() => createThing())
152
+ * const getEntity = scoped(() => createEntity())
130
153
  * const scope = createScope()
131
- * getThing({ scope }) === getThing({ scope }) !== getThing()
154
+ * getEntity({ scope }) === getEntity({ scope }) !== getEntity()
132
155
  * ```
133
156
  *
134
- * @param resolver
135
- * A function that returns a value of a particular type
136
- * with a resolution context being passed to it.
157
+ * @param fn
158
+ * A function that takes a resolution context
159
+ * and returns a value of some type.
137
160
  *
138
- * @returns The scoped provider.
161
+ * @returns The scoped resolver.
139
162
  */
140
- declare const scoped: <T>(resolver: Resolver<T>) => Provider<T>;
163
+ declare const scoped: <T>(fn: ResolverFn<T>) => Resolver<T>;
141
164
 
142
- type ProviderList = Provider<any>[];
143
- type ProviderRecord = Record<string, Provider<any>>;
144
- type InferProviderCollectionResolutions<Providers extends ProviderList | ProviderRecord> = {
145
- [K in keyof Providers]: Providers[K] extends Provider<infer T> ? T : never;
165
+ type ResolverList = Resolver<any>[];
166
+ type ResolverRecord = Record<string, Resolver<any>>;
167
+ type InferResolverCollectionResolutions<Resolvers extends ResolverList | ResolverRecord> = {
168
+ [K in keyof Resolvers]: Resolvers[K] extends Resolver<infer T> ? T : never;
146
169
  };
147
170
  /**
148
171
  * Awaits all promises and wraps the collection in a promise
@@ -153,12 +176,12 @@ type AwaitValuesInCollection<T extends any[] | Record<any, any>> = Promise<any>
153
176
  [I in keyof T]: T[I] extends Promise<infer T> ? T : T[I];
154
177
  }> : T;
155
178
  /**
156
- * Calls every provider in a list with a provided resolution context
179
+ * Calls every resolver in a list with a provided resolution context
157
180
  * and returns a list of resolutions. Returns a `Promise` of a list
158
181
  * of awaited resolutions if there's at least one `Promise` in the resolutions.
159
182
  *
160
183
  * @example
161
- * Only sync providers:
184
+ * Only sync resolvers:
162
185
  * ```ts
163
186
  * const getA = scoped(() => createA())
164
187
  * const getB = scoped(() => createB())
@@ -178,7 +201,7 @@ type AwaitValuesInCollection<T extends any[] | Record<any, any>> = Promise<any>
178
201
  * ```
179
202
  *
180
203
  * @example
181
- * Some provider is async:
204
+ * Some resolver is async:
182
205
  * ```ts
183
206
  * const getA = scoped(() => createA())
184
207
  * const getB = scoped(async () => await createB())
@@ -197,20 +220,20 @@ type AwaitValuesInCollection<T extends any[] | Record<any, any>> = Promise<any>
197
220
  * ]
198
221
  * ```
199
222
  *
200
- * @param providers - The list of providers.
223
+ * @param resolvers - The list of resolvers.
201
224
  * @param context - The resolution context.
202
225
  *
203
226
  * @returns The list of resolutions.
204
227
  */
205
- declare const resolveList: <const Providers extends ProviderList>(providers: Providers, context?: ResolutionContext) => AwaitValuesInCollection<InferProviderCollectionResolutions<Providers>>;
228
+ declare const resolveList: <const Resolvers extends ResolverList>(resolvers: Resolvers, context?: ResolutionContext) => AwaitValuesInCollection<InferResolverCollectionResolutions<Resolvers>>;
206
229
  /**
207
- * Calls every provider in a map with a provided resolution context
230
+ * Calls every resolver in a map with a provided resolution context
208
231
  * and returns a map with identical keys but with resolutions in values instead.
209
232
  * Returns a `Promise` of a map of awaited resolutions if there's at least one
210
233
  * `Promise` in the resolutions.
211
234
  *
212
235
  * @example
213
- * Only sync providers:
236
+ * Only sync resolvers:
214
237
  * ```ts
215
238
  * const getA = scoped(() => createA())
216
239
  * const getB = scoped(() => createB())
@@ -230,7 +253,7 @@ declare const resolveList: <const Providers extends ProviderList>(providers: Pro
230
253
  * ```
231
254
  *
232
255
  * @example
233
- * Some provider is async:
256
+ * Some resolver is async:
234
257
  * ```ts
235
258
  * const getA = scoped(() => createA())
236
259
  * const getB = scoped(async () => await createB())
@@ -249,11 +272,11 @@ declare const resolveList: <const Providers extends ProviderList>(providers: Pro
249
272
  * }
250
273
  * ```
251
274
  *
252
- * @param providers - The map of providers.
275
+ * @param resolvers - The map of resolvers.
253
276
  * @param context - The resolution context.
254
277
  *
255
278
  * @returns The map of resolutions.
256
279
  */
257
- declare const resolveMap: <const Providers extends ProviderRecord>(providers: Providers, context?: ResolutionContext) => AwaitValuesInCollection<InferProviderCollectionResolutions<Providers>>;
280
+ declare const resolveMap: <const Resolvers extends ResolverRecord>(resolvers: Resolvers, context?: ResolutionContext) => AwaitValuesInCollection<InferResolverCollectionResolutions<Resolvers>>;
258
281
 
259
- export { type MockMap, type Provider, type ResolutionContext, type Resolver, type Scope, createMockMap, createScope, resolveList, resolveMap, scoped, singleton, transient };
282
+ export { type MockMap, type ResolutionContext, type Resolver, type ResolverFn, type Scope, createMockMap, createScope, resolveList, resolveMap, scoped, singleton, transient };