Skip to content

Commit 6007703

Browse files
2 parents 6325fb5 + 4be7b28 commit 6007703

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

content/components.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Providers are a fundamental concept in Nest. Many of the basic Nest classes may
44

55
<figure><img class="illustrative-image" src="/assets/Components_1.png" /></figure>
66

7-
In the previous chapter, we built a simple `CatsController`. Controllers should handle HTTP requests and delegate more complex tasks to **providers**. Providers are plain JavaScript classes that are declared as `providers` in a [module](/modules).
7+
In the previous chapter, we built a simple `CatsController`. Controllers should handle HTTP requests and delegate more complex tasks to **providers**. Providers are plain JavaScript classes that are declared as `providers` in a NestJS module. For more information, see the "Modules" chapter.
88

9-
> info **Hint** Since Nest enables the possibility to design and organize dependencies in a more OO way, we strongly recommend following the [SOLID](https://en.wikipedia.org/wiki/SOLID) principles.
9+
> info **Hint** Since Nest enables the possibility to design and organize dependencies in a more OO way, we strongly recommend following the [SOLID principles](https://en.wikipedia.org/wiki/SOLID).
1010
1111
#### Services
1212

@@ -112,7 +112,7 @@ The `CatsService` is **injected** through the class constructor. Notice the use
112112

113113
#### Dependency injection
114114

115-
Nest is built around the strong design pattern commonly known as **Dependency injection**. We recommend reading a great article about this concept in the official [Angular](https://angular.dev/guide/di) documentation.
115+
Nest is built around the strong design pattern commonly known as **Dependency injection**. We recommend reading a great article about this concept in the official [Angular documentation](https://angular.dev/guide/di).
116116

117117
In Nest, thanks to TypeScript capabilities, it's extremely easy to manage dependencies because they are resolved just by type. In the example below, Nest will resolve the `catsService` by creating and returning an instance of `CatsService` (or, in the normal case of a singleton, returning the existing instance if it has already been requested elsewhere). This dependency is resolved and passed to your controller's constructor (or assigned to the indicated property):
118118

@@ -122,13 +122,13 @@ constructor(private catsService: CatsService) {}
122122

123123
#### Scopes
124124

125-
Providers normally have a lifetime ("scope") synchronized with the application lifecycle. When the application is bootstrapped, every dependency must be resolved, and therefore every provider has to be instantiated. Similarly, when the application shuts down, each provider will be destroyed. However, there are ways to make your provider lifetime **request-scoped** as well. You can read more about these techniques [here](/fundamentals/injection-scopes).
125+
Providers normally have a lifetime ("scope") synchronized with the application lifecycle. When the application is bootstrapped, every dependency must be resolved, and therefore every provider has to be instantiated. Similarly, when the application shuts down, each provider will be destroyed. However, there are ways to make your provider lifetime **request-scoped** as well. You can read more about these techniques in the [Injection Scopes](/fundamentals/injection-scopes) chapter.
126126

127127
<app-banner-courses></app-banner-courses>
128128

129129
#### Custom providers
130130

131-
Nest has a built-in inversion of control ("IoC") container that resolves relationships between providers. This feature underlies the dependency injection feature described above, but is in fact far more powerful than what we've described so far. There are several ways to define a provider: you can use plain values, classes, and either asynchronous or synchronous factories. More examples are provided [here](/fundamentals/dependency-injection).
131+
Nest has a built-in inversion of control ("IoC") container that resolves relationships between providers. This feature underlies the dependency injection feature described above, but is in fact far more powerful than what we've described so far. There are several ways to define a provider: you can use plain values, classes, and either asynchronous or synchronous factories. More examples of defining providers can be found in the [Dependency Injection](/fundamentals/dependency-injection) chapter.
132132

133133
#### Optional providers
134134

@@ -145,7 +145,7 @@ export class HttpService<T> {
145145
}
146146
```
147147

148-
Note that in the example above we are using a custom provider, which is the reason we include the `HTTP_OPTIONS` custom **token**. Previous examples showed constructor-based injection indicating a dependency through a class in the constructor. Read more about custom providers and their associated tokens [here](/fundamentals/custom-providers).
148+
Note that in the example above we are using a custom provider, which is the reason we include the `HTTP_OPTIONS` custom **token**. Previous examples showed constructor-based injection indicating a dependency through a class in the constructor. You can read more about custom providers and their associated tokens in the [Custom Providers](/fundamentals/custom-providers) chapter.
149149

150150
#### Property-based injection
151151

content/graphql/resolvers-map.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The type function is required when there's the potential for ambiguity between t
6767

6868
The options object can have any of the following key/value pairs:
6969

70-
- `nullable`: for specifying whether a field is nullable (in SDL, each field is non-nullable by default); `boolean`
70+
- `nullable`: for specifying whether a field is nullable (in `@nestjs/graphql`, each field is non-nullable by default); `boolean`
7171
- `description`: for setting a field description; `string`
7272
- `deprecationReason`: for marking a field as deprecated; `string`
7373

content/graphql/subscriptions.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ GraphQLModule.forRoot<ApolloDriverConfig>({
3434

3535
To create a subscription using the code first approach, we use the `@Subscription()` decorator (exported from the `@nestjs/graphql` package) and the `PubSub` class from the `graphql-subscriptions` package, which provides a simple **publish/subscribe API**.
3636

37-
The following subscription handler takes care of **subscribing** to an event by calling `PubSub#asyncIterator`. This method takes a single argument, the `triggerName`, which corresponds to an event topic name.
37+
The following subscription handler takes care of **subscribing** to an event by calling `PubSub#asyncIterableIterator`. This method takes a single argument, the `triggerName`, which corresponds to an event topic name.
3838

3939
```typescript
4040
const pubSub = new PubSub();
@@ -44,7 +44,7 @@ export class AuthorResolver {
4444
// ...
4545
@Subscription(() => Comment)
4646
commentAdded() {
47-
return pubSub.asyncIterator('commentAdded');
47+
return pubSub.asyncIterableIterator('commentAdded');
4848
}
4949
}
5050
```
@@ -68,7 +68,7 @@ Note that subscriptions, by definition, return an object with a single top level
6868
name: 'commentAdded',
6969
})
7070
subscribeToCommentAdded() {
71-
return pubSub.asyncIterator('commentAdded');
71+
return pubSub.asyncIterableIterator('commentAdded');
7272
}
7373
```
7474

@@ -111,7 +111,7 @@ To filter out specific events, set the `filter` property to a filter function. T
111111
payload.commentAdded.title === variables.title,
112112
})
113113
commentAdded(@Args('title') title: string) {
114-
return pubSub.asyncIterator('commentAdded');
114+
return pubSub.asyncIterableIterator('commentAdded');
115115
}
116116
```
117117

@@ -124,7 +124,7 @@ To mutate the published event payload, set the `resolve` property to a function.
124124
resolve: value => value,
125125
})
126126
commentAdded() {
127-
return pubSub.asyncIterator('commentAdded');
127+
return pubSub.asyncIterableIterator('commentAdded');
128128
}
129129
```
130130

@@ -140,7 +140,7 @@ If you need to access injected providers (e.g., use an external service to valid
140140
}
141141
})
142142
commentAdded() {
143-
return pubSub.asyncIterator('commentAdded');
143+
return pubSub.asyncIterableIterator('commentAdded');
144144
}
145145
```
146146

@@ -154,7 +154,7 @@ The same construction works with filters:
154154
}
155155
})
156156
commentAdded() {
157-
return pubSub.asyncIterator('commentAdded');
157+
return pubSub.asyncIterableIterator('commentAdded');
158158
}
159159
```
160160

@@ -170,7 +170,7 @@ export class AuthorResolver {
170170
// ...
171171
@Subscription()
172172
commentAdded() {
173-
return pubSub.asyncIterator('commentAdded');
173+
return pubSub.asyncIterableIterator('commentAdded');
174174
}
175175
}
176176
```
@@ -183,7 +183,7 @@ To filter out specific events based on context and arguments, set the `filter` p
183183
payload.commentAdded.title === variables.title,
184184
})
185185
commentAdded() {
186-
return pubSub.asyncIterator('commentAdded');
186+
return pubSub.asyncIterableIterator('commentAdded');
187187
}
188188
```
189189

@@ -194,7 +194,7 @@ To mutate the published payload, we can use a `resolve` function.
194194
resolve: value => value,
195195
})
196196
commentAdded() {
197-
return pubSub.asyncIterator('commentAdded');
197+
return pubSub.asyncIterableIterator('commentAdded');
198198
}
199199
```
200200

@@ -208,7 +208,7 @@ If you need to access injected providers (e.g., use an external service to valid
208208
}
209209
})
210210
commentAdded() {
211-
return pubSub.asyncIterator('commentAdded');
211+
return pubSub.asyncIterableIterator('commentAdded');
212212
}
213213
```
214214

@@ -222,7 +222,7 @@ The same construction works with filters:
222222
}
223223
})
224224
commentAdded() {
225-
return pubSub.asyncIterator('commentAdded');
225+
return pubSub.asyncIterableIterator('commentAdded');
226226
}
227227
```
228228

@@ -369,7 +369,7 @@ GraphQLModule.forRoot<MercuriusDriverConfig>({
369369

370370
To create a subscription using the code first approach, we use the `@Subscription()` decorator (exported from the `@nestjs/graphql` package) and the `PubSub` class from the `mercurius` package, which provides a simple **publish/subscribe API**.
371371

372-
The following subscription handler takes care of **subscribing** to an event by calling `PubSub#asyncIterator`. This method takes a single argument, the `triggerName`, which corresponds to an event topic name.
372+
The following subscription handler takes care of **subscribing** to an event by calling `PubSub#asyncIterableIterator`. This method takes a single argument, the `triggerName`, which corresponds to an event topic name.
373373

374374
```typescript
375375
@Resolver(() => Author)

content/techniques/queues.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ The `forRoot()` method is used to register a `bull` package configuration object
500500
- `limiter: RateLimiter` - Options to control the rate at which the queue's jobs are processed. See [RateLimiter](https://github.com/OptimalBits/bull/blob/master/REFERENCE.md#queue) for more information. Optional.
501501
- `redis: RedisOpts` - Options to configure the Redis connection. See [RedisOpts](https://github.com/OptimalBits/bull/blob/master/REFERENCE.md#queue) for more information. Optional.
502502
- `prefix: string` - Prefix for all queue keys. Optional.
503-
- `defaultJobOptions: JobOpts` - Options to control the default settings for new jobs. See [JobOpts](https://github.com/OptimalBits/bull/blob/master/REFERENCE.md#queueadd) for more information. Optional.
503+
- `defaultJobOptions: JobOpts` - Options to control the default settings for new jobs. See [JobOpts](https://github.com/OptimalBits/bull/blob/master/REFERENCE.md#queueadd) for more information. Optional. **Note: These do not take effect if you schedule jobs via a FlowProducer. See [bullmq#1034](https://github.com/taskforcesh/bullmq/issues/1034) for explanation.**
504504
- `settings: AdvancedSettings` - Advanced Queue configuration settings. These should usually not be changed. See [AdvancedSettings](https://github.com/OptimalBits/bull/blob/master/REFERENCE.md#queue) for more information. Optional.
505505

506506
All the options are optional, providing detailed control over queue behavior. These are passed directly to the Bull `Queue` constructor. Read more about these options [here](https://github.com/OptimalBits/bull/blob/master/REFERENCE.md#queue).

0 commit comments

Comments
 (0)