()
| 238 | } |
| 239 | |
| 240 | value(): GenericInterceptor<CTX> { |
| 241 | return async (ctx, next) => { |
| 242 | // Get the latest configuration |
| 243 | if (this.middlewareConfigView != null) { |
| 244 | this.middlewareConfig = |
| 245 | (await this.middlewareConfigView.singleValue()) ?? |
| 246 | this.middlewareConfig; |
| 247 | } |
| 248 | |
| 249 | if (this.interceptor == null) { |
| 250 | // Create a new interceptor for the first time or recreate it if it |
| 251 | // was reset to `null` when its configuration changed |
| 252 | debug( |
| 253 | 'Creating interceptor for %s with config', |
| 254 | this.middlewareFactory.name, |
| 255 | this.middlewareConfig, |
| 256 | ); |
| 257 | this.interceptor = createInterceptor( |
| 258 | this.middlewareFactory, |
| 259 | this.middlewareConfig, |
| 260 | ); |
| 261 | } |
| 262 | return this.interceptor(ctx, next); |
| 263 | }; |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | /** |
nothing calls this directly
no test coverage detected