@openapi-typescript-infra/service 4.15.1 → 4.16.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.
package/build/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
+ /// <reference types="cookie-parser" />
3
4
  /// <reference types="node" />
4
5
  import type { Server } from 'http';
5
6
  import type { REPLServer } from 'repl';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openapi-typescript-infra/service",
3
- "version": "4.15.1",
3
+ "version": "4.16.0",
4
4
  "description": "An opinionated framework for building configuration driven services - web, api, or ob. Uses OpenAPI, pino logging, express, confit, Typescript and vitest.",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -79,50 +79,50 @@
79
79
  "@opentelemetry/sdk-node": "^0.43.0",
80
80
  "@opentelemetry/sdk-trace-base": "^1.18.1",
81
81
  "@opentelemetry/semantic-conventions": "^1.18.1",
82
- "@sesamecare-oss/confit": "^2.2.0",
82
+ "@sesamecare-oss/confit": "^2.2.1",
83
83
  "@sesamecare-oss/opentelemetry-node-metrics": "^1.0.1",
84
84
  "ajv": "^8.12.0",
85
85
  "cookie-parser": "^1.4.6",
86
- "dotenv": "^16.4.1",
86
+ "dotenv": "^16.4.5",
87
87
  "express": "next",
88
- "express-openapi-validator": "^5.1.2",
88
+ "express-openapi-validator": "^5.1.6",
89
89
  "glob": "^8.1.0",
90
90
  "lodash": "^4.17.21",
91
91
  "minimist": "^1.2.8",
92
92
  "opentelemetry-instrumentation-fetch-node": "^1.1.2",
93
- "pino": "^8.17.2",
93
+ "pino": "^8.19.0",
94
94
  "read-pkg-up": "^7.0.1",
95
95
  "request-ip": "^3.3.0"
96
96
  },
97
97
  "devDependencies": {
98
- "@commitlint/cli": "^18.6.0",
99
- "@commitlint/config-conventional": "^18.6.0",
98
+ "@commitlint/cli": "^19.2.1",
99
+ "@commitlint/config-conventional": "^19.1.0",
100
100
  "@openapi-typescript-infra/coconfig": "^4.3.0",
101
- "@semantic-release/commit-analyzer": "^11.1.0",
101
+ "@semantic-release/commit-analyzer": "^12.0.0",
102
102
  "@semantic-release/exec": "^6.0.3",
103
- "@semantic-release/github": "^9.2.6",
103
+ "@semantic-release/github": "^10.0.2",
104
104
  "@semantic-release/release-notes-generator": "^12.1.0",
105
- "@types/cookie-parser": "^1.4.6",
105
+ "@types/cookie-parser": "^1.4.7",
106
106
  "@types/express": "^4.17.21",
107
107
  "@types/glob": "^8.1.0",
108
- "@types/lodash": "^4.14.202",
108
+ "@types/lodash": "^4.17.0",
109
109
  "@types/minimist": "^1.2.5",
110
- "@types/node": "^20.11.6",
110
+ "@types/node": "^20.11.30",
111
111
  "@types/request-ip": "^0.0.41",
112
- "@types/supertest": "^2.0.16",
113
- "@typescript-eslint/eslint-plugin": "^6.19.1",
114
- "@typescript-eslint/parser": "^6.19.1",
112
+ "@types/supertest": "^6.0.2",
113
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
114
+ "@typescript-eslint/parser": "^6.21.0",
115
115
  "coconfig": "^1.4.1",
116
- "eslint": "^8.56.0",
116
+ "eslint": "^8.57.0",
117
117
  "eslint-config-prettier": "^9.1.0",
118
118
  "eslint-plugin-import": "^2.29.1",
119
- "pino-pretty": "^10.3.1",
119
+ "pino-pretty": "^11.0.0",
120
120
  "pinst": "^3.0.0",
121
121
  "supertest": "^6.3.4",
122
122
  "ts-node": "^10.9.2",
123
123
  "tsconfig-paths": "^4.2.0",
124
- "typescript": "^5.3.3",
125
- "vitest": "^1.2.2"
124
+ "typescript": "^5.4.3",
125
+ "vitest": "^1.4.0"
126
126
  },
127
127
  "resolutions": {
128
128
  "qs": "^6.11.0"
package/src/env.ts CHANGED
@@ -12,3 +12,15 @@ export function getNodeEnv() {
12
12
  export function isDev() {
13
13
  return getNodeEnv() === 'development';
14
14
  }
15
+
16
+ export function isProd() {
17
+ return getNodeEnv() === 'production';
18
+ }
19
+
20
+ export function isStaging() {
21
+ return getNodeEnv() === 'staging';
22
+ }
23
+
24
+ export function isTest() {
25
+ return getNodeEnv() === 'test';
26
+ }
@@ -92,6 +92,7 @@ function finishLog<SLocals extends AnyServiceLocals = ServiceLocals<Configuratio
92
92
  }
93
93
 
94
94
  if (prefs.logRequests) {
95
+ endLog.h = JSON.stringify(req.headers);
95
96
  if (Buffer.isBuffer(req.body)) {
96
97
  endLog.b = req.body.toString('base64');
97
98
  } else if (typeof req.body !== 'string') {