@opengis/fastify-table 2.4.0 → 2.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"errorMessage.d.ts","sourceRoot":"","sources":["../../../../server/plugins/logger/errorMessage.ts"],"names":[],"mappings":"AAOA,iBAAS,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,OAuB/C;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"errorMessage.d.ts","sourceRoot":"","sources":["../../../../server/plugins/logger/errorMessage.ts"],"names":[],"mappings":"AAOA,iBAAS,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,OA0B/C;AAED,eAAe,YAAY,CAAC"}
@@ -7,6 +7,9 @@ function errorMessage(error, status) {
7
7
  const hook = applyHookSync("errorMessage", error);
8
8
  if (hook)
9
9
  return hook;
10
+ if (error.name === "FastifyError") {
11
+ return error.message;
12
+ }
10
13
  if (error.validation) {
11
14
  return error.message;
12
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cronApi.d.ts","sourceRoot":"","sources":["../../../../../server/routes/cron/controllers/cronApi.ts"],"names":[],"mappings":"AAGA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,gBAoBzD"}
1
+ {"version":3,"file":"cronApi.d.ts","sourceRoot":"","sources":["../../../../../server/routes/cron/controllers/cronApi.ts"],"names":[],"mappings":"AAQA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,gBAyBzD"}
@@ -1,9 +1,14 @@
1
- import { ForbiddenError, NotFoundError } from "../../../../errors.js";
1
+ import { ForbiddenError, UnauthorizedError, NotFoundError, } from "../../../../errors.js";
2
2
  import cronList from "../../../plugins/cron/cronList.js";
3
3
  export default async function cronApi(req, reply) {
4
- const { params = {}, user = {}, hostname } = req;
5
- if ((!user.uid || !user.user_type?.includes("admin")) &&
6
- !hostname?.includes("local")) {
4
+ const { params, hostname } = req;
5
+ const { uid, user_type: userType } = process.env.NODE_ENV === "test" || process.env.VITEST
6
+ ? req.headers
7
+ : req.user || {};
8
+ if (!uid && !hostname?.includes("local")) {
9
+ throw UnauthorizedError("unauthorized");
10
+ }
11
+ if (!userType?.includes?.("admin") && !hostname?.includes("local")) {
7
12
  throw ForbiddenError("access restricted");
8
13
  }
9
14
  if (params.name === "list") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [