oc-fastify-server-adapter 0.1.0 → 0.1.1

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/dist/index.d.ts CHANGED
@@ -100,5 +100,5 @@ export interface FastifyServerAdapterOptions {
100
100
  port?: number | string;
101
101
  trustProxy?: boolean | string | string[] | number;
102
102
  }
103
- export default function createFastifyAdapter(options?: FastifyServerAdapterOptions | number | string): HttpServerAdapter;
103
+ export default function createFastifyAdapter(options?: unknown): HttpServerAdapter;
104
104
  export {};
package/dist/index.js CHANGED
@@ -22,10 +22,7 @@ const timingStartSym = Symbol('timingStart');
22
22
  const multipartParsedSym = Symbol('multipartParsed');
23
23
  const defaultBodyLimit = 100 * 1024;
24
24
  function createFastifyAdapter(options) {
25
- const adapterOptions = typeof options === 'object' && options !== null
26
- ? options
27
- : { port: options };
28
- return new FastifyHttpServerAdapter(adapterOptions);
25
+ return new FastifyHttpServerAdapter(toFastifyAdapterOptions(options));
29
26
  }
30
27
  class FastifyHttpServerAdapter {
31
28
  name = 'fastify';
@@ -482,6 +479,11 @@ function parseBodyLimit(limit) {
482
479
  : 1;
483
480
  return Math.floor(value * multiplier);
484
481
  }
482
+ function toFastifyAdapterOptions(options) {
483
+ return typeof options === 'object' && options !== null
484
+ ? options
485
+ : { port: options };
486
+ }
485
487
  function normalisePort(port) {
486
488
  if (typeof port === 'number') {
487
489
  return port;
@@ -579,3 +581,4 @@ function isResponseSent(res) {
579
581
  ? res.sent
580
582
  : res.raw.writableEnded || res.raw.headersSent;
581
583
  }
584
+ module.exports = createFastifyAdapter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-fastify-server-adapter",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Fastify HTTP server adapter for OC",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -38,7 +38,9 @@
38
38
  "jest": {
39
39
  "preset": "ts-jest",
40
40
  "testEnvironment": "node",
41
- "testPathIgnorePatterns": ["/dist/"]
41
+ "testPathIgnorePatterns": [
42
+ "/dist/"
43
+ ]
42
44
  },
43
45
  "dependencies": {
44
46
  "@fastify/cookie": "^11.0.2",