@emoyly/problem 8.0.4 → 8.0.5

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,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.major = exports.version = void 0;
4
- exports.version = '8.0.4';
4
+ exports.version = '8.0.5';
5
5
  exports.major = Number(exports.version.split('.')[0]);
@@ -5,23 +5,19 @@ import type { MiddlewareOptions, PartialMiddlewareOptions, ProblemListener } fro
5
5
  * Middleware collects errors from somewhere, transforms them into something recognizable by a parser, and then passes them to the parsers, and then returns an array of Problems to whatever is using the middleware
6
6
  */
7
7
  export declare abstract class MiddlewareBase {
8
- options: MiddlewareOptions;
8
+ readonly options: MiddlewareOptions;
9
9
  abstract name: string;
10
10
  /**
11
11
  * When nothing is returned from the parsers, just throw in a default "fallback" Problem object, so that a Problem is still actually returned/emitted
12
12
  */
13
- enableFallback: boolean;
13
+ readonly enableFallback = true;
14
14
  constructor(defaultOptions: MiddlewareOptions, options?: PartialMiddlewareOptions);
15
- /**
16
- * Call this function when you want to use the middleware function
17
- */
18
- abstract use(): unknown;
19
15
  /**
20
16
  * Parse input using parsers
21
17
  */
22
- parse: (input: unknown) => Problem[];
23
- fallback: ProblemOpts;
24
- problemListeners: ProblemListener[];
18
+ protected parse: (input: unknown) => Problem[];
19
+ protected fallback: ProblemOpts;
20
+ protected problemListeners: ProblemListener[];
25
21
  protected emit: (list: Problem[]) => void;
26
22
  /**
27
23
  * Listen to problems
@@ -23,7 +23,6 @@ export class MiddlewareBase {
23
23
  return [new Problem({
24
24
  ...this.fallback,
25
25
  'errorObject': input,
26
- 'stack': (typeof input === 'object' && input !== null && 'stack' in input && typeof input.stack === 'string') ? input.stack : undefined,
27
26
  'source': `middleware:${this.name}`
28
27
  })];
29
28
  return [];
package/esm/problem.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare class Problem extends Error implements IProblem {
6
6
  detail: string | undefined;
7
7
  instance: string | undefined;
8
8
  errorObject?: unknown;
9
- readonly __problemVersion = "8.0.4";
9
+ readonly __problemVersion = "8.0.5";
10
10
  data: unknown;
11
11
  source?: string;
12
12
  constructor(opts: ProblemOpts);