@myxtra/microservice 1.36.0 → 1.37.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/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { FastifyPluginAsync, FastifyPluginOptions, FastifyPluginCallback, FastifyRequest, FastifyInstance } from 'fastify';
2
2
  import { z } from 'zod';
3
- import { BaseApi, Api } from '@myxtra/api';
3
+ import { BaseApi, Api, ServerError } from '@myxtra/api';
4
4
 
5
5
  declare const MOCKED_JWT_NAME = "toolkit@systemtest.dcs";
6
6
  declare const MOCKED_JWT_HEADER: string;
@@ -47,7 +47,7 @@ declare const validationError: z.ZodObject<{
47
47
  }>;
48
48
  declare const _default: FastifyPluginCallback<FastifyPluginOptions>;
49
49
 
50
- declare const createApi: <T extends BaseApi>(Api: Api<T>, request: FastifyRequest) => T;
50
+ declare const createApi: <T extends BaseApi>(Api: Api<T>, request: FastifyRequest, handleError?: (error: ServerError) => void) => T;
51
51
 
52
52
  declare const DEFAULT_SPEC_FILE_URL = "../.azure/apim/swagger.json";
53
53
  declare const generateSwagger: (app: FastifyInstance, specFile: URL) => void;
package/dist/index.mjs CHANGED
@@ -10228,7 +10228,9 @@ var zod = (app, options, done) => {
10228
10228
  problemJson
10229
10229
  });
10230
10230
  } else {
10231
- return reply.send(error);
10231
+ const err = error;
10232
+ const statusCode = err.statusCode ?? err.problemJson?.status ?? err.status ?? 500;
10233
+ return reply.status(statusCode).send(error);
10232
10234
  }
10233
10235
  });
10234
10236
  done();
@@ -10239,13 +10241,13 @@ var zod_default = fp2(zod);
10239
10241
  import "@myxtra/api";
10240
10242
  import config from "config";
10241
10243
  import "fastify";
10242
- var createApi = (Api, request) => {
10244
+ var createApi = (Api, request, handleError) => {
10243
10245
  let acceptLanguage = request.headers["accept-language"];
10244
10246
  if (!acceptLanguage) {
10245
10247
  acceptLanguage = "nl-BE";
10246
10248
  }
10247
10249
  const authorization = request.headers.authorization ?? "";
10248
- return new Api({ acceptLanguage, authorization, config });
10250
+ return new Api({ acceptLanguage, authorization, config, handleError });
10249
10251
  };
10250
10252
 
10251
10253
  // src/utils/swagger.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myxtra/microservice",
3
- "version": "1.36.0",
3
+ "version": "1.37.0",
4
4
  "main": "./dist/index.mjs",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -20,7 +20,7 @@
20
20
  "typecheck": "tsc --noEmit"
21
21
  },
22
22
  "dependencies": {
23
- "@myxtra/api": "1.35.0",
23
+ "@myxtra/api": "1.36.0",
24
24
  "@sentry/node": "^9.24.0"
25
25
  },
26
26
  "devDependencies": {