@dunx/create-app 3.1.0 → 3.1.2
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/package.json
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { Redis } from '@dunx/infra/redis';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* A second Redis connection, separate from the general-purpose one, reachable as
|
|
5
|
-
* a constructor parameter: `redisConnection('sessions')` returns a `Token`, which
|
|
6
|
-
* can only be reached with `inject()` in a field. `cache.module.ts` binds it with
|
|
7
|
-
* `RedisModule.forRootAsync(config, SessionsRedis)`.
|
|
8
|
-
*
|
|
9
|
-
* `cache.module.ts` binds it to database 1, which is what separates it.
|
|
10
|
-
*/
|
|
3
|
+
/** The session store, on database 1 so a cache flush cannot sign users out. */
|
|
11
4
|
export class SessionsRedis extends Redis {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HttpOptionsProvider,
|
|
3
|
-
|
|
3
|
+
WsRelay,
|
|
4
4
|
type CorsOptions,
|
|
5
5
|
type PubSubRelay,
|
|
6
6
|
type RequestLoggingOptions,
|
|
@@ -23,7 +23,8 @@ import { AppConfigService, RELAY_CHANNEL } from '../config.js';
|
|
|
23
23
|
export class AppHttpOptions extends HttpOptionsProvider {
|
|
24
24
|
constructor(
|
|
25
25
|
private readonly config: AppConfigService,
|
|
26
|
-
|
|
26
|
+
// The contract, not `RedisRelay`, so the backend changes without this moving.
|
|
27
|
+
private readonly bus: WsRelay,
|
|
27
28
|
) {
|
|
28
29
|
super();
|
|
29
30
|
this.trustProxy = this.config.get('trustProxy');
|
|
@@ -30,6 +30,9 @@ import { RequestTrail, RequestTrailMiddleware } from './request-trail.js';
|
|
|
30
30
|
* consumes it. `main.ts` used to build `new RedisRelay(...)` and thread it
|
|
31
31
|
* into `HttpFactory.create`, which was the last hand-built object in the
|
|
32
32
|
* options. The container closes it at shutdown.
|
|
33
|
+
*
|
|
34
|
+
* `forPostgresAsync` here runs the same fan-out over Postgres, with a
|
|
35
|
+
* factory returning `{ url }` for the database instead of these.
|
|
33
36
|
*/
|
|
34
37
|
WsRelayModule.forRootAsync({
|
|
35
38
|
useFactory: (config: AppConfigService) => {
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { HttpService } from '@dunx/http/client';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* A second outbound client, with its own timeout, reachable as a constructor
|
|
5
|
-
* parameter: `httpClient('health')` returns a `Token`, and a token can only be
|
|
6
|
-
* reached with `inject()` in a field. `upstream.module.ts` binds it with
|
|
7
|
-
* `HttpClientModule.forRootAsync(config, HealthClient)`.
|
|
8
|
-
*/
|
|
3
|
+
/** A probe client with its own short timeout, taken as a parameter. */
|
|
9
4
|
export class HealthClient extends HttpService {}
|