@tsed/platform-log-request 8.0.0-rc.5 → 8.0.0

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.
@@ -1,8 +1,8 @@
1
- import { Configuration, registerProvider } from "@tsed/di";
1
+ import { constant, injectable } from "@tsed/di";
2
2
  import { defaultAlterLog } from "../utils/defaultAlterLog.js";
3
3
  import { defaultLogResponse } from "../utils/defaultLogResponse.js";
4
- function factory(configuration) {
5
- const { logRequest = true, alterLog = defaultAlterLog, onLogResponse = defaultLogResponse } = configuration.get("logger");
4
+ function factory() {
5
+ const { logRequest = true, alterLog = defaultAlterLog, onLogResponse = defaultLogResponse } = constant("logger", {});
6
6
  return logRequest
7
7
  ? {
8
8
  alterLog,
@@ -10,23 +10,20 @@ function factory(configuration) {
10
10
  }
11
11
  : null;
12
12
  }
13
- export const PlatformLogRequestFactory = Symbol.for("PLATFORM:LOGGER:REQUEST");
14
- registerProvider({
15
- provide: PlatformLogRequestFactory,
16
- deps: [Configuration],
17
- useFactory: factory,
18
- hooks: {
19
- $onRequest(instance, $ctx) {
20
- if (instance) {
21
- $ctx.logger.alterLog((obj, level) => instance.alterLog(level, obj, $ctx));
22
- $ctx.logStarted = true;
23
- }
24
- },
25
- $onResponse(instance, $ctx) {
26
- if (instance && $ctx.logStarted) {
27
- instance.onLogResponse($ctx);
28
- }
13
+ export const PlatformLogRequestFactory = injectable(Symbol.for("PLATFORM:LOGGER:REQUEST"))
14
+ .factory(factory)
15
+ .hooks({
16
+ $onRequest(instance, $ctx) {
17
+ if (instance) {
18
+ $ctx.logger.alterLog((obj, level) => instance.alterLog(level, obj, $ctx));
19
+ $ctx.logStarted = true;
20
+ }
21
+ },
22
+ $onResponse(instance, $ctx) {
23
+ if (instance && $ctx.logStarted) {
24
+ instance.onLogResponse($ctx);
29
25
  }
30
26
  }
31
- });
27
+ })
28
+ .token();
32
29
  //# sourceMappingURL=PlatformLogRequestFactory.js.map
@@ -1 +1 @@
1
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"}
1
+ {"version":3,"file":"PlatformLogRequestFactory.js","sourceRoot":"","sources":["../../../src/services/PlatformLogRequestFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,QAAQ,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAEhE,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAElE,SAAS,OAAO;IACd,MAAM,EACJ,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,eAAe,EAC1B,aAAa,GAAG,kBAAkB,EACnC,GAAG,QAAQ,CAA2B,QAAQ,EAAE,EAAE,CAAC,CAAC;IAErD,OAAO,UAAU;QACf,CAAC,CAAC;YACE,QAAQ;YACR,aAAa;SACd;QACH,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAID,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;KACvF,OAAO,CAAC,OAAO,CAAC;KAChB,KAAK,CAAC;IACL,UAAU,CAAC,QAAoC,EAAE,IAAiB;QAChE,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;YAC/E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC;IACH,CAAC;IACD,WAAW,CAAC,QAAoC,EAAE,IAAiB;QACjE,IAAI,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAChC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF,CAAC;KACD,KAAK,EAAE,CAAC"}
@@ -1,9 +1,8 @@
1
- import { Configuration } from "@tsed/di";
2
1
  import { defaultAlterLog } from "../utils/defaultAlterLog.js";
3
- declare function factory(configuration: Configuration): {
2
+ declare function factory(): {
4
3
  alterLog: import("../index.js").AlterLogCallback | typeof defaultAlterLog;
5
4
  onLogResponse: ($ctx: import("@tsed/di").DIContext) => void;
6
5
  } | null;
7
- export declare const PlatformLogRequestFactory: unique symbol;
8
6
  export type PlatformLogRequestFactory = ReturnType<typeof factory>;
7
+ export declare const PlatformLogRequestFactory: any;
9
8
  export {};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tsed/platform-log-request",
3
3
  "description": "Log request module for Ts.ED Framework (Express, Koa, Serverless)",
4
4
  "type": "module",
5
- "version": "8.0.0-rc.5",
5
+ "version": "8.0.0",
6
6
  "source": "./src/index.ts",
7
7
  "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
@@ -25,19 +25,19 @@
25
25
  "tslib": "2.7.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@tsed/barrels": "8.0.0-rc.5",
29
- "@tsed/di": "8.0.0-rc.5",
30
- "@tsed/platform-middlewares": "8.0.0-rc.5",
31
- "@tsed/platform-params": "8.0.0-rc.5",
32
- "@tsed/typescript": "8.0.0-rc.5",
28
+ "@tsed/barrels": "8.0.0",
29
+ "@tsed/di": "8.0.0",
30
+ "@tsed/platform-middlewares": "8.0.0",
31
+ "@tsed/platform-params": "8.0.0",
32
+ "@tsed/typescript": "8.0.0",
33
33
  "eslint": "9.12.0",
34
34
  "typescript": "5.4.5",
35
35
  "vitest": "2.1.2"
36
36
  },
37
37
  "peerDependencies": {
38
- "@tsed/di": "8.0.0-rc.5",
39
- "@tsed/platform-middlewares": "8.0.0-rc.5",
40
- "@tsed/platform-params": "8.0.0-rc.5"
38
+ "@tsed/di": "8.0.0",
39
+ "@tsed/platform-middlewares": "8.0.0",
40
+ "@tsed/platform-params": "8.0.0"
41
41
  },
42
42
  "peerDependenciesMeta": {
43
43
  "@tsed/di": {
@@ -56,8 +56,5 @@
56
56
  },
57
57
  "homepage": "https://github.com/tsedio/tsed/tree/production/packages/platform/platform-log-request",
58
58
  "author": "Romain Lenzotti",
59
- "license": "MIT",
60
- "publishConfig": {
61
- "tag": "rc"
62
- }
59
+ "license": "MIT"
63
60
  }