@extk/expressive 0.9.0 → 0.10.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/README.md CHANGED
@@ -107,7 +107,6 @@ addRoute(
107
107
  // 3. Build the Express app
108
108
  const app = expressiveServer()
109
109
  .withHelmet()
110
- .withQs()
111
110
  .withMorgan()
112
111
  .withRoutes(router)
113
112
  .withSwagger(
@@ -271,7 +270,6 @@ import z from 'zod';
271
270
 
272
271
  const app = expressiveServer()
273
272
  .withHelmet()
274
- .withQs()
275
273
  .withMorgan()
276
274
  .withSwagger(
277
275
  b => b
package/dist/index.d.mts CHANGED
@@ -1,14 +1,14 @@
1
1
  import * as express from 'express';
2
2
  import express__default, { RequestHandler } from 'express';
3
3
  import * as express_serve_static_core from 'express-serve-static-core';
4
- import { RouteParameters } from 'express-serve-static-core';
4
+ import { RouteParameters, Query } from 'express-serve-static-core';
5
5
  import { HelmetOptions } from 'helmet';
6
6
  import morgan from 'morgan';
7
7
  import { SwaggerUiOptions, SwaggerOptions } from 'swagger-ui-express';
8
8
 
9
9
  type ExpressRoute = string;
10
10
  type ExpressLocalsObj = Record<string, any>;
11
- type ExpressHandler = RequestHandler<RouteParameters<ExpressRoute>, any, any, qs.ParsedQs, ExpressLocalsObj[]>;
11
+ type ExpressHandler = RequestHandler<RouteParameters<ExpressRoute>, any, any, Query, ExpressLocalsObj>;
12
12
  type PaginationQuery = {
13
13
  limit?: string | number;
14
14
  page?: string | number;
@@ -243,9 +243,7 @@ declare class ServerBuilder {
243
243
  constructor(app: express__default.Express, container: Container, swaggerRef: SwaggerRef);
244
244
  build(): express__default.Express;
245
245
  withHelmet(options?: Readonly<HelmetOptions>): this;
246
- withQs(): this;
247
- withMorgan(format?: string, // TODO: FormatFn
248
- options?: Parameters<typeof morgan>[1]): this;
246
+ withMorgan(format?: string | morgan.FormatFn, options?: Parameters<typeof morgan>[1]): this;
249
247
  withRoutes(routes: express__default.Router): this;
250
248
  /**
251
249
  * Helper function for fluent design
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import * as express from 'express';
2
2
  import express__default, { RequestHandler } from 'express';
3
3
  import * as express_serve_static_core from 'express-serve-static-core';
4
- import { RouteParameters } from 'express-serve-static-core';
4
+ import { RouteParameters, Query } from 'express-serve-static-core';
5
5
  import { HelmetOptions } from 'helmet';
6
6
  import morgan from 'morgan';
7
7
  import { SwaggerUiOptions, SwaggerOptions } from 'swagger-ui-express';
8
8
 
9
9
  type ExpressRoute = string;
10
10
  type ExpressLocalsObj = Record<string, any>;
11
- type ExpressHandler = RequestHandler<RouteParameters<ExpressRoute>, any, any, qs.ParsedQs, ExpressLocalsObj[]>;
11
+ type ExpressHandler = RequestHandler<RouteParameters<ExpressRoute>, any, any, Query, ExpressLocalsObj>;
12
12
  type PaginationQuery = {
13
13
  limit?: string | number;
14
14
  page?: string | number;
@@ -243,9 +243,7 @@ declare class ServerBuilder {
243
243
  constructor(app: express__default.Express, container: Container, swaggerRef: SwaggerRef);
244
244
  build(): express__default.Express;
245
245
  withHelmet(options?: Readonly<HelmetOptions>): this;
246
- withQs(): this;
247
- withMorgan(format?: string, // TODO: FormatFn
248
- options?: Parameters<typeof morgan>[1]): this;
246
+ withMorgan(format?: string | morgan.FormatFn, options?: Parameters<typeof morgan>[1]): this;
249
247
  withRoutes(routes: express__default.Router): this;
250
248
  /**
251
249
  * Helper function for fluent design
package/dist/index.js CHANGED
@@ -63,7 +63,6 @@ module.exports = __toCommonJS(index_exports);
63
63
  var import_express = __toESM(require("express"));
64
64
  var import_helmet = __toESM(require("helmet"));
65
65
  var import_morgan = __toESM(require("morgan"));
66
- var import_qs = __toESM(require("qs"));
67
66
  var import_swagger_ui_express = __toESM(require("swagger-ui-express"));
68
67
 
69
68
  // src/swagger.ts
@@ -221,18 +220,9 @@ var ServerBuilder = class {
221
220
  this.app.use((0, import_helmet.default)(options ?? {}));
222
221
  return this;
223
222
  }
224
- withQs() {
225
- this.app.set("query parser", function(str) {
226
- return import_qs.default.parse(str, { decoder(s) {
227
- return decodeURIComponent(s);
228
- } });
229
- });
230
- return this;
231
- }
232
223
  withMorgan(format, options) {
233
224
  this.app.use((0, import_morgan.default)(
234
- format ?? ":req[x-real-ip] :method :url :status :res[content-length] - :response-time ms",
235
- // TODO: ip or x-real-ip; also, default to json?
225
+ format ?? ":remote-addr :method :url :status :res[content-length] - :response-time ms",
236
226
  options ?? { stream: { write: (message) => {
237
227
  this.container.logger.info(message.trim());
238
228
  } } }
package/dist/index.mjs CHANGED
@@ -2,7 +2,6 @@
2
2
  import express from "express";
3
3
  import helmet from "helmet";
4
4
  import morgan from "morgan";
5
- import qs from "qs";
6
5
  import swaggerUi from "swagger-ui-express";
7
6
 
8
7
  // src/swagger.ts
@@ -160,18 +159,9 @@ var ServerBuilder = class {
160
159
  this.app.use(helmet(options ?? {}));
161
160
  return this;
162
161
  }
163
- withQs() {
164
- this.app.set("query parser", function(str) {
165
- return qs.parse(str, { decoder(s) {
166
- return decodeURIComponent(s);
167
- } });
168
- });
169
- return this;
170
- }
171
162
  withMorgan(format, options) {
172
163
  this.app.use(morgan(
173
- format ?? ":req[x-real-ip] :method :url :status :res[content-length] - :response-time ms",
174
- // TODO: ip or x-real-ip; also, default to json?
164
+ format ?? ":remote-addr :method :url :status :res[content-length] - :response-time ms",
175
165
  options ?? { stream: { write: (message) => {
176
166
  this.container.logger.info(message.trim());
177
167
  } } }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extk/expressive",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -45,7 +45,6 @@
45
45
  "dotenv": "^17.1.0",
46
46
  "helmet": "^8.0.0",
47
47
  "morgan": "^1.10.0",
48
- "qs": "^6.14.1",
49
48
  "swagger-ui-express": "^5.0.1"
50
49
  },
51
50
  "author": "",